diff --git a/project starter code/.DS_Store b/.DS_Store similarity index 100% rename from project starter code/.DS_Store rename to .DS_Store diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index 7e5c2878..25a4e4cf 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -17,10 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Login - uses: atlassian/gajira-login@master + uses: atlassian/gajira-login@v2 env: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} @@ -38,7 +38,7 @@ jobs: Repo link: https://github.com/${{ github.repository }} PR no. ${{ github.event.pull_request.number }} PR title: ${{ github.event.pull_request.title }} - PR description: ${{ github.event.pull_request.description }} + PR description: ${{ github.event.pull_request.body }} In addition, please resolve other issues, if any. fields: '{"components": [{"name":"Github PR"}], "customfield_16449":"https://classroom.udacity.com/", "customfield_16450":"Resolve the PR", "priority":{"id": "4"}}' diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..bca646a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ + +# Elastic Beanstalk Files +.elasticbeanstalk/* +!.elasticbeanstalk/*.cfg.yml +!.elasticbeanstalk/*.global.yml diff --git a/AWS BS.png b/AWS BS.png new file mode 100644 index 00000000..e091d4d1 Binary files /dev/null and b/AWS BS.png differ diff --git a/project starter code/node_modules/.bin/mime b/node_modules/.bin/mime similarity index 100% rename from project starter code/node_modules/.bin/mime rename to node_modules/.bin/mime diff --git a/project starter code/node_modules/.bin/mime.cmd b/node_modules/.bin/mime.cmd similarity index 100% rename from project starter code/node_modules/.bin/mime.cmd rename to node_modules/.bin/mime.cmd diff --git a/project starter code/node_modules/.bin/mime.ps1 b/node_modules/.bin/mime.ps1 similarity index 100% rename from project starter code/node_modules/.bin/mime.ps1 rename to node_modules/.bin/mime.ps1 diff --git a/project starter code/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp similarity index 100% rename from project starter code/node_modules/.bin/mkdirp rename to node_modules/.bin/mkdirp diff --git a/project starter code/node_modules/.bin/mkdirp.cmd b/node_modules/.bin/mkdirp.cmd similarity index 100% rename from project starter code/node_modules/.bin/mkdirp.cmd rename to node_modules/.bin/mkdirp.cmd diff --git a/project starter code/node_modules/.bin/mkdirp.ps1 b/node_modules/.bin/mkdirp.ps1 similarity index 100% rename from project starter code/node_modules/.bin/mkdirp.ps1 rename to node_modules/.bin/mkdirp.ps1 diff --git a/project starter code/node_modules/.bin/pixelmatch b/node_modules/.bin/pixelmatch similarity index 100% rename from project starter code/node_modules/.bin/pixelmatch rename to node_modules/.bin/pixelmatch diff --git a/project starter code/node_modules/.bin/pixelmatch.cmd b/node_modules/.bin/pixelmatch.cmd similarity index 100% rename from project starter code/node_modules/.bin/pixelmatch.cmd rename to node_modules/.bin/pixelmatch.cmd diff --git a/project starter code/node_modules/.bin/pixelmatch.ps1 b/node_modules/.bin/pixelmatch.ps1 similarity index 100% rename from project starter code/node_modules/.bin/pixelmatch.ps1 rename to node_modules/.bin/pixelmatch.ps1 diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..0f09b92c --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,1521 @@ +{ + "name": "api", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@babel/runtime": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.6.tgz", + "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "node_modules/@jimp/bmp": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.13.tgz", + "integrity": "sha512-9edAxu7N2FX7vzkdl5Jo1BbACfycUtBQX+XBMcHA2bk62P8R0otgkHg798frgAk/WxQIzwxqOH6wMiCwrlAzdQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "bmp-js": "^0.1.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/core": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.13.tgz", + "integrity": "sha512-qXpA1tzTnlkTku9yqtuRtS/wVntvE6f3m3GNxdTdtmc+O+Wcg9Xo2ABPMh7Nc0AHbMKzwvwgB2JnjZmlmJEObg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "any-base": "^1.1.0", + "buffer": "^5.2.0", + "exif-parser": "^0.1.12", + "file-type": "^16.5.4", + "load-bmfont": "^1.3.1", + "mkdirp": "^0.5.1", + "phin": "^2.9.1", + "pixelmatch": "^4.0.2", + "tinycolor2": "^1.4.1" + } + }, + "node_modules/@jimp/custom": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.13.tgz", + "integrity": "sha512-LTATglVUPGkPf15zX1wTMlZ0+AU7cGEGF6ekVF1crA8eHUWsGjrYTB+Ht4E3HTrCok8weQG+K01rJndCp/l4XA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/core": "^0.16.13" + } + }, + "node_modules/@jimp/gif": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.13.tgz", + "integrity": "sha512-yFAMZGv3o+YcjXilMWWwS/bv1iSqykFahFMSO169uVMtfQVfa90kt4/kDwrXNR6Q9i6VHpFiGZMlF2UnHClBvg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "gifwrap": "^0.9.2", + "omggif": "^1.0.9" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/jpeg": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.13.tgz", + "integrity": "sha512-BJHlDxzTlCqP2ThqP8J0eDrbBfod7npWCbJAcfkKqdQuFk0zBPaZ6KKaQKyKxmWJ87Z6ohANZoMKEbtvrwz1AA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "jpeg-js": "^0.4.2" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-blit": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.13.tgz", + "integrity": "sha512-8Z1k96ZFxlhK2bgrY1JNWNwvaBeI/bciLM0yDOni2+aZwfIIiC7Y6PeWHTAvjHNjphz+XCt01WQmOYWCn0ML6g==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-blur": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.13.tgz", + "integrity": "sha512-PvLrfa8vkej3qinlebyhLpksJgCF5aiysDMSVhOZqwH5nQLLtDE9WYbnsofGw4r0VVpyw3H/ANCIzYTyCtP9Cg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-circle": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.13.tgz", + "integrity": "sha512-RNave7EFgZrb5V5EpdvJGAEHMnDAJuwv05hKscNfIYxf0kR3KhViBTDy+MoTnMlIvaKFULfwIgaZWzyhuINMzA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-color": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.13.tgz", + "integrity": "sha512-xW+9BtEvoIkkH/Wde9ql4nAFbYLkVINhpgAE7VcBUsuuB34WUbcBl/taOuUYQrPEFQJ4jfXiAJZ2H/rvKjCVnQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "tinycolor2": "^1.4.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-contain": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.13.tgz", + "integrity": "sha512-QayTXw4tXMwU6q6acNTQrTTFTXpNRBe+MgTGMDU0lk+23PjlFCO/9sacflelG8lsp7vNHhAxFeHptDMAksEYzg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-cover": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.13.tgz", + "integrity": "sha512-BSsP71GTNaqWRcvkbWuIVH+zK7b3TSNebbhDkFK0fVaUTzHuKMS/mgY4hDZIEVt7Rf5FjadAYtsujHN9w0iSYA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-crop": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.13.tgz", + "integrity": "sha512-WEl2tPVYwzYL8OKme6Go2xqiWgKsgxlMwyHabdAU4tXaRwOCnOI7v4021gCcBb9zn/oWwguHuKHmK30Fw2Z/PA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-displace": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.13.tgz", + "integrity": "sha512-qt9WKq8vWrcjySa9DyQ0x/RBMHQeiVjdVSY1SJsMjssPUf0pS74qorcuAkGi89biN3YoGUgPkpqECnAWnYwgGA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-dither": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.13.tgz", + "integrity": "sha512-5/N3yJggbWQTlGZHQYJPmQXEwR52qaXjEzkp1yRBbtdaekXE3BG/suo0fqeoV/csf8ooI78sJzYmIrxNoWVtgQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-fisheye": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.13.tgz", + "integrity": "sha512-2rZmTdFbT/cF9lEZIkXCYO0TsT114Q27AX5IAo0Sju6jVQbvIk1dFUTnwLDadTo8wkJlFzGqMQ24Cs8cHWOliA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-flip": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.13.tgz", + "integrity": "sha512-EmcgAA74FTc5u7Z+hUO/sRjWwfPPLuOQP5O64x5g4j0T12Bd29IgsYZxoutZo/rb3579+JNa/3wsSEmyVv1EpA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-rotate": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-gaussian": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.13.tgz", + "integrity": "sha512-A1XKfGQD0iDdIiKqFYi8nZMv4dDVYdxbrmgR7y/CzUHhSYdcmoljLIIsZZM3Iks/Wa353W3vtvkWLuDbQbch1w==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-invert": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.13.tgz", + "integrity": "sha512-xFMrIn7czEZbdbMzZWuaZFnlLGJDVJ82y5vlsKsXRTG2kcxRsMPXvZRWHV57nSs1YFsNqXSbrC8B98n0E32njQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-mask": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.13.tgz", + "integrity": "sha512-wLRYKVBXql2GAYgt6FkTnCfE+q5NomM7Dlh0oIPGAoMBWDyTx0eYutRK6PlUrRK2yMHuroAJCglICTbxqGzowQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-normalize": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.13.tgz", + "integrity": "sha512-3tfad0n9soRna4IfW9NzQdQ2Z3ijkmo21DREHbE6CGcMIxOSvfRdSvf1qQPApxjTSo8LTU4MCi/fidx/NZ0GqQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-print": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.13.tgz", + "integrity": "sha512-0m6i3p01PGRkGAK9r53hDYrkyMq+tlhLOIbsSTmZyh6HLshUKlTB7eXskF5OpVd5ZUHoltlNc6R+ggvKIzxRFw==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "load-bmfont": "^1.4.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-resize": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.13.tgz", + "integrity": "sha512-qoqtN8LDknm3fJm9nuPygJv30O3vGhSBD2TxrsCnhtOsxKAqVPJtFVdGd/qVuZ8nqQANQmTlfqTiK9mVWQ7MiQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-rotate": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.13.tgz", + "integrity": "sha512-Ev+Jjmj1nHYw897z9C3R9dYsPv7S2/nxdgfFb/h8hOwK0Ovd1k/+yYS46A0uj/JCKK0pQk8wOslYBkPwdnLorw==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-scale": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.13.tgz", + "integrity": "sha512-05POQaEJVucjTiSGMoH68ZiELc7QqpIpuQlZ2JBbhCV+WCbPFUBcGSmE7w4Jd0E2GvCho/NoMODLwgcVGQA97A==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-shadow": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.13.tgz", + "integrity": "sha512-nmu5VSZ9hsB1JchTKhnnCY+paRBnwzSyK5fhkhtQHHoFD5ArBQ/5wU8y6tCr7k/GQhhGq1OrixsECeMjPoc8Zw==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blur": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-threshold": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.13.tgz", + "integrity": "sha512-+3zArBH0OE3Rhjm4HyAokMsZlIq5gpQec33CncyoSwxtRBM2WAhUVmCUKuBo+Lr/2/4ISoY4BWpHKhMLDix6cA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-color": ">=0.8.0", + "@jimp/plugin-resize": ">=0.8.0" + } + }, + "node_modules/@jimp/plugins": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.13.tgz", + "integrity": "sha512-CJLdqODEhEVs4MgWCxpWL5l95sCBlkuSLz65cxEm56X5akIsn4LOlwnKoSEZioYcZUBvHhCheH67AyPTudfnQQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/plugin-blur": "^0.16.13", + "@jimp/plugin-circle": "^0.16.13", + "@jimp/plugin-color": "^0.16.13", + "@jimp/plugin-contain": "^0.16.13", + "@jimp/plugin-cover": "^0.16.13", + "@jimp/plugin-crop": "^0.16.13", + "@jimp/plugin-displace": "^0.16.13", + "@jimp/plugin-dither": "^0.16.13", + "@jimp/plugin-fisheye": "^0.16.13", + "@jimp/plugin-flip": "^0.16.13", + "@jimp/plugin-gaussian": "^0.16.13", + "@jimp/plugin-invert": "^0.16.13", + "@jimp/plugin-mask": "^0.16.13", + "@jimp/plugin-normalize": "^0.16.13", + "@jimp/plugin-print": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/plugin-rotate": "^0.16.13", + "@jimp/plugin-scale": "^0.16.13", + "@jimp/plugin-shadow": "^0.16.13", + "@jimp/plugin-threshold": "^0.16.13", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/png": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.13.tgz", + "integrity": "sha512-8cGqINvbWJf1G0Her9zbq9I80roEX0A+U45xFby3tDWfzn+Zz8XKDF1Nv9VUwVx0N3zpcG1RPs9hfheG4Cq2kg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "pngjs": "^3.3.3" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/tiff": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.13.tgz", + "integrity": "sha512-oJY8d9u95SwW00VPHuCNxPap6Q1+E/xM5QThb9Hu+P6EGuu6lIeLaNBMmFZyblwFbwrH+WBOZlvIzDhi4Dm/6Q==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "utif": "^2.0.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/types": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.13.tgz", + "integrity": "sha512-mC0yVNUobFDjoYLg4hoUwzMKgNlxynzwt3cDXzumGvRJ7Kb8qQGOWJQjQFo5OxmGExqzPphkirdbBF88RVLBCg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/bmp": "^0.16.13", + "@jimp/gif": "^0.16.13", + "@jimp/jpeg": "^0.16.13", + "@jimp/png": "^0.16.13", + "@jimp/tiff": "^0.16.13", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/utils": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.13.tgz", + "integrity": "sha512-VyCpkZzFTHXtKgVO35iKN0sYR10psGpV6SkcSeV4oF7eSYlR8Bl6aQLCzVeFjvESF7mxTmIiI3/XrMobVrtxDA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "regenerator-runtime": "^0.13.3" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "node_modules/@types/node": { + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/any-base": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", + "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bmp-js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", + "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" + }, + "node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/exif-parser": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", + "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" + }, + "node_modules/express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/file-type": { + "version": "16.5.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", + "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gifwrap": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", + "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "dependencies": { + "image-q": "^4.0.0", + "omggif": "^1.0.10" + } + }, + "node_modules/global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "dependencies": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/image-q": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", + "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", + "dependencies": { + "@types/node": "16.9.1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "node_modules/jimp": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.13.tgz", + "integrity": "sha512-Bxz8q7V4rnCky9A0ktTNGA9SkNFVWRHodddI/DaAWZJzF7sVUlFYKQ60y9JGqrKpi48ECA/TnfMzzc5C70VByA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/custom": "^0.16.13", + "@jimp/plugins": "^0.16.13", + "@jimp/types": "^0.16.13", + "regenerator-runtime": "^0.13.3" + } + }, + "node_modules/jpeg-js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", + "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" + }, + "node_modules/load-bmfont": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", + "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", + "dependencies": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^2.9.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "dependencies": { + "dom-walk": "^0.1.0" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/omggif": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", + "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, + "node_modules/parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==" + }, + "node_modules/parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" + }, + "node_modules/parse-bmfont-xml": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", + "dependencies": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.5.0" + } + }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/peek-readable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", + "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==", + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/pixelmatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", + "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", + "dependencies": { + "pngjs": "^3.0.0" + }, + "bin": { + "pixelmatch": "bin/pixelmatch" + } + }, + "node_modules/pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strtok3": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", + "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/timm": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", + "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" + }, + "node_modules/tinycolor2": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utif": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", + "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "dependencies": { + "pako": "^1.0.5" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "dependencies": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "node_modules/xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" + }, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + } + } +} diff --git a/project starter code/node_modules/@babel/runtime/LICENSE b/node_modules/@babel/runtime/LICENSE similarity index 100% rename from project starter code/node_modules/@babel/runtime/LICENSE rename to node_modules/@babel/runtime/LICENSE diff --git a/node_modules/@babel/runtime/README.md b/node_modules/@babel/runtime/README.md new file mode 100644 index 00000000..2f3368ef --- /dev/null +++ b/node_modules/@babel/runtime/README.md @@ -0,0 +1,19 @@ +# @babel/runtime + +> babel's modular runtime helpers + +See our website [@babel/runtime](https://babeljs.io/docs/babel-runtime) for more information. + +## Install + +Using npm: + +```sh +npm install --save @babel/runtime +``` + +or using yarn: + +```sh +yarn add @babel/runtime +``` diff --git a/node_modules/@babel/runtime/helpers/AsyncGenerator.js b/node_modules/@babel/runtime/helpers/AsyncGenerator.js new file mode 100644 index 00000000..9dca1ed0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/AsyncGenerator.js @@ -0,0 +1,64 @@ +var OverloadYield = require("./OverloadYield.js"); +function AsyncGenerator(e) { + var r, t; + function resume(r, t) { + try { + var n = e[r](t), + o = n.value, + u = o instanceof OverloadYield; + Promise.resolve(u ? o.v : o).then(function (t) { + if (u) { + var i = "return" === r ? "return" : "next"; + if (!o.k || t.done) return resume(i, t); + t = e[i](t).value; + } + settle(n.done ? "return" : "normal", t); + }, function (e) { + resume("throw", e); + }); + } catch (e) { + settle("throw", e); + } + } + function settle(e, n) { + switch (e) { + case "return": + r.resolve({ + value: n, + done: !0 + }); + break; + case "throw": + r.reject(n); + break; + default: + r.resolve({ + value: n, + done: !1 + }); + } + (r = r.next) ? resume(r.key, r.arg) : t = null; + } + this._invoke = function (e, n) { + return new Promise(function (o, u) { + var i = { + key: e, + arg: n, + resolve: o, + reject: u, + next: null + }; + t ? t = t.next = i : (r = t = i, resume(e, n)); + }); + }, "function" != typeof e["return"] && (this["return"] = void 0); +} +AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { + return this; +}, AsyncGenerator.prototype.next = function (e) { + return this._invoke("next", e); +}, AsyncGenerator.prototype["throw"] = function (e) { + return this._invoke("throw", e); +}, AsyncGenerator.prototype["return"] = function (e) { + return this._invoke("return", e); +}; +module.exports = AsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/AwaitValue.js b/node_modules/@babel/runtime/helpers/AwaitValue.js new file mode 100644 index 00000000..52a7e69a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/AwaitValue.js @@ -0,0 +1,4 @@ +function _AwaitValue(t) { + this.wrapped = t; +} +module.exports = _AwaitValue, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/OverloadYield.js b/node_modules/@babel/runtime/helpers/OverloadYield.js new file mode 100644 index 00000000..0eca88c7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/OverloadYield.js @@ -0,0 +1,4 @@ +function _OverloadYield(e, d) { + this.v = e, this.k = d; +} +module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js b/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js new file mode 100644 index 00000000..29348d5f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js @@ -0,0 +1,9 @@ +function _applyDecoratedDescriptor(i, e, r, n, l) { + var a = {}; + return Object.keys(n).forEach(function (i) { + a[i] = n[i]; + }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { + return n(i, e, r) || r; + }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer && (Object.defineProperty(i, e, a), a = null), a; +} +module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecs.js b/node_modules/@babel/runtime/helpers/applyDecs.js new file mode 100644 index 00000000..3770c5ae --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecs.js @@ -0,0 +1,236 @@ +var _typeof = require("./typeof.js")["default"]; +var setFunctionName = require("./setFunctionName.js"); +var toPropertyKey = require("./toPropertyKey.js"); +function old_createMetadataMethodsForProperty(e, t, a, r) { + return { + getMetadata: function getMetadata(o) { + old_assertNotFinished(r, "getMetadata"), old_assertMetadataKey(o); + var i = e[o]; + if (void 0 !== i) if (1 === t) { + var n = i["public"]; + if (void 0 !== n) return n[a]; + } else if (2 === t) { + var l = i["private"]; + if (void 0 !== l) return l.get(a); + } else if (Object.hasOwnProperty.call(i, "constructor")) return i.constructor; + }, + setMetadata: function setMetadata(o, i) { + old_assertNotFinished(r, "setMetadata"), old_assertMetadataKey(o); + var n = e[o]; + if (void 0 === n && (n = e[o] = {}), 1 === t) { + var l = n["public"]; + void 0 === l && (l = n["public"] = {}), l[a] = i; + } else if (2 === t) { + var s = n.priv; + void 0 === s && (s = n["private"] = new Map()), s.set(a, i); + } else n.constructor = i; + } + }; +} +function old_convertMetadataMapToFinal(e, t) { + var a = e[Symbol.metadata || Symbol["for"]("Symbol.metadata")], + r = Object.getOwnPropertySymbols(t); + if (0 !== r.length) { + for (var o = 0; o < r.length; o++) { + var i = r[o], + n = t[i], + l = a ? a[i] : null, + s = n["public"], + c = l ? l["public"] : null; + s && c && Object.setPrototypeOf(s, c); + var d = n["private"]; + if (d) { + var u = Array.from(d.values()), + f = l ? l["private"] : null; + f && (u = u.concat(f)), n["private"] = u; + } + l && Object.setPrototypeOf(n, l); + } + a && Object.setPrototypeOf(t, a), e[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = t; + } +} +function old_createAddInitializerMethod(e, t) { + return function (a) { + old_assertNotFinished(t, "addInitializer"), old_assertCallable(a, "An initializer"), e.push(a); + }; +} +function old_memberDec(e, t, a, r, o, i, n, l, s) { + var c; + switch (i) { + case 1: + c = "accessor"; + break; + case 2: + c = "method"; + break; + case 3: + c = "getter"; + break; + case 4: + c = "setter"; + break; + default: + c = "field"; + } + var d, + u, + f = { + kind: c, + name: l ? "#" + t : toPropertyKey(t), + isStatic: n, + isPrivate: l + }, + p = { + v: !1 + }; + if (0 !== i && (f.addInitializer = old_createAddInitializerMethod(o, p)), l) { + d = 2, u = Symbol(t); + var v = {}; + 0 === i ? (v.get = a.get, v.set = a.set) : 2 === i ? v.get = function () { + return a.value; + } : (1 !== i && 3 !== i || (v.get = function () { + return a.get.call(this); + }), 1 !== i && 4 !== i || (v.set = function (e) { + a.set.call(this, e); + })), f.access = v; + } else d = 1, u = t; + try { + return e(s, Object.assign(f, old_createMetadataMethodsForProperty(r, d, u, p))); + } finally { + p.v = !0; + } +} +function old_assertNotFinished(e, t) { + if (e.v) throw Error("attempted to call " + t + " after decoration was finished"); +} +function old_assertMetadataKey(e) { + if ("symbol" != _typeof(e)) throw new TypeError("Metadata keys must be symbols, received: " + e); +} +function old_assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); +} +function old_assertValidReturnValue(e, t) { + var a = _typeof(t); + if (1 === e) { + if ("object" !== a || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && old_assertCallable(t.get, "accessor.get"), void 0 !== t.set && old_assertCallable(t.set, "accessor.set"), void 0 !== t.init && old_assertCallable(t.init, "accessor.init"), void 0 !== t.initializer && old_assertCallable(t.initializer, "accessor.initializer"); + } else if ("function" !== a) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); +} +function old_getInit(e) { + var t; + return null == (t = e.init) && (t = e.initializer) && void 0 !== console && console.warn(".initializer has been renamed to .init as of March 2022"), t; +} +function old_applyMemberDec(e, t, a, r, o, i, n, l, s) { + var c, + d, + u, + f, + p, + v, + y, + h = a[0]; + if (n ? (0 === o || 1 === o ? (c = { + get: a[3], + set: a[4] + }, u = "get") : 3 === o ? (c = { + get: a[3] + }, u = "get") : 4 === o ? (c = { + set: a[3] + }, u = "set") : c = { + value: a[3] + }, 0 !== o && (1 === o && setFunctionName(a[4], "#" + r, "set"), setFunctionName(a[3], "#" + r, u))) : 0 !== o && (c = Object.getOwnPropertyDescriptor(t, r)), 1 === o ? f = { + get: c.get, + set: c.set + } : 2 === o ? f = c.value : 3 === o ? f = c.get : 4 === o && (f = c.set), "function" == typeof h) void 0 !== (p = old_memberDec(h, r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? d = p : 1 === o ? (d = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = { + get: v, + set: y + }) : f = p);else for (var m = h.length - 1; m >= 0; m--) { + var b; + void 0 !== (p = old_memberDec(h[m], r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? b = p : 1 === o ? (b = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = { + get: v, + set: y + }) : f = p, void 0 !== b && (void 0 === d ? d = b : "function" == typeof d ? d = [d, b] : d.push(b))); + } + if (0 === o || 1 === o) { + if (void 0 === d) d = function d(e, t) { + return t; + };else if ("function" != typeof d) { + var g = d; + d = function d(e, t) { + for (var a = t, r = 0; r < g.length; r++) a = g[r].call(e, a); + return a; + }; + } else { + var _ = d; + d = function d(e, t) { + return _.call(e, t); + }; + } + e.push(d); + } + 0 !== o && (1 === o ? (c.get = f.get, c.set = f.set) : 2 === o ? c.value = f : 3 === o ? c.get = f : 4 === o && (c.set = f), n ? 1 === o ? (e.push(function (e, t) { + return f.get.call(e, t); + }), e.push(function (e, t) { + return f.set.call(e, t); + })) : 2 === o ? e.push(f) : e.push(function (e, t) { + return f.call(e, t); + }) : Object.defineProperty(t, r, c)); +} +function old_applyMemberDecs(e, t, a, r, o) { + for (var i, n, l = new Map(), s = new Map(), c = 0; c < o.length; c++) { + var d = o[c]; + if (Array.isArray(d)) { + var u, + f, + p, + v = d[1], + y = d[2], + h = d.length > 3, + m = v >= 5; + if (m ? (u = t, f = r, 0 != (v -= 5) && (p = n = n || [])) : (u = t.prototype, f = a, 0 !== v && (p = i = i || [])), 0 !== v && !h) { + var b = m ? s : l, + g = b.get(y) || 0; + if (!0 === g || 3 === g && 4 !== v || 4 === g && 3 !== v) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + y); + !g && v > 2 ? b.set(y, v) : b.set(y, !0); + } + old_applyMemberDec(e, u, d, y, v, m, h, f, p); + } + } + old_pushInitializers(e, i), old_pushInitializers(e, n); +} +function old_pushInitializers(e, t) { + t && e.push(function (e) { + for (var a = 0; a < t.length; a++) t[a].call(e); + return e; + }); +} +function old_applyClassDecs(e, t, a, r) { + if (r.length > 0) { + for (var o = [], i = t, n = t.name, l = r.length - 1; l >= 0; l--) { + var s = { + v: !1 + }; + try { + var c = Object.assign({ + kind: "class", + name: n, + addInitializer: old_createAddInitializerMethod(o, s) + }, old_createMetadataMethodsForProperty(a, 0, n, s)), + d = r[l](i, c); + } finally { + s.v = !0; + } + void 0 !== d && (old_assertValidReturnValue(10, d), i = d); + } + e.push(i, function () { + for (var e = 0; e < o.length; e++) o[e].call(i); + }); + } +} +function applyDecs(e, t, a) { + var r = [], + o = {}, + i = {}; + return old_applyMemberDecs(r, e, i, o, t), old_convertMetadataMapToFinal(e.prototype, i), old_applyClassDecs(r, e, o, a), old_convertMetadataMapToFinal(e, o), r; +} +module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecs2203.js b/node_modules/@babel/runtime/helpers/applyDecs2203.js new file mode 100644 index 00000000..d3da3338 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecs2203.js @@ -0,0 +1,184 @@ +var _typeof = require("./typeof.js")["default"]; +function applyDecs2203Factory() { + function createAddInitializerMethod(e, t) { + return function (r) { + !function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + }(t), assertCallable(r, "An initializer"), e.push(r); + }; + } + function memberDec(e, t, r, a, n, i, s, o) { + var c; + switch (n) { + case 1: + c = "accessor"; + break; + case 2: + c = "method"; + break; + case 3: + c = "getter"; + break; + case 4: + c = "setter"; + break; + default: + c = "field"; + } + var l, + u, + f = { + kind: c, + name: s ? "#" + t : t, + "static": i, + "private": s + }, + p = { + v: !1 + }; + 0 !== n && (f.addInitializer = createAddInitializerMethod(a, p)), 0 === n ? s ? (l = r.get, u = r.set) : (l = function l() { + return this[t]; + }, u = function u(e) { + this[t] = e; + }) : 2 === n ? l = function l() { + return r.value; + } : (1 !== n && 3 !== n || (l = function l() { + return r.get.call(this); + }), 1 !== n && 4 !== n || (u = function u(e) { + r.set.call(this, e); + })), f.access = l && u ? { + get: l, + set: u + } : l ? { + get: l + } : { + set: u + }; + try { + return e(o, f); + } finally { + p.v = !0; + } + } + function assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); + } + function assertValidReturnValue(e, t) { + var r = _typeof(t); + if (1 === e) { + if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init"); + } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); + } + function applyMemberDec(e, t, r, a, n, i, s, o) { + var c, + l, + u, + f, + p, + d, + h = r[0]; + if (s ? c = 0 === n || 1 === n ? { + get: r[3], + set: r[4] + } : 3 === n ? { + get: r[3] + } : 4 === n ? { + set: r[3] + } : { + value: r[3] + } : 0 !== n && (c = Object.getOwnPropertyDescriptor(t, a)), 1 === n ? u = { + get: c.get, + set: c.set + } : 2 === n ? u = c.value : 3 === n ? u = c.get : 4 === n && (u = c.set), "function" == typeof h) void 0 !== (f = memberDec(h, a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? l = f : 1 === n ? (l = f.init, p = f.get || u.get, d = f.set || u.set, u = { + get: p, + set: d + }) : u = f);else for (var v = h.length - 1; v >= 0; v--) { + var g; + void 0 !== (f = memberDec(h[v], a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? g = f : 1 === n ? (g = f.init, p = f.get || u.get, d = f.set || u.set, u = { + get: p, + set: d + }) : u = f, void 0 !== g && (void 0 === l ? l = g : "function" == typeof l ? l = [l, g] : l.push(g))); + } + if (0 === n || 1 === n) { + if (void 0 === l) l = function l(e, t) { + return t; + };else if ("function" != typeof l) { + var y = l; + l = function l(e, t) { + for (var r = t, a = 0; a < y.length; a++) r = y[a].call(e, r); + return r; + }; + } else { + var m = l; + l = function l(e, t) { + return m.call(e, t); + }; + } + e.push(l); + } + 0 !== n && (1 === n ? (c.get = u.get, c.set = u.set) : 2 === n ? c.value = u : 3 === n ? c.get = u : 4 === n && (c.set = u), s ? 1 === n ? (e.push(function (e, t) { + return u.get.call(e, t); + }), e.push(function (e, t) { + return u.set.call(e, t); + })) : 2 === n ? e.push(u) : e.push(function (e, t) { + return u.call(e, t); + }) : Object.defineProperty(t, a, c)); + } + function pushInitializers(e, t) { + t && e.push(function (e) { + for (var r = 0; r < t.length; r++) t[r].call(e); + return e; + }); + } + return function (e, t, r) { + var a = []; + return function (e, t, r) { + for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) { + var c = r[o]; + if (Array.isArray(c)) { + var l, + u, + f = c[1], + p = c[2], + d = c.length > 3, + h = f >= 5; + if (h ? (l = t, 0 != (f -= 5) && (u = n = n || [])) : (l = t.prototype, 0 !== f && (u = a = a || [])), 0 !== f && !d) { + var v = h ? s : i, + g = v.get(p) || 0; + if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p); + !g && f > 2 ? v.set(p, f) : v.set(p, !0); + } + applyMemberDec(e, l, c, p, f, h, d, u); + } + } + pushInitializers(e, a), pushInitializers(e, n); + }(a, e, t), function (e, t, r) { + if (r.length > 0) { + for (var a = [], n = t, i = t.name, s = r.length - 1; s >= 0; s--) { + var o = { + v: !1 + }; + try { + var c = r[s](n, { + kind: "class", + name: i, + addInitializer: createAddInitializerMethod(a, o) + }); + } finally { + o.v = !0; + } + void 0 !== c && (assertValidReturnValue(10, c), n = c); + } + e.push(n, function () { + for (var e = 0; e < a.length; e++) a[e].call(n); + }); + } + }(a, e, r), a; + }; +} +var applyDecs2203Impl; +function applyDecs2203(e, t, r) { + return (applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory())(e, t, r); +} +module.exports = applyDecs2203, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecs2203R.js b/node_modules/@babel/runtime/helpers/applyDecs2203R.js new file mode 100644 index 00000000..725419b5 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecs2203R.js @@ -0,0 +1,191 @@ +var _typeof = require("./typeof.js")["default"]; +var setFunctionName = require("./setFunctionName.js"); +var toPropertyKey = require("./toPropertyKey.js"); +function applyDecs2203RFactory() { + function createAddInitializerMethod(e, t) { + return function (r) { + !function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + }(t), assertCallable(r, "An initializer"), e.push(r); + }; + } + function memberDec(e, t, r, n, a, i, o, s) { + var c; + switch (a) { + case 1: + c = "accessor"; + break; + case 2: + c = "method"; + break; + case 3: + c = "getter"; + break; + case 4: + c = "setter"; + break; + default: + c = "field"; + } + var l, + u, + f = { + kind: c, + name: o ? "#" + t : toPropertyKey(t), + "static": i, + "private": o + }, + p = { + v: !1 + }; + 0 !== a && (f.addInitializer = createAddInitializerMethod(n, p)), 0 === a ? o ? (l = r.get, u = r.set) : (l = function l() { + return this[t]; + }, u = function u(e) { + this[t] = e; + }) : 2 === a ? l = function l() { + return r.value; + } : (1 !== a && 3 !== a || (l = function l() { + return r.get.call(this); + }), 1 !== a && 4 !== a || (u = function u(e) { + r.set.call(this, e); + })), f.access = l && u ? { + get: l, + set: u + } : l ? { + get: l + } : { + set: u + }; + try { + return e(s, f); + } finally { + p.v = !0; + } + } + function assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); + } + function assertValidReturnValue(e, t) { + var r = _typeof(t); + if (1 === e) { + if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init"); + } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); + } + function applyMemberDec(e, t, r, n, a, i, o, s) { + var c, + l, + u, + f, + p, + d, + h, + v = r[0]; + if (o ? (0 === a || 1 === a ? (c = { + get: r[3], + set: r[4] + }, u = "get") : 3 === a ? (c = { + get: r[3] + }, u = "get") : 4 === a ? (c = { + set: r[3] + }, u = "set") : c = { + value: r[3] + }, 0 !== a && (1 === a && setFunctionName(r[4], "#" + n, "set"), setFunctionName(r[3], "#" + n, u))) : 0 !== a && (c = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? f = { + get: c.get, + set: c.set + } : 2 === a ? f = c.value : 3 === a ? f = c.get : 4 === a && (f = c.set), "function" == typeof v) void 0 !== (p = memberDec(v, n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? l = p : 1 === a ? (l = p.init, d = p.get || f.get, h = p.set || f.set, f = { + get: d, + set: h + }) : f = p);else for (var g = v.length - 1; g >= 0; g--) { + var y; + void 0 !== (p = memberDec(v[g], n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? y = p : 1 === a ? (y = p.init, d = p.get || f.get, h = p.set || f.set, f = { + get: d, + set: h + }) : f = p, void 0 !== y && (void 0 === l ? l = y : "function" == typeof l ? l = [l, y] : l.push(y))); + } + if (0 === a || 1 === a) { + if (void 0 === l) l = function l(e, t) { + return t; + };else if ("function" != typeof l) { + var m = l; + l = function l(e, t) { + for (var r = t, n = 0; n < m.length; n++) r = m[n].call(e, r); + return r; + }; + } else { + var b = l; + l = function l(e, t) { + return b.call(e, t); + }; + } + e.push(l); + } + 0 !== a && (1 === a ? (c.get = f.get, c.set = f.set) : 2 === a ? c.value = f : 3 === a ? c.get = f : 4 === a && (c.set = f), o ? 1 === a ? (e.push(function (e, t) { + return f.get.call(e, t); + }), e.push(function (e, t) { + return f.set.call(e, t); + })) : 2 === a ? e.push(f) : e.push(function (e, t) { + return f.call(e, t); + }) : Object.defineProperty(t, n, c)); + } + function applyMemberDecs(e, t) { + for (var r, n, a = [], i = new Map(), o = new Map(), s = 0; s < t.length; s++) { + var c = t[s]; + if (Array.isArray(c)) { + var l, + u, + f = c[1], + p = c[2], + d = c.length > 3, + h = f >= 5; + if (h ? (l = e, 0 != (f -= 5) && (u = n = n || [])) : (l = e.prototype, 0 !== f && (u = r = r || [])), 0 !== f && !d) { + var v = h ? o : i, + g = v.get(p) || 0; + if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p); + !g && f > 2 ? v.set(p, f) : v.set(p, !0); + } + applyMemberDec(a, l, c, p, f, h, d, u); + } + } + return pushInitializers(a, r), pushInitializers(a, n), a; + } + function pushInitializers(e, t) { + t && e.push(function (e) { + for (var r = 0; r < t.length; r++) t[r].call(e); + return e; + }); + } + return function (e, t, r) { + return { + e: applyMemberDecs(e, t), + get c() { + return function (e, t) { + if (t.length > 0) { + for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) { + var o = { + v: !1 + }; + try { + var s = t[i](n, { + kind: "class", + name: a, + addInitializer: createAddInitializerMethod(r, o) + }); + } finally { + o.v = !0; + } + void 0 !== s && (assertValidReturnValue(10, s), n = s); + } + return [n, function () { + for (var e = 0; e < r.length; e++) r[e].call(n); + }]; + } + }(e, r); + } + }; + }; +} +function applyDecs2203R(e, t, r) { + return (module.exports = applyDecs2203R = applyDecs2203RFactory(), module.exports.__esModule = true, module.exports["default"] = module.exports)(e, t, r); +} +module.exports = applyDecs2203R, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecs2301.js b/node_modules/@babel/runtime/helpers/applyDecs2301.js new file mode 100644 index 00000000..fc2c1307 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecs2301.js @@ -0,0 +1,222 @@ +var _typeof = require("./typeof.js")["default"]; +var checkInRHS = require("./checkInRHS.js"); +var setFunctionName = require("./setFunctionName.js"); +var toPropertyKey = require("./toPropertyKey.js"); +function applyDecs2301Factory() { + function createAddInitializerMethod(e, t) { + return function (r) { + !function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + }(t), assertCallable(r, "An initializer"), e.push(r); + }; + } + function assertInstanceIfPrivate(e, t) { + if (!e(t)) throw new TypeError("Attempted to access private element on non-instance"); + } + function memberDec(e, t, r, n, a, i, s, o, c) { + var u; + switch (a) { + case 1: + u = "accessor"; + break; + case 2: + u = "method"; + break; + case 3: + u = "getter"; + break; + case 4: + u = "setter"; + break; + default: + u = "field"; + } + var l, + f, + p = { + kind: u, + name: s ? "#" + t : toPropertyKey(t), + "static": i, + "private": s + }, + d = { + v: !1 + }; + if (0 !== a && (p.addInitializer = createAddInitializerMethod(n, d)), s || 0 !== a && 2 !== a) { + if (2 === a) l = function l(e) { + return assertInstanceIfPrivate(c, e), r.value; + };else { + var h = 0 === a || 1 === a; + (h || 3 === a) && (l = s ? function (e) { + return assertInstanceIfPrivate(c, e), r.get.call(e); + } : function (e) { + return r.get.call(e); + }), (h || 4 === a) && (f = s ? function (e, t) { + assertInstanceIfPrivate(c, e), r.set.call(e, t); + } : function (e, t) { + r.set.call(e, t); + }); + } + } else l = function l(e) { + return e[t]; + }, 0 === a && (f = function f(e, r) { + e[t] = r; + }); + var v = s ? c.bind() : function (e) { + return t in e; + }; + p.access = l && f ? { + get: l, + set: f, + has: v + } : l ? { + get: l, + has: v + } : { + set: f, + has: v + }; + try { + return e(o, p); + } finally { + d.v = !0; + } + } + function assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); + } + function assertValidReturnValue(e, t) { + var r = _typeof(t); + if (1 === e) { + if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init"); + } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); + } + function curryThis2(e) { + return function (t) { + e(this, t); + }; + } + function applyMemberDec(e, t, r, n, a, i, s, o, c) { + var u, + l, + f, + p, + d, + h, + v, + y, + g = r[0]; + if (s ? (0 === a || 1 === a ? (u = { + get: (d = r[3], function () { + return d(this); + }), + set: curryThis2(r[4]) + }, f = "get") : 3 === a ? (u = { + get: r[3] + }, f = "get") : 4 === a ? (u = { + set: r[3] + }, f = "set") : u = { + value: r[3] + }, 0 !== a && (1 === a && setFunctionName(u.set, "#" + n, "set"), setFunctionName(u[f || "value"], "#" + n, f))) : 0 !== a && (u = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? p = { + get: u.get, + set: u.set + } : 2 === a ? p = u.value : 3 === a ? p = u.get : 4 === a && (p = u.set), "function" == typeof g) void 0 !== (h = memberDec(g, n, u, o, a, i, s, p, c)) && (assertValidReturnValue(a, h), 0 === a ? l = h : 1 === a ? (l = h.init, v = h.get || p.get, y = h.set || p.set, p = { + get: v, + set: y + }) : p = h);else for (var m = g.length - 1; m >= 0; m--) { + var b; + void 0 !== (h = memberDec(g[m], n, u, o, a, i, s, p, c)) && (assertValidReturnValue(a, h), 0 === a ? b = h : 1 === a ? (b = h.init, v = h.get || p.get, y = h.set || p.set, p = { + get: v, + set: y + }) : p = h, void 0 !== b && (void 0 === l ? l = b : "function" == typeof l ? l = [l, b] : l.push(b))); + } + if (0 === a || 1 === a) { + if (void 0 === l) l = function l(e, t) { + return t; + };else if ("function" != typeof l) { + var I = l; + l = function l(e, t) { + for (var r = t, n = 0; n < I.length; n++) r = I[n].call(e, r); + return r; + }; + } else { + var w = l; + l = function l(e, t) { + return w.call(e, t); + }; + } + e.push(l); + } + 0 !== a && (1 === a ? (u.get = p.get, u.set = p.set) : 2 === a ? u.value = p : 3 === a ? u.get = p : 4 === a && (u.set = p), s ? 1 === a ? (e.push(function (e, t) { + return p.get.call(e, t); + }), e.push(function (e, t) { + return p.set.call(e, t); + })) : 2 === a ? e.push(p) : e.push(function (e, t) { + return p.call(e, t); + }) : Object.defineProperty(t, n, u)); + } + function applyMemberDecs(e, t, r) { + for (var n, a, i, s = [], o = new Map(), c = new Map(), u = 0; u < t.length; u++) { + var l = t[u]; + if (Array.isArray(l)) { + var f, + p, + d = l[1], + h = l[2], + v = l.length > 3, + y = d >= 5, + g = r; + if (y ? (f = e, 0 != (d -= 5) && (p = a = a || []), v && !i && (i = function i(t) { + return checkInRHS(t) === e; + }), g = i) : (f = e.prototype, 0 !== d && (p = n = n || [])), 0 !== d && !v) { + var m = y ? c : o, + b = m.get(h) || 0; + if (!0 === b || 3 === b && 4 !== d || 4 === b && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); + !b && d > 2 ? m.set(h, d) : m.set(h, !0); + } + applyMemberDec(s, f, l, h, d, y, v, p, g); + } + } + return pushInitializers(s, n), pushInitializers(s, a), s; + } + function pushInitializers(e, t) { + t && e.push(function (e) { + for (var r = 0; r < t.length; r++) t[r].call(e); + return e; + }); + } + return function (e, t, r, n) { + return { + e: applyMemberDecs(e, t, n), + get c() { + return function (e, t) { + if (t.length > 0) { + for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) { + var s = { + v: !1 + }; + try { + var o = t[i](n, { + kind: "class", + name: a, + addInitializer: createAddInitializerMethod(r, s) + }); + } finally { + s.v = !0; + } + void 0 !== o && (assertValidReturnValue(10, o), n = o); + } + return [n, function () { + for (var e = 0; e < r.length; e++) r[e].call(n); + }]; + } + }(e, r); + } + }; + }; +} +function applyDecs2301(e, t, r, n) { + return (module.exports = applyDecs2301 = applyDecs2301Factory(), module.exports.__esModule = true, module.exports["default"] = module.exports)(e, t, r, n); +} +module.exports = applyDecs2301, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecs2305.js b/node_modules/@babel/runtime/helpers/applyDecs2305.js new file mode 100644 index 00000000..744c3521 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecs2305.js @@ -0,0 +1,133 @@ +var _typeof = require("./typeof.js")["default"]; +var checkInRHS = require("./checkInRHS.js"); +var setFunctionName = require("./setFunctionName.js"); +var toPropertyKey = require("./toPropertyKey.js"); +function applyDecs2305(e, t, r, n, o, a) { + function i(e, t, r) { + return function (n, o) { + return r && r(n), e[t].call(n, o); + }; + } + function c(e, t) { + for (var r = 0; r < e.length; r++) e[r].call(t); + return t; + } + function s(e, t, r, n) { + if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); + return e; + } + function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { + function m(e) { + if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); + } + var y, + v = t[0], + g = t[3], + b = !u; + if (!b) { + r || Array.isArray(v) || (v = [v]); + var w = {}, + S = [], + A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; + f ? (p || d ? w = { + get: setFunctionName(function () { + return g(this); + }, n, "get"), + set: function set(e) { + t[4](this, e); + } + } : w[A] = g, p || setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); + } + for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { + var D = v[j], + E = r ? v[j - 1] : void 0, + I = {}, + O = { + kind: ["field", "accessor", "method", "getter", "setter", "class"][o], + name: n, + metadata: a, + addInitializer: function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + s(t, "An initializer", "be", !0), c.push(t); + }.bind(null, I) + }; + try { + if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { + var k, F; + O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { + return m(e), w.value; + } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { + return e[n]; + }, (o < 2 || 4 === o) && (F = function F(e, t) { + e[n] = t; + })); + var N = O.access = { + has: f ? h.bind() : function (e) { + return n in e; + } + }; + if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { + get: w.get, + set: w.set + } : w[A], O), d) { + if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); + } + } finally { + I.v = !0; + } + } + return (p || d) && u.push(function (e, t) { + for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); + return t; + }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; + } + function u(e, t) { + return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { + configurable: !0, + enumerable: !0, + value: t + }); + } + if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; + var f = Object.create(null == l ? null : l), + p = function (e, t, r, n) { + var o, + a, + i = [], + s = function s(t) { + return checkInRHS(t) === e; + }, + u = new Map(); + function l(e) { + e && i.push(c.bind(null, e)); + } + for (var f = 0; f < t.length; f++) { + var p = t[f]; + if (Array.isArray(p)) { + var d = p[1], + h = p[2], + m = p.length > 3, + y = 16 & d, + v = !!(8 & d), + g = 0 == (d &= 7), + b = h + "/" + v; + if (!g && !m) { + var w = u.get(b); + if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); + u.set(b, !(d > 2) || d); + } + applyDec(v ? e : e.prototype, p, y, m ? "#" + h : toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); + } + } + return l(o), l(a), i; + }(e, t, o, f); + return r.length || u(e, f), { + e: p, + get c() { + var t = []; + return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; + } + }; +} +module.exports = applyDecs2305, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/applyDecs2311.js b/node_modules/@babel/runtime/helpers/applyDecs2311.js new file mode 100644 index 00000000..5f00a311 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/applyDecs2311.js @@ -0,0 +1,124 @@ +var _typeof = require("./typeof.js")["default"]; +var checkInRHS = require("./checkInRHS.js"); +var setFunctionName = require("./setFunctionName.js"); +var toPropertyKey = require("./toPropertyKey.js"); +function applyDecs2311(e, t, n, r, o, i) { + var a, + c, + u, + s, + f, + l, + p, + d = Symbol.metadata || Symbol["for"]("Symbol.metadata"), + m = Object.defineProperty, + h = Object.create, + y = [h(null), h(null)], + v = t.length; + function g(t, n, r) { + return function (o, i) { + n && (i = o, o = e); + for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); + return r ? i : o; + }; + } + function b(e, t, n, r) { + if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined")); + return e; + } + function applyDec(e, t, n, r, o, i, u, s, f, l, p) { + function d(e) { + if (!p(e)) throw new TypeError("Attempted to access private element on non-instance"); + } + var h = [].concat(t[0]), + v = t[3], + w = !u, + D = 1 === o, + S = 3 === o, + j = 4 === o, + E = 2 === o; + function I(t, n, r) { + return function (o, i) { + return n && (i = o, o = e), r && r(o), P[t].call(o, i); + }; + } + if (!w) { + var P = {}, + k = [], + F = S ? "get" : j || D ? "set" : "value"; + if (f ? (l || D ? P = { + get: setFunctionName(function () { + return v(this); + }, r, "get"), + set: function set(e) { + t[4](this, e); + } + } : P[F] = v, l || setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { + if ((c = y[+s][r]) && 7 != (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet"); + y[+s][r] = o < 3 ? 1 : o; + } + } + for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { + var T = b(h[O], "A decorator", "be", !0), + z = n ? h[O - 1] : void 0, + A = {}, + H = { + kind: ["field", "accessor", "method", "getter", "setter", "class"][o], + name: r, + metadata: a, + addInitializer: function (e, t) { + if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished"); + b(t, "An initializer", "be", !0), i.push(t); + }.bind(null, A) + }; + if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H["static"] = s, H["private"] = f, c = H.access = { + has: f ? p.bind() : function (e) { + return r in e; + } + }, j || (c.get = f ? E ? function (e) { + return d(e), P.value; + } : I("get", 0, d) : function (e) { + return e[r]; + }), E || S || (c.set = f ? I("set", 0, d) : function (e, t) { + e[r] = t; + }), N = T.call(z, D ? { + get: P.get, + set: P.set + } : P[F], H), A.v = 1, D) { + if ("object" == _typeof(N) && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); + } else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N); + } + return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; + } + function w(e) { + return m(e, d, { + configurable: !0, + enumerable: !0, + value: a + }); + } + return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function l(e) { + e && f.push(g(e)); + }, p = function p(t, r) { + for (var i = 0; i < n.length; i++) { + var a = n[i], + c = a[1], + l = 7 & c; + if ((8 & c) == t && !l == r) { + var p = a[2], + d = !!a[3], + m = 16 & c; + applyDec(t ? e : e.prototype, a, m, d ? "#" + p : toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { + return checkInRHS(t) === e; + } : o); + } + } + }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { + e: c, + get c() { + var n = []; + return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; + } + }; +} +module.exports = applyDecs2311, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/arrayLikeToArray.js b/node_modules/@babel/runtime/helpers/arrayLikeToArray.js new file mode 100644 index 00000000..19787e31 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/arrayLikeToArray.js @@ -0,0 +1,6 @@ +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} +module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/arrayWithHoles.js b/node_modules/@babel/runtime/helpers/arrayWithHoles.js new file mode 100644 index 00000000..78bdd931 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/arrayWithHoles.js @@ -0,0 +1,4 @@ +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js b/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js new file mode 100644 index 00000000..42218f54 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js @@ -0,0 +1,5 @@ +var arrayLikeToArray = require("./arrayLikeToArray.js"); +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return arrayLikeToArray(r); +} +module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/assertClassBrand.js b/node_modules/@babel/runtime/helpers/assertClassBrand.js new file mode 100644 index 00000000..e63ed8f4 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/assertClassBrand.js @@ -0,0 +1,5 @@ +function _assertClassBrand(e, t, n) { + if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; + throw new TypeError("Private element is not present on this object"); +} +module.exports = _assertClassBrand, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/assertThisInitialized.js b/node_modules/@babel/runtime/helpers/assertThisInitialized.js new file mode 100644 index 00000000..02594fbe --- /dev/null +++ b/node_modules/@babel/runtime/helpers/assertThisInitialized.js @@ -0,0 +1,5 @@ +function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} +module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js b/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js new file mode 100644 index 00000000..023568e0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js @@ -0,0 +1,24 @@ +var OverloadYield = require("./OverloadYield.js"); +function _asyncGeneratorDelegate(t) { + var e = {}, + n = !1; + function pump(e, r) { + return n = !0, r = new Promise(function (n) { + n(t[e](r)); + }), { + done: !1, + value: new OverloadYield(r, 1) + }; + } + return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { + return this; + }, e.next = function (t) { + return n ? (n = !1, t) : pump("next", t); + }, "function" == typeof t["throw"] && (e["throw"] = function (t) { + if (n) throw n = !1, t; + return pump("throw", t); + }), "function" == typeof t["return"] && (e["return"] = function (t) { + return n ? (n = !1, t) : pump("return", t); + }), e; +} +module.exports = _asyncGeneratorDelegate, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/asyncIterator.js b/node_modules/@babel/runtime/helpers/asyncIterator.js new file mode 100644 index 00000000..9c0c95cf --- /dev/null +++ b/node_modules/@babel/runtime/helpers/asyncIterator.js @@ -0,0 +1,45 @@ +function _asyncIterator(r) { + var n, + t, + o, + e = 2; + for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { + if (t && null != (n = r[t])) return n.call(r); + if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); + t = "@@asyncIterator", o = "@@iterator"; + } + throw new TypeError("Object is not async iterable"); +} +function AsyncFromSyncIterator(r) { + function AsyncFromSyncIteratorContinuation(r) { + if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); + var n = r.done; + return Promise.resolve(r.value).then(function (r) { + return { + value: r, + done: n + }; + }); + } + return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { + this.s = r, this.n = r.next; + }, AsyncFromSyncIterator.prototype = { + s: null, + n: null, + next: function next() { + return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); + }, + "return": function _return(r) { + var n = this.s["return"]; + return void 0 === n ? Promise.resolve({ + value: r, + done: !0 + }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + }, + "throw": function _throw(r) { + var n = this.s["return"]; + return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + } + }, new AsyncFromSyncIterator(r); +} +module.exports = _asyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/asyncToGenerator.js b/node_modules/@babel/runtime/helpers/asyncToGenerator.js new file mode 100644 index 00000000..a080339b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/asyncToGenerator.js @@ -0,0 +1,26 @@ +function asyncGeneratorStep(n, t, e, r, o, a, c) { + try { + var i = n[a](c), + u = i.value; + } catch (n) { + return void e(n); + } + i.done ? t(u) : Promise.resolve(u).then(r, o); +} +function _asyncToGenerator(n) { + return function () { + var t = this, + e = arguments; + return new Promise(function (r, o) { + var a = n.apply(t, e); + function _next(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "next", n); + } + function _throw(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); + } + _next(void 0); + }); + }; +} +module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js b/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js new file mode 100644 index 00000000..2d6fab91 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js @@ -0,0 +1,5 @@ +var OverloadYield = require("./OverloadYield.js"); +function _awaitAsyncGenerator(e) { + return new OverloadYield(e, 0); +} +module.exports = _awaitAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/callSuper.js b/node_modules/@babel/runtime/helpers/callSuper.js new file mode 100644 index 00000000..38eaf7f8 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/callSuper.js @@ -0,0 +1,7 @@ +var getPrototypeOf = require("./getPrototypeOf.js"); +var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); +var possibleConstructorReturn = require("./possibleConstructorReturn.js"); +function _callSuper(t, o, e) { + return o = getPrototypeOf(o), possibleConstructorReturn(t, isNativeReflectConstruct() ? Reflect.construct(o, e || [], getPrototypeOf(t).constructor) : o.apply(t, e)); +} +module.exports = _callSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/checkInRHS.js b/node_modules/@babel/runtime/helpers/checkInRHS.js new file mode 100644 index 00000000..4eea13d9 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/checkInRHS.js @@ -0,0 +1,6 @@ +var _typeof = require("./typeof.js")["default"]; +function _checkInRHS(e) { + if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); + return e; +} +module.exports = _checkInRHS, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js b/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js new file mode 100644 index 00000000..33ad54c9 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js @@ -0,0 +1,4 @@ +function _checkPrivateRedeclaration(e, t) { + if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); +} +module.exports = _checkPrivateRedeclaration, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js b/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js new file mode 100644 index 00000000..9998b835 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js @@ -0,0 +1,10 @@ +function _classApplyDescriptorDestructureSet(e, t) { + if (t.set) return "__destrObj" in t || (t.__destrObj = { + set value(r) { + t.set.call(e, r); + } + }), t.__destrObj; + if (!t.writable) throw new TypeError("attempted to set read only private field"); + return t; +} +module.exports = _classApplyDescriptorDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js b/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js new file mode 100644 index 00000000..ab627245 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js @@ -0,0 +1,4 @@ +function _classApplyDescriptorGet(e, t) { + return t.get ? t.get.call(e) : t.value; +} +module.exports = _classApplyDescriptorGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js b/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js new file mode 100644 index 00000000..0975f95f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js @@ -0,0 +1,7 @@ +function _classApplyDescriptorSet(e, t, l) { + if (t.set) t.set.call(e, l);else { + if (!t.writable) throw new TypeError("attempted to set read only private field"); + t.value = l; + } +} +module.exports = _classApplyDescriptorSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classCallCheck.js b/node_modules/@babel/runtime/helpers/classCallCheck.js new file mode 100644 index 00000000..21b8390f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classCallCheck.js @@ -0,0 +1,4 @@ +function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} +module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js b/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js new file mode 100644 index 00000000..7520f74d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classCheckPrivateStaticAccess(s, a, r) { + return assertClassBrand(a, s, r); +} +module.exports = _classCheckPrivateStaticAccess, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js b/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js new file mode 100644 index 00000000..7f70395e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js @@ -0,0 +1,4 @@ +function _classCheckPrivateStaticFieldDescriptor(t, e) { + if (void 0 === t) throw new TypeError("attempted to " + e + " private static field before its declaration"); +} +module.exports = _classCheckPrivateStaticFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js b/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js new file mode 100644 index 00000000..be855be9 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js @@ -0,0 +1,5 @@ +var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js"); +function _classExtractFieldDescriptor(e, t) { + return classPrivateFieldGet2(t, e); +} +module.exports = _classExtractFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classNameTDZError.js b/node_modules/@babel/runtime/helpers/classNameTDZError.js new file mode 100644 index 00000000..8141ff89 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classNameTDZError.js @@ -0,0 +1,4 @@ +function _classNameTDZError(e) { + throw new ReferenceError('Class "' + e + '" cannot be referenced in computed property keys.'); +} +module.exports = _classNameTDZError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js new file mode 100644 index 00000000..97c764d0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js @@ -0,0 +1,7 @@ +var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); +var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js"); +function _classPrivateFieldDestructureSet(e, t) { + var r = classPrivateFieldGet2(t, e); + return classApplyDescriptorDestructureSet(e, r); +} +module.exports = _classPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js b/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js new file mode 100644 index 00000000..bbee142a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js @@ -0,0 +1,7 @@ +var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); +var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js"); +function _classPrivateFieldGet(e, t) { + var r = classPrivateFieldGet2(t, e); + return classApplyDescriptorGet(e, r); +} +module.exports = _classPrivateFieldGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldGet2.js b/node_modules/@babel/runtime/helpers/classPrivateFieldGet2.js new file mode 100644 index 00000000..d4c271c7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldGet2.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classPrivateFieldGet2(s, a) { + return s.get(assertClassBrand(s, a)); +} +module.exports = _classPrivateFieldGet2, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js b/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js new file mode 100644 index 00000000..a290c19a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js @@ -0,0 +1,5 @@ +var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js"); +function _classPrivateFieldInitSpec(e, t, a) { + checkPrivateRedeclaration(e, t), t.set(e, a); +} +module.exports = _classPrivateFieldInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js b/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js new file mode 100644 index 00000000..f9e46f26 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js @@ -0,0 +1,5 @@ +function _classPrivateFieldBase(e, t) { + if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); + return e; +} +module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js b/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js new file mode 100644 index 00000000..5dc687fe --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js @@ -0,0 +1,5 @@ +var id = 0; +function _classPrivateFieldKey(e) { + return "__private_" + id++ + "_" + e; +} +module.exports = _classPrivateFieldKey, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js b/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js new file mode 100644 index 00000000..f3746e74 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js @@ -0,0 +1,7 @@ +var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); +var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js"); +function _classPrivateFieldSet(e, t, r) { + var s = classPrivateFieldGet2(t, e); + return classApplyDescriptorSet(e, s, r), r; +} +module.exports = _classPrivateFieldSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateFieldSet2.js b/node_modules/@babel/runtime/helpers/classPrivateFieldSet2.js new file mode 100644 index 00000000..25c60caa --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateFieldSet2.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classPrivateFieldSet2(s, a, r) { + return s.set(assertClassBrand(s, a), r), r; +} +module.exports = _classPrivateFieldSet2, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateGetter.js b/node_modules/@babel/runtime/helpers/classPrivateGetter.js new file mode 100644 index 00000000..1b3cf30a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateGetter.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classPrivateGetter(s, r, a) { + return a(assertClassBrand(s, r)); +} +module.exports = _classPrivateGetter, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js new file mode 100644 index 00000000..e4af3878 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classPrivateMethodGet(s, a, r) { + return assertClassBrand(a, s), r; +} +module.exports = _classPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js b/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js new file mode 100644 index 00000000..821c8ed0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js @@ -0,0 +1,5 @@ +var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js"); +function _classPrivateMethodInitSpec(e, a) { + checkPrivateRedeclaration(e, a), a.add(e); +} +module.exports = _classPrivateMethodInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js similarity index 100% rename from project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js rename to node_modules/@babel/runtime/helpers/classPrivateMethodSet.js diff --git a/node_modules/@babel/runtime/helpers/classPrivateSetter.js b/node_modules/@babel/runtime/helpers/classPrivateSetter.js new file mode 100644 index 00000000..494f81f0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classPrivateSetter.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classPrivateSetter(s, r, a, t) { + return r(assertClassBrand(s, a), t), t; +} +module.exports = _classPrivateSetter, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js new file mode 100644 index 00000000..2bb6e8b1 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js @@ -0,0 +1,7 @@ +var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); +var assertClassBrand = require("./assertClassBrand.js"); +var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); +function _classStaticPrivateFieldDestructureSet(t, r, s) { + return assertClassBrand(r, t), classCheckPrivateStaticFieldDescriptor(s, "set"), classApplyDescriptorDestructureSet(t, s); +} +module.exports = _classStaticPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js new file mode 100644 index 00000000..eb2365f3 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js @@ -0,0 +1,7 @@ +var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); +var assertClassBrand = require("./assertClassBrand.js"); +var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); +function _classStaticPrivateFieldSpecGet(t, s, r) { + return assertClassBrand(s, t), classCheckPrivateStaticFieldDescriptor(r, "get"), classApplyDescriptorGet(t, r); +} +module.exports = _classStaticPrivateFieldSpecGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js new file mode 100644 index 00000000..7783cd8d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js @@ -0,0 +1,7 @@ +var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); +var assertClassBrand = require("./assertClassBrand.js"); +var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); +function _classStaticPrivateFieldSpecSet(s, t, r, e) { + return assertClassBrand(t, s), classCheckPrivateStaticFieldDescriptor(r, "set"), classApplyDescriptorSet(s, r, e), e; +} +module.exports = _classStaticPrivateFieldSpecSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js new file mode 100644 index 00000000..c895be5c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js @@ -0,0 +1,5 @@ +var assertClassBrand = require("./assertClassBrand.js"); +function _classStaticPrivateMethodGet(s, a, t) { + return assertClassBrand(a, s), t; +} +module.exports = _classStaticPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js similarity index 100% rename from project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js rename to node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js diff --git a/node_modules/@babel/runtime/helpers/construct.js b/node_modules/@babel/runtime/helpers/construct.js new file mode 100644 index 00000000..aee8e704 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/construct.js @@ -0,0 +1,10 @@ +var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); +var setPrototypeOf = require("./setPrototypeOf.js"); +function _construct(t, e, r) { + if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && setPrototypeOf(p, r.prototype), p; +} +module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createClass.js b/node_modules/@babel/runtime/helpers/createClass.js new file mode 100644 index 00000000..8757f9ee --- /dev/null +++ b/node_modules/@babel/runtime/helpers/createClass.js @@ -0,0 +1,13 @@ +var toPropertyKey = require("./toPropertyKey.js"); +function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); + } +} +function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} +module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js b/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js new file mode 100644 index 00000000..27783079 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js @@ -0,0 +1,50 @@ +var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); +function _createForOfIteratorHelper(r, e) { + var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t) { + if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { + t && (r = t); + var _n = 0, + F = function F() {}; + return { + s: F, + n: function n() { + return _n >= r.length ? { + done: !0 + } : { + done: !1, + value: r[_n++] + }; + }, + e: function e(r) { + throw r; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var o, + a = !0, + u = !1; + return { + s: function s() { + t = t.call(r); + }, + n: function n() { + var r = t.next(); + return a = r.done, r; + }, + e: function e(r) { + u = !0, o = r; + }, + f: function f() { + try { + a || null == t["return"] || t["return"](); + } finally { + if (u) throw o; + } + } + }; +} +module.exports = _createForOfIteratorHelper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js b/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js new file mode 100644 index 00000000..bc81b1cd --- /dev/null +++ b/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js @@ -0,0 +1,19 @@ +var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); +function _createForOfIteratorHelperLoose(r, e) { + var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (t) return (t = t.call(r)).next.bind(t); + if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { + t && (r = t); + var o = 0; + return function () { + return o >= r.length ? { + done: !0 + } : { + done: !1, + value: r[o++] + }; + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +module.exports = _createForOfIteratorHelperLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/createSuper.js b/node_modules/@babel/runtime/helpers/createSuper.js new file mode 100644 index 00000000..b1869e61 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/createSuper.js @@ -0,0 +1,16 @@ +var getPrototypeOf = require("./getPrototypeOf.js"); +var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); +var possibleConstructorReturn = require("./possibleConstructorReturn.js"); +function _createSuper(t) { + var r = isNativeReflectConstruct(); + return function () { + var e, + o = getPrototypeOf(t); + if (r) { + var s = getPrototypeOf(this).constructor; + e = Reflect.construct(o, arguments, s); + } else e = o.apply(this, arguments); + return possibleConstructorReturn(this, e); + }; +} +module.exports = _createSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/decorate.js b/node_modules/@babel/runtime/helpers/decorate.js new file mode 100644 index 00000000..bc22acf4 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/decorate.js @@ -0,0 +1,250 @@ +var toArray = require("./toArray.js"); +var toPropertyKey = require("./toPropertyKey.js"); +function _decorate(e, r, t, i) { + var o = _getDecoratorsApi(); + if (i) for (var n = 0; n < i.length; n++) o = i[n](o); + var s = r(function (e) { + o.initializeInstanceElements(e, a.elements); + }, t), + a = o.decorateClass(_coalesceClassElements(s.d.map(_createElementDescriptor)), e); + return o.initializeClassElements(s.F, a.elements), o.runClassFinishers(s.F, a.finishers); +} +function _getDecoratorsApi() { + _getDecoratorsApi = function _getDecoratorsApi() { + return e; + }; + var e = { + elementsDefinitionOrder: [["method"], ["field"]], + initializeInstanceElements: function initializeInstanceElements(e, r) { + ["method", "field"].forEach(function (t) { + r.forEach(function (r) { + r.kind === t && "own" === r.placement && this.defineClassElement(e, r); + }, this); + }, this); + }, + initializeClassElements: function initializeClassElements(e, r) { + var t = e.prototype; + ["method", "field"].forEach(function (i) { + r.forEach(function (r) { + var o = r.placement; + if (r.kind === i && ("static" === o || "prototype" === o)) { + var n = "static" === o ? e : t; + this.defineClassElement(n, r); + } + }, this); + }, this); + }, + defineClassElement: function defineClassElement(e, r) { + var t = r.descriptor; + if ("field" === r.kind) { + var i = r.initializer; + t = { + enumerable: t.enumerable, + writable: t.writable, + configurable: t.configurable, + value: void 0 === i ? void 0 : i.call(e) + }; + } + Object.defineProperty(e, r.key, t); + }, + decorateClass: function decorateClass(e, r) { + var t = [], + i = [], + o = { + "static": [], + prototype: [], + own: [] + }; + if (e.forEach(function (e) { + this.addElementPlacement(e, o); + }, this), e.forEach(function (e) { + if (!_hasDecorators(e)) return t.push(e); + var r = this.decorateElement(e, o); + t.push(r.element), t.push.apply(t, r.extras), i.push.apply(i, r.finishers); + }, this), !r) return { + elements: t, + finishers: i + }; + var n = this.decorateConstructor(t, r); + return i.push.apply(i, n.finishers), n.finishers = i, n; + }, + addElementPlacement: function addElementPlacement(e, r, t) { + var i = r[e.placement]; + if (!t && -1 !== i.indexOf(e.key)) throw new TypeError("Duplicated element (" + e.key + ")"); + i.push(e.key); + }, + decorateElement: function decorateElement(e, r) { + for (var t = [], i = [], o = e.decorators, n = o.length - 1; n >= 0; n--) { + var s = r[e.placement]; + s.splice(s.indexOf(e.key), 1); + var a = this.fromElementDescriptor(e), + l = this.toElementFinisherExtras((0, o[n])(a) || a); + e = l.element, this.addElementPlacement(e, r), l.finisher && i.push(l.finisher); + var c = l.extras; + if (c) { + for (var p = 0; p < c.length; p++) this.addElementPlacement(c[p], r); + t.push.apply(t, c); + } + } + return { + element: e, + finishers: i, + extras: t + }; + }, + decorateConstructor: function decorateConstructor(e, r) { + for (var t = [], i = r.length - 1; i >= 0; i--) { + var o = this.fromClassDescriptor(e), + n = this.toClassDescriptor((0, r[i])(o) || o); + if (void 0 !== n.finisher && t.push(n.finisher), void 0 !== n.elements) { + e = n.elements; + for (var s = 0; s < e.length - 1; s++) for (var a = s + 1; a < e.length; a++) if (e[s].key === e[a].key && e[s].placement === e[a].placement) throw new TypeError("Duplicated element (" + e[s].key + ")"); + } + } + return { + elements: e, + finishers: t + }; + }, + fromElementDescriptor: function fromElementDescriptor(e) { + var r = { + kind: e.kind, + key: e.key, + placement: e.placement, + descriptor: e.descriptor + }; + return Object.defineProperty(r, Symbol.toStringTag, { + value: "Descriptor", + configurable: !0 + }), "field" === e.kind && (r.initializer = e.initializer), r; + }, + toElementDescriptors: function toElementDescriptors(e) { + if (void 0 !== e) return toArray(e).map(function (e) { + var r = this.toElementDescriptor(e); + return this.disallowProperty(e, "finisher", "An element descriptor"), this.disallowProperty(e, "extras", "An element descriptor"), r; + }, this); + }, + toElementDescriptor: function toElementDescriptor(e) { + var r = e.kind + ""; + if ("method" !== r && "field" !== r) throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "' + r + '"'); + var t = toPropertyKey(e.key), + i = e.placement + ""; + if ("static" !== i && "prototype" !== i && "own" !== i) throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "' + i + '"'); + var o = e.descriptor; + this.disallowProperty(e, "elements", "An element descriptor"); + var n = { + kind: r, + key: t, + placement: i, + descriptor: Object.assign({}, o) + }; + return "field" !== r ? this.disallowProperty(e, "initializer", "A method descriptor") : (this.disallowProperty(o, "get", "The property descriptor of a field descriptor"), this.disallowProperty(o, "set", "The property descriptor of a field descriptor"), this.disallowProperty(o, "value", "The property descriptor of a field descriptor"), n.initializer = e.initializer), n; + }, + toElementFinisherExtras: function toElementFinisherExtras(e) { + return { + element: this.toElementDescriptor(e), + finisher: _optionalCallableProperty(e, "finisher"), + extras: this.toElementDescriptors(e.extras) + }; + }, + fromClassDescriptor: function fromClassDescriptor(e) { + var r = { + kind: "class", + elements: e.map(this.fromElementDescriptor, this) + }; + return Object.defineProperty(r, Symbol.toStringTag, { + value: "Descriptor", + configurable: !0 + }), r; + }, + toClassDescriptor: function toClassDescriptor(e) { + var r = e.kind + ""; + if ("class" !== r) throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "' + r + '"'); + this.disallowProperty(e, "key", "A class descriptor"), this.disallowProperty(e, "placement", "A class descriptor"), this.disallowProperty(e, "descriptor", "A class descriptor"), this.disallowProperty(e, "initializer", "A class descriptor"), this.disallowProperty(e, "extras", "A class descriptor"); + var t = _optionalCallableProperty(e, "finisher"); + return { + elements: this.toElementDescriptors(e.elements), + finisher: t + }; + }, + runClassFinishers: function runClassFinishers(e, r) { + for (var t = 0; t < r.length; t++) { + var i = (0, r[t])(e); + if (void 0 !== i) { + if ("function" != typeof i) throw new TypeError("Finishers must return a constructor."); + e = i; + } + } + return e; + }, + disallowProperty: function disallowProperty(e, r, t) { + if (void 0 !== e[r]) throw new TypeError(t + " can't have a ." + r + " property."); + } + }; + return e; +} +function _createElementDescriptor(e) { + var r, + t = toPropertyKey(e.key); + "method" === e.kind ? r = { + value: e.value, + writable: !0, + configurable: !0, + enumerable: !1 + } : "get" === e.kind ? r = { + get: e.value, + configurable: !0, + enumerable: !1 + } : "set" === e.kind ? r = { + set: e.value, + configurable: !0, + enumerable: !1 + } : "field" === e.kind && (r = { + configurable: !0, + writable: !0, + enumerable: !0 + }); + var i = { + kind: "field" === e.kind ? "field" : "method", + key: t, + placement: e["static"] ? "static" : "field" === e.kind ? "own" : "prototype", + descriptor: r + }; + return e.decorators && (i.decorators = e.decorators), "field" === e.kind && (i.initializer = e.value), i; +} +function _coalesceGetterSetter(e, r) { + void 0 !== e.descriptor.get ? r.descriptor.get = e.descriptor.get : r.descriptor.set = e.descriptor.set; +} +function _coalesceClassElements(e) { + for (var r = [], isSameElement = function isSameElement(e) { + return "method" === e.kind && e.key === o.key && e.placement === o.placement; + }, t = 0; t < e.length; t++) { + var i, + o = e[t]; + if ("method" === o.kind && (i = r.find(isSameElement))) { + if (_isDataDescriptor(o.descriptor) || _isDataDescriptor(i.descriptor)) { + if (_hasDecorators(o) || _hasDecorators(i)) throw new ReferenceError("Duplicated methods (" + o.key + ") can't be decorated."); + i.descriptor = o.descriptor; + } else { + if (_hasDecorators(o)) { + if (_hasDecorators(i)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + o.key + ")."); + i.decorators = o.decorators; + } + _coalesceGetterSetter(o, i); + } + } else r.push(o); + } + return r; +} +function _hasDecorators(e) { + return e.decorators && e.decorators.length; +} +function _isDataDescriptor(e) { + return void 0 !== e && !(void 0 === e.value && void 0 === e.writable); +} +function _optionalCallableProperty(e, r) { + var t = e[r]; + if (void 0 !== t && "function" != typeof t) throw new TypeError("Expected '" + r + "' to be a function"); + return t; +} +module.exports = _decorate, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defaults.js b/node_modules/@babel/runtime/helpers/defaults.js new file mode 100644 index 00000000..dfdbbb03 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/defaults.js @@ -0,0 +1,9 @@ +function _defaults(e, r) { + for (var t = Object.getOwnPropertyNames(r), o = 0; o < t.length; o++) { + var n = t[o], + a = Object.getOwnPropertyDescriptor(r, n); + a && a.configurable && void 0 === e[n] && Object.defineProperty(e, n, a); + } + return e; +} +module.exports = _defaults, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defineAccessor.js b/node_modules/@babel/runtime/helpers/defineAccessor.js new file mode 100644 index 00000000..dc065f01 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/defineAccessor.js @@ -0,0 +1,8 @@ +function _defineAccessor(e, r, n, t) { + var c = { + configurable: !0, + enumerable: !0 + }; + return c[e] = t, Object.defineProperty(r, n, c); +} +module.exports = _defineAccessor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js b/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js new file mode 100644 index 00000000..ab9f43c1 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js @@ -0,0 +1,12 @@ +function _defineEnumerableProperties(e, r) { + for (var t in r) { + var n = r[t]; + n.configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, t, n); + } + if (Object.getOwnPropertySymbols) for (var a = Object.getOwnPropertySymbols(r), b = 0; b < a.length; b++) { + var i = a[b]; + (n = r[i]).configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, i, n); + } + return e; +} +module.exports = _defineEnumerableProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/defineProperty.js b/node_modules/@babel/runtime/helpers/defineProperty.js new file mode 100644 index 00000000..2c2ff1e9 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/defineProperty.js @@ -0,0 +1,10 @@ +var toPropertyKey = require("./toPropertyKey.js"); +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} +module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/dispose.js b/node_modules/@babel/runtime/helpers/dispose.js new file mode 100644 index 00000000..c20193ca --- /dev/null +++ b/node_modules/@babel/runtime/helpers/dispose.js @@ -0,0 +1,28 @@ +function dispose_SuppressedError(r, e) { + return "undefined" != typeof SuppressedError ? dispose_SuppressedError = SuppressedError : (dispose_SuppressedError = function dispose_SuppressedError(r, e) { + this.suppressed = e, this.error = r, this.stack = Error().stack; + }, dispose_SuppressedError.prototype = Object.create(Error.prototype, { + constructor: { + value: dispose_SuppressedError, + writable: !0, + configurable: !0 + } + })), new dispose_SuppressedError(r, e); +} +function _dispose(r, e, s) { + function next() { + for (; r.length > 0;) try { + var o = r.pop(), + p = o.d.call(o.v); + if (o.a) return Promise.resolve(p).then(next, err); + } catch (r) { + return err(r); + } + if (s) throw e; + } + function err(r) { + return e = s ? new dispose_SuppressedError(e, r) : r, s = !0, next(); + } + return next(); +} +module.exports = _dispose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js b/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js new file mode 100644 index 00000000..4086a7db --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js @@ -0,0 +1,64 @@ +import OverloadYield from "./OverloadYield.js"; +function AsyncGenerator(e) { + var r, t; + function resume(r, t) { + try { + var n = e[r](t), + o = n.value, + u = o instanceof OverloadYield; + Promise.resolve(u ? o.v : o).then(function (t) { + if (u) { + var i = "return" === r ? "return" : "next"; + if (!o.k || t.done) return resume(i, t); + t = e[i](t).value; + } + settle(n.done ? "return" : "normal", t); + }, function (e) { + resume("throw", e); + }); + } catch (e) { + settle("throw", e); + } + } + function settle(e, n) { + switch (e) { + case "return": + r.resolve({ + value: n, + done: !0 + }); + break; + case "throw": + r.reject(n); + break; + default: + r.resolve({ + value: n, + done: !1 + }); + } + (r = r.next) ? resume(r.key, r.arg) : t = null; + } + this._invoke = function (e, n) { + return new Promise(function (o, u) { + var i = { + key: e, + arg: n, + resolve: o, + reject: u, + next: null + }; + t ? t = t.next = i : (r = t = i, resume(e, n)); + }); + }, "function" != typeof e["return"] && (this["return"] = void 0); +} +AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { + return this; +}, AsyncGenerator.prototype.next = function (e) { + return this._invoke("next", e); +}, AsyncGenerator.prototype["throw"] = function (e) { + return this._invoke("throw", e); +}, AsyncGenerator.prototype["return"] = function (e) { + return this._invoke("return", e); +}; +export { AsyncGenerator as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/AwaitValue.js b/node_modules/@babel/runtime/helpers/esm/AwaitValue.js new file mode 100644 index 00000000..6f210c9c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/AwaitValue.js @@ -0,0 +1,4 @@ +function _AwaitValue(t) { + this.wrapped = t; +} +export { _AwaitValue as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/OverloadYield.js b/node_modules/@babel/runtime/helpers/esm/OverloadYield.js new file mode 100644 index 00000000..d7753a66 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/OverloadYield.js @@ -0,0 +1,4 @@ +function _OverloadYield(e, d) { + this.v = e, this.k = d; +} +export { _OverloadYield as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js b/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js new file mode 100644 index 00000000..8ceb3c9e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js @@ -0,0 +1,9 @@ +function _applyDecoratedDescriptor(i, e, r, n, l) { + var a = {}; + return Object.keys(n).forEach(function (i) { + a[i] = n[i]; + }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { + return n(i, e, r) || r; + }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer && (Object.defineProperty(i, e, a), a = null), a; +} +export { _applyDecoratedDescriptor as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecs.js b/node_modules/@babel/runtime/helpers/esm/applyDecs.js new file mode 100644 index 00000000..2b75dfd7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecs.js @@ -0,0 +1,236 @@ +import _typeof from "./typeof.js"; +import setFunctionName from "./setFunctionName.js"; +import toPropertyKey from "./toPropertyKey.js"; +function old_createMetadataMethodsForProperty(e, t, a, r) { + return { + getMetadata: function getMetadata(o) { + old_assertNotFinished(r, "getMetadata"), old_assertMetadataKey(o); + var i = e[o]; + if (void 0 !== i) if (1 === t) { + var n = i["public"]; + if (void 0 !== n) return n[a]; + } else if (2 === t) { + var l = i["private"]; + if (void 0 !== l) return l.get(a); + } else if (Object.hasOwnProperty.call(i, "constructor")) return i.constructor; + }, + setMetadata: function setMetadata(o, i) { + old_assertNotFinished(r, "setMetadata"), old_assertMetadataKey(o); + var n = e[o]; + if (void 0 === n && (n = e[o] = {}), 1 === t) { + var l = n["public"]; + void 0 === l && (l = n["public"] = {}), l[a] = i; + } else if (2 === t) { + var s = n.priv; + void 0 === s && (s = n["private"] = new Map()), s.set(a, i); + } else n.constructor = i; + } + }; +} +function old_convertMetadataMapToFinal(e, t) { + var a = e[Symbol.metadata || Symbol["for"]("Symbol.metadata")], + r = Object.getOwnPropertySymbols(t); + if (0 !== r.length) { + for (var o = 0; o < r.length; o++) { + var i = r[o], + n = t[i], + l = a ? a[i] : null, + s = n["public"], + c = l ? l["public"] : null; + s && c && Object.setPrototypeOf(s, c); + var d = n["private"]; + if (d) { + var u = Array.from(d.values()), + f = l ? l["private"] : null; + f && (u = u.concat(f)), n["private"] = u; + } + l && Object.setPrototypeOf(n, l); + } + a && Object.setPrototypeOf(t, a), e[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = t; + } +} +function old_createAddInitializerMethod(e, t) { + return function (a) { + old_assertNotFinished(t, "addInitializer"), old_assertCallable(a, "An initializer"), e.push(a); + }; +} +function old_memberDec(e, t, a, r, o, i, n, l, s) { + var c; + switch (i) { + case 1: + c = "accessor"; + break; + case 2: + c = "method"; + break; + case 3: + c = "getter"; + break; + case 4: + c = "setter"; + break; + default: + c = "field"; + } + var d, + u, + f = { + kind: c, + name: l ? "#" + t : toPropertyKey(t), + isStatic: n, + isPrivate: l + }, + p = { + v: !1 + }; + if (0 !== i && (f.addInitializer = old_createAddInitializerMethod(o, p)), l) { + d = 2, u = Symbol(t); + var v = {}; + 0 === i ? (v.get = a.get, v.set = a.set) : 2 === i ? v.get = function () { + return a.value; + } : (1 !== i && 3 !== i || (v.get = function () { + return a.get.call(this); + }), 1 !== i && 4 !== i || (v.set = function (e) { + a.set.call(this, e); + })), f.access = v; + } else d = 1, u = t; + try { + return e(s, Object.assign(f, old_createMetadataMethodsForProperty(r, d, u, p))); + } finally { + p.v = !0; + } +} +function old_assertNotFinished(e, t) { + if (e.v) throw Error("attempted to call " + t + " after decoration was finished"); +} +function old_assertMetadataKey(e) { + if ("symbol" != _typeof(e)) throw new TypeError("Metadata keys must be symbols, received: " + e); +} +function old_assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); +} +function old_assertValidReturnValue(e, t) { + var a = _typeof(t); + if (1 === e) { + if ("object" !== a || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && old_assertCallable(t.get, "accessor.get"), void 0 !== t.set && old_assertCallable(t.set, "accessor.set"), void 0 !== t.init && old_assertCallable(t.init, "accessor.init"), void 0 !== t.initializer && old_assertCallable(t.initializer, "accessor.initializer"); + } else if ("function" !== a) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); +} +function old_getInit(e) { + var t; + return null == (t = e.init) && (t = e.initializer) && void 0 !== console && console.warn(".initializer has been renamed to .init as of March 2022"), t; +} +function old_applyMemberDec(e, t, a, r, o, i, n, l, s) { + var c, + d, + u, + f, + p, + v, + y, + h = a[0]; + if (n ? (0 === o || 1 === o ? (c = { + get: a[3], + set: a[4] + }, u = "get") : 3 === o ? (c = { + get: a[3] + }, u = "get") : 4 === o ? (c = { + set: a[3] + }, u = "set") : c = { + value: a[3] + }, 0 !== o && (1 === o && setFunctionName(a[4], "#" + r, "set"), setFunctionName(a[3], "#" + r, u))) : 0 !== o && (c = Object.getOwnPropertyDescriptor(t, r)), 1 === o ? f = { + get: c.get, + set: c.set + } : 2 === o ? f = c.value : 3 === o ? f = c.get : 4 === o && (f = c.set), "function" == typeof h) void 0 !== (p = old_memberDec(h, r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? d = p : 1 === o ? (d = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = { + get: v, + set: y + }) : f = p);else for (var m = h.length - 1; m >= 0; m--) { + var b; + void 0 !== (p = old_memberDec(h[m], r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? b = p : 1 === o ? (b = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = { + get: v, + set: y + }) : f = p, void 0 !== b && (void 0 === d ? d = b : "function" == typeof d ? d = [d, b] : d.push(b))); + } + if (0 === o || 1 === o) { + if (void 0 === d) d = function d(e, t) { + return t; + };else if ("function" != typeof d) { + var g = d; + d = function d(e, t) { + for (var a = t, r = 0; r < g.length; r++) a = g[r].call(e, a); + return a; + }; + } else { + var _ = d; + d = function d(e, t) { + return _.call(e, t); + }; + } + e.push(d); + } + 0 !== o && (1 === o ? (c.get = f.get, c.set = f.set) : 2 === o ? c.value = f : 3 === o ? c.get = f : 4 === o && (c.set = f), n ? 1 === o ? (e.push(function (e, t) { + return f.get.call(e, t); + }), e.push(function (e, t) { + return f.set.call(e, t); + })) : 2 === o ? e.push(f) : e.push(function (e, t) { + return f.call(e, t); + }) : Object.defineProperty(t, r, c)); +} +function old_applyMemberDecs(e, t, a, r, o) { + for (var i, n, l = new Map(), s = new Map(), c = 0; c < o.length; c++) { + var d = o[c]; + if (Array.isArray(d)) { + var u, + f, + p, + v = d[1], + y = d[2], + h = d.length > 3, + m = v >= 5; + if (m ? (u = t, f = r, 0 != (v -= 5) && (p = n = n || [])) : (u = t.prototype, f = a, 0 !== v && (p = i = i || [])), 0 !== v && !h) { + var b = m ? s : l, + g = b.get(y) || 0; + if (!0 === g || 3 === g && 4 !== v || 4 === g && 3 !== v) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + y); + !g && v > 2 ? b.set(y, v) : b.set(y, !0); + } + old_applyMemberDec(e, u, d, y, v, m, h, f, p); + } + } + old_pushInitializers(e, i), old_pushInitializers(e, n); +} +function old_pushInitializers(e, t) { + t && e.push(function (e) { + for (var a = 0; a < t.length; a++) t[a].call(e); + return e; + }); +} +function old_applyClassDecs(e, t, a, r) { + if (r.length > 0) { + for (var o = [], i = t, n = t.name, l = r.length - 1; l >= 0; l--) { + var s = { + v: !1 + }; + try { + var c = Object.assign({ + kind: "class", + name: n, + addInitializer: old_createAddInitializerMethod(o, s) + }, old_createMetadataMethodsForProperty(a, 0, n, s)), + d = r[l](i, c); + } finally { + s.v = !0; + } + void 0 !== d && (old_assertValidReturnValue(10, d), i = d); + } + e.push(i, function () { + for (var e = 0; e < o.length; e++) o[e].call(i); + }); + } +} +function applyDecs(e, t, a) { + var r = [], + o = {}, + i = {}; + return old_applyMemberDecs(r, e, i, o, t), old_convertMetadataMapToFinal(e.prototype, i), old_applyClassDecs(r, e, o, a), old_convertMetadataMapToFinal(e, o), r; +} +export { applyDecs as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js b/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js new file mode 100644 index 00000000..bddb51d0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js @@ -0,0 +1,184 @@ +import _typeof from "./typeof.js"; +function applyDecs2203Factory() { + function createAddInitializerMethod(e, t) { + return function (r) { + !function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + }(t), assertCallable(r, "An initializer"), e.push(r); + }; + } + function memberDec(e, t, r, a, n, i, s, o) { + var c; + switch (n) { + case 1: + c = "accessor"; + break; + case 2: + c = "method"; + break; + case 3: + c = "getter"; + break; + case 4: + c = "setter"; + break; + default: + c = "field"; + } + var l, + u, + f = { + kind: c, + name: s ? "#" + t : t, + "static": i, + "private": s + }, + p = { + v: !1 + }; + 0 !== n && (f.addInitializer = createAddInitializerMethod(a, p)), 0 === n ? s ? (l = r.get, u = r.set) : (l = function l() { + return this[t]; + }, u = function u(e) { + this[t] = e; + }) : 2 === n ? l = function l() { + return r.value; + } : (1 !== n && 3 !== n || (l = function l() { + return r.get.call(this); + }), 1 !== n && 4 !== n || (u = function u(e) { + r.set.call(this, e); + })), f.access = l && u ? { + get: l, + set: u + } : l ? { + get: l + } : { + set: u + }; + try { + return e(o, f); + } finally { + p.v = !0; + } + } + function assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); + } + function assertValidReturnValue(e, t) { + var r = _typeof(t); + if (1 === e) { + if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init"); + } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); + } + function applyMemberDec(e, t, r, a, n, i, s, o) { + var c, + l, + u, + f, + p, + d, + h = r[0]; + if (s ? c = 0 === n || 1 === n ? { + get: r[3], + set: r[4] + } : 3 === n ? { + get: r[3] + } : 4 === n ? { + set: r[3] + } : { + value: r[3] + } : 0 !== n && (c = Object.getOwnPropertyDescriptor(t, a)), 1 === n ? u = { + get: c.get, + set: c.set + } : 2 === n ? u = c.value : 3 === n ? u = c.get : 4 === n && (u = c.set), "function" == typeof h) void 0 !== (f = memberDec(h, a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? l = f : 1 === n ? (l = f.init, p = f.get || u.get, d = f.set || u.set, u = { + get: p, + set: d + }) : u = f);else for (var v = h.length - 1; v >= 0; v--) { + var g; + void 0 !== (f = memberDec(h[v], a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? g = f : 1 === n ? (g = f.init, p = f.get || u.get, d = f.set || u.set, u = { + get: p, + set: d + }) : u = f, void 0 !== g && (void 0 === l ? l = g : "function" == typeof l ? l = [l, g] : l.push(g))); + } + if (0 === n || 1 === n) { + if (void 0 === l) l = function l(e, t) { + return t; + };else if ("function" != typeof l) { + var y = l; + l = function l(e, t) { + for (var r = t, a = 0; a < y.length; a++) r = y[a].call(e, r); + return r; + }; + } else { + var m = l; + l = function l(e, t) { + return m.call(e, t); + }; + } + e.push(l); + } + 0 !== n && (1 === n ? (c.get = u.get, c.set = u.set) : 2 === n ? c.value = u : 3 === n ? c.get = u : 4 === n && (c.set = u), s ? 1 === n ? (e.push(function (e, t) { + return u.get.call(e, t); + }), e.push(function (e, t) { + return u.set.call(e, t); + })) : 2 === n ? e.push(u) : e.push(function (e, t) { + return u.call(e, t); + }) : Object.defineProperty(t, a, c)); + } + function pushInitializers(e, t) { + t && e.push(function (e) { + for (var r = 0; r < t.length; r++) t[r].call(e); + return e; + }); + } + return function (e, t, r) { + var a = []; + return function (e, t, r) { + for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) { + var c = r[o]; + if (Array.isArray(c)) { + var l, + u, + f = c[1], + p = c[2], + d = c.length > 3, + h = f >= 5; + if (h ? (l = t, 0 != (f -= 5) && (u = n = n || [])) : (l = t.prototype, 0 !== f && (u = a = a || [])), 0 !== f && !d) { + var v = h ? s : i, + g = v.get(p) || 0; + if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p); + !g && f > 2 ? v.set(p, f) : v.set(p, !0); + } + applyMemberDec(e, l, c, p, f, h, d, u); + } + } + pushInitializers(e, a), pushInitializers(e, n); + }(a, e, t), function (e, t, r) { + if (r.length > 0) { + for (var a = [], n = t, i = t.name, s = r.length - 1; s >= 0; s--) { + var o = { + v: !1 + }; + try { + var c = r[s](n, { + kind: "class", + name: i, + addInitializer: createAddInitializerMethod(a, o) + }); + } finally { + o.v = !0; + } + void 0 !== c && (assertValidReturnValue(10, c), n = c); + } + e.push(n, function () { + for (var e = 0; e < a.length; e++) a[e].call(n); + }); + } + }(a, e, r), a; + }; +} +var applyDecs2203Impl; +function applyDecs2203(e, t, r) { + return (applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory())(e, t, r); +} +export { applyDecs2203 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js b/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js new file mode 100644 index 00000000..3944bf42 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js @@ -0,0 +1,191 @@ +import _typeof from "./typeof.js"; +import setFunctionName from "./setFunctionName.js"; +import toPropertyKey from "./toPropertyKey.js"; +function applyDecs2203RFactory() { + function createAddInitializerMethod(e, t) { + return function (r) { + !function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + }(t), assertCallable(r, "An initializer"), e.push(r); + }; + } + function memberDec(e, t, r, n, a, i, o, s) { + var c; + switch (a) { + case 1: + c = "accessor"; + break; + case 2: + c = "method"; + break; + case 3: + c = "getter"; + break; + case 4: + c = "setter"; + break; + default: + c = "field"; + } + var l, + u, + f = { + kind: c, + name: o ? "#" + t : toPropertyKey(t), + "static": i, + "private": o + }, + p = { + v: !1 + }; + 0 !== a && (f.addInitializer = createAddInitializerMethod(n, p)), 0 === a ? o ? (l = r.get, u = r.set) : (l = function l() { + return this[t]; + }, u = function u(e) { + this[t] = e; + }) : 2 === a ? l = function l() { + return r.value; + } : (1 !== a && 3 !== a || (l = function l() { + return r.get.call(this); + }), 1 !== a && 4 !== a || (u = function u(e) { + r.set.call(this, e); + })), f.access = l && u ? { + get: l, + set: u + } : l ? { + get: l + } : { + set: u + }; + try { + return e(s, f); + } finally { + p.v = !0; + } + } + function assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); + } + function assertValidReturnValue(e, t) { + var r = _typeof(t); + if (1 === e) { + if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init"); + } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); + } + function applyMemberDec(e, t, r, n, a, i, o, s) { + var c, + l, + u, + f, + p, + d, + h, + v = r[0]; + if (o ? (0 === a || 1 === a ? (c = { + get: r[3], + set: r[4] + }, u = "get") : 3 === a ? (c = { + get: r[3] + }, u = "get") : 4 === a ? (c = { + set: r[3] + }, u = "set") : c = { + value: r[3] + }, 0 !== a && (1 === a && setFunctionName(r[4], "#" + n, "set"), setFunctionName(r[3], "#" + n, u))) : 0 !== a && (c = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? f = { + get: c.get, + set: c.set + } : 2 === a ? f = c.value : 3 === a ? f = c.get : 4 === a && (f = c.set), "function" == typeof v) void 0 !== (p = memberDec(v, n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? l = p : 1 === a ? (l = p.init, d = p.get || f.get, h = p.set || f.set, f = { + get: d, + set: h + }) : f = p);else for (var g = v.length - 1; g >= 0; g--) { + var y; + void 0 !== (p = memberDec(v[g], n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? y = p : 1 === a ? (y = p.init, d = p.get || f.get, h = p.set || f.set, f = { + get: d, + set: h + }) : f = p, void 0 !== y && (void 0 === l ? l = y : "function" == typeof l ? l = [l, y] : l.push(y))); + } + if (0 === a || 1 === a) { + if (void 0 === l) l = function l(e, t) { + return t; + };else if ("function" != typeof l) { + var m = l; + l = function l(e, t) { + for (var r = t, n = 0; n < m.length; n++) r = m[n].call(e, r); + return r; + }; + } else { + var b = l; + l = function l(e, t) { + return b.call(e, t); + }; + } + e.push(l); + } + 0 !== a && (1 === a ? (c.get = f.get, c.set = f.set) : 2 === a ? c.value = f : 3 === a ? c.get = f : 4 === a && (c.set = f), o ? 1 === a ? (e.push(function (e, t) { + return f.get.call(e, t); + }), e.push(function (e, t) { + return f.set.call(e, t); + })) : 2 === a ? e.push(f) : e.push(function (e, t) { + return f.call(e, t); + }) : Object.defineProperty(t, n, c)); + } + function applyMemberDecs(e, t) { + for (var r, n, a = [], i = new Map(), o = new Map(), s = 0; s < t.length; s++) { + var c = t[s]; + if (Array.isArray(c)) { + var l, + u, + f = c[1], + p = c[2], + d = c.length > 3, + h = f >= 5; + if (h ? (l = e, 0 != (f -= 5) && (u = n = n || [])) : (l = e.prototype, 0 !== f && (u = r = r || [])), 0 !== f && !d) { + var v = h ? o : i, + g = v.get(p) || 0; + if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p); + !g && f > 2 ? v.set(p, f) : v.set(p, !0); + } + applyMemberDec(a, l, c, p, f, h, d, u); + } + } + return pushInitializers(a, r), pushInitializers(a, n), a; + } + function pushInitializers(e, t) { + t && e.push(function (e) { + for (var r = 0; r < t.length; r++) t[r].call(e); + return e; + }); + } + return function (e, t, r) { + return { + e: applyMemberDecs(e, t), + get c() { + return function (e, t) { + if (t.length > 0) { + for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) { + var o = { + v: !1 + }; + try { + var s = t[i](n, { + kind: "class", + name: a, + addInitializer: createAddInitializerMethod(r, o) + }); + } finally { + o.v = !0; + } + void 0 !== s && (assertValidReturnValue(10, s), n = s); + } + return [n, function () { + for (var e = 0; e < r.length; e++) r[e].call(n); + }]; + } + }(e, r); + } + }; + }; +} +function applyDecs2203R(e, t, r) { + return (applyDecs2203R = applyDecs2203RFactory())(e, t, r); +} +export { applyDecs2203R as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js b/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js new file mode 100644 index 00000000..bb4fbe6a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js @@ -0,0 +1,222 @@ +import _typeof from "./typeof.js"; +import checkInRHS from "./checkInRHS.js"; +import setFunctionName from "./setFunctionName.js"; +import toPropertyKey from "./toPropertyKey.js"; +function applyDecs2301Factory() { + function createAddInitializerMethod(e, t) { + return function (r) { + !function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + }(t), assertCallable(r, "An initializer"), e.push(r); + }; + } + function assertInstanceIfPrivate(e, t) { + if (!e(t)) throw new TypeError("Attempted to access private element on non-instance"); + } + function memberDec(e, t, r, n, a, i, s, o, c) { + var u; + switch (a) { + case 1: + u = "accessor"; + break; + case 2: + u = "method"; + break; + case 3: + u = "getter"; + break; + case 4: + u = "setter"; + break; + default: + u = "field"; + } + var l, + f, + p = { + kind: u, + name: s ? "#" + t : toPropertyKey(t), + "static": i, + "private": s + }, + d = { + v: !1 + }; + if (0 !== a && (p.addInitializer = createAddInitializerMethod(n, d)), s || 0 !== a && 2 !== a) { + if (2 === a) l = function l(e) { + return assertInstanceIfPrivate(c, e), r.value; + };else { + var h = 0 === a || 1 === a; + (h || 3 === a) && (l = s ? function (e) { + return assertInstanceIfPrivate(c, e), r.get.call(e); + } : function (e) { + return r.get.call(e); + }), (h || 4 === a) && (f = s ? function (e, t) { + assertInstanceIfPrivate(c, e), r.set.call(e, t); + } : function (e, t) { + r.set.call(e, t); + }); + } + } else l = function l(e) { + return e[t]; + }, 0 === a && (f = function f(e, r) { + e[t] = r; + }); + var v = s ? c.bind() : function (e) { + return t in e; + }; + p.access = l && f ? { + get: l, + set: f, + has: v + } : l ? { + get: l, + has: v + } : { + set: f, + has: v + }; + try { + return e(o, p); + } finally { + d.v = !0; + } + } + function assertCallable(e, t) { + if ("function" != typeof e) throw new TypeError(t + " must be a function"); + } + function assertValidReturnValue(e, t) { + var r = _typeof(t); + if (1 === e) { + if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init"); + } else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0"); + } + function curryThis2(e) { + return function (t) { + e(this, t); + }; + } + function applyMemberDec(e, t, r, n, a, i, s, o, c) { + var u, + l, + f, + p, + d, + h, + v, + y, + g = r[0]; + if (s ? (0 === a || 1 === a ? (u = { + get: (d = r[3], function () { + return d(this); + }), + set: curryThis2(r[4]) + }, f = "get") : 3 === a ? (u = { + get: r[3] + }, f = "get") : 4 === a ? (u = { + set: r[3] + }, f = "set") : u = { + value: r[3] + }, 0 !== a && (1 === a && setFunctionName(u.set, "#" + n, "set"), setFunctionName(u[f || "value"], "#" + n, f))) : 0 !== a && (u = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? p = { + get: u.get, + set: u.set + } : 2 === a ? p = u.value : 3 === a ? p = u.get : 4 === a && (p = u.set), "function" == typeof g) void 0 !== (h = memberDec(g, n, u, o, a, i, s, p, c)) && (assertValidReturnValue(a, h), 0 === a ? l = h : 1 === a ? (l = h.init, v = h.get || p.get, y = h.set || p.set, p = { + get: v, + set: y + }) : p = h);else for (var m = g.length - 1; m >= 0; m--) { + var b; + void 0 !== (h = memberDec(g[m], n, u, o, a, i, s, p, c)) && (assertValidReturnValue(a, h), 0 === a ? b = h : 1 === a ? (b = h.init, v = h.get || p.get, y = h.set || p.set, p = { + get: v, + set: y + }) : p = h, void 0 !== b && (void 0 === l ? l = b : "function" == typeof l ? l = [l, b] : l.push(b))); + } + if (0 === a || 1 === a) { + if (void 0 === l) l = function l(e, t) { + return t; + };else if ("function" != typeof l) { + var I = l; + l = function l(e, t) { + for (var r = t, n = 0; n < I.length; n++) r = I[n].call(e, r); + return r; + }; + } else { + var w = l; + l = function l(e, t) { + return w.call(e, t); + }; + } + e.push(l); + } + 0 !== a && (1 === a ? (u.get = p.get, u.set = p.set) : 2 === a ? u.value = p : 3 === a ? u.get = p : 4 === a && (u.set = p), s ? 1 === a ? (e.push(function (e, t) { + return p.get.call(e, t); + }), e.push(function (e, t) { + return p.set.call(e, t); + })) : 2 === a ? e.push(p) : e.push(function (e, t) { + return p.call(e, t); + }) : Object.defineProperty(t, n, u)); + } + function applyMemberDecs(e, t, r) { + for (var n, a, i, s = [], o = new Map(), c = new Map(), u = 0; u < t.length; u++) { + var l = t[u]; + if (Array.isArray(l)) { + var f, + p, + d = l[1], + h = l[2], + v = l.length > 3, + y = d >= 5, + g = r; + if (y ? (f = e, 0 != (d -= 5) && (p = a = a || []), v && !i && (i = function i(t) { + return checkInRHS(t) === e; + }), g = i) : (f = e.prototype, 0 !== d && (p = n = n || [])), 0 !== d && !v) { + var m = y ? c : o, + b = m.get(h) || 0; + if (!0 === b || 3 === b && 4 !== d || 4 === b && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); + !b && d > 2 ? m.set(h, d) : m.set(h, !0); + } + applyMemberDec(s, f, l, h, d, y, v, p, g); + } + } + return pushInitializers(s, n), pushInitializers(s, a), s; + } + function pushInitializers(e, t) { + t && e.push(function (e) { + for (var r = 0; r < t.length; r++) t[r].call(e); + return e; + }); + } + return function (e, t, r, n) { + return { + e: applyMemberDecs(e, t, n), + get c() { + return function (e, t) { + if (t.length > 0) { + for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) { + var s = { + v: !1 + }; + try { + var o = t[i](n, { + kind: "class", + name: a, + addInitializer: createAddInitializerMethod(r, s) + }); + } finally { + s.v = !0; + } + void 0 !== o && (assertValidReturnValue(10, o), n = o); + } + return [n, function () { + for (var e = 0; e < r.length; e++) r[e].call(n); + }]; + } + }(e, r); + } + }; + }; +} +function applyDecs2301(e, t, r, n) { + return (applyDecs2301 = applyDecs2301Factory())(e, t, r, n); +} +export { applyDecs2301 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js b/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js new file mode 100644 index 00000000..a11b2b90 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js @@ -0,0 +1,133 @@ +import _typeof from "./typeof.js"; +import checkInRHS from "./checkInRHS.js"; +import setFunctionName from "./setFunctionName.js"; +import toPropertyKey from "./toPropertyKey.js"; +function applyDecs2305(e, t, r, n, o, a) { + function i(e, t, r) { + return function (n, o) { + return r && r(n), e[t].call(n, o); + }; + } + function c(e, t) { + for (var r = 0; r < e.length; r++) e[r].call(t); + return t; + } + function s(e, t, r, n) { + if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); + return e; + } + function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { + function m(e) { + if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); + } + var y, + v = t[0], + g = t[3], + b = !u; + if (!b) { + r || Array.isArray(v) || (v = [v]); + var w = {}, + S = [], + A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; + f ? (p || d ? w = { + get: setFunctionName(function () { + return g(this); + }, n, "get"), + set: function set(e) { + t[4](this, e); + } + } : w[A] = g, p || setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); + } + for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { + var D = v[j], + E = r ? v[j - 1] : void 0, + I = {}, + O = { + kind: ["field", "accessor", "method", "getter", "setter", "class"][o], + name: n, + metadata: a, + addInitializer: function (e, t) { + if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); + s(t, "An initializer", "be", !0), c.push(t); + }.bind(null, I) + }; + try { + if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { + var k, F; + O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { + return m(e), w.value; + } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { + return e[n]; + }, (o < 2 || 4 === o) && (F = function F(e, t) { + e[n] = t; + })); + var N = O.access = { + has: f ? h.bind() : function (e) { + return n in e; + } + }; + if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { + get: w.get, + set: w.set + } : w[A], O), d) { + if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); + } + } finally { + I.v = !0; + } + } + return (p || d) && u.push(function (e, t) { + for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); + return t; + }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; + } + function u(e, t) { + return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { + configurable: !0, + enumerable: !0, + value: t + }); + } + if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; + var f = Object.create(null == l ? null : l), + p = function (e, t, r, n) { + var o, + a, + i = [], + s = function s(t) { + return checkInRHS(t) === e; + }, + u = new Map(); + function l(e) { + e && i.push(c.bind(null, e)); + } + for (var f = 0; f < t.length; f++) { + var p = t[f]; + if (Array.isArray(p)) { + var d = p[1], + h = p[2], + m = p.length > 3, + y = 16 & d, + v = !!(8 & d), + g = 0 == (d &= 7), + b = h + "/" + v; + if (!g && !m) { + var w = u.get(b); + if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); + u.set(b, !(d > 2) || d); + } + applyDec(v ? e : e.prototype, p, y, m ? "#" + h : toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); + } + } + return l(o), l(a), i; + }(e, t, o, f); + return r.length || u(e, f), { + e: p, + get c() { + var t = []; + return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; + } + }; +} +export { applyDecs2305 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/applyDecs2311.js b/node_modules/@babel/runtime/helpers/esm/applyDecs2311.js new file mode 100644 index 00000000..41b2c484 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/applyDecs2311.js @@ -0,0 +1,124 @@ +import _typeof from "./typeof.js"; +import checkInRHS from "./checkInRHS.js"; +import setFunctionName from "./setFunctionName.js"; +import toPropertyKey from "./toPropertyKey.js"; +function applyDecs2311(e, t, n, r, o, i) { + var a, + c, + u, + s, + f, + l, + p, + d = Symbol.metadata || Symbol["for"]("Symbol.metadata"), + m = Object.defineProperty, + h = Object.create, + y = [h(null), h(null)], + v = t.length; + function g(t, n, r) { + return function (o, i) { + n && (i = o, o = e); + for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); + return r ? i : o; + }; + } + function b(e, t, n, r) { + if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined")); + return e; + } + function applyDec(e, t, n, r, o, i, u, s, f, l, p) { + function d(e) { + if (!p(e)) throw new TypeError("Attempted to access private element on non-instance"); + } + var h = [].concat(t[0]), + v = t[3], + w = !u, + D = 1 === o, + S = 3 === o, + j = 4 === o, + E = 2 === o; + function I(t, n, r) { + return function (o, i) { + return n && (i = o, o = e), r && r(o), P[t].call(o, i); + }; + } + if (!w) { + var P = {}, + k = [], + F = S ? "get" : j || D ? "set" : "value"; + if (f ? (l || D ? P = { + get: setFunctionName(function () { + return v(this); + }, r, "get"), + set: function set(e) { + t[4](this, e); + } + } : P[F] = v, l || setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { + if ((c = y[+s][r]) && 7 != (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet"); + y[+s][r] = o < 3 ? 1 : o; + } + } + for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { + var T = b(h[O], "A decorator", "be", !0), + z = n ? h[O - 1] : void 0, + A = {}, + H = { + kind: ["field", "accessor", "method", "getter", "setter", "class"][o], + name: r, + metadata: a, + addInitializer: function (e, t) { + if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished"); + b(t, "An initializer", "be", !0), i.push(t); + }.bind(null, A) + }; + if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H["static"] = s, H["private"] = f, c = H.access = { + has: f ? p.bind() : function (e) { + return r in e; + } + }, j || (c.get = f ? E ? function (e) { + return d(e), P.value; + } : I("get", 0, d) : function (e) { + return e[r]; + }), E || S || (c.set = f ? I("set", 0, d) : function (e, t) { + e[r] = t; + }), N = T.call(z, D ? { + get: P.get, + set: P.set + } : P[F], H), A.v = 1, D) { + if ("object" == _typeof(N) && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); + } else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N); + } + return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; + } + function w(e) { + return m(e, d, { + configurable: !0, + enumerable: !0, + value: a + }); + } + return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function l(e) { + e && f.push(g(e)); + }, p = function p(t, r) { + for (var i = 0; i < n.length; i++) { + var a = n[i], + c = a[1], + l = 7 & c; + if ((8 & c) == t && !l == r) { + var p = a[2], + d = !!a[3], + m = 16 & c; + applyDec(t ? e : e.prototype, a, m, d ? "#" + p : toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { + return checkInRHS(t) === e; + } : o); + } + } + }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { + e: c, + get c() { + var n = []; + return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; + } + }; +} +export { applyDecs2311 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js b/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js new file mode 100644 index 00000000..9ace7724 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js @@ -0,0 +1,6 @@ +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} +export { _arrayLikeToArray as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js b/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js new file mode 100644 index 00000000..99fa7154 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js @@ -0,0 +1,4 @@ +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +export { _arrayWithHoles as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js b/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js new file mode 100644 index 00000000..1ce6f214 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js @@ -0,0 +1,5 @@ +import arrayLikeToArray from "./arrayLikeToArray.js"; +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return arrayLikeToArray(r); +} +export { _arrayWithoutHoles as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/assertClassBrand.js b/node_modules/@babel/runtime/helpers/esm/assertClassBrand.js new file mode 100644 index 00000000..ae7b7126 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/assertClassBrand.js @@ -0,0 +1,5 @@ +function _assertClassBrand(e, t, n) { + if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; + throw new TypeError("Private element is not present on this object"); +} +export { _assertClassBrand as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js b/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js new file mode 100644 index 00000000..4a41bde6 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js @@ -0,0 +1,5 @@ +function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} +export { _assertThisInitialized as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js b/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js new file mode 100644 index 00000000..e0266897 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js @@ -0,0 +1,24 @@ +import OverloadYield from "./OverloadYield.js"; +function _asyncGeneratorDelegate(t) { + var e = {}, + n = !1; + function pump(e, r) { + return n = !0, r = new Promise(function (n) { + n(t[e](r)); + }), { + done: !1, + value: new OverloadYield(r, 1) + }; + } + return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { + return this; + }, e.next = function (t) { + return n ? (n = !1, t) : pump("next", t); + }, "function" == typeof t["throw"] && (e["throw"] = function (t) { + if (n) throw n = !1, t; + return pump("throw", t); + }), "function" == typeof t["return"] && (e["return"] = function (t) { + return n ? (n = !1, t) : pump("return", t); + }), e; +} +export { _asyncGeneratorDelegate as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/asyncIterator.js b/node_modules/@babel/runtime/helpers/esm/asyncIterator.js new file mode 100644 index 00000000..2ed00b79 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/asyncIterator.js @@ -0,0 +1,45 @@ +function _asyncIterator(r) { + var n, + t, + o, + e = 2; + for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { + if (t && null != (n = r[t])) return n.call(r); + if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); + t = "@@asyncIterator", o = "@@iterator"; + } + throw new TypeError("Object is not async iterable"); +} +function AsyncFromSyncIterator(r) { + function AsyncFromSyncIteratorContinuation(r) { + if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); + var n = r.done; + return Promise.resolve(r.value).then(function (r) { + return { + value: r, + done: n + }; + }); + } + return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { + this.s = r, this.n = r.next; + }, AsyncFromSyncIterator.prototype = { + s: null, + n: null, + next: function next() { + return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); + }, + "return": function _return(r) { + var n = this.s["return"]; + return void 0 === n ? Promise.resolve({ + value: r, + done: !0 + }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + }, + "throw": function _throw(r) { + var n = this.s["return"]; + return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + } + }, new AsyncFromSyncIterator(r); +} +export { _asyncIterator as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js b/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js new file mode 100644 index 00000000..00f29b1f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js @@ -0,0 +1,26 @@ +function asyncGeneratorStep(n, t, e, r, o, a, c) { + try { + var i = n[a](c), + u = i.value; + } catch (n) { + return void e(n); + } + i.done ? t(u) : Promise.resolve(u).then(r, o); +} +function _asyncToGenerator(n) { + return function () { + var t = this, + e = arguments; + return new Promise(function (r, o) { + var a = n.apply(t, e); + function _next(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "next", n); + } + function _throw(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); + } + _next(void 0); + }); + }; +} +export { _asyncToGenerator as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js b/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js new file mode 100644 index 00000000..097c88c9 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js @@ -0,0 +1,5 @@ +import OverloadYield from "./OverloadYield.js"; +function _awaitAsyncGenerator(e) { + return new OverloadYield(e, 0); +} +export { _awaitAsyncGenerator as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/callSuper.js b/node_modules/@babel/runtime/helpers/esm/callSuper.js new file mode 100644 index 00000000..6d17a4ee --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/callSuper.js @@ -0,0 +1,7 @@ +import getPrototypeOf from "./getPrototypeOf.js"; +import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; +import possibleConstructorReturn from "./possibleConstructorReturn.js"; +function _callSuper(t, o, e) { + return o = getPrototypeOf(o), possibleConstructorReturn(t, isNativeReflectConstruct() ? Reflect.construct(o, e || [], getPrototypeOf(t).constructor) : o.apply(t, e)); +} +export { _callSuper as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/checkInRHS.js b/node_modules/@babel/runtime/helpers/esm/checkInRHS.js new file mode 100644 index 00000000..12f59b4c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/checkInRHS.js @@ -0,0 +1,6 @@ +import _typeof from "./typeof.js"; +function _checkInRHS(e) { + if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); + return e; +} +export { _checkInRHS as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js b/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js new file mode 100644 index 00000000..e9e6b3b4 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js @@ -0,0 +1,4 @@ +function _checkPrivateRedeclaration(e, t) { + if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); +} +export { _checkPrivateRedeclaration as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js new file mode 100644 index 00000000..56234195 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js @@ -0,0 +1,10 @@ +function _classApplyDescriptorDestructureSet(e, t) { + if (t.set) return "__destrObj" in t || (t.__destrObj = { + set value(r) { + t.set.call(e, r); + } + }), t.__destrObj; + if (!t.writable) throw new TypeError("attempted to set read only private field"); + return t; +} +export { _classApplyDescriptorDestructureSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js new file mode 100644 index 00000000..b9259d3e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js @@ -0,0 +1,4 @@ +function _classApplyDescriptorGet(e, t) { + return t.get ? t.get.call(e) : t.value; +} +export { _classApplyDescriptorGet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js new file mode 100644 index 00000000..d9c4fbd2 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js @@ -0,0 +1,7 @@ +function _classApplyDescriptorSet(e, t, l) { + if (t.set) t.set.call(e, l);else { + if (!t.writable) throw new TypeError("attempted to set read only private field"); + t.value = l; + } +} +export { _classApplyDescriptorSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classCallCheck.js b/node_modules/@babel/runtime/helpers/esm/classCallCheck.js new file mode 100644 index 00000000..bf972193 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classCallCheck.js @@ -0,0 +1,4 @@ +function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} +export { _classCallCheck as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js b/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js new file mode 100644 index 00000000..366ed05e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classCheckPrivateStaticAccess(s, a, r) { + return assertClassBrand(a, s, r); +} +export { _classCheckPrivateStaticAccess as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js b/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js new file mode 100644 index 00000000..844be91a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js @@ -0,0 +1,4 @@ +function _classCheckPrivateStaticFieldDescriptor(t, e) { + if (void 0 === t) throw new TypeError("attempted to " + e + " private static field before its declaration"); +} +export { _classCheckPrivateStaticFieldDescriptor as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js b/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js new file mode 100644 index 00000000..652689d1 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js @@ -0,0 +1,5 @@ +import classPrivateFieldGet2 from "./classPrivateFieldGet2.js"; +function _classExtractFieldDescriptor(e, t) { + return classPrivateFieldGet2(t, e); +} +export { _classExtractFieldDescriptor as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js b/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js new file mode 100644 index 00000000..68e76ff7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js @@ -0,0 +1,4 @@ +function _classNameTDZError(e) { + throw new ReferenceError('Class "' + e + '" cannot be referenced in computed property keys.'); +} +export { _classNameTDZError as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js new file mode 100644 index 00000000..93033663 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js @@ -0,0 +1,7 @@ +import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; +import classPrivateFieldGet2 from "./classPrivateFieldGet2.js"; +function _classPrivateFieldDestructureSet(e, t) { + var r = classPrivateFieldGet2(t, e); + return classApplyDescriptorDestructureSet(e, r); +} +export { _classPrivateFieldDestructureSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js new file mode 100644 index 00000000..ce7ebcb7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js @@ -0,0 +1,7 @@ +import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; +import classPrivateFieldGet2 from "./classPrivateFieldGet2.js"; +function _classPrivateFieldGet(e, t) { + var r = classPrivateFieldGet2(t, e); + return classApplyDescriptorGet(e, r); +} +export { _classPrivateFieldGet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet2.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet2.js new file mode 100644 index 00000000..4aa3da6b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet2.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classPrivateFieldGet2(s, a) { + return s.get(assertClassBrand(s, a)); +} +export { _classPrivateFieldGet2 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js new file mode 100644 index 00000000..5dcdbe04 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js @@ -0,0 +1,5 @@ +import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js"; +function _classPrivateFieldInitSpec(e, t, a) { + checkPrivateRedeclaration(e, t), t.set(e, a); +} +export { _classPrivateFieldInitSpec as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js new file mode 100644 index 00000000..4bd662ca --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js @@ -0,0 +1,5 @@ +function _classPrivateFieldBase(e, t) { + if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); + return e; +} +export { _classPrivateFieldBase as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js new file mode 100644 index 00000000..90d21937 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js @@ -0,0 +1,5 @@ +var id = 0; +function _classPrivateFieldKey(e) { + return "__private_" + id++ + "_" + e; +} +export { _classPrivateFieldKey as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js new file mode 100644 index 00000000..b5161bdb --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js @@ -0,0 +1,7 @@ +import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; +import classPrivateFieldGet2 from "./classPrivateFieldGet2.js"; +function _classPrivateFieldSet(e, t, r) { + var s = classPrivateFieldGet2(t, e); + return classApplyDescriptorSet(e, s, r), r; +} +export { _classPrivateFieldSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet2.js b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet2.js new file mode 100644 index 00000000..337b01a4 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet2.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classPrivateFieldSet2(s, a, r) { + return s.set(assertClassBrand(s, a), r), r; +} +export { _classPrivateFieldSet2 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateGetter.js b/node_modules/@babel/runtime/helpers/esm/classPrivateGetter.js new file mode 100644 index 00000000..ff3e9851 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateGetter.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classPrivateGetter(s, r, a) { + return a(assertClassBrand(s, r)); +} +export { _classPrivateGetter as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js new file mode 100644 index 00000000..4832fc6f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classPrivateMethodGet(s, a, r) { + return assertClassBrand(a, s), r; +} +export { _classPrivateMethodGet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js new file mode 100644 index 00000000..61e23e26 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js @@ -0,0 +1,5 @@ +import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js"; +function _classPrivateMethodInitSpec(e, a) { + checkPrivateRedeclaration(e, a), a.add(e); +} +export { _classPrivateMethodInitSpec as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js new file mode 100644 index 00000000..d181b513 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js @@ -0,0 +1,4 @@ +function _classPrivateMethodSet() { + throw new TypeError("attempted to reassign private method"); +} +export { _classPrivateMethodSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classPrivateSetter.js b/node_modules/@babel/runtime/helpers/esm/classPrivateSetter.js new file mode 100644 index 00000000..9a80d59b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classPrivateSetter.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classPrivateSetter(s, r, a, t) { + return r(assertClassBrand(s, a), t), t; +} +export { _classPrivateSetter as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js new file mode 100644 index 00000000..747e639d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js @@ -0,0 +1,7 @@ +import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; +import assertClassBrand from "./assertClassBrand.js"; +import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; +function _classStaticPrivateFieldDestructureSet(t, r, s) { + return assertClassBrand(r, t), classCheckPrivateStaticFieldDescriptor(s, "set"), classApplyDescriptorDestructureSet(t, s); +} +export { _classStaticPrivateFieldDestructureSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js new file mode 100644 index 00000000..23684b74 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js @@ -0,0 +1,7 @@ +import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; +import assertClassBrand from "./assertClassBrand.js"; +import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; +function _classStaticPrivateFieldSpecGet(t, s, r) { + return assertClassBrand(s, t), classCheckPrivateStaticFieldDescriptor(r, "get"), classApplyDescriptorGet(t, r); +} +export { _classStaticPrivateFieldSpecGet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js new file mode 100644 index 00000000..3a314682 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js @@ -0,0 +1,7 @@ +import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; +import assertClassBrand from "./assertClassBrand.js"; +import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; +function _classStaticPrivateFieldSpecSet(s, t, r, e) { + return assertClassBrand(t, s), classCheckPrivateStaticFieldDescriptor(r, "set"), classApplyDescriptorSet(s, r, e), e; +} +export { _classStaticPrivateFieldSpecSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js new file mode 100644 index 00000000..047b177b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js @@ -0,0 +1,5 @@ +import assertClassBrand from "./assertClassBrand.js"; +function _classStaticPrivateMethodGet(s, a, t) { + return assertClassBrand(a, s), t; +} +export { _classStaticPrivateMethodGet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js new file mode 100644 index 00000000..a61ae63e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js @@ -0,0 +1,4 @@ +function _classStaticPrivateMethodSet() { + throw new TypeError("attempted to set read only static private field"); +} +export { _classStaticPrivateMethodSet as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/construct.js b/node_modules/@babel/runtime/helpers/esm/construct.js new file mode 100644 index 00000000..91609ff7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/construct.js @@ -0,0 +1,10 @@ +import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; +import setPrototypeOf from "./setPrototypeOf.js"; +function _construct(t, e, r) { + if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && setPrototypeOf(p, r.prototype), p; +} +export { _construct as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createClass.js b/node_modules/@babel/runtime/helpers/esm/createClass.js new file mode 100644 index 00000000..9b178515 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/createClass.js @@ -0,0 +1,13 @@ +import toPropertyKey from "./toPropertyKey.js"; +function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); + } +} +function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} +export { _createClass as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js b/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js new file mode 100644 index 00000000..93b97f91 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js @@ -0,0 +1,50 @@ +import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; +function _createForOfIteratorHelper(r, e) { + var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t) { + if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { + t && (r = t); + var _n = 0, + F = function F() {}; + return { + s: F, + n: function n() { + return _n >= r.length ? { + done: !0 + } : { + done: !1, + value: r[_n++] + }; + }, + e: function e(r) { + throw r; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var o, + a = !0, + u = !1; + return { + s: function s() { + t = t.call(r); + }, + n: function n() { + var r = t.next(); + return a = r.done, r; + }, + e: function e(r) { + u = !0, o = r; + }, + f: function f() { + try { + a || null == t["return"] || t["return"](); + } finally { + if (u) throw o; + } + } + }; +} +export { _createForOfIteratorHelper as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js b/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js new file mode 100644 index 00000000..3deaae44 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js @@ -0,0 +1,19 @@ +import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; +function _createForOfIteratorHelperLoose(r, e) { + var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (t) return (t = t.call(r)).next.bind(t); + if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { + t && (r = t); + var o = 0; + return function () { + return o >= r.length ? { + done: !0 + } : { + done: !1, + value: r[o++] + }; + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +export { _createForOfIteratorHelperLoose as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/createSuper.js b/node_modules/@babel/runtime/helpers/esm/createSuper.js new file mode 100644 index 00000000..dfabf711 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/createSuper.js @@ -0,0 +1,16 @@ +import getPrototypeOf from "./getPrototypeOf.js"; +import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; +import possibleConstructorReturn from "./possibleConstructorReturn.js"; +function _createSuper(t) { + var r = isNativeReflectConstruct(); + return function () { + var e, + o = getPrototypeOf(t); + if (r) { + var s = getPrototypeOf(this).constructor; + e = Reflect.construct(o, arguments, s); + } else e = o.apply(this, arguments); + return possibleConstructorReturn(this, e); + }; +} +export { _createSuper as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/decorate.js b/node_modules/@babel/runtime/helpers/esm/decorate.js new file mode 100644 index 00000000..f76b6a6a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/decorate.js @@ -0,0 +1,250 @@ +import toArray from "./toArray.js"; +import toPropertyKey from "./toPropertyKey.js"; +function _decorate(e, r, t, i) { + var o = _getDecoratorsApi(); + if (i) for (var n = 0; n < i.length; n++) o = i[n](o); + var s = r(function (e) { + o.initializeInstanceElements(e, a.elements); + }, t), + a = o.decorateClass(_coalesceClassElements(s.d.map(_createElementDescriptor)), e); + return o.initializeClassElements(s.F, a.elements), o.runClassFinishers(s.F, a.finishers); +} +function _getDecoratorsApi() { + _getDecoratorsApi = function _getDecoratorsApi() { + return e; + }; + var e = { + elementsDefinitionOrder: [["method"], ["field"]], + initializeInstanceElements: function initializeInstanceElements(e, r) { + ["method", "field"].forEach(function (t) { + r.forEach(function (r) { + r.kind === t && "own" === r.placement && this.defineClassElement(e, r); + }, this); + }, this); + }, + initializeClassElements: function initializeClassElements(e, r) { + var t = e.prototype; + ["method", "field"].forEach(function (i) { + r.forEach(function (r) { + var o = r.placement; + if (r.kind === i && ("static" === o || "prototype" === o)) { + var n = "static" === o ? e : t; + this.defineClassElement(n, r); + } + }, this); + }, this); + }, + defineClassElement: function defineClassElement(e, r) { + var t = r.descriptor; + if ("field" === r.kind) { + var i = r.initializer; + t = { + enumerable: t.enumerable, + writable: t.writable, + configurable: t.configurable, + value: void 0 === i ? void 0 : i.call(e) + }; + } + Object.defineProperty(e, r.key, t); + }, + decorateClass: function decorateClass(e, r) { + var t = [], + i = [], + o = { + "static": [], + prototype: [], + own: [] + }; + if (e.forEach(function (e) { + this.addElementPlacement(e, o); + }, this), e.forEach(function (e) { + if (!_hasDecorators(e)) return t.push(e); + var r = this.decorateElement(e, o); + t.push(r.element), t.push.apply(t, r.extras), i.push.apply(i, r.finishers); + }, this), !r) return { + elements: t, + finishers: i + }; + var n = this.decorateConstructor(t, r); + return i.push.apply(i, n.finishers), n.finishers = i, n; + }, + addElementPlacement: function addElementPlacement(e, r, t) { + var i = r[e.placement]; + if (!t && -1 !== i.indexOf(e.key)) throw new TypeError("Duplicated element (" + e.key + ")"); + i.push(e.key); + }, + decorateElement: function decorateElement(e, r) { + for (var t = [], i = [], o = e.decorators, n = o.length - 1; n >= 0; n--) { + var s = r[e.placement]; + s.splice(s.indexOf(e.key), 1); + var a = this.fromElementDescriptor(e), + l = this.toElementFinisherExtras((0, o[n])(a) || a); + e = l.element, this.addElementPlacement(e, r), l.finisher && i.push(l.finisher); + var c = l.extras; + if (c) { + for (var p = 0; p < c.length; p++) this.addElementPlacement(c[p], r); + t.push.apply(t, c); + } + } + return { + element: e, + finishers: i, + extras: t + }; + }, + decorateConstructor: function decorateConstructor(e, r) { + for (var t = [], i = r.length - 1; i >= 0; i--) { + var o = this.fromClassDescriptor(e), + n = this.toClassDescriptor((0, r[i])(o) || o); + if (void 0 !== n.finisher && t.push(n.finisher), void 0 !== n.elements) { + e = n.elements; + for (var s = 0; s < e.length - 1; s++) for (var a = s + 1; a < e.length; a++) if (e[s].key === e[a].key && e[s].placement === e[a].placement) throw new TypeError("Duplicated element (" + e[s].key + ")"); + } + } + return { + elements: e, + finishers: t + }; + }, + fromElementDescriptor: function fromElementDescriptor(e) { + var r = { + kind: e.kind, + key: e.key, + placement: e.placement, + descriptor: e.descriptor + }; + return Object.defineProperty(r, Symbol.toStringTag, { + value: "Descriptor", + configurable: !0 + }), "field" === e.kind && (r.initializer = e.initializer), r; + }, + toElementDescriptors: function toElementDescriptors(e) { + if (void 0 !== e) return toArray(e).map(function (e) { + var r = this.toElementDescriptor(e); + return this.disallowProperty(e, "finisher", "An element descriptor"), this.disallowProperty(e, "extras", "An element descriptor"), r; + }, this); + }, + toElementDescriptor: function toElementDescriptor(e) { + var r = e.kind + ""; + if ("method" !== r && "field" !== r) throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "' + r + '"'); + var t = toPropertyKey(e.key), + i = e.placement + ""; + if ("static" !== i && "prototype" !== i && "own" !== i) throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "' + i + '"'); + var o = e.descriptor; + this.disallowProperty(e, "elements", "An element descriptor"); + var n = { + kind: r, + key: t, + placement: i, + descriptor: Object.assign({}, o) + }; + return "field" !== r ? this.disallowProperty(e, "initializer", "A method descriptor") : (this.disallowProperty(o, "get", "The property descriptor of a field descriptor"), this.disallowProperty(o, "set", "The property descriptor of a field descriptor"), this.disallowProperty(o, "value", "The property descriptor of a field descriptor"), n.initializer = e.initializer), n; + }, + toElementFinisherExtras: function toElementFinisherExtras(e) { + return { + element: this.toElementDescriptor(e), + finisher: _optionalCallableProperty(e, "finisher"), + extras: this.toElementDescriptors(e.extras) + }; + }, + fromClassDescriptor: function fromClassDescriptor(e) { + var r = { + kind: "class", + elements: e.map(this.fromElementDescriptor, this) + }; + return Object.defineProperty(r, Symbol.toStringTag, { + value: "Descriptor", + configurable: !0 + }), r; + }, + toClassDescriptor: function toClassDescriptor(e) { + var r = e.kind + ""; + if ("class" !== r) throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "' + r + '"'); + this.disallowProperty(e, "key", "A class descriptor"), this.disallowProperty(e, "placement", "A class descriptor"), this.disallowProperty(e, "descriptor", "A class descriptor"), this.disallowProperty(e, "initializer", "A class descriptor"), this.disallowProperty(e, "extras", "A class descriptor"); + var t = _optionalCallableProperty(e, "finisher"); + return { + elements: this.toElementDescriptors(e.elements), + finisher: t + }; + }, + runClassFinishers: function runClassFinishers(e, r) { + for (var t = 0; t < r.length; t++) { + var i = (0, r[t])(e); + if (void 0 !== i) { + if ("function" != typeof i) throw new TypeError("Finishers must return a constructor."); + e = i; + } + } + return e; + }, + disallowProperty: function disallowProperty(e, r, t) { + if (void 0 !== e[r]) throw new TypeError(t + " can't have a ." + r + " property."); + } + }; + return e; +} +function _createElementDescriptor(e) { + var r, + t = toPropertyKey(e.key); + "method" === e.kind ? r = { + value: e.value, + writable: !0, + configurable: !0, + enumerable: !1 + } : "get" === e.kind ? r = { + get: e.value, + configurable: !0, + enumerable: !1 + } : "set" === e.kind ? r = { + set: e.value, + configurable: !0, + enumerable: !1 + } : "field" === e.kind && (r = { + configurable: !0, + writable: !0, + enumerable: !0 + }); + var i = { + kind: "field" === e.kind ? "field" : "method", + key: t, + placement: e["static"] ? "static" : "field" === e.kind ? "own" : "prototype", + descriptor: r + }; + return e.decorators && (i.decorators = e.decorators), "field" === e.kind && (i.initializer = e.value), i; +} +function _coalesceGetterSetter(e, r) { + void 0 !== e.descriptor.get ? r.descriptor.get = e.descriptor.get : r.descriptor.set = e.descriptor.set; +} +function _coalesceClassElements(e) { + for (var r = [], isSameElement = function isSameElement(e) { + return "method" === e.kind && e.key === o.key && e.placement === o.placement; + }, t = 0; t < e.length; t++) { + var i, + o = e[t]; + if ("method" === o.kind && (i = r.find(isSameElement))) { + if (_isDataDescriptor(o.descriptor) || _isDataDescriptor(i.descriptor)) { + if (_hasDecorators(o) || _hasDecorators(i)) throw new ReferenceError("Duplicated methods (" + o.key + ") can't be decorated."); + i.descriptor = o.descriptor; + } else { + if (_hasDecorators(o)) { + if (_hasDecorators(i)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + o.key + ")."); + i.decorators = o.decorators; + } + _coalesceGetterSetter(o, i); + } + } else r.push(o); + } + return r; +} +function _hasDecorators(e) { + return e.decorators && e.decorators.length; +} +function _isDataDescriptor(e) { + return void 0 !== e && !(void 0 === e.value && void 0 === e.writable); +} +function _optionalCallableProperty(e, r) { + var t = e[r]; + if (void 0 !== t && "function" != typeof t) throw new TypeError("Expected '" + r + "' to be a function"); + return t; +} +export { _decorate as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defaults.js b/node_modules/@babel/runtime/helpers/esm/defaults.js new file mode 100644 index 00000000..d3041a3d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/defaults.js @@ -0,0 +1,9 @@ +function _defaults(e, r) { + for (var t = Object.getOwnPropertyNames(r), o = 0; o < t.length; o++) { + var n = t[o], + a = Object.getOwnPropertyDescriptor(r, n); + a && a.configurable && void 0 === e[n] && Object.defineProperty(e, n, a); + } + return e; +} +export { _defaults as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defineAccessor.js b/node_modules/@babel/runtime/helpers/esm/defineAccessor.js new file mode 100644 index 00000000..a8292dea --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/defineAccessor.js @@ -0,0 +1,8 @@ +function _defineAccessor(e, r, n, t) { + var c = { + configurable: !0, + enumerable: !0 + }; + return c[e] = t, Object.defineProperty(r, n, c); +} +export { _defineAccessor as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js b/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js new file mode 100644 index 00000000..3d31d980 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js @@ -0,0 +1,12 @@ +function _defineEnumerableProperties(e, r) { + for (var t in r) { + var n = r[t]; + n.configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, t, n); + } + if (Object.getOwnPropertySymbols) for (var a = Object.getOwnPropertySymbols(r), b = 0; b < a.length; b++) { + var i = a[b]; + (n = r[i]).configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, i, n); + } + return e; +} +export { _defineEnumerableProperties as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/defineProperty.js b/node_modules/@babel/runtime/helpers/esm/defineProperty.js new file mode 100644 index 00000000..05ec32b7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/defineProperty.js @@ -0,0 +1,10 @@ +import toPropertyKey from "./toPropertyKey.js"; +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} +export { _defineProperty as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/dispose.js b/node_modules/@babel/runtime/helpers/esm/dispose.js new file mode 100644 index 00000000..a87ab202 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/dispose.js @@ -0,0 +1,28 @@ +function dispose_SuppressedError(r, e) { + return "undefined" != typeof SuppressedError ? dispose_SuppressedError = SuppressedError : (dispose_SuppressedError = function dispose_SuppressedError(r, e) { + this.suppressed = e, this.error = r, this.stack = Error().stack; + }, dispose_SuppressedError.prototype = Object.create(Error.prototype, { + constructor: { + value: dispose_SuppressedError, + writable: !0, + configurable: !0 + } + })), new dispose_SuppressedError(r, e); +} +function _dispose(r, e, s) { + function next() { + for (; r.length > 0;) try { + var o = r.pop(), + p = o.d.call(o.v); + if (o.a) return Promise.resolve(p).then(next, err); + } catch (r) { + return err(r); + } + if (s) throw e; + } + function err(r) { + return e = s ? new dispose_SuppressedError(e, r) : r, s = !0, next(); + } + return next(); +} +export { _dispose as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/extends.js b/node_modules/@babel/runtime/helpers/esm/extends.js new file mode 100644 index 00000000..53f118ca --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/extends.js @@ -0,0 +1,10 @@ +function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, _extends.apply(null, arguments); +} +export { _extends as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/get.js b/node_modules/@babel/runtime/helpers/esm/get.js new file mode 100644 index 00000000..8124bc02 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/get.js @@ -0,0 +1,11 @@ +import superPropBase from "./superPropBase.js"; +function _get() { + return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { + var p = superPropBase(e, t); + if (p) { + var n = Object.getOwnPropertyDescriptor(p, t); + return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; + } + }, _get.apply(null, arguments); +} +export { _get as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js b/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js new file mode 100644 index 00000000..9073c456 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js @@ -0,0 +1,6 @@ +function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); +} +export { _getPrototypeOf as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/identity.js b/node_modules/@babel/runtime/helpers/esm/identity.js new file mode 100644 index 00000000..6b564ac5 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/identity.js @@ -0,0 +1,4 @@ +function _identity(t) { + return t; +} +export { _identity as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/importDeferProxy.js b/node_modules/@babel/runtime/helpers/esm/importDeferProxy.js new file mode 100644 index 00000000..6d35b526 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/importDeferProxy.js @@ -0,0 +1,27 @@ +function _importDeferProxy(e) { + var t = null, + constValue = function constValue(e) { + return function () { + return e; + }; + }, + proxy = function proxy(r) { + return function (n, o, f) { + return null === t && (t = e()), r(t, o, f); + }; + }; + return new Proxy({}, { + defineProperty: constValue(!1), + deleteProperty: constValue(!1), + get: proxy(Reflect.get), + getOwnPropertyDescriptor: proxy(Reflect.getOwnPropertyDescriptor), + getPrototypeOf: constValue(null), + isExtensible: constValue(!1), + has: proxy(Reflect.has), + ownKeys: proxy(Reflect.ownKeys), + preventExtensions: constValue(!0), + set: constValue(!1), + setPrototypeOf: constValue(!1) + }); +} +export { _importDeferProxy as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/inherits.js b/node_modules/@babel/runtime/helpers/esm/inherits.js new file mode 100644 index 00000000..78f6e4e3 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/inherits.js @@ -0,0 +1,14 @@ +import setPrototypeOf from "./setPrototypeOf.js"; +function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && setPrototypeOf(t, e); +} +export { _inherits as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js b/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js new file mode 100644 index 00000000..0bd13306 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js @@ -0,0 +1,5 @@ +import setPrototypeOf from "./setPrototypeOf.js"; +function _inheritsLoose(t, o) { + t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o); +} +export { _inheritsLoose as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js b/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js new file mode 100644 index 00000000..68bcc2cd --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js @@ -0,0 +1,9 @@ +function _initializerDefineProperty(e, i, r, l) { + r && Object.defineProperty(e, i, { + enumerable: r.enumerable, + configurable: r.configurable, + writable: r.writable, + value: r.initializer ? r.initializer.call(l) : void 0 + }); +} +export { _initializerDefineProperty as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js b/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js new file mode 100644 index 00000000..0a658e39 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js @@ -0,0 +1,4 @@ +function _initializerWarningHelper(r, e) { + throw Error("Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform."); +} +export { _initializerWarningHelper as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/instanceof.js b/node_modules/@babel/runtime/helpers/esm/instanceof.js new file mode 100644 index 00000000..316539ee --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/instanceof.js @@ -0,0 +1,4 @@ +function _instanceof(n, e) { + return null != e && "undefined" != typeof Symbol && e[Symbol.hasInstance] ? !!e[Symbol.hasInstance](n) : n instanceof e; +} +export { _instanceof as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js b/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js new file mode 100644 index 00000000..365d2481 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js @@ -0,0 +1,6 @@ +function _interopRequireDefault(e) { + return e && e.__esModule ? e : { + "default": e + }; +} +export { _interopRequireDefault as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js b/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js new file mode 100644 index 00000000..e190f1e2 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js @@ -0,0 +1,27 @@ +import _typeof from "./typeof.js"; +function _getRequireWildcardCache(e) { + if ("function" != typeof WeakMap) return null; + var r = new WeakMap(), + t = new WeakMap(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { + return e ? t : r; + })(e); +} +function _interopRequireWildcard(e, r) { + if (!r && e && e.__esModule) return e; + if (null === e || "object" != _typeof(e) && "function" != typeof e) return { + "default": e + }; + var t = _getRequireWildcardCache(r); + if (t && t.has(e)) return t.get(e); + var n = { + __proto__: null + }, + a = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { + var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; + i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; + } + return n["default"] = e, t && t.set(e, n), n; +} +export { _interopRequireWildcard as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js b/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js new file mode 100644 index 00000000..0cfe276f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js @@ -0,0 +1,8 @@ +function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } +} +export { _isNativeFunction as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js b/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js new file mode 100644 index 00000000..0eb5e395 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js @@ -0,0 +1,9 @@ +function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { + return !!t; + })(); +} +export { _isNativeReflectConstruct as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/iterableToArray.js b/node_modules/@babel/runtime/helpers/esm/iterableToArray.js new file mode 100644 index 00000000..b7de3396 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/iterableToArray.js @@ -0,0 +1,4 @@ +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +export { _iterableToArray as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js b/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js new file mode 100644 index 00000000..473f0678 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js @@ -0,0 +1,28 @@ +function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} +export { _iterableToArrayLimit as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js b/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js new file mode 100644 index 00000000..2afdb5ce --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js @@ -0,0 +1,10 @@ +function _iterableToArrayLimitLoose(e, r) { + var t = e && ("undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]); + if (null != t) { + var o, + l = []; + for (t = t.call(e); e.length < r && !(o = t.next()).done;) l.push(o.value); + return l; + } +} +export { _iterableToArrayLimitLoose as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/jsx.js b/node_modules/@babel/runtime/helpers/esm/jsx.js new file mode 100644 index 00000000..a120e5b6 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/jsx.js @@ -0,0 +1,22 @@ +var REACT_ELEMENT_TYPE; +function _createRawReactElement(e, r, E, l) { + REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103); + var o = e && e.defaultProps, + n = arguments.length - 3; + if (r || 0 === n || (r = { + children: void 0 + }), 1 === n) r.children = l;else if (n > 1) { + for (var t = Array(n), f = 0; f < n; f++) t[f] = arguments[f + 3]; + r.children = t; + } + if (r && o) for (var i in o) void 0 === r[i] && (r[i] = o[i]);else r || (r = o || {}); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: e, + key: void 0 === E ? null : "" + E, + ref: null, + props: r, + _owner: null + }; +} +export { _createRawReactElement as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js b/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js new file mode 100644 index 00000000..527c682b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js @@ -0,0 +1,9 @@ +import arrayLikeToArray from "./arrayLikeToArray.js"; +function _maybeArrayLike(r, a, e) { + if (a && !Array.isArray(a) && "number" == typeof a.length) { + var y = a.length; + return arrayLikeToArray(a, void 0 !== e && e < y ? e : y); + } + return r(a, e); +} +export { _maybeArrayLike as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js b/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js new file mode 100644 index 00000000..5f70e0d7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js @@ -0,0 +1,4 @@ +function _newArrowCheck(n, r) { + if (n !== r) throw new TypeError("Cannot instantiate an arrow function"); +} +export { _newArrowCheck as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js b/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js new file mode 100644 index 00000000..9050250b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js @@ -0,0 +1,4 @@ +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +export { _nonIterableRest as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js b/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js new file mode 100644 index 00000000..fb03235a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js @@ -0,0 +1,4 @@ +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +export { _nonIterableSpread as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/nullishReceiverError.js b/node_modules/@babel/runtime/helpers/esm/nullishReceiverError.js new file mode 100644 index 00000000..d8c30604 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/nullishReceiverError.js @@ -0,0 +1,4 @@ +function _nullishReceiverError(r) { + throw new TypeError("Cannot set property of null or undefined."); +} +export { _nullishReceiverError as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js b/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js new file mode 100644 index 00000000..a92eac8f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js @@ -0,0 +1,4 @@ +function _objectDestructuringEmpty(t) { + if (null == t) throw new TypeError("Cannot destructure " + t); +} +export { _objectDestructuringEmpty as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectSpread.js b/node_modules/@babel/runtime/helpers/esm/objectSpread.js new file mode 100644 index 00000000..0f82f069 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/objectSpread.js @@ -0,0 +1,14 @@ +import defineProperty from "./defineProperty.js"; +function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? Object(arguments[r]) : {}, + o = Object.keys(t); + "function" == typeof Object.getOwnPropertySymbols && o.push.apply(o, Object.getOwnPropertySymbols(t).filter(function (e) { + return Object.getOwnPropertyDescriptor(t, e).enumerable; + })), o.forEach(function (r) { + defineProperty(e, r, t[r]); + }); + } + return e; +} +export { _objectSpread as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectSpread2.js b/node_modules/@babel/runtime/helpers/esm/objectSpread2.js new file mode 100644 index 00000000..0035bc76 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/objectSpread2.js @@ -0,0 +1,23 @@ +import defineProperty from "./defineProperty.js"; +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +export { _objectSpread2 as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js b/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js new file mode 100644 index 00000000..8e8e4753 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js @@ -0,0 +1,13 @@ +import objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js"; +function _objectWithoutProperties(e, t) { + if (null == e) return {}; + var o, + r, + i = objectWithoutPropertiesLoose(e, t); + if (Object.getOwnPropertySymbols) { + var n = Object.getOwnPropertySymbols(e); + for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); + } + return i; +} +export { _objectWithoutProperties as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js b/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js new file mode 100644 index 00000000..09a8ef69 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js @@ -0,0 +1,10 @@ +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for (var n in r) if ({}.hasOwnProperty.call(r, n)) { + if (e.indexOf(n) >= 0) continue; + t[n] = r[n]; + } + return t; +} +export { _objectWithoutPropertiesLoose as default }; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/package.json b/node_modules/@babel/runtime/helpers/esm/package.json similarity index 100% rename from project starter code/node_modules/@babel/runtime/helpers/esm/package.json rename to node_modules/@babel/runtime/helpers/esm/package.json diff --git a/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js b/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js new file mode 100644 index 00000000..d84e1e6f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js @@ -0,0 +1,8 @@ +import _typeof from "./typeof.js"; +import assertThisInitialized from "./assertThisInitialized.js"; +function _possibleConstructorReturn(t, e) { + if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return assertThisInitialized(t); +} +export { _possibleConstructorReturn as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/readOnlyError.js b/node_modules/@babel/runtime/helpers/esm/readOnlyError.js new file mode 100644 index 00000000..fcc3e339 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/readOnlyError.js @@ -0,0 +1,4 @@ +function _readOnlyError(r) { + throw new TypeError('"' + r + '" is read-only'); +} +export { _readOnlyError as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js b/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js new file mode 100644 index 00000000..19c78cde --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js @@ -0,0 +1,304 @@ +import _typeof from "./typeof.js"; +function _regeneratorRuntime() { + "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + _regeneratorRuntime = function _regeneratorRuntime() { + return e; + }; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = Object.defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof Symbol ? Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function define(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = Object.create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = Object.getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + ["next", "throw", "return"].forEach(function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function value(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) r.push(n); + return r.reverse(), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function stop() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function dispatchException(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function complete(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function finish(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + "catch": function _catch(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; +} +export { _regeneratorRuntime as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/set.js b/node_modules/@babel/runtime/helpers/esm/set.js new file mode 100644 index 00000000..ed0a8039 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/set.js @@ -0,0 +1,22 @@ +import superPropBase from "./superPropBase.js"; +import defineProperty from "./defineProperty.js"; +function set(e, r, t, o) { + return set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, o) { + var f, + i = superPropBase(e, r); + if (i) { + if ((f = Object.getOwnPropertyDescriptor(i, r)).set) return f.set.call(o, t), !0; + if (!f.writable) return !1; + } + if (f = Object.getOwnPropertyDescriptor(o, r)) { + if (!f.writable) return !1; + f.value = t, Object.defineProperty(o, r, f); + } else defineProperty(o, r, t); + return !0; + }, set(e, r, t, o); +} +function _set(e, r, t, o, f) { + if (!set(e, r, t, o || e) && f) throw new TypeError("failed to set property"); + return t; +} +export { _set as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/setFunctionName.js b/node_modules/@babel/runtime/helpers/esm/setFunctionName.js new file mode 100644 index 00000000..82213cea --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/setFunctionName.js @@ -0,0 +1,12 @@ +import _typeof from "./typeof.js"; +function setFunctionName(e, t, n) { + "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); + try { + Object.defineProperty(e, "name", { + configurable: !0, + value: n ? n + " " + t : t + }); + } catch (e) {} + return e; +} +export { setFunctionName as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js b/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js new file mode 100644 index 00000000..c30983c9 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js @@ -0,0 +1,6 @@ +function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); +} +export { _setPrototypeOf as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js b/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js new file mode 100644 index 00000000..41d5738c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js @@ -0,0 +1,7 @@ +function _skipFirstGeneratorNext(t) { + return function () { + var r = t.apply(this, arguments); + return r.next(), r; + }; +} +export { _skipFirstGeneratorNext as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/slicedToArray.js b/node_modules/@babel/runtime/helpers/esm/slicedToArray.js new file mode 100644 index 00000000..c044c2a6 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/slicedToArray.js @@ -0,0 +1,8 @@ +import arrayWithHoles from "./arrayWithHoles.js"; +import iterableToArrayLimit from "./iterableToArrayLimit.js"; +import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; +import nonIterableRest from "./nonIterableRest.js"; +function _slicedToArray(r, e) { + return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest(); +} +export { _slicedToArray as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js b/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js new file mode 100644 index 00000000..3ab0d3fe --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js @@ -0,0 +1,8 @@ +import arrayWithHoles from "./arrayWithHoles.js"; +import iterableToArrayLimitLoose from "./iterableToArrayLimitLoose.js"; +import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; +import nonIterableRest from "./nonIterableRest.js"; +function _slicedToArrayLoose(r, e) { + return arrayWithHoles(r) || iterableToArrayLimitLoose(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest(); +} +export { _slicedToArrayLoose as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/superPropBase.js b/node_modules/@babel/runtime/helpers/esm/superPropBase.js new file mode 100644 index 00000000..a5fa3861 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/superPropBase.js @@ -0,0 +1,6 @@ +import getPrototypeOf from "./getPrototypeOf.js"; +function _superPropBase(t, o) { + for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t));); + return t; +} +export { _superPropBase as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js b/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js new file mode 100644 index 00000000..3d842cda --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js @@ -0,0 +1,8 @@ +function _taggedTemplateLiteral(e, t) { + return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { + raw: { + value: Object.freeze(t) + } + })); +} +export { _taggedTemplateLiteral as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js b/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js new file mode 100644 index 00000000..741aeb85 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js @@ -0,0 +1,4 @@ +function _taggedTemplateLiteralLoose(e, t) { + return t || (t = e.slice(0)), e.raw = t, e; +} +export { _taggedTemplateLiteralLoose as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/tdz.js b/node_modules/@babel/runtime/helpers/esm/tdz.js new file mode 100644 index 00000000..58df493f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/tdz.js @@ -0,0 +1,4 @@ +function _tdzError(e) { + throw new ReferenceError(e + " is not defined - temporal dead zone"); +} +export { _tdzError as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/temporalRef.js b/node_modules/@babel/runtime/helpers/esm/temporalRef.js new file mode 100644 index 00000000..8dbf014d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/temporalRef.js @@ -0,0 +1,6 @@ +import temporalUndefined from "./temporalUndefined.js"; +import tdz from "./tdz.js"; +function _temporalRef(r, e) { + return r === temporalUndefined ? tdz(e) : r; +} +export { _temporalRef as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js b/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js new file mode 100644 index 00000000..2ec0b0da --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js @@ -0,0 +1,2 @@ +function _temporalUndefined() {} +export { _temporalUndefined as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toArray.js b/node_modules/@babel/runtime/helpers/esm/toArray.js new file mode 100644 index 00000000..e5f0f52a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/toArray.js @@ -0,0 +1,8 @@ +import arrayWithHoles from "./arrayWithHoles.js"; +import iterableToArray from "./iterableToArray.js"; +import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; +import nonIterableRest from "./nonIterableRest.js"; +function _toArray(r) { + return arrayWithHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableRest(); +} +export { _toArray as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js b/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js new file mode 100644 index 00000000..f7338e4d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js @@ -0,0 +1,8 @@ +import arrayWithoutHoles from "./arrayWithoutHoles.js"; +import iterableToArray from "./iterableToArray.js"; +import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; +import nonIterableSpread from "./nonIterableSpread.js"; +function _toConsumableArray(r) { + return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread(); +} +export { _toConsumableArray as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toPrimitive.js b/node_modules/@babel/runtime/helpers/esm/toPrimitive.js new file mode 100644 index 00000000..9a3de46b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/toPrimitive.js @@ -0,0 +1,12 @@ +import _typeof from "./typeof.js"; +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +export { toPrimitive as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js b/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js new file mode 100644 index 00000000..b3274d87 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js @@ -0,0 +1,7 @@ +import _typeof from "./typeof.js"; +import toPrimitive from "./toPrimitive.js"; +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +export { toPropertyKey as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/toSetter.js b/node_modules/@babel/runtime/helpers/esm/toSetter.js new file mode 100644 index 00000000..b1dbf7ae --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/toSetter.js @@ -0,0 +1,10 @@ +function _toSetter(t, e, n) { + e || (e = []); + var r = e.length++; + return Object.defineProperty({}, "_", { + set: function set(o) { + e[r] = o, t.apply(n, e); + } + }); +} +export { _toSetter as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/typeof.js b/node_modules/@babel/runtime/helpers/esm/typeof.js new file mode 100644 index 00000000..5b0bc9b0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/typeof.js @@ -0,0 +1,10 @@ +function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); +} +export { _typeof as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js b/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js new file mode 100644 index 00000000..33adc493 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js @@ -0,0 +1,9 @@ +import arrayLikeToArray from "./arrayLikeToArray.js"; +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0; + } +} +export { _unsupportedIterableToArray as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/using.js b/node_modules/@babel/runtime/helpers/esm/using.js new file mode 100644 index 00000000..9bda17b5 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/using.js @@ -0,0 +1,12 @@ +function _using(o, n, e) { + if (null == n) return n; + if (Object(n) !== n) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + if (e) var r = n[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")]; + if (null == r && (r = n[Symbol.dispose || Symbol["for"]("Symbol.dispose")]), "function" != typeof r) throw new TypeError("Property [Symbol.dispose] is not a function."); + return o.push({ + v: n, + d: r, + a: e + }), n; +} +export { _using as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/usingCtx.js b/node_modules/@babel/runtime/helpers/esm/usingCtx.js new file mode 100644 index 00000000..b180e3a8 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/usingCtx.js @@ -0,0 +1,47 @@ +function _usingCtx() { + var r = "function" == typeof SuppressedError ? SuppressedError : function (r, n) { + var e = Error(); + return e.name = "SuppressedError", e.error = r, e.suppressed = n, e; + }, + n = {}, + e = []; + function using(r, n) { + if (null != n) { + if (Object(n) !== n) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + if (r) var o = n[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")]; + if (null == o && (o = n[Symbol.dispose || Symbol["for"]("Symbol.dispose")]), "function" != typeof o) throw new TypeError("Property [Symbol.dispose] is not a function."); + e.push({ + v: n, + d: o, + a: r + }); + } else r && e.push({ + d: n, + a: r + }); + return n; + } + return { + e: n, + u: using.bind(null, !1), + a: using.bind(null, !0), + d: function d() { + var o = this.e; + function next() { + for (; r = e.pop();) try { + var r, + t = r.d && r.d.call(r.v); + if (r.a) return Promise.resolve(t).then(next, err); + } catch (r) { + return err(r); + } + if (o !== n) throw o; + } + function err(e) { + return o = o !== n ? new r(e, o) : e, next(); + } + return next(); + } + }; +} +export { _usingCtx as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js b/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js new file mode 100644 index 00000000..3fe052cb --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js @@ -0,0 +1,7 @@ +import AsyncGenerator from "./AsyncGenerator.js"; +function _wrapAsyncGenerator(r) { + return function () { + return new AsyncGenerator(r.apply(this, arguments)); + }; +} +export { _wrapAsyncGenerator as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js b/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js new file mode 100644 index 00000000..15bf78f5 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js @@ -0,0 +1,27 @@ +import getPrototypeOf from "./getPrototypeOf.js"; +import setPrototypeOf from "./setPrototypeOf.js"; +import isNativeFunction from "./isNativeFunction.js"; +import construct from "./construct.js"; +function _wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return _wrapNativeSuper = function _wrapNativeSuper(t) { + if (null === t || !isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return construct(t, arguments, getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), setPrototypeOf(Wrapper, t); + }, _wrapNativeSuper(t); +} +export { _wrapNativeSuper as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js b/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js new file mode 100644 index 00000000..ecf821e7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js @@ -0,0 +1,51 @@ +import _typeof from "./typeof.js"; +import setPrototypeOf from "./setPrototypeOf.js"; +import inherits from "./inherits.js"; +function _wrapRegExp() { + _wrapRegExp = function _wrapRegExp(e, r) { + return new BabelRegExp(e, void 0, r); + }; + var e = RegExp.prototype, + r = new WeakMap(); + function BabelRegExp(e, t, p) { + var o = RegExp(e, t); + return r.set(o, p || r.get(e)), setPrototypeOf(o, BabelRegExp.prototype); + } + function buildGroups(e, t) { + var p = r.get(t); + return Object.keys(p).reduce(function (r, t) { + var o = p[t]; + if ("number" == typeof o) r[t] = e[o];else { + for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; + r[t] = e[o[i]]; + } + return r; + }, Object.create(null)); + } + return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { + var t = e.exec.call(this, r); + if (t) { + t.groups = buildGroups(t, this); + var p = t.indices; + p && (p.groups = buildGroups(p, this)); + } + return t; + }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { + if ("string" == typeof p) { + var o = r.get(this); + return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { + var t = o[r]; + return "$" + (Array.isArray(t) ? t.join("$") : t); + })); + } + if ("function" == typeof p) { + var i = this; + return e[Symbol.replace].call(this, t, function () { + var e = arguments; + return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); + }); + } + return e[Symbol.replace].call(this, t, p); + }, _wrapRegExp.apply(this, arguments); +} +export { _wrapRegExp as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js b/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js new file mode 100644 index 00000000..250c2869 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js @@ -0,0 +1,4 @@ +function _writeOnlyError(r) { + throw new TypeError('"' + r + '" is write-only'); +} +export { _writeOnlyError as default }; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/extends.js b/node_modules/@babel/runtime/helpers/extends.js new file mode 100644 index 00000000..9c0885c5 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/extends.js @@ -0,0 +1,10 @@ +function _extends() { + return (module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _extends.apply(null, arguments); +} +module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/get.js b/node_modules/@babel/runtime/helpers/get.js new file mode 100644 index 00000000..662eba3a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/get.js @@ -0,0 +1,11 @@ +var superPropBase = require("./superPropBase.js"); +function _get() { + return (module.exports = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { + var p = superPropBase(e, t); + if (p) { + var n = Object.getOwnPropertyDescriptor(p, t); + return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; + } + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _get.apply(null, arguments); +} +module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/getPrototypeOf.js b/node_modules/@babel/runtime/helpers/getPrototypeOf.js new file mode 100644 index 00000000..aa09634b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/getPrototypeOf.js @@ -0,0 +1,6 @@ +function _getPrototypeOf(t) { + return (module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _getPrototypeOf(t); +} +module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/identity.js b/node_modules/@babel/runtime/helpers/identity.js new file mode 100644 index 00000000..54de5b5b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/identity.js @@ -0,0 +1,4 @@ +function _identity(t) { + return t; +} +module.exports = _identity, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/importDeferProxy.js b/node_modules/@babel/runtime/helpers/importDeferProxy.js new file mode 100644 index 00000000..cffaae65 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/importDeferProxy.js @@ -0,0 +1,27 @@ +function _importDeferProxy(e) { + var t = null, + constValue = function constValue(e) { + return function () { + return e; + }; + }, + proxy = function proxy(r) { + return function (n, o, f) { + return null === t && (t = e()), r(t, o, f); + }; + }; + return new Proxy({}, { + defineProperty: constValue(!1), + deleteProperty: constValue(!1), + get: proxy(Reflect.get), + getOwnPropertyDescriptor: proxy(Reflect.getOwnPropertyDescriptor), + getPrototypeOf: constValue(null), + isExtensible: constValue(!1), + has: proxy(Reflect.has), + ownKeys: proxy(Reflect.ownKeys), + preventExtensions: constValue(!0), + set: constValue(!1), + setPrototypeOf: constValue(!1) + }); +} +module.exports = _importDeferProxy, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/inherits.js b/node_modules/@babel/runtime/helpers/inherits.js new file mode 100644 index 00000000..715a78ef --- /dev/null +++ b/node_modules/@babel/runtime/helpers/inherits.js @@ -0,0 +1,14 @@ +var setPrototypeOf = require("./setPrototypeOf.js"); +function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && setPrototypeOf(t, e); +} +module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/inheritsLoose.js b/node_modules/@babel/runtime/helpers/inheritsLoose.js new file mode 100644 index 00000000..a27baf01 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/inheritsLoose.js @@ -0,0 +1,5 @@ +var setPrototypeOf = require("./setPrototypeOf.js"); +function _inheritsLoose(t, o) { + t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o); +} +module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/initializerDefineProperty.js b/node_modules/@babel/runtime/helpers/initializerDefineProperty.js new file mode 100644 index 00000000..f9fa3173 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/initializerDefineProperty.js @@ -0,0 +1,9 @@ +function _initializerDefineProperty(e, i, r, l) { + r && Object.defineProperty(e, i, { + enumerable: r.enumerable, + configurable: r.configurable, + writable: r.writable, + value: r.initializer ? r.initializer.call(l) : void 0 + }); +} +module.exports = _initializerDefineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/initializerWarningHelper.js b/node_modules/@babel/runtime/helpers/initializerWarningHelper.js new file mode 100644 index 00000000..e14ce59a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/initializerWarningHelper.js @@ -0,0 +1,4 @@ +function _initializerWarningHelper(r, e) { + throw Error("Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform."); +} +module.exports = _initializerWarningHelper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/instanceof.js b/node_modules/@babel/runtime/helpers/instanceof.js new file mode 100644 index 00000000..9952301d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/instanceof.js @@ -0,0 +1,4 @@ +function _instanceof(n, e) { + return null != e && "undefined" != typeof Symbol && e[Symbol.hasInstance] ? !!e[Symbol.hasInstance](n) : n instanceof e; +} +module.exports = _instanceof, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/interopRequireDefault.js b/node_modules/@babel/runtime/helpers/interopRequireDefault.js new file mode 100644 index 00000000..69447158 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/interopRequireDefault.js @@ -0,0 +1,6 @@ +function _interopRequireDefault(e) { + return e && e.__esModule ? e : { + "default": e + }; +} +module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/interopRequireWildcard.js b/node_modules/@babel/runtime/helpers/interopRequireWildcard.js new file mode 100644 index 00000000..41411cc3 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/interopRequireWildcard.js @@ -0,0 +1,27 @@ +var _typeof = require("./typeof.js")["default"]; +function _getRequireWildcardCache(e) { + if ("function" != typeof WeakMap) return null; + var r = new WeakMap(), + t = new WeakMap(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { + return e ? t : r; + })(e); +} +function _interopRequireWildcard(e, r) { + if (!r && e && e.__esModule) return e; + if (null === e || "object" != _typeof(e) && "function" != typeof e) return { + "default": e + }; + var t = _getRequireWildcardCache(r); + if (t && t.has(e)) return t.get(e); + var n = { + __proto__: null + }, + a = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { + var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; + i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; + } + return n["default"] = e, t && t.set(e, n), n; +} +module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/isNativeFunction.js b/node_modules/@babel/runtime/helpers/isNativeFunction.js new file mode 100644 index 00000000..f0eb49e3 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/isNativeFunction.js @@ -0,0 +1,8 @@ +function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } +} +module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js b/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js new file mode 100644 index 00000000..b677e107 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js @@ -0,0 +1,9 @@ +function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (module.exports = _isNativeReflectConstruct = function _isNativeReflectConstruct() { + return !!t; + }, module.exports.__esModule = true, module.exports["default"] = module.exports)(); +} +module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/iterableToArray.js b/node_modules/@babel/runtime/helpers/iterableToArray.js new file mode 100644 index 00000000..c839a321 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/iterableToArray.js @@ -0,0 +1,4 @@ +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js b/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js new file mode 100644 index 00000000..2671778b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js @@ -0,0 +1,28 @@ +function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} +module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js b/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js new file mode 100644 index 00000000..718a5b15 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js @@ -0,0 +1,10 @@ +function _iterableToArrayLimitLoose(e, r) { + var t = e && ("undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]); + if (null != t) { + var o, + l = []; + for (t = t.call(e); e.length < r && !(o = t.next()).done;) l.push(o.value); + return l; + } +} +module.exports = _iterableToArrayLimitLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/jsx.js b/node_modules/@babel/runtime/helpers/jsx.js new file mode 100644 index 00000000..3415eead --- /dev/null +++ b/node_modules/@babel/runtime/helpers/jsx.js @@ -0,0 +1,22 @@ +var REACT_ELEMENT_TYPE; +function _createRawReactElement(e, r, E, l) { + REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103); + var o = e && e.defaultProps, + n = arguments.length - 3; + if (r || 0 === n || (r = { + children: void 0 + }), 1 === n) r.children = l;else if (n > 1) { + for (var t = Array(n), f = 0; f < n; f++) t[f] = arguments[f + 3]; + r.children = t; + } + if (r && o) for (var i in o) void 0 === r[i] && (r[i] = o[i]);else r || (r = o || {}); + return { + $$typeof: REACT_ELEMENT_TYPE, + type: e, + key: void 0 === E ? null : "" + E, + ref: null, + props: r, + _owner: null + }; +} +module.exports = _createRawReactElement, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/maybeArrayLike.js b/node_modules/@babel/runtime/helpers/maybeArrayLike.js new file mode 100644 index 00000000..9873cc76 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/maybeArrayLike.js @@ -0,0 +1,9 @@ +var arrayLikeToArray = require("./arrayLikeToArray.js"); +function _maybeArrayLike(r, a, e) { + if (a && !Array.isArray(a) && "number" == typeof a.length) { + var y = a.length; + return arrayLikeToArray(a, void 0 !== e && e < y ? e : y); + } + return r(a, e); +} +module.exports = _maybeArrayLike, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/newArrowCheck.js b/node_modules/@babel/runtime/helpers/newArrowCheck.js new file mode 100644 index 00000000..8e74d991 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/newArrowCheck.js @@ -0,0 +1,4 @@ +function _newArrowCheck(n, r) { + if (n !== r) throw new TypeError("Cannot instantiate an arrow function"); +} +module.exports = _newArrowCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js b/node_modules/@babel/runtime/helpers/nonIterableRest.js similarity index 100% rename from project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js rename to node_modules/@babel/runtime/helpers/nonIterableRest.js diff --git a/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js b/node_modules/@babel/runtime/helpers/nonIterableSpread.js similarity index 100% rename from project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js rename to node_modules/@babel/runtime/helpers/nonIterableSpread.js diff --git a/node_modules/@babel/runtime/helpers/nullishReceiverError.js b/node_modules/@babel/runtime/helpers/nullishReceiverError.js new file mode 100644 index 00000000..970e0231 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/nullishReceiverError.js @@ -0,0 +1,4 @@ +function _nullishReceiverError(r) { + throw new TypeError("Cannot set property of null or undefined."); +} +module.exports = _nullishReceiverError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js b/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js new file mode 100644 index 00000000..9f62a1b0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js @@ -0,0 +1,4 @@ +function _objectDestructuringEmpty(t) { + if (null == t) throw new TypeError("Cannot destructure " + t); +} +module.exports = _objectDestructuringEmpty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectSpread.js b/node_modules/@babel/runtime/helpers/objectSpread.js new file mode 100644 index 00000000..a3676438 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/objectSpread.js @@ -0,0 +1,14 @@ +var defineProperty = require("./defineProperty.js"); +function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? Object(arguments[r]) : {}, + o = Object.keys(t); + "function" == typeof Object.getOwnPropertySymbols && o.push.apply(o, Object.getOwnPropertySymbols(t).filter(function (e) { + return Object.getOwnPropertyDescriptor(t, e).enumerable; + })), o.forEach(function (r) { + defineProperty(e, r, t[r]); + }); + } + return e; +} +module.exports = _objectSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectSpread2.js b/node_modules/@babel/runtime/helpers/objectSpread2.js new file mode 100644 index 00000000..4f3b9fa0 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/objectSpread2.js @@ -0,0 +1,23 @@ +var defineProperty = require("./defineProperty.js"); +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectWithoutProperties.js b/node_modules/@babel/runtime/helpers/objectWithoutProperties.js new file mode 100644 index 00000000..4330d4bf --- /dev/null +++ b/node_modules/@babel/runtime/helpers/objectWithoutProperties.js @@ -0,0 +1,13 @@ +var objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js"); +function _objectWithoutProperties(e, t) { + if (null == e) return {}; + var o, + r, + i = objectWithoutPropertiesLoose(e, t); + if (Object.getOwnPropertySymbols) { + var n = Object.getOwnPropertySymbols(e); + for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); + } + return i; +} +module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js b/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js new file mode 100644 index 00000000..21ca98cb --- /dev/null +++ b/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js @@ -0,0 +1,10 @@ +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for (var n in r) if ({}.hasOwnProperty.call(r, n)) { + if (e.indexOf(n) >= 0) continue; + t[n] = r[n]; + } + return t; +} +module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js b/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js new file mode 100644 index 00000000..06e6e6d8 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js @@ -0,0 +1,8 @@ +var _typeof = require("./typeof.js")["default"]; +var assertThisInitialized = require("./assertThisInitialized.js"); +function _possibleConstructorReturn(t, e) { + if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return assertThisInitialized(t); +} +module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/readOnlyError.js b/node_modules/@babel/runtime/helpers/readOnlyError.js new file mode 100644 index 00000000..1bf3e092 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/readOnlyError.js @@ -0,0 +1,4 @@ +function _readOnlyError(r) { + throw new TypeError('"' + r + '" is read-only'); +} +module.exports = _readOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/regeneratorRuntime.js b/node_modules/@babel/runtime/helpers/regeneratorRuntime.js new file mode 100644 index 00000000..f33e4945 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/regeneratorRuntime.js @@ -0,0 +1,304 @@ +var _typeof = require("./typeof.js")["default"]; +function _regeneratorRuntime() { + "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + module.exports = _regeneratorRuntime = function _regeneratorRuntime() { + return e; + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = Object.defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof Symbol ? Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function define(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = Object.create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = Object.getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + ["next", "throw", "return"].forEach(function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function value(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) r.push(n); + return r.reverse(), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function stop() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function dispatchException(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function complete(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function finish(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + "catch": function _catch(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; +} +module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/set.js b/node_modules/@babel/runtime/helpers/set.js new file mode 100644 index 00000000..6421470a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/set.js @@ -0,0 +1,22 @@ +var superPropBase = require("./superPropBase.js"); +var defineProperty = require("./defineProperty.js"); +function set(e, r, t, o) { + return set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, o) { + var f, + i = superPropBase(e, r); + if (i) { + if ((f = Object.getOwnPropertyDescriptor(i, r)).set) return f.set.call(o, t), !0; + if (!f.writable) return !1; + } + if (f = Object.getOwnPropertyDescriptor(o, r)) { + if (!f.writable) return !1; + f.value = t, Object.defineProperty(o, r, f); + } else defineProperty(o, r, t); + return !0; + }, set(e, r, t, o); +} +function _set(e, r, t, o, f) { + if (!set(e, r, t, o || e) && f) throw new TypeError("failed to set property"); + return t; +} +module.exports = _set, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/setFunctionName.js b/node_modules/@babel/runtime/helpers/setFunctionName.js new file mode 100644 index 00000000..9664076a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/setFunctionName.js @@ -0,0 +1,12 @@ +var _typeof = require("./typeof.js")["default"]; +function setFunctionName(e, t, n) { + "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); + try { + Object.defineProperty(e, "name", { + configurable: !0, + value: n ? n + " " + t : t + }); + } catch (e) {} + return e; +} +module.exports = setFunctionName, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/setPrototypeOf.js b/node_modules/@babel/runtime/helpers/setPrototypeOf.js new file mode 100644 index 00000000..260377f3 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/setPrototypeOf.js @@ -0,0 +1,6 @@ +function _setPrototypeOf(t, e) { + return (module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _setPrototypeOf(t, e); +} +module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js b/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js new file mode 100644 index 00000000..2aed548e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js @@ -0,0 +1,7 @@ +function _skipFirstGeneratorNext(t) { + return function () { + var r = t.apply(this, arguments); + return r.next(), r; + }; +} +module.exports = _skipFirstGeneratorNext, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/slicedToArray.js b/node_modules/@babel/runtime/helpers/slicedToArray.js new file mode 100644 index 00000000..3d752c42 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/slicedToArray.js @@ -0,0 +1,8 @@ +var arrayWithHoles = require("./arrayWithHoles.js"); +var iterableToArrayLimit = require("./iterableToArrayLimit.js"); +var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); +var nonIterableRest = require("./nonIterableRest.js"); +function _slicedToArray(r, e) { + return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest(); +} +module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js b/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js new file mode 100644 index 00000000..6fb3879c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js @@ -0,0 +1,8 @@ +var arrayWithHoles = require("./arrayWithHoles.js"); +var iterableToArrayLimitLoose = require("./iterableToArrayLimitLoose.js"); +var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); +var nonIterableRest = require("./nonIterableRest.js"); +function _slicedToArrayLoose(r, e) { + return arrayWithHoles(r) || iterableToArrayLimitLoose(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest(); +} +module.exports = _slicedToArrayLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/superPropBase.js b/node_modules/@babel/runtime/helpers/superPropBase.js new file mode 100644 index 00000000..5cad4595 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/superPropBase.js @@ -0,0 +1,6 @@ +var getPrototypeOf = require("./getPrototypeOf.js"); +function _superPropBase(t, o) { + for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t));); + return t; +} +module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js b/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js new file mode 100644 index 00000000..38d6065a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js @@ -0,0 +1,8 @@ +function _taggedTemplateLiteral(e, t) { + return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { + raw: { + value: Object.freeze(t) + } + })); +} +module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js b/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js new file mode 100644 index 00000000..2f8c146a --- /dev/null +++ b/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js @@ -0,0 +1,4 @@ +function _taggedTemplateLiteralLoose(e, t) { + return t || (t = e.slice(0)), e.raw = t, e; +} +module.exports = _taggedTemplateLiteralLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/tdz.js b/node_modules/@babel/runtime/helpers/tdz.js new file mode 100644 index 00000000..c66f476c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/tdz.js @@ -0,0 +1,4 @@ +function _tdzError(e) { + throw new ReferenceError(e + " is not defined - temporal dead zone"); +} +module.exports = _tdzError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/temporalRef.js b/node_modules/@babel/runtime/helpers/temporalRef.js new file mode 100644 index 00000000..54c9190c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/temporalRef.js @@ -0,0 +1,6 @@ +var temporalUndefined = require("./temporalUndefined.js"); +var tdz = require("./tdz.js"); +function _temporalRef(r, e) { + return r === temporalUndefined ? tdz(e) : r; +} +module.exports = _temporalRef, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js b/node_modules/@babel/runtime/helpers/temporalUndefined.js similarity index 100% rename from project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js rename to node_modules/@babel/runtime/helpers/temporalUndefined.js diff --git a/node_modules/@babel/runtime/helpers/toArray.js b/node_modules/@babel/runtime/helpers/toArray.js new file mode 100644 index 00000000..2be1d2bd --- /dev/null +++ b/node_modules/@babel/runtime/helpers/toArray.js @@ -0,0 +1,8 @@ +var arrayWithHoles = require("./arrayWithHoles.js"); +var iterableToArray = require("./iterableToArray.js"); +var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); +var nonIterableRest = require("./nonIterableRest.js"); +function _toArray(r) { + return arrayWithHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableRest(); +} +module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toConsumableArray.js b/node_modules/@babel/runtime/helpers/toConsumableArray.js new file mode 100644 index 00000000..698f9c69 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/toConsumableArray.js @@ -0,0 +1,8 @@ +var arrayWithoutHoles = require("./arrayWithoutHoles.js"); +var iterableToArray = require("./iterableToArray.js"); +var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); +var nonIterableSpread = require("./nonIterableSpread.js"); +function _toConsumableArray(r) { + return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread(); +} +module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toPrimitive.js b/node_modules/@babel/runtime/helpers/toPrimitive.js new file mode 100644 index 00000000..ef9d249b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/toPrimitive.js @@ -0,0 +1,12 @@ +var _typeof = require("./typeof.js")["default"]; +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toPropertyKey.js b/node_modules/@babel/runtime/helpers/toPropertyKey.js new file mode 100644 index 00000000..3ca3d4fc --- /dev/null +++ b/node_modules/@babel/runtime/helpers/toPropertyKey.js @@ -0,0 +1,7 @@ +var _typeof = require("./typeof.js")["default"]; +var toPrimitive = require("./toPrimitive.js"); +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/toSetter.js b/node_modules/@babel/runtime/helpers/toSetter.js new file mode 100644 index 00000000..e0012a8f --- /dev/null +++ b/node_modules/@babel/runtime/helpers/toSetter.js @@ -0,0 +1,10 @@ +function _toSetter(t, e, n) { + e || (e = []); + var r = e.length++; + return Object.defineProperty({}, "_", { + set: function set(o) { + e[r] = o, t.apply(n, e); + } + }); +} +module.exports = _toSetter, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/typeof.js b/node_modules/@babel/runtime/helpers/typeof.js new file mode 100644 index 00000000..64a8ecf7 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/typeof.js @@ -0,0 +1,10 @@ +function _typeof(o) { + "@babel/helpers - typeof"; + + return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o); +} +module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js b/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js new file mode 100644 index 00000000..8fb1a71d --- /dev/null +++ b/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js @@ -0,0 +1,9 @@ +var arrayLikeToArray = require("./arrayLikeToArray.js"); +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0; + } +} +module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/using.js b/node_modules/@babel/runtime/helpers/using.js new file mode 100644 index 00000000..37c79e2c --- /dev/null +++ b/node_modules/@babel/runtime/helpers/using.js @@ -0,0 +1,12 @@ +function _using(o, n, e) { + if (null == n) return n; + if (Object(n) !== n) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + if (e) var r = n[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")]; + if (null == r && (r = n[Symbol.dispose || Symbol["for"]("Symbol.dispose")]), "function" != typeof r) throw new TypeError("Property [Symbol.dispose] is not a function."); + return o.push({ + v: n, + d: r, + a: e + }), n; +} +module.exports = _using, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/usingCtx.js b/node_modules/@babel/runtime/helpers/usingCtx.js new file mode 100644 index 00000000..b2443821 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/usingCtx.js @@ -0,0 +1,47 @@ +function _usingCtx() { + var r = "function" == typeof SuppressedError ? SuppressedError : function (r, n) { + var e = Error(); + return e.name = "SuppressedError", e.error = r, e.suppressed = n, e; + }, + n = {}, + e = []; + function using(r, n) { + if (null != n) { + if (Object(n) !== n) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + if (r) var o = n[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")]; + if (null == o && (o = n[Symbol.dispose || Symbol["for"]("Symbol.dispose")]), "function" != typeof o) throw new TypeError("Property [Symbol.dispose] is not a function."); + e.push({ + v: n, + d: o, + a: r + }); + } else r && e.push({ + d: n, + a: r + }); + return n; + } + return { + e: n, + u: using.bind(null, !1), + a: using.bind(null, !0), + d: function d() { + var o = this.e; + function next() { + for (; r = e.pop();) try { + var r, + t = r.d && r.d.call(r.v); + if (r.a) return Promise.resolve(t).then(next, err); + } catch (r) { + return err(r); + } + if (o !== n) throw o; + } + function err(e) { + return o = o !== n ? new r(e, o) : e, next(); + } + return next(); + } + }; +} +module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js b/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js new file mode 100644 index 00000000..34f9099e --- /dev/null +++ b/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js @@ -0,0 +1,7 @@ +var AsyncGenerator = require("./AsyncGenerator.js"); +function _wrapAsyncGenerator(r) { + return function () { + return new AsyncGenerator(r.apply(this, arguments)); + }; +} +module.exports = _wrapAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/wrapNativeSuper.js b/node_modules/@babel/runtime/helpers/wrapNativeSuper.js new file mode 100644 index 00000000..8a3f172b --- /dev/null +++ b/node_modules/@babel/runtime/helpers/wrapNativeSuper.js @@ -0,0 +1,27 @@ +var getPrototypeOf = require("./getPrototypeOf.js"); +var setPrototypeOf = require("./setPrototypeOf.js"); +var isNativeFunction = require("./isNativeFunction.js"); +var construct = require("./construct.js"); +function _wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return (module.exports = _wrapNativeSuper = function _wrapNativeSuper(t) { + if (null === t || !isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return construct(t, arguments, getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), setPrototypeOf(Wrapper, t); + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _wrapNativeSuper(t); +} +module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/wrapRegExp.js b/node_modules/@babel/runtime/helpers/wrapRegExp.js new file mode 100644 index 00000000..c5271688 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/wrapRegExp.js @@ -0,0 +1,51 @@ +var _typeof = require("./typeof.js")["default"]; +var setPrototypeOf = require("./setPrototypeOf.js"); +var inherits = require("./inherits.js"); +function _wrapRegExp() { + module.exports = _wrapRegExp = function _wrapRegExp(e, r) { + return new BabelRegExp(e, void 0, r); + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + var e = RegExp.prototype, + r = new WeakMap(); + function BabelRegExp(e, t, p) { + var o = RegExp(e, t); + return r.set(o, p || r.get(e)), setPrototypeOf(o, BabelRegExp.prototype); + } + function buildGroups(e, t) { + var p = r.get(t); + return Object.keys(p).reduce(function (r, t) { + var o = p[t]; + if ("number" == typeof o) r[t] = e[o];else { + for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; + r[t] = e[o[i]]; + } + return r; + }, Object.create(null)); + } + return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { + var t = e.exec.call(this, r); + if (t) { + t.groups = buildGroups(t, this); + var p = t.indices; + p && (p.groups = buildGroups(p, this)); + } + return t; + }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { + if ("string" == typeof p) { + var o = r.get(this); + return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { + var t = o[r]; + return "$" + (Array.isArray(t) ? t.join("$") : t); + })); + } + if ("function" == typeof p) { + var i = this; + return e[Symbol.replace].call(this, t, function () { + var e = arguments; + return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); + }); + } + return e[Symbol.replace].call(this, t, p); + }, _wrapRegExp.apply(this, arguments); +} +module.exports = _wrapRegExp, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/node_modules/@babel/runtime/helpers/writeOnlyError.js b/node_modules/@babel/runtime/helpers/writeOnlyError.js new file mode 100644 index 00000000..c98ee825 --- /dev/null +++ b/node_modules/@babel/runtime/helpers/writeOnlyError.js @@ -0,0 +1,4 @@ +function _writeOnlyError(r) { + throw new TypeError('"' + r + '" is write-only'); +} +module.exports = _writeOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/regenerator-runtime/LICENSE b/node_modules/@babel/runtime/node_modules/regenerator-runtime/LICENSE similarity index 100% rename from project starter code/node_modules/regenerator-runtime/LICENSE rename to node_modules/@babel/runtime/node_modules/regenerator-runtime/LICENSE diff --git a/project starter code/node_modules/regenerator-runtime/README.md b/node_modules/@babel/runtime/node_modules/regenerator-runtime/README.md similarity index 100% rename from project starter code/node_modules/regenerator-runtime/README.md rename to node_modules/@babel/runtime/node_modules/regenerator-runtime/README.md diff --git a/node_modules/@babel/runtime/node_modules/regenerator-runtime/package.json b/node_modules/@babel/runtime/node_modules/regenerator-runtime/package.json new file mode 100644 index 00000000..503086f8 --- /dev/null +++ b/node_modules/@babel/runtime/node_modules/regenerator-runtime/package.json @@ -0,0 +1,19 @@ +{ + "name": "regenerator-runtime", + "author": "Ben Newman ", + "description": "Runtime for Regenerator-compiled generator and async functions.", + "version": "0.14.1", + "main": "runtime.js", + "keywords": [ + "regenerator", + "runtime", + "generator", + "async" + ], + "sideEffects": true, + "repository": { + "type": "git", + "url": "https://github.com/facebook/regenerator/tree/main/packages/runtime" + }, + "license": "MIT" +} diff --git a/project starter code/node_modules/regenerator-runtime/path.js b/node_modules/@babel/runtime/node_modules/regenerator-runtime/path.js similarity index 100% rename from project starter code/node_modules/regenerator-runtime/path.js rename to node_modules/@babel/runtime/node_modules/regenerator-runtime/path.js diff --git a/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js b/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js new file mode 100644 index 00000000..5593ca59 --- /dev/null +++ b/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js @@ -0,0 +1,761 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +var runtime = (function (exports) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + function define(obj, key, value) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + return obj[key]; + } + try { + // IE 8 has a broken Object.defineProperty that only works on DOM objects. + define({}, ""); + } catch (err) { + define = function(obj, key, value) { + return obj[key] = value; + }; + } + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }); + + return generator; + } + exports.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + define(IteratorPrototype, iteratorSymbol, function () { + return this; + }); + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = GeneratorFunctionPrototype; + defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true }); + defineProperty( + GeneratorFunctionPrototype, + "constructor", + { value: GeneratorFunction, configurable: true } + ); + GeneratorFunction.displayName = define( + GeneratorFunctionPrototype, + toStringTagSymbol, + "GeneratorFunction" + ); + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + define(prototype, method, function(arg) { + return this._invoke(method, arg); + }); + }); + } + + exports.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + exports.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + define(genFun, toStringTagSymbol, "GeneratorFunction"); + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + exports.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return PromiseImpl.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return PromiseImpl.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function(error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + defineProperty(this, "_invoke", { value: enqueue }); + } + + defineIteratorMethods(AsyncIterator.prototype); + define(AsyncIterator.prototype, asyncIteratorSymbol, function () { + return this; + }); + exports.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { + if (PromiseImpl === void 0) PromiseImpl = Promise; + + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList), + PromiseImpl + ); + + return exports.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per GeneratorResume behavior specified since ES2015: + // ES2015 spec, step 3: https://262.ecma-international.org/6.0/#sec-generatorresume + // Latest spec, step 2: https://tc39.es/ecma262/#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var methodName = context.method; + var method = delegate.iterator[methodName]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method, or a missing .next method, always terminate the + // yield* loop. + context.delegate = null; + + // Note: ["return"] must be used for ES3 parsing compatibility. + if (methodName === "throw" && delegate.iterator["return"]) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + if (methodName !== "return") { + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a '" + methodName + "' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + define(Gp, toStringTagSymbol, "Generator"); + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + define(Gp, iteratorSymbol, function() { + return this; + }); + + define(Gp, "toString", function() { + return "[object Generator]"; + }); + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + exports.keys = function(val) { + var object = Object(val); + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable != null) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + throw new TypeError(typeof iterable + " is not iterable"); + } + exports.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + + // Regardless of whether this script is executing as a CommonJS module + // or not, return the runtime object so that we can declare the variable + // regeneratorRuntime in the outer scope, which allows this module to be + // injected easily by `bin/regenerator --include-runtime script.js`. + return exports; + +}( + // If this script is executing as a CommonJS module, use module.exports + // as the regeneratorRuntime namespace. Otherwise create a new empty + // object. Either way, the resulting object will be used to initialize + // the regeneratorRuntime variable at the top of this file. + typeof module === "object" ? module.exports : {} +)); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + // This module should not be running in strict mode, so the above + // assignment should always work unless something is misconfigured. Just + // in case runtime.js accidentally runs in strict mode, in modern engines + // we can explicitly access globalThis. In older engines we can escape + // strict mode using a global Function call. This could conceivably fail + // if a Content Security Policy forbids using Function, but in that case + // the proper solution is to fix the accidental strict mode problem. If + // you've misconfigured your bundler to force strict mode and applied a + // CSP to forbid Function, and you're not willing to fix either of those + // problems, please detail your unique predicament in a GitHub issue. + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } +} diff --git a/node_modules/@babel/runtime/package.json b/node_modules/@babel/runtime/package.json new file mode 100644 index 00000000..1ad54a5f --- /dev/null +++ b/node_modules/@babel/runtime/package.json @@ -0,0 +1,1065 @@ +{ + "name": "@babel/runtime", + "version": "7.24.6", + "description": "babel's modular runtime helpers", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-runtime" + }, + "homepage": "https://babel.dev/docs/en/next/babel-runtime", + "author": "The Babel Team (https://babel.dev/team)", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "exports": { + "./helpers/AsyncGenerator": [ + { + "node": "./helpers/AsyncGenerator.js", + "import": "./helpers/esm/AsyncGenerator.js", + "default": "./helpers/AsyncGenerator.js" + }, + "./helpers/AsyncGenerator.js" + ], + "./helpers/esm/AsyncGenerator": "./helpers/esm/AsyncGenerator.js", + "./helpers/OverloadYield": [ + { + "node": "./helpers/OverloadYield.js", + "import": "./helpers/esm/OverloadYield.js", + "default": "./helpers/OverloadYield.js" + }, + "./helpers/OverloadYield.js" + ], + "./helpers/esm/OverloadYield": "./helpers/esm/OverloadYield.js", + "./helpers/applyDecoratedDescriptor": [ + { + "node": "./helpers/applyDecoratedDescriptor.js", + "import": "./helpers/esm/applyDecoratedDescriptor.js", + "default": "./helpers/applyDecoratedDescriptor.js" + }, + "./helpers/applyDecoratedDescriptor.js" + ], + "./helpers/esm/applyDecoratedDescriptor": "./helpers/esm/applyDecoratedDescriptor.js", + "./helpers/applyDecs2311": [ + { + "node": "./helpers/applyDecs2311.js", + "import": "./helpers/esm/applyDecs2311.js", + "default": "./helpers/applyDecs2311.js" + }, + "./helpers/applyDecs2311.js" + ], + "./helpers/esm/applyDecs2311": "./helpers/esm/applyDecs2311.js", + "./helpers/arrayLikeToArray": [ + { + "node": "./helpers/arrayLikeToArray.js", + "import": "./helpers/esm/arrayLikeToArray.js", + "default": "./helpers/arrayLikeToArray.js" + }, + "./helpers/arrayLikeToArray.js" + ], + "./helpers/esm/arrayLikeToArray": "./helpers/esm/arrayLikeToArray.js", + "./helpers/arrayWithHoles": [ + { + "node": "./helpers/arrayWithHoles.js", + "import": "./helpers/esm/arrayWithHoles.js", + "default": "./helpers/arrayWithHoles.js" + }, + "./helpers/arrayWithHoles.js" + ], + "./helpers/esm/arrayWithHoles": "./helpers/esm/arrayWithHoles.js", + "./helpers/arrayWithoutHoles": [ + { + "node": "./helpers/arrayWithoutHoles.js", + "import": "./helpers/esm/arrayWithoutHoles.js", + "default": "./helpers/arrayWithoutHoles.js" + }, + "./helpers/arrayWithoutHoles.js" + ], + "./helpers/esm/arrayWithoutHoles": "./helpers/esm/arrayWithoutHoles.js", + "./helpers/assertClassBrand": [ + { + "node": "./helpers/assertClassBrand.js", + "import": "./helpers/esm/assertClassBrand.js", + "default": "./helpers/assertClassBrand.js" + }, + "./helpers/assertClassBrand.js" + ], + "./helpers/esm/assertClassBrand": "./helpers/esm/assertClassBrand.js", + "./helpers/assertThisInitialized": [ + { + "node": "./helpers/assertThisInitialized.js", + "import": "./helpers/esm/assertThisInitialized.js", + "default": "./helpers/assertThisInitialized.js" + }, + "./helpers/assertThisInitialized.js" + ], + "./helpers/esm/assertThisInitialized": "./helpers/esm/assertThisInitialized.js", + "./helpers/asyncGeneratorDelegate": [ + { + "node": "./helpers/asyncGeneratorDelegate.js", + "import": "./helpers/esm/asyncGeneratorDelegate.js", + "default": "./helpers/asyncGeneratorDelegate.js" + }, + "./helpers/asyncGeneratorDelegate.js" + ], + "./helpers/esm/asyncGeneratorDelegate": "./helpers/esm/asyncGeneratorDelegate.js", + "./helpers/asyncIterator": [ + { + "node": "./helpers/asyncIterator.js", + "import": "./helpers/esm/asyncIterator.js", + "default": "./helpers/asyncIterator.js" + }, + "./helpers/asyncIterator.js" + ], + "./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js", + "./helpers/asyncToGenerator": [ + { + "node": "./helpers/asyncToGenerator.js", + "import": "./helpers/esm/asyncToGenerator.js", + "default": "./helpers/asyncToGenerator.js" + }, + "./helpers/asyncToGenerator.js" + ], + "./helpers/esm/asyncToGenerator": "./helpers/esm/asyncToGenerator.js", + "./helpers/awaitAsyncGenerator": [ + { + "node": "./helpers/awaitAsyncGenerator.js", + "import": "./helpers/esm/awaitAsyncGenerator.js", + "default": "./helpers/awaitAsyncGenerator.js" + }, + "./helpers/awaitAsyncGenerator.js" + ], + "./helpers/esm/awaitAsyncGenerator": "./helpers/esm/awaitAsyncGenerator.js", + "./helpers/callSuper": [ + { + "node": "./helpers/callSuper.js", + "import": "./helpers/esm/callSuper.js", + "default": "./helpers/callSuper.js" + }, + "./helpers/callSuper.js" + ], + "./helpers/esm/callSuper": "./helpers/esm/callSuper.js", + "./helpers/checkInRHS": [ + { + "node": "./helpers/checkInRHS.js", + "import": "./helpers/esm/checkInRHS.js", + "default": "./helpers/checkInRHS.js" + }, + "./helpers/checkInRHS.js" + ], + "./helpers/esm/checkInRHS": "./helpers/esm/checkInRHS.js", + "./helpers/checkPrivateRedeclaration": [ + { + "node": "./helpers/checkPrivateRedeclaration.js", + "import": "./helpers/esm/checkPrivateRedeclaration.js", + "default": "./helpers/checkPrivateRedeclaration.js" + }, + "./helpers/checkPrivateRedeclaration.js" + ], + "./helpers/esm/checkPrivateRedeclaration": "./helpers/esm/checkPrivateRedeclaration.js", + "./helpers/classCallCheck": [ + { + "node": "./helpers/classCallCheck.js", + "import": "./helpers/esm/classCallCheck.js", + "default": "./helpers/classCallCheck.js" + }, + "./helpers/classCallCheck.js" + ], + "./helpers/esm/classCallCheck": "./helpers/esm/classCallCheck.js", + "./helpers/classNameTDZError": [ + { + "node": "./helpers/classNameTDZError.js", + "import": "./helpers/esm/classNameTDZError.js", + "default": "./helpers/classNameTDZError.js" + }, + "./helpers/classNameTDZError.js" + ], + "./helpers/esm/classNameTDZError": "./helpers/esm/classNameTDZError.js", + "./helpers/classPrivateFieldGet2": [ + { + "node": "./helpers/classPrivateFieldGet2.js", + "import": "./helpers/esm/classPrivateFieldGet2.js", + "default": "./helpers/classPrivateFieldGet2.js" + }, + "./helpers/classPrivateFieldGet2.js" + ], + "./helpers/esm/classPrivateFieldGet2": "./helpers/esm/classPrivateFieldGet2.js", + "./helpers/classPrivateFieldInitSpec": [ + { + "node": "./helpers/classPrivateFieldInitSpec.js", + "import": "./helpers/esm/classPrivateFieldInitSpec.js", + "default": "./helpers/classPrivateFieldInitSpec.js" + }, + "./helpers/classPrivateFieldInitSpec.js" + ], + "./helpers/esm/classPrivateFieldInitSpec": "./helpers/esm/classPrivateFieldInitSpec.js", + "./helpers/classPrivateFieldLooseBase": [ + { + "node": "./helpers/classPrivateFieldLooseBase.js", + "import": "./helpers/esm/classPrivateFieldLooseBase.js", + "default": "./helpers/classPrivateFieldLooseBase.js" + }, + "./helpers/classPrivateFieldLooseBase.js" + ], + "./helpers/esm/classPrivateFieldLooseBase": "./helpers/esm/classPrivateFieldLooseBase.js", + "./helpers/classPrivateFieldLooseKey": [ + { + "node": "./helpers/classPrivateFieldLooseKey.js", + "import": "./helpers/esm/classPrivateFieldLooseKey.js", + "default": "./helpers/classPrivateFieldLooseKey.js" + }, + "./helpers/classPrivateFieldLooseKey.js" + ], + "./helpers/esm/classPrivateFieldLooseKey": "./helpers/esm/classPrivateFieldLooseKey.js", + "./helpers/classPrivateFieldSet2": [ + { + "node": "./helpers/classPrivateFieldSet2.js", + "import": "./helpers/esm/classPrivateFieldSet2.js", + "default": "./helpers/classPrivateFieldSet2.js" + }, + "./helpers/classPrivateFieldSet2.js" + ], + "./helpers/esm/classPrivateFieldSet2": "./helpers/esm/classPrivateFieldSet2.js", + "./helpers/classPrivateGetter": [ + { + "node": "./helpers/classPrivateGetter.js", + "import": "./helpers/esm/classPrivateGetter.js", + "default": "./helpers/classPrivateGetter.js" + }, + "./helpers/classPrivateGetter.js" + ], + "./helpers/esm/classPrivateGetter": "./helpers/esm/classPrivateGetter.js", + "./helpers/classPrivateMethodInitSpec": [ + { + "node": "./helpers/classPrivateMethodInitSpec.js", + "import": "./helpers/esm/classPrivateMethodInitSpec.js", + "default": "./helpers/classPrivateMethodInitSpec.js" + }, + "./helpers/classPrivateMethodInitSpec.js" + ], + "./helpers/esm/classPrivateMethodInitSpec": "./helpers/esm/classPrivateMethodInitSpec.js", + "./helpers/classPrivateSetter": [ + { + "node": "./helpers/classPrivateSetter.js", + "import": "./helpers/esm/classPrivateSetter.js", + "default": "./helpers/classPrivateSetter.js" + }, + "./helpers/classPrivateSetter.js" + ], + "./helpers/esm/classPrivateSetter": "./helpers/esm/classPrivateSetter.js", + "./helpers/classStaticPrivateMethodGet": [ + { + "node": "./helpers/classStaticPrivateMethodGet.js", + "import": "./helpers/esm/classStaticPrivateMethodGet.js", + "default": "./helpers/classStaticPrivateMethodGet.js" + }, + "./helpers/classStaticPrivateMethodGet.js" + ], + "./helpers/esm/classStaticPrivateMethodGet": "./helpers/esm/classStaticPrivateMethodGet.js", + "./helpers/construct": [ + { + "node": "./helpers/construct.js", + "import": "./helpers/esm/construct.js", + "default": "./helpers/construct.js" + }, + "./helpers/construct.js" + ], + "./helpers/esm/construct": "./helpers/esm/construct.js", + "./helpers/createClass": [ + { + "node": "./helpers/createClass.js", + "import": "./helpers/esm/createClass.js", + "default": "./helpers/createClass.js" + }, + "./helpers/createClass.js" + ], + "./helpers/esm/createClass": "./helpers/esm/createClass.js", + "./helpers/createForOfIteratorHelper": [ + { + "node": "./helpers/createForOfIteratorHelper.js", + "import": "./helpers/esm/createForOfIteratorHelper.js", + "default": "./helpers/createForOfIteratorHelper.js" + }, + "./helpers/createForOfIteratorHelper.js" + ], + "./helpers/esm/createForOfIteratorHelper": "./helpers/esm/createForOfIteratorHelper.js", + "./helpers/createForOfIteratorHelperLoose": [ + { + "node": "./helpers/createForOfIteratorHelperLoose.js", + "import": "./helpers/esm/createForOfIteratorHelperLoose.js", + "default": "./helpers/createForOfIteratorHelperLoose.js" + }, + "./helpers/createForOfIteratorHelperLoose.js" + ], + "./helpers/esm/createForOfIteratorHelperLoose": "./helpers/esm/createForOfIteratorHelperLoose.js", + "./helpers/createSuper": [ + { + "node": "./helpers/createSuper.js", + "import": "./helpers/esm/createSuper.js", + "default": "./helpers/createSuper.js" + }, + "./helpers/createSuper.js" + ], + "./helpers/esm/createSuper": "./helpers/esm/createSuper.js", + "./helpers/decorate": [ + { + "node": "./helpers/decorate.js", + "import": "./helpers/esm/decorate.js", + "default": "./helpers/decorate.js" + }, + "./helpers/decorate.js" + ], + "./helpers/esm/decorate": "./helpers/esm/decorate.js", + "./helpers/defaults": [ + { + "node": "./helpers/defaults.js", + "import": "./helpers/esm/defaults.js", + "default": "./helpers/defaults.js" + }, + "./helpers/defaults.js" + ], + "./helpers/esm/defaults": "./helpers/esm/defaults.js", + "./helpers/defineAccessor": [ + { + "node": "./helpers/defineAccessor.js", + "import": "./helpers/esm/defineAccessor.js", + "default": "./helpers/defineAccessor.js" + }, + "./helpers/defineAccessor.js" + ], + "./helpers/esm/defineAccessor": "./helpers/esm/defineAccessor.js", + "./helpers/defineProperty": [ + { + "node": "./helpers/defineProperty.js", + "import": "./helpers/esm/defineProperty.js", + "default": "./helpers/defineProperty.js" + }, + "./helpers/defineProperty.js" + ], + "./helpers/esm/defineProperty": "./helpers/esm/defineProperty.js", + "./helpers/extends": [ + { + "node": "./helpers/extends.js", + "import": "./helpers/esm/extends.js", + "default": "./helpers/extends.js" + }, + "./helpers/extends.js" + ], + "./helpers/esm/extends": "./helpers/esm/extends.js", + "./helpers/get": [ + { + "node": "./helpers/get.js", + "import": "./helpers/esm/get.js", + "default": "./helpers/get.js" + }, + "./helpers/get.js" + ], + "./helpers/esm/get": "./helpers/esm/get.js", + "./helpers/getPrototypeOf": [ + { + "node": "./helpers/getPrototypeOf.js", + "import": "./helpers/esm/getPrototypeOf.js", + "default": "./helpers/getPrototypeOf.js" + }, + "./helpers/getPrototypeOf.js" + ], + "./helpers/esm/getPrototypeOf": "./helpers/esm/getPrototypeOf.js", + "./helpers/identity": [ + { + "node": "./helpers/identity.js", + "import": "./helpers/esm/identity.js", + "default": "./helpers/identity.js" + }, + "./helpers/identity.js" + ], + "./helpers/esm/identity": "./helpers/esm/identity.js", + "./helpers/importDeferProxy": [ + { + "node": "./helpers/importDeferProxy.js", + "import": "./helpers/esm/importDeferProxy.js", + "default": "./helpers/importDeferProxy.js" + }, + "./helpers/importDeferProxy.js" + ], + "./helpers/esm/importDeferProxy": "./helpers/esm/importDeferProxy.js", + "./helpers/inherits": [ + { + "node": "./helpers/inherits.js", + "import": "./helpers/esm/inherits.js", + "default": "./helpers/inherits.js" + }, + "./helpers/inherits.js" + ], + "./helpers/esm/inherits": "./helpers/esm/inherits.js", + "./helpers/inheritsLoose": [ + { + "node": "./helpers/inheritsLoose.js", + "import": "./helpers/esm/inheritsLoose.js", + "default": "./helpers/inheritsLoose.js" + }, + "./helpers/inheritsLoose.js" + ], + "./helpers/esm/inheritsLoose": "./helpers/esm/inheritsLoose.js", + "./helpers/initializerDefineProperty": [ + { + "node": "./helpers/initializerDefineProperty.js", + "import": "./helpers/esm/initializerDefineProperty.js", + "default": "./helpers/initializerDefineProperty.js" + }, + "./helpers/initializerDefineProperty.js" + ], + "./helpers/esm/initializerDefineProperty": "./helpers/esm/initializerDefineProperty.js", + "./helpers/initializerWarningHelper": [ + { + "node": "./helpers/initializerWarningHelper.js", + "import": "./helpers/esm/initializerWarningHelper.js", + "default": "./helpers/initializerWarningHelper.js" + }, + "./helpers/initializerWarningHelper.js" + ], + "./helpers/esm/initializerWarningHelper": "./helpers/esm/initializerWarningHelper.js", + "./helpers/instanceof": [ + { + "node": "./helpers/instanceof.js", + "import": "./helpers/esm/instanceof.js", + "default": "./helpers/instanceof.js" + }, + "./helpers/instanceof.js" + ], + "./helpers/esm/instanceof": "./helpers/esm/instanceof.js", + "./helpers/interopRequireDefault": [ + { + "node": "./helpers/interopRequireDefault.js", + "import": "./helpers/esm/interopRequireDefault.js", + "default": "./helpers/interopRequireDefault.js" + }, + "./helpers/interopRequireDefault.js" + ], + "./helpers/esm/interopRequireDefault": "./helpers/esm/interopRequireDefault.js", + "./helpers/interopRequireWildcard": [ + { + "node": "./helpers/interopRequireWildcard.js", + "import": "./helpers/esm/interopRequireWildcard.js", + "default": "./helpers/interopRequireWildcard.js" + }, + "./helpers/interopRequireWildcard.js" + ], + "./helpers/esm/interopRequireWildcard": "./helpers/esm/interopRequireWildcard.js", + "./helpers/isNativeFunction": [ + { + "node": "./helpers/isNativeFunction.js", + "import": "./helpers/esm/isNativeFunction.js", + "default": "./helpers/isNativeFunction.js" + }, + "./helpers/isNativeFunction.js" + ], + "./helpers/esm/isNativeFunction": "./helpers/esm/isNativeFunction.js", + "./helpers/isNativeReflectConstruct": [ + { + "node": "./helpers/isNativeReflectConstruct.js", + "import": "./helpers/esm/isNativeReflectConstruct.js", + "default": "./helpers/isNativeReflectConstruct.js" + }, + "./helpers/isNativeReflectConstruct.js" + ], + "./helpers/esm/isNativeReflectConstruct": "./helpers/esm/isNativeReflectConstruct.js", + "./helpers/iterableToArray": [ + { + "node": "./helpers/iterableToArray.js", + "import": "./helpers/esm/iterableToArray.js", + "default": "./helpers/iterableToArray.js" + }, + "./helpers/iterableToArray.js" + ], + "./helpers/esm/iterableToArray": "./helpers/esm/iterableToArray.js", + "./helpers/iterableToArrayLimit": [ + { + "node": "./helpers/iterableToArrayLimit.js", + "import": "./helpers/esm/iterableToArrayLimit.js", + "default": "./helpers/iterableToArrayLimit.js" + }, + "./helpers/iterableToArrayLimit.js" + ], + "./helpers/esm/iterableToArrayLimit": "./helpers/esm/iterableToArrayLimit.js", + "./helpers/iterableToArrayLimitLoose": [ + { + "node": "./helpers/iterableToArrayLimitLoose.js", + "import": "./helpers/esm/iterableToArrayLimitLoose.js", + "default": "./helpers/iterableToArrayLimitLoose.js" + }, + "./helpers/iterableToArrayLimitLoose.js" + ], + "./helpers/esm/iterableToArrayLimitLoose": "./helpers/esm/iterableToArrayLimitLoose.js", + "./helpers/jsx": [ + { + "node": "./helpers/jsx.js", + "import": "./helpers/esm/jsx.js", + "default": "./helpers/jsx.js" + }, + "./helpers/jsx.js" + ], + "./helpers/esm/jsx": "./helpers/esm/jsx.js", + "./helpers/maybeArrayLike": [ + { + "node": "./helpers/maybeArrayLike.js", + "import": "./helpers/esm/maybeArrayLike.js", + "default": "./helpers/maybeArrayLike.js" + }, + "./helpers/maybeArrayLike.js" + ], + "./helpers/esm/maybeArrayLike": "./helpers/esm/maybeArrayLike.js", + "./helpers/newArrowCheck": [ + { + "node": "./helpers/newArrowCheck.js", + "import": "./helpers/esm/newArrowCheck.js", + "default": "./helpers/newArrowCheck.js" + }, + "./helpers/newArrowCheck.js" + ], + "./helpers/esm/newArrowCheck": "./helpers/esm/newArrowCheck.js", + "./helpers/nonIterableRest": [ + { + "node": "./helpers/nonIterableRest.js", + "import": "./helpers/esm/nonIterableRest.js", + "default": "./helpers/nonIterableRest.js" + }, + "./helpers/nonIterableRest.js" + ], + "./helpers/esm/nonIterableRest": "./helpers/esm/nonIterableRest.js", + "./helpers/nonIterableSpread": [ + { + "node": "./helpers/nonIterableSpread.js", + "import": "./helpers/esm/nonIterableSpread.js", + "default": "./helpers/nonIterableSpread.js" + }, + "./helpers/nonIterableSpread.js" + ], + "./helpers/esm/nonIterableSpread": "./helpers/esm/nonIterableSpread.js", + "./helpers/nullishReceiverError": [ + { + "node": "./helpers/nullishReceiverError.js", + "import": "./helpers/esm/nullishReceiverError.js", + "default": "./helpers/nullishReceiverError.js" + }, + "./helpers/nullishReceiverError.js" + ], + "./helpers/esm/nullishReceiverError": "./helpers/esm/nullishReceiverError.js", + "./helpers/objectDestructuringEmpty": [ + { + "node": "./helpers/objectDestructuringEmpty.js", + "import": "./helpers/esm/objectDestructuringEmpty.js", + "default": "./helpers/objectDestructuringEmpty.js" + }, + "./helpers/objectDestructuringEmpty.js" + ], + "./helpers/esm/objectDestructuringEmpty": "./helpers/esm/objectDestructuringEmpty.js", + "./helpers/objectSpread2": [ + { + "node": "./helpers/objectSpread2.js", + "import": "./helpers/esm/objectSpread2.js", + "default": "./helpers/objectSpread2.js" + }, + "./helpers/objectSpread2.js" + ], + "./helpers/esm/objectSpread2": "./helpers/esm/objectSpread2.js", + "./helpers/objectWithoutProperties": [ + { + "node": "./helpers/objectWithoutProperties.js", + "import": "./helpers/esm/objectWithoutProperties.js", + "default": "./helpers/objectWithoutProperties.js" + }, + "./helpers/objectWithoutProperties.js" + ], + "./helpers/esm/objectWithoutProperties": "./helpers/esm/objectWithoutProperties.js", + "./helpers/objectWithoutPropertiesLoose": [ + { + "node": "./helpers/objectWithoutPropertiesLoose.js", + "import": "./helpers/esm/objectWithoutPropertiesLoose.js", + "default": "./helpers/objectWithoutPropertiesLoose.js" + }, + "./helpers/objectWithoutPropertiesLoose.js" + ], + "./helpers/esm/objectWithoutPropertiesLoose": "./helpers/esm/objectWithoutPropertiesLoose.js", + "./helpers/possibleConstructorReturn": [ + { + "node": "./helpers/possibleConstructorReturn.js", + "import": "./helpers/esm/possibleConstructorReturn.js", + "default": "./helpers/possibleConstructorReturn.js" + }, + "./helpers/possibleConstructorReturn.js" + ], + "./helpers/esm/possibleConstructorReturn": "./helpers/esm/possibleConstructorReturn.js", + "./helpers/readOnlyError": [ + { + "node": "./helpers/readOnlyError.js", + "import": "./helpers/esm/readOnlyError.js", + "default": "./helpers/readOnlyError.js" + }, + "./helpers/readOnlyError.js" + ], + "./helpers/esm/readOnlyError": "./helpers/esm/readOnlyError.js", + "./helpers/regeneratorRuntime": [ + { + "node": "./helpers/regeneratorRuntime.js", + "import": "./helpers/esm/regeneratorRuntime.js", + "default": "./helpers/regeneratorRuntime.js" + }, + "./helpers/regeneratorRuntime.js" + ], + "./helpers/esm/regeneratorRuntime": "./helpers/esm/regeneratorRuntime.js", + "./helpers/set": [ + { + "node": "./helpers/set.js", + "import": "./helpers/esm/set.js", + "default": "./helpers/set.js" + }, + "./helpers/set.js" + ], + "./helpers/esm/set": "./helpers/esm/set.js", + "./helpers/setFunctionName": [ + { + "node": "./helpers/setFunctionName.js", + "import": "./helpers/esm/setFunctionName.js", + "default": "./helpers/setFunctionName.js" + }, + "./helpers/setFunctionName.js" + ], + "./helpers/esm/setFunctionName": "./helpers/esm/setFunctionName.js", + "./helpers/setPrototypeOf": [ + { + "node": "./helpers/setPrototypeOf.js", + "import": "./helpers/esm/setPrototypeOf.js", + "default": "./helpers/setPrototypeOf.js" + }, + "./helpers/setPrototypeOf.js" + ], + "./helpers/esm/setPrototypeOf": "./helpers/esm/setPrototypeOf.js", + "./helpers/skipFirstGeneratorNext": [ + { + "node": "./helpers/skipFirstGeneratorNext.js", + "import": "./helpers/esm/skipFirstGeneratorNext.js", + "default": "./helpers/skipFirstGeneratorNext.js" + }, + "./helpers/skipFirstGeneratorNext.js" + ], + "./helpers/esm/skipFirstGeneratorNext": "./helpers/esm/skipFirstGeneratorNext.js", + "./helpers/slicedToArray": [ + { + "node": "./helpers/slicedToArray.js", + "import": "./helpers/esm/slicedToArray.js", + "default": "./helpers/slicedToArray.js" + }, + "./helpers/slicedToArray.js" + ], + "./helpers/esm/slicedToArray": "./helpers/esm/slicedToArray.js", + "./helpers/slicedToArrayLoose": [ + { + "node": "./helpers/slicedToArrayLoose.js", + "import": "./helpers/esm/slicedToArrayLoose.js", + "default": "./helpers/slicedToArrayLoose.js" + }, + "./helpers/slicedToArrayLoose.js" + ], + "./helpers/esm/slicedToArrayLoose": "./helpers/esm/slicedToArrayLoose.js", + "./helpers/superPropBase": [ + { + "node": "./helpers/superPropBase.js", + "import": "./helpers/esm/superPropBase.js", + "default": "./helpers/superPropBase.js" + }, + "./helpers/superPropBase.js" + ], + "./helpers/esm/superPropBase": "./helpers/esm/superPropBase.js", + "./helpers/taggedTemplateLiteral": [ + { + "node": "./helpers/taggedTemplateLiteral.js", + "import": "./helpers/esm/taggedTemplateLiteral.js", + "default": "./helpers/taggedTemplateLiteral.js" + }, + "./helpers/taggedTemplateLiteral.js" + ], + "./helpers/esm/taggedTemplateLiteral": "./helpers/esm/taggedTemplateLiteral.js", + "./helpers/taggedTemplateLiteralLoose": [ + { + "node": "./helpers/taggedTemplateLiteralLoose.js", + "import": "./helpers/esm/taggedTemplateLiteralLoose.js", + "default": "./helpers/taggedTemplateLiteralLoose.js" + }, + "./helpers/taggedTemplateLiteralLoose.js" + ], + "./helpers/esm/taggedTemplateLiteralLoose": "./helpers/esm/taggedTemplateLiteralLoose.js", + "./helpers/tdz": [ + { + "node": "./helpers/tdz.js", + "import": "./helpers/esm/tdz.js", + "default": "./helpers/tdz.js" + }, + "./helpers/tdz.js" + ], + "./helpers/esm/tdz": "./helpers/esm/tdz.js", + "./helpers/temporalRef": [ + { + "node": "./helpers/temporalRef.js", + "import": "./helpers/esm/temporalRef.js", + "default": "./helpers/temporalRef.js" + }, + "./helpers/temporalRef.js" + ], + "./helpers/esm/temporalRef": "./helpers/esm/temporalRef.js", + "./helpers/temporalUndefined": [ + { + "node": "./helpers/temporalUndefined.js", + "import": "./helpers/esm/temporalUndefined.js", + "default": "./helpers/temporalUndefined.js" + }, + "./helpers/temporalUndefined.js" + ], + "./helpers/esm/temporalUndefined": "./helpers/esm/temporalUndefined.js", + "./helpers/toArray": [ + { + "node": "./helpers/toArray.js", + "import": "./helpers/esm/toArray.js", + "default": "./helpers/toArray.js" + }, + "./helpers/toArray.js" + ], + "./helpers/esm/toArray": "./helpers/esm/toArray.js", + "./helpers/toConsumableArray": [ + { + "node": "./helpers/toConsumableArray.js", + "import": "./helpers/esm/toConsumableArray.js", + "default": "./helpers/toConsumableArray.js" + }, + "./helpers/toConsumableArray.js" + ], + "./helpers/esm/toConsumableArray": "./helpers/esm/toConsumableArray.js", + "./helpers/toPrimitive": [ + { + "node": "./helpers/toPrimitive.js", + "import": "./helpers/esm/toPrimitive.js", + "default": "./helpers/toPrimitive.js" + }, + "./helpers/toPrimitive.js" + ], + "./helpers/esm/toPrimitive": "./helpers/esm/toPrimitive.js", + "./helpers/toPropertyKey": [ + { + "node": "./helpers/toPropertyKey.js", + "import": "./helpers/esm/toPropertyKey.js", + "default": "./helpers/toPropertyKey.js" + }, + "./helpers/toPropertyKey.js" + ], + "./helpers/esm/toPropertyKey": "./helpers/esm/toPropertyKey.js", + "./helpers/toSetter": [ + { + "node": "./helpers/toSetter.js", + "import": "./helpers/esm/toSetter.js", + "default": "./helpers/toSetter.js" + }, + "./helpers/toSetter.js" + ], + "./helpers/esm/toSetter": "./helpers/esm/toSetter.js", + "./helpers/typeof": [ + { + "node": "./helpers/typeof.js", + "import": "./helpers/esm/typeof.js", + "default": "./helpers/typeof.js" + }, + "./helpers/typeof.js" + ], + "./helpers/esm/typeof": "./helpers/esm/typeof.js", + "./helpers/unsupportedIterableToArray": [ + { + "node": "./helpers/unsupportedIterableToArray.js", + "import": "./helpers/esm/unsupportedIterableToArray.js", + "default": "./helpers/unsupportedIterableToArray.js" + }, + "./helpers/unsupportedIterableToArray.js" + ], + "./helpers/esm/unsupportedIterableToArray": "./helpers/esm/unsupportedIterableToArray.js", + "./helpers/usingCtx": [ + { + "node": "./helpers/usingCtx.js", + "import": "./helpers/esm/usingCtx.js", + "default": "./helpers/usingCtx.js" + }, + "./helpers/usingCtx.js" + ], + "./helpers/esm/usingCtx": "./helpers/esm/usingCtx.js", + "./helpers/wrapAsyncGenerator": [ + { + "node": "./helpers/wrapAsyncGenerator.js", + "import": "./helpers/esm/wrapAsyncGenerator.js", + "default": "./helpers/wrapAsyncGenerator.js" + }, + "./helpers/wrapAsyncGenerator.js" + ], + "./helpers/esm/wrapAsyncGenerator": "./helpers/esm/wrapAsyncGenerator.js", + "./helpers/wrapNativeSuper": [ + { + "node": "./helpers/wrapNativeSuper.js", + "import": "./helpers/esm/wrapNativeSuper.js", + "default": "./helpers/wrapNativeSuper.js" + }, + "./helpers/wrapNativeSuper.js" + ], + "./helpers/esm/wrapNativeSuper": "./helpers/esm/wrapNativeSuper.js", + "./helpers/wrapRegExp": [ + { + "node": "./helpers/wrapRegExp.js", + "import": "./helpers/esm/wrapRegExp.js", + "default": "./helpers/wrapRegExp.js" + }, + "./helpers/wrapRegExp.js" + ], + "./helpers/esm/wrapRegExp": "./helpers/esm/wrapRegExp.js", + "./helpers/writeOnlyError": [ + { + "node": "./helpers/writeOnlyError.js", + "import": "./helpers/esm/writeOnlyError.js", + "default": "./helpers/writeOnlyError.js" + }, + "./helpers/writeOnlyError.js" + ], + "./helpers/esm/writeOnlyError": "./helpers/esm/writeOnlyError.js", + "./helpers/AwaitValue": [ + { + "node": "./helpers/AwaitValue.js", + "import": "./helpers/esm/AwaitValue.js", + "default": "./helpers/AwaitValue.js" + }, + "./helpers/AwaitValue.js" + ], + "./helpers/esm/AwaitValue": "./helpers/esm/AwaitValue.js", + "./helpers/applyDecs": [ + { + "node": "./helpers/applyDecs.js", + "import": "./helpers/esm/applyDecs.js", + "default": "./helpers/applyDecs.js" + }, + "./helpers/applyDecs.js" + ], + "./helpers/esm/applyDecs": "./helpers/esm/applyDecs.js", + "./helpers/applyDecs2203": [ + { + "node": "./helpers/applyDecs2203.js", + "import": "./helpers/esm/applyDecs2203.js", + "default": "./helpers/applyDecs2203.js" + }, + "./helpers/applyDecs2203.js" + ], + "./helpers/esm/applyDecs2203": "./helpers/esm/applyDecs2203.js", + "./helpers/applyDecs2203R": [ + { + "node": "./helpers/applyDecs2203R.js", + "import": "./helpers/esm/applyDecs2203R.js", + "default": "./helpers/applyDecs2203R.js" + }, + "./helpers/applyDecs2203R.js" + ], + "./helpers/esm/applyDecs2203R": "./helpers/esm/applyDecs2203R.js", + "./helpers/applyDecs2301": [ + { + "node": "./helpers/applyDecs2301.js", + "import": "./helpers/esm/applyDecs2301.js", + "default": "./helpers/applyDecs2301.js" + }, + "./helpers/applyDecs2301.js" + ], + "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", + "./helpers/applyDecs2305": [ + { + "node": "./helpers/applyDecs2305.js", + "import": "./helpers/esm/applyDecs2305.js", + "default": "./helpers/applyDecs2305.js" + }, + "./helpers/applyDecs2305.js" + ], + "./helpers/esm/applyDecs2305": "./helpers/esm/applyDecs2305.js", + "./helpers/classApplyDescriptorDestructureSet": [ + { + "node": "./helpers/classApplyDescriptorDestructureSet.js", + "import": "./helpers/esm/classApplyDescriptorDestructureSet.js", + "default": "./helpers/classApplyDescriptorDestructureSet.js" + }, + "./helpers/classApplyDescriptorDestructureSet.js" + ], + "./helpers/esm/classApplyDescriptorDestructureSet": "./helpers/esm/classApplyDescriptorDestructureSet.js", + "./helpers/classApplyDescriptorGet": [ + { + "node": "./helpers/classApplyDescriptorGet.js", + "import": "./helpers/esm/classApplyDescriptorGet.js", + "default": "./helpers/classApplyDescriptorGet.js" + }, + "./helpers/classApplyDescriptorGet.js" + ], + "./helpers/esm/classApplyDescriptorGet": "./helpers/esm/classApplyDescriptorGet.js", + "./helpers/classApplyDescriptorSet": [ + { + "node": "./helpers/classApplyDescriptorSet.js", + "import": "./helpers/esm/classApplyDescriptorSet.js", + "default": "./helpers/classApplyDescriptorSet.js" + }, + "./helpers/classApplyDescriptorSet.js" + ], + "./helpers/esm/classApplyDescriptorSet": "./helpers/esm/classApplyDescriptorSet.js", + "./helpers/classCheckPrivateStaticAccess": [ + { + "node": "./helpers/classCheckPrivateStaticAccess.js", + "import": "./helpers/esm/classCheckPrivateStaticAccess.js", + "default": "./helpers/classCheckPrivateStaticAccess.js" + }, + "./helpers/classCheckPrivateStaticAccess.js" + ], + "./helpers/esm/classCheckPrivateStaticAccess": "./helpers/esm/classCheckPrivateStaticAccess.js", + "./helpers/classCheckPrivateStaticFieldDescriptor": [ + { + "node": "./helpers/classCheckPrivateStaticFieldDescriptor.js", + "import": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", + "default": "./helpers/classCheckPrivateStaticFieldDescriptor.js" + }, + "./helpers/classCheckPrivateStaticFieldDescriptor.js" + ], + "./helpers/esm/classCheckPrivateStaticFieldDescriptor": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", + "./helpers/classExtractFieldDescriptor": [ + { + "node": "./helpers/classExtractFieldDescriptor.js", + "import": "./helpers/esm/classExtractFieldDescriptor.js", + "default": "./helpers/classExtractFieldDescriptor.js" + }, + "./helpers/classExtractFieldDescriptor.js" + ], + "./helpers/esm/classExtractFieldDescriptor": "./helpers/esm/classExtractFieldDescriptor.js", + "./helpers/classPrivateFieldDestructureSet": [ + { + "node": "./helpers/classPrivateFieldDestructureSet.js", + "import": "./helpers/esm/classPrivateFieldDestructureSet.js", + "default": "./helpers/classPrivateFieldDestructureSet.js" + }, + "./helpers/classPrivateFieldDestructureSet.js" + ], + "./helpers/esm/classPrivateFieldDestructureSet": "./helpers/esm/classPrivateFieldDestructureSet.js", + "./helpers/classPrivateFieldGet": [ + { + "node": "./helpers/classPrivateFieldGet.js", + "import": "./helpers/esm/classPrivateFieldGet.js", + "default": "./helpers/classPrivateFieldGet.js" + }, + "./helpers/classPrivateFieldGet.js" + ], + "./helpers/esm/classPrivateFieldGet": "./helpers/esm/classPrivateFieldGet.js", + "./helpers/classPrivateFieldSet": [ + { + "node": "./helpers/classPrivateFieldSet.js", + "import": "./helpers/esm/classPrivateFieldSet.js", + "default": "./helpers/classPrivateFieldSet.js" + }, + "./helpers/classPrivateFieldSet.js" + ], + "./helpers/esm/classPrivateFieldSet": "./helpers/esm/classPrivateFieldSet.js", + "./helpers/classPrivateMethodGet": [ + { + "node": "./helpers/classPrivateMethodGet.js", + "import": "./helpers/esm/classPrivateMethodGet.js", + "default": "./helpers/classPrivateMethodGet.js" + }, + "./helpers/classPrivateMethodGet.js" + ], + "./helpers/esm/classPrivateMethodGet": "./helpers/esm/classPrivateMethodGet.js", + "./helpers/classPrivateMethodSet": [ + { + "node": "./helpers/classPrivateMethodSet.js", + "import": "./helpers/esm/classPrivateMethodSet.js", + "default": "./helpers/classPrivateMethodSet.js" + }, + "./helpers/classPrivateMethodSet.js" + ], + "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", + "./helpers/classStaticPrivateFieldDestructureSet": [ + { + "node": "./helpers/classStaticPrivateFieldDestructureSet.js", + "import": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", + "default": "./helpers/classStaticPrivateFieldDestructureSet.js" + }, + "./helpers/classStaticPrivateFieldDestructureSet.js" + ], + "./helpers/esm/classStaticPrivateFieldDestructureSet": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", + "./helpers/classStaticPrivateFieldSpecGet": [ + { + "node": "./helpers/classStaticPrivateFieldSpecGet.js", + "import": "./helpers/esm/classStaticPrivateFieldSpecGet.js", + "default": "./helpers/classStaticPrivateFieldSpecGet.js" + }, + "./helpers/classStaticPrivateFieldSpecGet.js" + ], + "./helpers/esm/classStaticPrivateFieldSpecGet": "./helpers/esm/classStaticPrivateFieldSpecGet.js", + "./helpers/classStaticPrivateFieldSpecSet": [ + { + "node": "./helpers/classStaticPrivateFieldSpecSet.js", + "import": "./helpers/esm/classStaticPrivateFieldSpecSet.js", + "default": "./helpers/classStaticPrivateFieldSpecSet.js" + }, + "./helpers/classStaticPrivateFieldSpecSet.js" + ], + "./helpers/esm/classStaticPrivateFieldSpecSet": "./helpers/esm/classStaticPrivateFieldSpecSet.js", + "./helpers/classStaticPrivateMethodSet": [ + { + "node": "./helpers/classStaticPrivateMethodSet.js", + "import": "./helpers/esm/classStaticPrivateMethodSet.js", + "default": "./helpers/classStaticPrivateMethodSet.js" + }, + "./helpers/classStaticPrivateMethodSet.js" + ], + "./helpers/esm/classStaticPrivateMethodSet": "./helpers/esm/classStaticPrivateMethodSet.js", + "./helpers/defineEnumerableProperties": [ + { + "node": "./helpers/defineEnumerableProperties.js", + "import": "./helpers/esm/defineEnumerableProperties.js", + "default": "./helpers/defineEnumerableProperties.js" + }, + "./helpers/defineEnumerableProperties.js" + ], + "./helpers/esm/defineEnumerableProperties": "./helpers/esm/defineEnumerableProperties.js", + "./helpers/dispose": [ + { + "node": "./helpers/dispose.js", + "import": "./helpers/esm/dispose.js", + "default": "./helpers/dispose.js" + }, + "./helpers/dispose.js" + ], + "./helpers/esm/dispose": "./helpers/esm/dispose.js", + "./helpers/objectSpread": [ + { + "node": "./helpers/objectSpread.js", + "import": "./helpers/esm/objectSpread.js", + "default": "./helpers/objectSpread.js" + }, + "./helpers/objectSpread.js" + ], + "./helpers/esm/objectSpread": "./helpers/esm/objectSpread.js", + "./helpers/using": [ + { + "node": "./helpers/using.js", + "import": "./helpers/esm/using.js", + "default": "./helpers/using.js" + }, + "./helpers/using.js" + ], + "./helpers/esm/using": "./helpers/esm/using.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./regenerator": "./regenerator/index.js", + "./regenerator/*.js": "./regenerator/*.js", + "./regenerator/": "./regenerator/" + }, + "engines": { + "node": ">=6.9.0" + }, + "type": "commonjs" +} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/regenerator/index.js b/node_modules/@babel/runtime/regenerator/index.js similarity index 100% rename from project starter code/node_modules/@babel/runtime/regenerator/index.js rename to node_modules/@babel/runtime/regenerator/index.js diff --git a/node_modules/@jimp/bmp/CHANGELOG.md b/node_modules/@jimp/bmp/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/bmp/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/bmp/LICENSE b/node_modules/@jimp/bmp/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/bmp/LICENSE rename to node_modules/@jimp/bmp/LICENSE diff --git a/project starter code/node_modules/@jimp/bmp/README.md b/node_modules/@jimp/bmp/README.md similarity index 100% rename from project starter code/node_modules/@jimp/bmp/README.md rename to node_modules/@jimp/bmp/README.md diff --git a/node_modules/@jimp/bmp/dist/index.js b/node_modules/@jimp/bmp/dist/index.js new file mode 100644 index 00000000..21e16f37 --- /dev/null +++ b/node_modules/@jimp/bmp/dist/index.js @@ -0,0 +1,71 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _bmpJs = _interopRequireDefault(require("bmp-js")); + +var _utils = require("@jimp/utils"); + +var MIME_TYPE = "image/bmp"; +var MIME_TYPE_SECOND = "image/x-ms-bmp"; + +function toAGBR(image) { + return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { + var red = this.bitmap.data[index + 0]; + var green = this.bitmap.data[index + 1]; + var blue = this.bitmap.data[index + 2]; + var alpha = this.bitmap.data[index + 3]; + this.bitmap.data[index + 0] = alpha; + this.bitmap.data[index + 1] = blue; + this.bitmap.data[index + 2] = green; + this.bitmap.data[index + 3] = red; + }).bitmap; +} + +function fromAGBR(bitmap) { + return (0, _utils.scan)({ + bitmap: bitmap + }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { + var alpha = this.bitmap.data[index + 0]; + var blue = this.bitmap.data[index + 1]; + var green = this.bitmap.data[index + 2]; + var red = this.bitmap.data[index + 3]; + this.bitmap.data[index + 0] = red; + this.bitmap.data[index + 1] = green; + this.bitmap.data[index + 2] = blue; + this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; + }).bitmap; +} + +var decode = function decode(data) { + return fromAGBR(_bmpJs["default"].decode(data)); +}; + +var encode = function encode(image) { + return _bmpJs["default"].encode(toAGBR(image)).data; +}; + +var _default = function _default() { + var _decoders, _encoders; + + return { + mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ["bmp"]), + constants: { + MIME_BMP: MIME_TYPE, + MIME_X_MS_BMP: MIME_TYPE_SECOND + }, + decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), + encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/bmp/dist/index.js.map b/node_modules/@jimp/bmp/dist/index.js.map new file mode 100644 index 00000000..efd390ba --- /dev/null +++ b/node_modules/@jimp/bmp/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBACLA,KADK,EAEL,CAFK,EAGL,CAHK,EAILA,KA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TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\n\nfunction toAGBR(image) {\n return scan(\n image,\n 0,\n 0,\n image.bitmap.width,\n image.bitmap.height,\n function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }\n ).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan(\n { bitmap },\n 0,\n 0,\n bitmap.width,\n bitmap.height,\n function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }\n ).bitmap;\n}\n\nconst decode = (data) => fromAGBR(BMP.decode(data));\nconst encode = (image) => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"bmp\"] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND,\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode,\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode,\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/bmp/index.d.ts b/node_modules/@jimp/bmp/index.d.ts new file mode 100644 index 00000000..0a9b9a51 --- /dev/null +++ b/node_modules/@jimp/bmp/index.d.ts @@ -0,0 +1,24 @@ +import { DecoderFn, EncoderFn } from "@jimp/core"; + +interface Bmp { + constants: { + MIME_BMP: "image/bmp"; + MIME_X_MS_BMP: "image/x-ms-bmp"; + }; + + mime: { + "image/bmp": string[]; + }; + + decoders: { + "image/bmp": DecoderFn; + "image/x-ms-bmp": DecoderFn; + }; + + encoders: { + "image/bmp": EncoderFn; + "image/x-ms-bmp": EncoderFn; + }; +} + +export default function (): Bmp; diff --git a/node_modules/@jimp/bmp/package.json b/node_modules/@jimp/bmp/package.json new file mode 100644 index 00000000..d2881dc8 --- /dev/null +++ b/node_modules/@jimp/bmp/package.json @@ -0,0 +1,38 @@ +{ + "name": "@jimp/bmp", + "version": "0.16.13", + "description": "Default Jimp bmp encoder/decoder.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "bmp-js": "^0.1.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/bmp/src/index.js b/node_modules/@jimp/bmp/src/index.js new file mode 100644 index 00000000..12fe2c79 --- /dev/null +++ b/node_modules/@jimp/bmp/src/index.js @@ -0,0 +1,69 @@ +import BMP from "bmp-js"; +import { scan } from "@jimp/utils"; + +const MIME_TYPE = "image/bmp"; +const MIME_TYPE_SECOND = "image/x-ms-bmp"; + +function toAGBR(image) { + return scan( + image, + 0, + 0, + image.bitmap.width, + image.bitmap.height, + function (x, y, index) { + const red = this.bitmap.data[index + 0]; + const green = this.bitmap.data[index + 1]; + const blue = this.bitmap.data[index + 2]; + const alpha = this.bitmap.data[index + 3]; + + this.bitmap.data[index + 0] = alpha; + this.bitmap.data[index + 1] = blue; + this.bitmap.data[index + 2] = green; + this.bitmap.data[index + 3] = red; + } + ).bitmap; +} + +function fromAGBR(bitmap) { + return scan( + { bitmap }, + 0, + 0, + bitmap.width, + bitmap.height, + function (x, y, index) { + const alpha = this.bitmap.data[index + 0]; + const blue = this.bitmap.data[index + 1]; + const green = this.bitmap.data[index + 2]; + const red = this.bitmap.data[index + 3]; + + this.bitmap.data[index + 0] = red; + this.bitmap.data[index + 1] = green; + this.bitmap.data[index + 2] = blue; + this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; + } + ).bitmap; +} + +const decode = (data) => fromAGBR(BMP.decode(data)); +const encode = (image) => BMP.encode(toAGBR(image)).data; + +export default () => ({ + mime: { [MIME_TYPE]: ["bmp"] }, + + constants: { + MIME_BMP: MIME_TYPE, + MIME_X_MS_BMP: MIME_TYPE_SECOND, + }, + + decoders: { + [MIME_TYPE]: decode, + [MIME_TYPE_SECOND]: decode, + }, + + encoders: { + [MIME_TYPE]: encode, + [MIME_TYPE_SECOND]: encode, + }, +}); diff --git a/node_modules/@jimp/bmp/test/bmp.test.js b/node_modules/@jimp/bmp/test/bmp.test.js new file mode 100644 index 00000000..c72536ee --- /dev/null +++ b/node_modules/@jimp/bmp/test/bmp.test.js @@ -0,0 +1,47 @@ +/* eslint-disable no-control-regex */ + +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import bmp from "../src"; + +const jimp = configure({ types: [bmp] }, Jimp); + +describe("BMP", () => { + const imagesDir = getTestDir(__dirname) + "/images"; + + it("load BMP", async () => { + const image = await jimp.read(imagesDir + "/windows95.bmp"); + + image.getPixelColor(10, 10).should.be.equal(0xeff7f7ff); + image.getPixelColor(150, 80).should.be.equal(0x73add6ff); + image.getPixelColor(190, 200).should.be.equal(0xf7c300ff); + }); + + it("export BMP", async () => { + const image = await jimp.read({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + const buffer = await image.getBufferAsync("image/bmp"); + + buffer.toString().should.match(/^BMZ\u0000/); + }); + + it("uses correct colors for BMP", async function () { + this.timeout(4000); + + const expectedImg = await jimp.read( + getTestDir(__dirname) + "/images/windows95.png" + ); + const image = await jimp.read( + getTestDir(__dirname) + "/images/windows95.bmp" + ); + + image.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); +}); diff --git a/project starter code/node_modules/@jimp/bmp/test/images/windows95.bmp b/node_modules/@jimp/bmp/test/images/windows95.bmp similarity index 100% rename from project starter code/node_modules/@jimp/bmp/test/images/windows95.bmp rename to node_modules/@jimp/bmp/test/images/windows95.bmp diff --git a/project starter code/node_modules/@jimp/bmp/test/images/windows95.png b/node_modules/@jimp/bmp/test/images/windows95.png similarity index 100% rename from project starter code/node_modules/@jimp/bmp/test/images/windows95.png rename to node_modules/@jimp/bmp/test/images/windows95.png diff --git a/node_modules/@jimp/core/CHANGELOG.md b/node_modules/@jimp/core/CHANGELOG.md new file mode 100644 index 00000000..d709b828 --- /dev/null +++ b/node_modules/@jimp/core/CHANGELOG.md @@ -0,0 +1,104 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Fix edgeHandling types [#1080](https://github.com/jimp-dev/jimp/pull/1080) ([@domdomegg](https://github.com/domdomegg)) +- upgrade file-type [#1108](https://github.com/jimp-dev/jimp/pull/1108) ([@krudos](https://github.com/krudos)) + +#### ⚠️ Pushed to `master` + +- try this ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 3 + +- [@krudos](https://github.com/krudos) +- Adam Jones ([@domdomegg](https://github.com/domdomegg)) +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.14.0 (Mon Jun 29 2020) + +#### 🚀 Enhancement + +- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) + +#### Authors: 1 + +- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### 🐛 Bug Fix + +- Make callback optional for Jimp.rgbaToInt [#889](https://github.com/oliver-moran/jimp/pull/889) ([@HanKruiger](https://github.com/HanKruiger)) + +#### Authors: 2 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) +- Han Kruiger ([@HanKruiger](https://github.com/HanKruiger)) + +--- + +# v0.10.2 (Tue Apr 14 2020) + +#### 🐛 Bug Fix + +- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee)) + +#### Authors: 1 + +- Sebastian Skałacki ([@skalee](https://github.com/skalee)) + +--- + +# v0.10.0 (Mon Mar 30 2020) + +#### 🚀 Enhancement + +- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) + +#### Authors: 1 + +- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) + +--- + +# v0.9.6 (Wed Mar 18 2020) + +#### 🐛 Bug Fix + +- Relax mkdirp dependency to allow newer minimist [#857](https://github.com/oliver-moran/jimp/pull/857) ([@Den-dp](https://github.com/Den-dp)) + +#### 🏠 Internal + +- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) + +#### Authors: 2 + +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) +- Denis Bendrikov ([@Den-dp](https://github.com/Den-dp)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) +- `@jimp/core` + - Follow redirects [#789](https://github.com/oliver-moran/jimp/pull/789) ([@SaWey](https://github.com/SaWey) sander@solora.be) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/core/LICENSE b/node_modules/@jimp/core/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/core/LICENSE rename to node_modules/@jimp/core/LICENSE diff --git a/node_modules/@jimp/core/README.md b/node_modules/@jimp/core/README.md new file mode 100644 index 00000000..4ca355ff --- /dev/null +++ b/node_modules/@jimp/core/README.md @@ -0,0 +1,52 @@ +
+ +

@jimp/core

+
+ +The main Jimp class. This class can be extended with types and bitmap manipulation functions. Out of the box it does not support any image type. + +## Available Methods + +### Jimp + +The Jimp class constructor. + +### addConstants + +Add constant or static methods to the Jimp constructor. + +```js +addConstants({ + MIME_SPECIAL: "image/special", +}); +``` + +### addJimpMethods + +Add a bitmap manipulation method to Jimp constructor. These method should return this so that the function can be chain-able. + +```js +addJimpMethods({ + cropCrazy: function() { + // Your custom image manipulation method + + return this; + } +}) + +const image = await Jimp.read(...); + +image.resize(10, Jimp.AUTO), + .cropCrazy(); + +await image.writeAsync('test.png'); +``` + +### addType + +Add a image mime type to Jimp constructor. First argument is a mime type and the second is an array of file extension for that type. + +```js +addType("image/special", ["spec", "special"]); +``` diff --git a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js b/node_modules/@jimp/core/dist/composite/composite-modes.js similarity index 100% rename from project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js rename to node_modules/@jimp/core/dist/composite/composite-modes.js diff --git a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map b/node_modules/@jimp/core/dist/composite/composite-modes.js.map similarity index 100% rename from project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map rename to node_modules/@jimp/core/dist/composite/composite-modes.js.map diff --git a/node_modules/@jimp/core/dist/composite/index.js b/node_modules/@jimp/core/dist/composite/index.js new file mode 100644 index 00000000..a308d8de --- /dev/null +++ b/node_modules/@jimp/core/dist/composite/index.js @@ -0,0 +1,97 @@ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = composite; + +var _utils = require("@jimp/utils"); + +var constants = _interopRequireWildcard(require("../constants")); + +var compositeModes = _interopRequireWildcard(require("./composite-modes")); + +/** + * Composites a source image over to this image respecting alpha channels + * @param {Jimp} src the source Jimp instance + * @param {number} x the x position to blit the image + * @param {number} y the y position to blit the image + * @param {object} options determine what mode to use + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +function composite(src, x, y) { + var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var cb = arguments.length > 4 ? arguments[4] : undefined; + + if (typeof options === "function") { + cb = options; + options = {}; + } + + if (!(src instanceof this.constructor)) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } + + var _options = options, + mode = _options.mode, + opacitySource = _options.opacitySource, + opacityDest = _options.opacityDest; + + if (!mode) { + mode = constants.BLEND_SOURCE_OVER; + } + + if (typeof opacitySource !== "number" || opacitySource < 0 || opacitySource > 1) { + opacitySource = 1.0; + } + + if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) { + opacityDest = 1.0; + } // eslint-disable-next-line import/namespace + + + var blendmode = compositeModes[mode]; // round input + + x = Math.round(x); + y = Math.round(y); + var baseImage = this; + + if (opacityDest !== 1.0) { + baseImage.opacity(opacityDest); + } + + src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { + var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); + var blended = blendmode({ + r: this.bitmap.data[idx + 0] / 255, + g: this.bitmap.data[idx + 1] / 255, + b: this.bitmap.data[idx + 2] / 255, + a: this.bitmap.data[idx + 3] / 255 + }, { + r: baseImage.bitmap.data[dstIdx + 0] / 255, + g: baseImage.bitmap.data[dstIdx + 1] / 255, + b: baseImage.bitmap.data[dstIdx + 2] / 255, + a: baseImage.bitmap.data[dstIdx + 3] / 255 + }, opacitySource); + baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(blended.r * 255); + baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(blended.g * 255); + baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); + baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; +} + +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/composite/index.js.map b/node_modules/@jimp/core/dist/composite/index.js.map new file mode 100644 index 00000000..f55a3748 --- /dev/null +++ b/node_modules/@jimp/core/dist/composite/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,SAAT,CAAmBC,GAAnB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAAgD;AAAA,MAAlBC,OAAkB,uEAAR,EAAQ;AAAA,MAAJC,EAAI;;AAC7D,MAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,IAAAA,EAAE,GAAGD,OAAL;AACAA,IAAAA,OAAO,GAAG,EAAV;AACD;;AAED,MAAI,EAAEH,GAAG,YAAY,KAAKK,WAAtB,CAAJ,EAAwC;AACtC,WAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,MAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,WAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAZ4D,iBAclBD,OAdkB;AAAA,MAcvDK,IAduD,YAcvDA,IAduD;AAAA,MAcjDC,aAdiD,YAcjDA,aAdiD;AAAA,MAclCC,WAdkC,YAclCA,WAdkC;;AAgB7D,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AKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACK,CAAR,GAAY,GADsB,CAApC;AAGD,GAvCH;;AA0CA,MAAI,0BAAc9B,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\n\nimport * as compositeModes from \"./composite-modes\";\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== \"number\" ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== \"number\" || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n // eslint-disable-next-line import/namespace\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const dstIdx = baseImage.getPixelIndex(\n x + sx,\n y + sy,\n constants.EDGE_CROP\n );\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255,\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255,\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/constants.js b/node_modules/@jimp/core/dist/constants.js new file mode 100644 index 00000000..0c0c8522 --- /dev/null +++ b/node_modules/@jimp/core/dist/constants.js @@ -0,0 +1,53 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; +// used to auto resizing etc. +var AUTO = -1; // Align modes for cover, contain, bit masks + +exports.AUTO = AUTO; +var HORIZONTAL_ALIGN_LEFT = 1; +exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; +var HORIZONTAL_ALIGN_CENTER = 2; +exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; +var HORIZONTAL_ALIGN_RIGHT = 4; +exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; +var VERTICAL_ALIGN_TOP = 8; +exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; +var VERTICAL_ALIGN_MIDDLE = 16; +exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; +var VERTICAL_ALIGN_BOTTOM = 32; // blend modes + +exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; +var BLEND_SOURCE_OVER = "srcOver"; +exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; +var BLEND_DESTINATION_OVER = "dstOver"; +exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; +var BLEND_MULTIPLY = "multiply"; +exports.BLEND_MULTIPLY = BLEND_MULTIPLY; +var BLEND_ADD = "add"; +exports.BLEND_ADD = BLEND_ADD; +var BLEND_SCREEN = "screen"; +exports.BLEND_SCREEN = BLEND_SCREEN; +var BLEND_OVERLAY = "overlay"; +exports.BLEND_OVERLAY = BLEND_OVERLAY; +var BLEND_DARKEN = "darken"; +exports.BLEND_DARKEN = BLEND_DARKEN; +var BLEND_LIGHTEN = "lighten"; +exports.BLEND_LIGHTEN = BLEND_LIGHTEN; +var BLEND_HARDLIGHT = "hardLight"; +exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; +var BLEND_DIFFERENCE = "difference"; +exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; +var BLEND_EXCLUSION = "exclusion"; // Edge Handling + +exports.BLEND_EXCLUSION = BLEND_EXCLUSION; +var EDGE_EXTEND = 1; +exports.EDGE_EXTEND = EDGE_EXTEND; +var EDGE_WRAP = 2; +exports.EDGE_WRAP = EDGE_WRAP; +var EDGE_CROP = 3; +exports.EDGE_CROP = EDGE_CROP; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/constants.js.map b/node_modules/@jimp/core/dist/constants.js.map new file mode 100644 index 00000000..b9b18e6d --- /dev/null +++ b/node_modules/@jimp/core/dist/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = \"srcOver\";\nexport const BLEND_DESTINATION_OVER = \"dstOver\";\nexport const BLEND_MULTIPLY = \"multiply\";\nexport const BLEND_ADD = \"add\";\nexport const BLEND_SCREEN = \"screen\";\nexport const BLEND_OVERLAY = \"overlay\";\nexport const BLEND_DARKEN = \"darken\";\nexport const BLEND_LIGHTEN = \"lighten\";\nexport const BLEND_HARDLIGHT = \"hardLight\";\nexport const BLEND_DIFFERENCE = \"difference\";\nexport const BLEND_EXCLUSION = \"exclusion\";\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/index.js b/node_modules/@jimp/core/dist/index.js new file mode 100644 index 00000000..34f87fdd --- /dev/null +++ b/node_modules/@jimp/core/dist/index.js @@ -0,0 +1,1292 @@ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.addConstants = addConstants; +exports.addJimpMethods = addJimpMethods; +exports.jimpEvMethod = jimpEvMethod; +exports.jimpEvChange = jimpEvChange; +Object.defineProperty(exports, "addType", { + enumerable: true, + get: function get() { + return MIME.addType; + } +}); +exports["default"] = void 0; + +var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); + +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); + +var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); + +var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); + +var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); + +var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); + +var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _fs = _interopRequireDefault(require("fs")); + +var _path = _interopRequireDefault(require("path")); + +var _events = _interopRequireDefault(require("events")); + +var _utils = require("@jimp/utils"); + +var _anyBase = _interopRequireDefault(require("any-base")); + +var _mkdirp = _interopRequireDefault(require("mkdirp")); + +var _pixelmatch = _interopRequireDefault(require("pixelmatch")); + +var _tinycolor = _interopRequireDefault(require("tinycolor2")); + +var _phash = _interopRequireDefault(require("./modules/phash")); + +var _request = _interopRequireDefault(require("./request")); + +var _composite = _interopRequireDefault(require("./composite")); + +var _promisify = _interopRequireDefault(require("./utils/promisify")); + +var MIME = _interopRequireWildcard(require("./utils/mime")); + +var _imageBitmap = require("./utils/image-bitmap"); + +var constants = _interopRequireWildcard(require("./constants")); + +var alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; // an array storing the maximum string length of hashes at various bases +// 0 and 1 do not exist as possible hash lengths + +var maxHashLength = [NaN, NaN]; + +for (var i = 2; i < 65; i++) { + var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1")); + maxHashLength.push(maxHash.length); +} // no operation + + +function noop() {} // error checking methods + + +function isArrayBuffer(test) { + return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1; +} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, +// But this function is not useful when running in node directly + + +function bufferFromArrayBuffer(arrayBuffer) { + var buffer = Buffer.alloc(arrayBuffer.byteLength); + var view = new Uint8Array(arrayBuffer); + + for (var _i = 0; _i < buffer.length; ++_i) { + buffer[_i] = view[_i]; + } + + return buffer; +} + +function loadFromURL(options, cb) { + (0, _request["default"])(options, function (err, response, data) { + if (err) { + return cb(err); + } + + if ("headers" in response && "location" in response.headers) { + options.url = response.headers.location; + return loadFromURL(options, cb); + } + + if ((0, _typeof2["default"])(data) === "object" && Buffer.isBuffer(data)) { + return cb(null, data); + } + + var msg = "Could not load Buffer from <" + options.url + "> " + "(HTTP: " + response.statusCode + ")"; + return new Error(msg); + }); +} + +function loadBufferFromPath(src, cb) { + if (_fs["default"] && typeof _fs["default"].readFile === "function" && !src.match(/^(http|ftp)s?:\/\/./)) { + _fs["default"].readFile(src, cb); + } else { + loadFromURL({ + url: src + }, cb); + } +} + +function isRawRGBAData(obj) { + return obj && (0, _typeof2["default"])(obj) === "object" && typeof obj.width === "number" && typeof obj.height === "number" && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === "function" && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); +} + +function makeRGBABufferFromRGB(buffer) { + if (buffer.length % 3 !== 0) { + throw new Error("Buffer length is incorrect"); + } + + var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); + var j = 0; + + for (var _i2 = 0; _i2 < buffer.length; _i2++) { + rgbaBuffer[j] = buffer[_i2]; + + if ((_i2 + 1) % 3 === 0) { + rgbaBuffer[++j] = 255; + } + + j++; + } + + return rgbaBuffer; +} + +var emptyBitmap = { + data: null, + width: null, + height: null +}; +/** + * Jimp constructor (from a file) + * @param path a path to the image + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap + */ + +/** + * Jimp constructor (from a url with options) + * @param options { url, otherOptions} + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap + */ + +/** + * Jimp constructor (from another Jimp image or raw image data) + * @param image a Jimp image to clone + * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap + */ + +/** + * Jimp constructor (from a Buffer) + * @param data a Buffer containing the image data + * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap + */ + +/** + * Jimp constructor (to generate a new image) + * @param w the width of the image + * @param h the height of the image + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap + */ + +/** + * Jimp constructor (to generate a new image) + * @param w the width of the image + * @param h the height of the image + * @param background color to fill the image with + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap + */ + +var Jimp = +/*#__PURE__*/ +function (_EventEmitter) { + (0, _inherits2["default"])(Jimp, _EventEmitter); + + // An object representing a bitmap in memory, comprising: + // - data: a buffer of the bitmap data + // - width: the width of the image in pixels + // - height: the height of the image in pixels + // Default colour to use for new pixels + // Default MIME is PNG + // Exif data for the image + // Whether Transparency supporting formats will be exported as RGB or RGBA + function Jimp() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + (0, _classCallCheck2["default"])(this, Jimp); + _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { + return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); + }); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { + return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); + }); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); + (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); + var jimpInstance = (0, _assertThisInitialized2["default"])(_this); + var cb = noop; + + if (isArrayBuffer(args[0])) { + args[0] = bufferFromArrayBuffer(args[0]); + } + + function finish() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + var err = args[0]; + var evData = err || {}; + evData.methodName = "constructor"; + setTimeout(function () { + var _cb; + + // run on next tick. + if (err && cb === noop) { + jimpInstance.emitError("constructor", err); + } else if (!err) { + jimpInstance.emitMulti("constructor", "initialized"); + } + + (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); + }, 1); + } + + if (typeof args[0] === "number" && typeof args[1] === "number" || parseInt(args[0], 10) && parseInt(args[1], 10)) { + // create a new image + var w = parseInt(args[0], 10); + var h = parseInt(args[1], 10); + cb = args[2]; // with a hex color + + if (typeof args[2] === "number") { + _this._background = args[2]; + cb = args[3]; + } // with a css color + + + if (typeof args[2] === "string") { + _this._background = Jimp.cssColorToHex(args[2]); + cb = args[3]; + } + + if (typeof cb === "undefined") { + cb = noop; + } + + if (typeof cb !== "function") { + return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "cb must be a function", finish)); + } + + _this.bitmap = { + data: Buffer.alloc(w * h * 4), + width: w, + height: h + }; + + for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { + _this.bitmap.data.writeUInt32BE(_this._background, _i3); + } + + finish(null, (0, _assertThisInitialized2["default"])(_this)); + } else if ((0, _typeof2["default"])(args[0]) === "object" && args[0].url) { + cb = args[1] || noop; + + if (typeof cb !== "function") { + return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "cb must be a function", finish)); + } + + loadFromURL(args[0], function (err, data) { + if (err) { + return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); + } + + _this.parseBitmap(data, args[0].url, finish); + }); + } else if (args[0] instanceof Jimp) { + // clone an existing Jimp + var original = args[0]; + cb = args[1]; + + if (typeof cb === "undefined") { + cb = noop; + } + + if (typeof cb !== "function") { + return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "cb must be a function", finish)); + } + + _this.bitmap = { + data: Buffer.from(original.bitmap.data), + width: original.bitmap.width, + height: original.bitmap.height + }; + _this._quality = original._quality; + _this._deflateLevel = original._deflateLevel; + _this._deflateStrategy = original._deflateStrategy; + _this._filterType = original._filterType; + _this._rgba = original._rgba; + _this._background = original._background; + _this._originalMime = original._originalMime; + finish(null, (0, _assertThisInitialized2["default"])(_this)); + } else if (isRawRGBAData(args[0])) { + var imageData = args[0]; + cb = args[1] || noop; + var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; + var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); + _this.bitmap = { + data: buffer, + width: imageData.width, + height: imageData.height + }; + finish(null, (0, _assertThisInitialized2["default"])(_this)); + } else if (typeof args[0] === "string") { + // read from a path + var path = args[0]; + cb = args[1]; + + if (typeof cb === "undefined") { + cb = noop; + } + + if (typeof cb !== "function") { + return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "cb must be a function", finish)); + } + + loadBufferFromPath(path, function (err, data) { + if (err) { + return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); + } + + _this.parseBitmap(data, path, finish); + }); + } else if ((0, _typeof2["default"])(args[0]) === "object" && Buffer.isBuffer(args[0])) { + // read from a buffer + var data = args[0]; + cb = args[1]; + + if (typeof cb !== "function") { + return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "cb must be a function", finish)); + } + + _this.parseBitmap(data, null, finish); + } else { + // Allow client libs to add new ways to build a Jimp object. + // Extra constructors must be added by `Jimp.appendConstructorOption()` + cb = args[args.length - 1]; + + if (typeof cb !== "function") { + // TODO: try to solve the args after cb problem. + cb = args[args.length - 2]; + + if (typeof cb !== "function") { + cb = noop; + } + } + + var extraConstructor = Jimp.__extraConstructors.find(function (c) { + return c.test.apply(c, args); + }); + + if (extraConstructor) { + new Promise(function (resolve, reject) { + var _extraConstructor$run; + + (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); + }).then(function () { + return finish(null, (0, _assertThisInitialized2["default"])(_this)); + })["catch"](finish); + } else { + return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "No matching constructor overloading was found. " + "Please see the docs for how to call the Jimp constructor.", finish)); + } + } + + return _this; + } + /** + * Parse a bitmap with the loaded image types. + * + * @param {Buffer} data raw image data + * @param {string} path optional path to file + * @param {function(Error, Jimp)} finish (optional) a callback for when complete + * @memberof Jimp + */ + + + (0, _createClass2["default"])(Jimp, [{ + key: "parseBitmap", + value: function parseBitmap(data, path, finish) { + _imageBitmap.parseBitmap.call(this, data, null, finish); + } + /** + * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) + * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + + }, { + key: "rgba", + value: function rgba(bool, cb) { + if (typeof bool !== "boolean") { + return _utils.throwError.call(this, "bool must be a boolean, true for RGBA or false for RGB", cb); + } + + this._rgba = bool; + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + /** + * Emit for multiple listeners + * @param {string} methodName name of the method to emit an error for + * @param {string} eventName name of the eventName to emit an error for + * @param {object} data to emit + */ + + }, { + key: "emitMulti", + value: function emitMulti(methodName, eventName) { + var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + data = Object.assign(data, { + methodName: methodName, + eventName: eventName + }); + this.emit("any", data); + + if (methodName) { + this.emit(methodName, data); + } + + this.emit(eventName, data); + } + }, { + key: "emitError", + value: function emitError(methodName, err) { + this.emitMulti(methodName, "error", err); + } + /** + * Get the current height of the image + * @return {number} height of the image + */ + + }, { + key: "getHeight", + value: function getHeight() { + return this.bitmap.height; + } + /** + * Get the current width of the image + * @return {number} width of the image + */ + + }, { + key: "getWidth", + value: function getWidth() { + return this.bitmap.width; + } + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns {string} pretty printed + */ + + }, { + key: "inspect", + value: function inspect() { + return ""; + } + /** + * Nicely format Jimp object when converted to a string + * @returns {string} pretty printed + */ + + }, { + key: "toString", + value: function toString() { + return "[object Jimp]"; + } + /** + * Returns the original MIME of the image (default: "image/png") + * @returns {string} the MIME + */ + + }, { + key: "getMIME", + value: function getMIME() { + var mime = this._originalMime || Jimp.MIME_PNG; + return mime; + } + /** + * Returns the appropriate file extension for the original MIME of the image (default: "png") + * @returns {string} the file extension + */ + + }, { + key: "getExtension", + value: function getExtension() { + var mime = this.getMIME(); + return MIME.getExtension(mime); + } + /** + * Writes the image to a file + * @param {string} path a path to the destination file + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk + * @returns {Jimp} this for chaining of methods + */ + + }, { + key: "write", + value: function write(path, cb) { + var _this2 = this; + + if (!_fs["default"] || !_fs["default"].createWriteStream) { + throw new Error("Cant access the filesystem. You can use the getBase64 method."); + } + + if (typeof path !== "string") { + return _utils.throwError.call(this, "path must be a string", cb); + } + + if (typeof cb === "undefined") { + cb = noop; + } + + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", cb); + } + + var mime = MIME.getType(path) || this.getMIME(); + + var pathObj = _path["default"].parse(path); + + if (pathObj.dir) { + _mkdirp["default"].sync(pathObj.dir); + } + + this.getBuffer(mime, function (err, buffer) { + if (err) { + return _utils.throwError.call(_this2, err, cb); + } + + var stream = _fs["default"].createWriteStream(path); + + stream.on("open", function () { + stream.write(buffer); + stream.end(); + }).on("error", function (err) { + return _utils.throwError.call(_this2, err, cb); + }); + stream.on("finish", function () { + cb.call(_this2, null, _this2); + }); + }); + return this; + } + }, { + key: "getBase64", + + /** + * Converts the image to a base 64 string + * @param {string} mime the mime type of the image data to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ + value: function getBase64(mime, cb) { + if (mime === Jimp.AUTO) { + // allow auto MIME detection + mime = this.getMIME(); + } + + if (typeof mime !== "string") { + return _utils.throwError.call(this, "mime must be a string", cb); + } + + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", cb); + } + + this.getBuffer(mime, function (err, data) { + if (err) { + return _utils.throwError.call(this, err, cb); + } + + var src = "data:" + mime + ";base64," + data.toString("base64"); + cb.call(this, null, src); + }); + return this; + } + }, { + key: "hash", + + /** + * Generates a perceptual hash of the image . And pads the string. Can configure base. + * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {string} a string representing the hash + */ + value: function hash(base, cb) { + base = base || 64; + + if (typeof base === "function") { + cb = base; + base = 64; + } + + if (typeof base !== "number") { + return _utils.throwError.call(this, "base must be a number", cb); + } + + if (base < 2 || base > 64) { + return _utils.throwError.call(this, "base must be a number between 2 and 64", cb); + } + + var hash = this.pHash(); + hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); + + while (hash.length < maxHashLength[base]) { + hash = "0" + hash; // pad out with leading zeros + } + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, hash); + } + + return hash; + } + /** + * Calculates the perceptual hash + * @returns {number} the perceptual hash + */ + + }, { + key: "pHash", + value: function pHash() { + var pHash = new _phash["default"](); + return pHash.getHash(this); + } + /** + * Calculates the hamming distance of the current image and a hash based on their perceptual hash + * @param {hash} compareHash hash to compare to + * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical + */ + + }, { + key: "distanceFromHash", + value: function distanceFromHash(compareHash) { + var pHash = new _phash["default"](); + var currentHash = pHash.getHash(this); + return pHash.distance(currentHash, compareHash); + } + /** + * Converts the image to a buffer + * @param {string} mime the mime type of the image buffer to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ + + }, { + key: "getPixelIndex", + + /** + * Returns the offset of a pixel in the bitmap buffer + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {number} cb (optional) a callback for when complete + * @returns {number} the index of the pixel or -1 if not found + */ + value: function getPixelIndex(x, y, edgeHandling, cb) { + var xi; + var yi; + + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + + if (!edgeHandling) { + edgeHandling = Jimp.EDGE_EXTEND; + } + + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } // round input + + + x = Math.round(x); + y = Math.round(y); + xi = x; + yi = y; + + if (edgeHandling === Jimp.EDGE_EXTEND) { + if (x < 0) xi = 0; + if (x >= this.bitmap.width) xi = this.bitmap.width - 1; + if (y < 0) yi = 0; + if (y >= this.bitmap.height) yi = this.bitmap.height - 1; + } + + if (edgeHandling === Jimp.EDGE_WRAP) { + if (x < 0) { + xi = this.bitmap.width + x; + } + + if (x >= this.bitmap.width) { + xi = x % this.bitmap.width; + } + + if (y < 0) { + xi = this.bitmap.height + y; + } + + if (y >= this.bitmap.height) { + yi = y % this.bitmap.height; + } + } + + var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 + + if (xi < 0 || xi >= this.bitmap.width) { + i = -1; + } + + if (yi < 0 || yi >= this.bitmap.height) { + i = -1; + } + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, i); + } + + return i; + } + /** + * Returns the hex colour value of a pixel + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {number} the color of the pixel + */ + + }, { + key: "getPixelColor", + value: function getPixelColor(x, y, cb) { + if (typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "x and y must be numbers", cb); // round input + + x = Math.round(x); + y = Math.round(y); + var idx = this.getPixelIndex(x, y); + var hex = this.bitmap.data.readUInt32BE(idx); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, hex); + } + + return hex; + } + }, { + key: "setPixelColor", + + /** + * Returns the hex colour value of a pixel + * @param {number} hex color to set + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {number} the index of the pixel or -1 if not found + */ + value: function setPixelColor(hex, x, y, cb) { + if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "hex, x and y must be numbers", cb); // round input + + x = Math.round(x); + y = Math.round(y); + var idx = this.getPixelIndex(x, y); + this.bitmap.data.writeUInt32BE(hex, idx); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }, { + key: "hasAlpha", + + /** + * Determine if the image contains opaque pixels. + * @return {boolean} hasAlpha whether the image contains opaque pixels + */ + value: function hasAlpha() { + for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { + for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { + var idx = this.bitmap.width * yIndex + xIndex << 2; + var alpha = this.bitmap.data[idx + 3]; + + if (alpha !== 0xff) { + return true; + } + } + } + + return false; + } + /** + * Iterate scan through a region of the bitmap + * @param {number} x the x coordinate to begin the scan at + * @param {number} y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} + */ + + }, { + key: "scanIterator", + value: function scanIterator(x, y, w, h) { + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers"); + } + + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers"); + } + + return (0, _utils.scanIterator)(this, x, y, w, h); + } + }]); + return Jimp; +}(_events["default"]); + +function addConstants(constants) { + var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + Object.entries(constants).forEach(function (_ref) { + var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), + name = _ref2[0], + value = _ref2[1]; + + jimpInstance[name] = value; + }); +} + +function addJimpMethods(methods) { + var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + Object.entries(methods).forEach(function (_ref3) { + var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), + name = _ref4[0], + value = _ref4[1]; + + jimpInstance.prototype[name] = value; + }); +} + +addConstants(constants); +addJimpMethods({ + composite: _composite["default"] +}); +Jimp.__extraConstructors = []; +/** + * Allow client libs to add new ways to build a Jimp object. + * @param {string} name identify the extra constructor. + * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. + * @param {function} run where the magic happens. + */ + +Jimp.appendConstructorOption = function (name, test, run) { + Jimp.__extraConstructors.push({ + name: name, + test: test, + run: run + }); +}; +/** + * Read an image from a file or a Buffer. Takes the same args as the constructor + * @returns {Promise} a promise + */ + + +Jimp.read = function () { + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return new Promise(function (resolve, reject) { + // eslint-disable-next-line no-new + (0, _construct2["default"])(Jimp, args.concat([function (err, image) { + if (err) reject(err);else resolve(image); + }])); + }); +}; + +Jimp.create = Jimp.read; +/** + * A static helper method that converts RGBA values to a single integer value + * @param {number} r the red value (0-255) + * @param {number} g the green value (0-255) + * @param {number} b the blue value (0-255) + * @param {number} a the alpha value (0-255) + * @param {function(Error, Jimp)} cb (optional) A callback for when complete + * @returns {number} an single integer colour value + */ + +Jimp.rgbaToInt = function (r, g, b, a, cb) { + if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number" || typeof a !== "number") { + return _utils.throwError.call(this, "r, g, b and a must be numbers", cb); + } + + if (r < 0 || r > 255) { + return _utils.throwError.call(this, "r must be between 0 and 255", cb); + } + + if (g < 0 || g > 255) { + _utils.throwError.call(this, "g must be between 0 and 255", cb); + } + + if (b < 0 || b > 255) { + return _utils.throwError.call(this, "b must be between 0 and 255", cb); + } + + if (a < 0 || a > 255) { + return _utils.throwError.call(this, "a must be between 0 and 255", cb); + } + + r = Math.round(r); + b = Math.round(b); + g = Math.round(g); + a = Math.round(a); + var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, i); + } + + return i; +}; +/** + * A static helper method that converts RGBA values to a single integer value + * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) + * @param {function(Error, Jimp)} cb (optional) A callback for when complete + * @returns {object} an object with the properties r, g, b and a representing RGBA values + */ + + +Jimp.intToRGBA = function (i, cb) { + if (typeof i !== "number") { + return _utils.throwError.call(this, "i must be a number", cb); + } + + var rgba = {}; + rgba.r = Math.floor(i / Math.pow(256, 3)); + rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); + rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); + rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, rgba); + } + + return rgba; +}; +/** + * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number + * @param {string} cssColor a number + * @returns {number} a hex number representing a color + */ + + +Jimp.cssColorToHex = function (cssColor) { + cssColor = cssColor || 0; // 0, null, undefined, NaN + + if (typeof cssColor === "number") return Number(cssColor); + return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); +}; +/** + * Limits a number to between 0 or 255 + * @param {number} n a number + * @returns {number} the number limited to between 0 or 255 + */ + + +Jimp.limit255 = function (n) { + n = Math.max(n, 0); + n = Math.min(n, 255); + return n; +}; +/** + * Diffs two images and returns + * @param {Jimp} img1 a Jimp image to compare + * @param {Jimp} img2 a Jimp image to compare + * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) + * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } + */ + + +Jimp.diff = function (img1, img2) { + var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; + if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, "img1 and img2 must be an Jimp images"); + var bmp1 = img1.bitmap; + var bmp2 = img2.bitmap; + + if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { + if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { + // img1 is bigger + img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height); + } else { + // img2 is bigger (or they are the same in area) + img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); + } + } + + if (typeof threshold !== "number" || threshold < 0 || threshold > 1) { + return _utils.throwError.call(this, "threshold must be a number between 0 and 1"); + } + + var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); + var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { + threshold: threshold + }); + return { + percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), + image: diff + }; +}; +/** + * Calculates the hamming distance of two images based on their perceptual hash + * @param {Jimp} img1 a Jimp image to compare + * @param {Jimp} img2 a Jimp image to compare + * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical + */ + + +Jimp.distance = function (img1, img2) { + var phash = new _phash["default"](); + var hash1 = phash.getHash(img1); + var hash2 = phash.getHash(img2); + return phash.distance(hash1, hash2); +}; +/** + * Calculates the hamming distance of two images based on their perceptual hash + * @param {hash} hash1 a pHash + * @param {hash} hash2 a pHash + * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical + */ + + +Jimp.compareHashes = function (hash1, hash2) { + var phash = new _phash["default"](); + return phash.distance(hash1, hash2); +}; +/** + * Compute color difference + * 0 means no difference, 1 means maximum difference. + * @param {number} rgba1: first color to compare. + * @param {number} rgba2: second color to compare. + * Both parameters must be an color object {r:val, g:val, b:val, a:val} + * Where `a` is optional and `val` is an integer between 0 and 255. + * @returns {number} float between 0 and 1. + */ + + +Jimp.colorDiff = function (rgba1, rgba2) { + var pow = function pow(n) { + return Math.pow(n, 2); + }; + + var max = Math.max; + var maxVal = 255 * 255 * 3; + + if (rgba1.a !== 0 && !rgba1.a) { + rgba1.a = 255; + } + + if (rgba2.a !== 0 && !rgba2.a) { + rgba2.a = 255; + } + + return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; +}; +/** + * Helper to create Jimp methods that emit events before and after its execution. + * @param {string} methodName The name to be appended to Jimp prototype. + * @param {string} evName The event name to be called. + * It will be prefixed by `before-` and emitted when on method call. + * It will be appended by `ed` and emitted after the method run. + * @param {function} method A function implementing the method itself. + * It will also create a quiet version that will not emit events, to not + * mess the user code with many `changed` event calls. You can call with + * `methodName + "Quiet"`. + * + * The emitted event comes with a object parameter to the listener with the + * `methodName` as one attribute. + */ + + +function jimpEvMethod(methodName, evName, method) { + var evNameBefore = "before-" + evName; + var evNameAfter = evName.replace(/e$/, "") + "ed"; + + Jimp.prototype[methodName] = function () { + var wrappedCb; + + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + var cb = args[method.length - 1]; + var jimpInstance = this; + + if (typeof cb === "function") { + wrappedCb = function wrappedCb() { + for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + + var err = args[0], + data = args[1]; + + if (err) { + jimpInstance.emitError(methodName, err); + } else { + jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); + } + + cb.apply(this, args); + }; + + args[args.length - 1] = wrappedCb; + } else { + wrappedCb = false; + } + + this.emitMulti(methodName, evNameBefore); + var result; + + try { + result = method.apply(this, args); + + if (!wrappedCb) { + this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); + } + } catch (error) { + error.methodName = methodName; + this.emitError(methodName, error); + } + + return result; + }; + + Jimp.prototype[methodName + "Quiet"] = method; +} +/** + * Creates a new image that is a clone of this one. + * @param {function(Error, Jimp)} cb (optional) A callback for when complete + * @returns the new image + */ + + +jimpEvMethod("clone", "clone", function (cb) { + var clone = new Jimp(this); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(clone, null, clone); + } + + return clone; +}); +/** + * Simplify jimpEvMethod call for the common `change` evName. + * @param {string} methodName name of the method + * @param {function} method to watch changes for + */ + +function jimpEvChange(methodName, method) { + jimpEvMethod(methodName, "change", method); +} +/** + * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) + * @param b A Boolean, true to use RGBA or false to use RGB + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + + +jimpEvChange("background", function (hex, cb) { + if (typeof hex !== "number") { + return _utils.throwError.call(this, "hex must be a hexadecimal rgba value", cb); + } + + this._background = hex; + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; +}); +/** + * Scans through a region of the bitmap, calling a function for each pixel. + * @param {number} x the x coordinate to begin the scan at + * @param {number} y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @param f a function to call on even pixel; the (x, y) position of the pixel + * and the index of the pixel in the bitmap buffer are passed to the function + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + +jimpEvChange("scan", function (x, y, w, h, f, cb) { + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } + + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } + + if (typeof f !== "function") { + return _utils.throwError.call(this, "f must be a function", cb); + } + + var result = (0, _utils.scan)(this, x, y, w, h, f); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, result); + } + + return result; +}); + +if (process.env.ENVIRONMENT === "BROWSER") { + // For use in a web browser or web worker + + /* global self */ + var gl; + + if (typeof window !== "undefined" && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === "object") { + gl = window; + } + + if (typeof self !== "undefined" && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === "object") { + gl = self; + } + + gl.Jimp = Jimp; + gl.Buffer = Buffer; +} + +var _default = Jimp; +exports["default"] = _default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/index.js.map b/node_modules/@jimp/core/dist/index.js.map new file mode 100644 index 00000000..3f39a86b --- /dev/null +++ b/node_modules/@jimp/core/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,GACZ,kEADF,C,CAGA;AACA;;AACA,IAAMC,aAAa,GAAG,CAACC,GAAD,EAAMA,GAAN,CAAtB;;AAEA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,EAApB,EAAwBA,CAAC,EAAzB,EAA6B;AAC3B,MAAMC,OAAO,GAAG,yBACdC,oBAAQC,GADM,EAEdN,QAAQ,CAACO,KAAT,CAAe,CAAf,EAAkBJ,CAAlB,CAFc,EAGd,IAAIK,KAAJ,CAAU,KAAK,CAAf,EAAkBC,IAAlB,CAAuB,GAAvB,CAHc,CAAhB;AAIAR,EAAAA,aAAa,CAACS,IAAd,CAAmBN,OAAO,CAACO,MAA3B;AACD,C,CAED;;;AACA,SAASC,IAAT,GAAgB,CAAE,C,CAElB;;;AAEA,SAASC,aAAT,CAAuBC,IAAvB,EAA6B;AAC3B,SACEC,MAAM,CAACC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BJ,IAA/B,EAAqCK,WAArC,GAAmDC,OAAnD,CAA2D,aAA3D,IACA,CAAC,CAFH;AAID,C,CAED;AACA;;;AACA,SAASC,qBAAT,CAA+BC,WAA/B,EAA4C;AAC1C,MAAMC,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAaH,WAAW,CAACI,UAAzB,CAAf;AACA,MAAMC,IAAI,GAAG,IAAIC,UAAJ,CAAeN,WAAf,CAAb;;AAEA,OAAK,IAAInB,EAAC,GAAG,CAAb,EAAgBA,EAAC,GAAGoB,MAAM,CAACZ,MAA3B,EAAmC,EAAER,EAArC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WAAlB,IAAiC,QAAOA,MAAP,0DAAOA,MAAP,OAAkB,QAAvD,EAAiE;AAC/DD,IAAAA,EAAE,GAAGC,MAAL;AACD;;AAED,MAAI,OAAOC,IAAP,KAAgB,WAAhB,IAA+B,QAAOA,IAAP,0DAAOA,IAAP,OAAgB,QAAnD,EAA6D;AAC3DF,IAAAA,EAAE,GAAGE,IAAL;AACD;;AAEDF,EAAAA,EAAE,CAACzJ,IAAH,GAAUA,IAAV;AACAyJ,EAAAA,EAAE,CAAC1L,MAAH,GAAYA,MAAZ;AACD;;eAIciC,I","sourcesContent":["import fs from \"fs\";\nimport Path from \"path\";\nimport EventEmitter from \"events\";\n\nimport { isNodePattern, throwError, scan, scanIterator } from \"@jimp/utils\";\nimport anyBase from \"any-base\";\nimport mkdirp from \"mkdirp\";\nimport pixelMatch from \"pixelmatch\";\nimport tinyColor from \"tinycolor2\";\n\nimport ImagePHash from \"./modules/phash\";\nimport request from \"./request\";\n\nimport composite from \"./composite\";\nimport promisify from \"./utils/promisify\";\nimport * as MIME from \"./utils/mime\";\nimport { parseBitmap, getBuffer, getBufferAsync } from \"./utils/image-bitmap\";\nimport * as constants from \"./constants\";\n\nconst alphabet =\n \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(\n anyBase.BIN,\n alphabet.slice(0, i)\n )(new Array(64 + 1).join(\"1\"));\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString.call(test).toLowerCase().indexOf(\"arraybuffer\") >\n -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if (\"headers\" in response && \"location\" in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === \"object\" && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n \"Could not load Buffer from <\" +\n options.url +\n \"> \" +\n \"(HTTP: \" +\n response.statusCode +\n \")\";\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === \"function\" &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === \"object\" &&\n typeof obj.width === \"number\" &&\n typeof obj.height === \"number\" &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === \"function\" &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error(\"Buffer length is incorrect\");\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null,\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = \"constructor\";\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError(\"constructor\", err);\n } else if (!err) {\n jimpInstance.emitMulti(\"constructor\", \"initialized\");\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === \"number\" && typeof args[1] === \"number\") ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === \"number\") {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === \"string\") {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === \"object\" && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height,\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height,\n };\n\n finish(null, this);\n } else if (typeof args[0] === \"string\") {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === \"object\" && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== \"function\") {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== \"function\") {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find((c) =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) => {\n extraConstructor.run.call(this, resolve, reject, ...args);\n })\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n \"No matching constructor overloading was found. \" +\n \"Please see the docs for how to call the Jimp constructor.\",\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== \"boolean\") {\n return throwError.call(\n this,\n \"bool must be a boolean, true for RGBA or false for RGB\",\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit(\"any\", data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, \"error\", err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n \"\"\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return \"[object Jimp]\";\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n \"Cant access the filesystem. You can use the getBase64 method.\"\n );\n }\n\n if (typeof path !== \"string\") {\n return throwError.call(this, \"path must be a string\", cb);\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on(\"open\", () => {\n stream.write(buffer);\n stream.end();\n })\n .on(\"error\", (err) => {\n return throwError.call(this, err, cb);\n });\n stream.on(\"finish\", () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = (path) => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n this.getBuffer(mime, function (err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = \"data:\" + mime + \";base64,\" + data.toString(\"base64\");\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = (mime) => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === \"function\") {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== \"number\") {\n return throwError.call(this, \"base must be a number\", cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n \"base must be a number between 2 and 64\",\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = \"0\" + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== \"number\" ||\n typeof x !== \"number\" ||\n typeof y !== \"number\"\n )\n return throwError.call(this, \"hex, x and y must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\");\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\");\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function (name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function (...args) {\n return new Promise((resolve, reject) => {\n // eslint-disable-next-line no-new\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function (r, g, b, a, cb) {\n if (\n typeof r !== \"number\" ||\n typeof g !== \"number\" ||\n typeof b !== \"number\" ||\n typeof a !== \"number\"\n ) {\n return throwError.call(this, \"r, g, b and a must be numbers\", cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, \"r must be between 0 and 255\", cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, \"g must be between 0 and 255\", cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, \"b must be between 0 and 255\", cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, \"a must be between 0 and 255\", cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function (i, cb) {\n if (typeof i !== \"number\") {\n return throwError.call(this, \"i must be a number\", cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function (cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === \"number\") return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function (n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function (img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, \"img1 and img2 must be an Jimp images\");\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== \"number\" || threshold < 0 || threshold > 1) {\n return throwError.call(this, \"threshold must be a number between 0 and 1\");\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff,\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function (img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function (hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function (rgba1, rgba2) {\n const pow = (n) => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = \"before-\" + evName;\n const evNameAfter = evName.replace(/e$/, \"\") + \"ed\";\n\n Jimp.prototype[methodName] = function (...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === \"function\") {\n wrappedCb = function (...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data,\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result,\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + \"Quiet\"] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod(\"clone\", \"clone\", function (cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, \"change\", method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"background\", function (hex, cb) {\n if (typeof hex !== \"number\") {\n return throwError.call(this, \"hex must be a hexadecimal rgba value\", cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"scan\", function (x, y, w, h, f, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof f !== \"function\") {\n return throwError.call(this, \"f must be a function\", cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === \"BROWSER\") {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== \"undefined\" && typeof window === \"object\") {\n gl = window;\n }\n\n if (typeof self !== \"undefined\" && typeof self === \"object\") {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from \"./utils/mime\";\n\nexport default Jimp;\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/modules/phash.js b/node_modules/@jimp/core/dist/modules/phash.js new file mode 100644 index 00000000..cc655658 --- /dev/null +++ b/node_modules/@jimp/core/dist/modules/phash.js @@ -0,0 +1,173 @@ +"use strict"; + +/* +Copyright (c) 2011 Elliot Shepherd + +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. +*/ +// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java + +/* + * pHash-like image hash. + * Author: Elliot Shepherd (elliot@jarofworms.com + * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html + */ +function ImagePHash(size, smallerSize) { + this.size = this.size || size; + this.smallerSize = this.smallerSize || smallerSize; + initCoefficients(this.size); +} + +ImagePHash.prototype.size = 32; +ImagePHash.prototype.smallerSize = 8; + +ImagePHash.prototype.distance = function (s1, s2) { + var counter = 0; + + for (var k = 0; k < s1.length; k++) { + if (s1[k] !== s2[k]) { + counter++; + } + } + + return counter / s1.length; +}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. + + +ImagePHash.prototype.getHash = function (img) { + /* 1. Reduce size. + * Like Average Hash, pHash starts with a small image. + * However, the image is larger than 8x8; 32x32 is a good size. + * This is really done to simplify the DCT computation and not + * because it is needed to reduce the high frequencies. + */ + img = img.clone().resize(this.size, this.size); + /* 2. Reduce color. + * The image is reduced to a grayscale just to further simplify + * the number of computations. + */ + + img.grayscale(); + var vals = []; + + for (var x = 0; x < img.bitmap.width; x++) { + vals[x] = []; + + for (var y = 0; y < img.bitmap.height; y++) { + vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; + } + } + /* 3. Compute the DCT. + * The DCT separates the image into a collection of frequencies + * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses + * a 32x32 DCT. + */ + + + var dctVals = applyDCT(vals, this.size); + /* 4. Reduce the DCT. + * This is the magic step. While the DCT is 32x32, just keep the + * top-left 8x8. Those represent the lowest frequencies in the + * picture. + */ + + /* 5. Compute the average value. + * Like the Average Hash, compute the mean DCT value (using only + * the 8x8 DCT low-frequency values and excluding the first term + * since the DC coefficient can be significantly different from + * the other values and will throw off the average). + */ + + var total = 0; + + for (var _x = 0; _x < this.smallerSize; _x++) { + for (var _y = 0; _y < this.smallerSize; _y++) { + total += dctVals[_x][_y]; + } + } + + var avg = total / (this.smallerSize * this.smallerSize); + /* 6. Further reduce the DCT. + * This is the magic step. Set the 64 hash bits to 0 or 1 + * depending on whether each of the 64 DCT values is above or + * below the average value. The result doesn't tell us the + * actual low frequencies; it just tells us the very-rough + * relative scale of the frequencies to the mean. The result + * will not vary as long as the overall structure of the image + * remains the same; this can survive gamma and color histogram + * adjustments without a problem. + */ + + var hash = ""; + + for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { + for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { + hash += dctVals[_x2][_y2] > avg ? "1" : "0"; + } + } + + return hash; +}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java + + +function intToRGBA(i) { + var rgba = {}; + rgba.r = Math.floor(i / Math.pow(256, 3)); + rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); + rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); + rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); + return rgba; +} + +var c = []; + +function initCoefficients(size) { + for (var i = 1; i < size; i++) { + c[i] = 1; + } + + c[0] = 1 / Math.sqrt(2.0); +} + +function applyDCT(f, size) { + var N = size; + var F = []; + + for (var u = 0; u < N; u++) { + F[u] = []; + + for (var v = 0; v < N; v++) { + var sum = 0; + + for (var i = 0; i < N; i++) { + for (var j = 0; j < N; j++) { + sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; + } + } + + sum *= c[u] * c[v] / 4; + F[u][v] = sum; + } + } + + return F; +} + +module.exports = ImagePHash; +//# sourceMappingURL=phash.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/modules/phash.js.map b/node_modules/@jimp/core/dist/modules/phash.js.map new file mode 100644 index 00000000..b7f5523f --- /dev/null +++ b/node_modules/@jimp/core/dist/modules/phash.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WAAL,IAAoBA,WAAvC;AACAC,EAAAA,gBAAgB,CAAC,KAAKF,IAAN,CAAhB;AACD;;AAEDD,UAAU,CAACI,SAAX,CAAqBH,IAArB,GAA4B,EAA5B;AACAD,UAAU,CAACI,SAAX,CAAqBF,WAArB,GAAmC,CAAnC;;AAEAF,UAAU,CAACI,SAAX,CAAqBC,QAArB,GAAgC,UAAUC,EAAV,EAAcC,EAAd,EAAkB;AAChD,MAAIC,OAAO,G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CAAb,EAAgBA,CAAC,GAAGH,CAApB,EAAuBG,CAAC,EAAxB,EAA4B;AAC1B,UAAIC,GAAG,GAAG,CAAV;;AACA,WAAK,IAAIf,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGW,CAApB,EAAuBX,CAAC,EAAxB,EAA4B;AAC1B,aAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,CAApB,EAAuBK,CAAC,EAAxB,EAA4B;AAC1BD,UAAAA,GAAG,IACDZ,IAAI,CAACc,GAAL,CAAU,CAAC,IAAIjB,CAAJ,GAAQ,CAAT,KAAe,MAAMW,CAArB,CAAD,GAA4BE,CAA5B,GAAgCV,IAAI,CAACe,EAA9C,IACAf,IAAI,CAACc,GAAL,CAAU,CAAC,IAAID,CAAJ,GAAQ,CAAT,KAAe,MAAML,CAArB,CAAD,GAA4BG,CAA5B,GAAgCX,IAAI,CAACe,EAA9C,CADA,GAEAR,CAAC,CAACV,CAAD,CAAD,CAAKgB,CAAL,CAHF;AAID;AACF;;AAEDD,MAAAA,GAAG,IAAKP,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function (s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function (img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = \"\";\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? \"1\" : \"0\";\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/request.js b/node_modules/@jimp/core/dist/request.js new file mode 100644 index 00000000..074adb5d --- /dev/null +++ b/node_modules/@jimp/core/dist/request.js @@ -0,0 +1,55 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +/* global XMLHttpRequest */ +if (process.browser || process.env.ENVIRONMENT === "BROWSER" || typeof process.versions.electron !== "undefined" && process.type === "renderer" && typeof XMLHttpRequest === "function") { + // If we run into a browser or the electron renderer process, + // use XHR method instead of Request node module. + module.exports = function (options, cb) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", options.url, true); + xhr.responseType = "arraybuffer"; + xhr.addEventListener("load", function () { + if (xhr.status < 400) { + try { + var data = Buffer.from(this.response); + cb(null, xhr, data); + } catch (error) { + return cb(new Error("Response is not a buffer for url " + options.url + ". Error: " + error.message)); + } + } else { + cb(new Error("HTTP Status " + xhr.status + " for url " + options.url)); + } + }); + xhr.addEventListener("error", function (e) { + cb(e); + }); + xhr.send(); + }; +} else { + module.exports = function (_ref, cb) { + var options = (0, _extends2["default"])({}, _ref); + + var p = require("phin"); + + p(_objectSpread({ + compression: true + }, options), function (err, res) { + if (err === null) { + cb(null, res, res.body); + } else { + cb(err); + } + }); + }; +} +//# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/request.js.map b/node_modules/@jimp/core/dist/request.js.map new file mode 100644 index 00000000..6ffeb7f1 --- /dev/null +++ b/node_modules/@jimp/core/dist/request.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAAUC,OAAV,EAAmBC,EAAnB,EAAuB;AACtC,QAAMC,GAAG,GAAG,IAAIL,cAAJ,EAAZ;AACAK,IAAAA,GAAG,CAACC,IAAJ,CAAS,KAAT,EAAgBH,OAAO,C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AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === \"BROWSER\" ||\n (typeof process.versions.electron !== \"undefined\" &&\n process.type === \"renderer\" &&\n typeof XMLHttpRequest === \"function\")\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function (options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open(\"GET\", options.url, true);\n xhr.responseType = \"arraybuffer\";\n xhr.addEventListener(\"load\", function () {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n \"Response is not a buffer for url \" +\n options.url +\n \". Error: \" +\n error.message\n )\n );\n }\n } else {\n cb(new Error(\"HTTP Status \" + xhr.status + \" for url \" + options.url));\n }\n });\n xhr.addEventListener(\"error\", (e) => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function ({ ...options }, cb) {\n const p = require(\"phin\");\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/utils/image-bitmap.js b/node_modules/@jimp/core/dist/utils/image-bitmap.js new file mode 100644 index 00000000..e7c3dc99 --- /dev/null +++ b/node_modules/@jimp/core/dist/utils/image-bitmap.js @@ -0,0 +1,319 @@ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.parseBitmap = parseBitmap; +exports.getBuffer = getBuffer; +exports.getBufferAsync = getBufferAsync; + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); + +var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); + +var _fileType = _interopRequireDefault(require("file-type")); + +var _exifParser = _interopRequireDefault(require("exif-parser")); + +var _utils = require("@jimp/utils"); + +var constants = _interopRequireWildcard(require("../constants")); + +var MIME = _interopRequireWildcard(require("./mime")); + +var _promisify = _interopRequireDefault(require("./promisify")); + +function getMIMEFromBuffer(buffer, path) { + var fileTypeFromBuffer; + return _regenerator["default"].async(function getMIMEFromBuffer$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return _regenerator["default"].awrap(_fileType["default"].fromBuffer(buffer)); + + case 2: + fileTypeFromBuffer = _context.sent; + + if (!fileTypeFromBuffer) { + _context.next = 5; + break; + } + + return _context.abrupt("return", fileTypeFromBuffer.mime); + + case 5: + if (!path) { + _context.next = 7; + break; + } + + return _context.abrupt("return", MIME.getType(path)); + + case 7: + return _context.abrupt("return", null); + + case 8: + case "end": + return _context.stop(); + } + } + }); +} +/* + * Obtains image orientation from EXIF metadata. + * + * @param img {Jimp} a Jimp image object + * @returns {number} a number 1-8 representing EXIF orientation, + * in particular 1 if orientation tag is missing + */ + + +function getExifOrientation(img) { + return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; +} +/** + * Returns a function which translates EXIF-rotated coordinates into + * non-rotated ones. + * + * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. + * + * @param img {Jimp} a Jimp image object + * @returns {function} transformation function for transformBitmap(). + */ + + +function getExifOrientationTransformation(img) { + var w = img.getWidth(); + var h = img.getHeight(); + + switch (getExifOrientation(img)) { + case 1: + // Horizontal (normal) + // does not need to be supported here + return null; + + case 2: + // Mirror horizontal + return function (x, y) { + return [w - x - 1, y]; + }; + + case 3: + // Rotate 180 + return function (x, y) { + return [w - x - 1, h - y - 1]; + }; + + case 4: + // Mirror vertical + return function (x, y) { + return [x, h - y - 1]; + }; + + case 5: + // Mirror horizontal and rotate 270 CW + return function (x, y) { + return [y, x]; + }; + + case 6: + // Rotate 90 CW + return function (x, y) { + return [y, h - x - 1]; + }; + + case 7: + // Mirror horizontal and rotate 90 CW + return function (x, y) { + return [w - y - 1, h - x - 1]; + }; + + case 8: + // Rotate 270 CW + return function (x, y) { + return [w - y - 1, x]; + }; + + default: + return null; + } +} +/* + * Transforms bitmap in place (moves pixels around) according to given + * transformation function. + * + * @param img {Jimp} a Jimp image object, which bitmap is supposed to + * be transformed + * @param width {number} bitmap width after the transformation + * @param height {number} bitmap height after the transformation + * @param transformation {function} transformation function which defines pixel + * mapping between new and source bitmap. It takes a pair of coordinates + * in the target, and returns a respective pair of coordinates in + * the source bitmap, i.e. has following form: + * `function(new_x, new_y) { return [src_x, src_y] }`. + */ + + +function transformBitmap(img, width, height, transformation) { + // Underscore-prefixed values are related to the source bitmap + // Their counterparts with no prefix are related to the target bitmap + var _data = img.bitmap.data; + var _width = img.bitmap.width; + var data = Buffer.alloc(_data.length); + + for (var x = 0; x < width; x++) { + for (var y = 0; y < height; y++) { + var _transformation = transformation(x, y), + _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), + _x = _transformation2[0], + _y = _transformation2[1]; + + var idx = width * y + x << 2; + + var _idx = _width * _y + _x << 2; + + var pixel = _data.readUInt32BE(_idx); + + data.writeUInt32BE(pixel, idx); + } + } + + img.bitmap.data = data; + img.bitmap.width = width; + img.bitmap.height = height; +} +/* + * Automagically rotates an image based on its EXIF data (if present). + * @param img {Jimp} a Jimp image object + */ + + +function exifRotate(img) { + if (getExifOrientation(img) < 2) return; + var transformation = getExifOrientationTransformation(img); + var swapDimensions = getExifOrientation(img) > 4; + var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; + var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; + transformBitmap(img, newWidth, newHeight, transformation); +} // parses a bitmap from the constructor to the JIMP bitmap property + + +function parseBitmap(data, path, cb) { + var mime, _mime; + + return _regenerator["default"].async(function parseBitmap$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return _regenerator["default"].awrap(getMIMEFromBuffer(data, path)); + + case 2: + mime = _context2.sent; + + if (!(typeof mime !== "string")) { + _context2.next = 5; + break; + } + + return _context2.abrupt("return", cb(new Error("Could not find MIME for Buffer <" + path + ">"))); + + case 5: + this._originalMime = mime.toLowerCase(); + _context2.prev = 6; + _mime = this.getMIME(); + + if (!this.constructor.decoders[_mime]) { + _context2.next = 12; + break; + } + + this.bitmap = this.constructor.decoders[_mime](data); + _context2.next = 13; + break; + + case 12: + return _context2.abrupt("return", _utils.throwError.call(this, "Unsupported MIME type: " + _mime, cb)); + + case 13: + _context2.next = 18; + break; + + case 15: + _context2.prev = 15; + _context2.t0 = _context2["catch"](6); + return _context2.abrupt("return", cb.call(this, _context2.t0, this)); + + case 18: + try { + this._exif = _exifParser["default"].create(data).parse(); + exifRotate(this); // EXIF data + } catch (error) { + /* meh */ + } + + cb.call(this, null, this); + return _context2.abrupt("return", this); + + case 21: + case "end": + return _context2.stop(); + } + } + }, null, this, [[6, 15]]); +} + +function compositeBitmapOverBackground(Jimp, image) { + return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; +} +/** + * Converts the image to a buffer + * @param {string} mime the mime type of the image buffer to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ + + +function getBuffer(mime, cb) { + if (mime === constants.AUTO) { + // allow auto MIME detection + mime = this.getMIME(); + } + + if (typeof mime !== "string") { + return _utils.throwError.call(this, "mime must be a string", cb); + } + + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", cb); + } + + mime = mime.toLowerCase(); + + if (this._rgba && this.constructor.hasAlpha[mime]) { + this.bitmap.data = Buffer.from(this.bitmap.data); + } else { + // when format doesn't support alpha + // composite onto a new image so that the background shows through alpha channels + this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; + } + + if (this.constructor.encoders[mime]) { + var buffer = this.constructor.encoders[mime](this); + cb.call(this, null, buffer); + } else { + cb.call(this, "Unsupported MIME type: " + mime); + } + + return this; +} + +function getBufferAsync(mime) { + return (0, _promisify["default"])(getBuffer, this, mime); +} +//# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/utils/image-bitmap.js.map b/node_modules/@jimp/core/dist/utils/image-bitmap.js.map new file mode 100644 index 00000000..dcc464e9 --- /dev/null +++ b/node_modules/@jimp/core/dist/utils/image-bitmap.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","FileType","fromBuffer","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","EXIFParser","create","parse","error","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAAeA,iBAAf,CAAiCC,MAAjC,EAAyCC,IAAzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+CACmCC,qBAASC,UAAT,CAAoBH,MAApB,CADnC;;AAAA;AACQI,UAAAA,kBADR;;AAAA,eAGMA,kBAHN;AAAA;AAAA;AAAA;;AAAA,2CAKWA,kBAAkB,CAACC,IAL9B;;AAAA;AAAA,eAQMJ,IARN;AAAA;AAAA;AAAA;;AAAA,2CAWWK,IAAI,CAACC,OAAL,CAAaN,IAAb,CAXX;;AAAA;AAAA,2CAcS,IAdT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA;;;;;;;;;AAOA,SAASO,kBAAT,CAA4BC,GAA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EAA8B;AAC5B,WAAO6C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAEDtC,EAAAA,IAAI,GAAGA,IAAI,CAACyC,WAAL,EAAP;;AAEA,MAAI,KAAKkB,KAAL,IAAc,KAAKhB,WAAL,CAAiBiB,QAAjB,CAA0B5D,IAA1B,CAAlB,EAAmD;AACjD,SAAKoB,MAAL,CAAYC,IAAZ,GAAmBE,MAAM,CAACsC,IAAP,CAAY,KAAKzC,MAAL,CAAYC,IAAxB,CAAnB;AACD,GAFD,MAEO;AACL;AACA;AACA,SAAKD,MAAL,CAAYC,IAAZ,GAAmB8B,6BAA6B,CAC9C,KAAKR,WADyC,EAE9C,IAF8C,CAA7B,CAGjBtB,IAHF;AAID;;AAED,MAAI,KAAKsB,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,CAAJ,EAAqC;AACnC,QAAML,MAAM,GAAG,KAAKgD,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,EAAgC,IAAhC,CAAf;AACAsC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBnD,MAApB;AACD,GAHD,MAGO;AACL2C,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,4BAA4B9C,IAA1C;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAAS+D,cAAT,CAAwB/D,IAAxB,EAA8B;AACnC,SAAO,2BAAUwD,SAAV,EAAqB,IAArB,EAA2BxD,IAA3B,CAAP;AACD","sourcesContent":["import FileType from \"file-type\";\n\nimport EXIFParser from \"exif-parser\";\nimport { throwError } from \"@jimp/utils\";\n\nimport * as constants from \"../constants\";\nimport * as MIME from \"./mime\";\nimport promisify from \"./promisify\";\n\nasync function getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = await FileType.fromBuffer(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function (x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function (x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function (x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function (x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function (x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function (x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function (x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport async function parseBitmap(data, path, cb) {\n const mime = await getMIMEFromBuffer(data, path);\n\n if (typeof mime !== \"string\") {\n return cb(new Error(\"Could not find MIME for Buffer <\" + path + \">\"));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, \"Unsupported MIME type: \" + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/utils/mime.js b/node_modules/@jimp/core/dist/utils/mime.js new file mode 100644 index 00000000..6e94ba72 --- /dev/null +++ b/node_modules/@jimp/core/dist/utils/mime.js @@ -0,0 +1,47 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getExtension = exports.getType = exports.addType = void 0; +var mimeTypes = {}; + +var findType = function findType(extension) { + return Object.entries(mimeTypes).find(function (type) { + return type[1].includes(extension); + }) || []; +}; + +var addType = function addType(mime, extensions) { + mimeTypes[mime] = extensions; +}; +/** + * Lookup a mime type based on extension + * @param {string} path path to find extension for + * @returns {string} mime found mime type + */ + + +exports.addType = addType; + +var getType = function getType(path) { + var pathParts = path.split("/").slice(-1); + var extension = pathParts[pathParts.length - 1].split(".").pop(); + var type = findType(extension); + return type[0]; +}; +/** + * Return file extension associated with a mime type + * @param {string} type mime type to look up + * @returns {string} extension file extension + */ + + +exports.getType = getType; + +var getExtension = function getExtension(type) { + return (mimeTypes[type.toLowerCase()] || [])[0]; +}; + +exports.getExtension = getExtension; +//# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/utils/mime.js.map b/node_modules/@jimp/core/dist/utils/mime.js.map new file mode 100644 index 00000000..0fbcd7e1 --- /dev/null +++ b/node_modules/@jimp/core/dist/utils/mime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,SAAD;AAAA,SACfC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAACC,IAAD;AAAA,WAAUA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAV;AAAA,GAA/B,KAAyE,EAD1D;AAAA,CAAjB;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAU;AAC/B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAACZ,IAAD;AAAA,SAAU,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAV;AAAA,CAArB","sourcesContent":["const mimeTypes = {};\n\nconst findType = (extension) =>\n Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = (path) => {\n const pathParts = path.split(\"/\").slice(-1);\n const extension = pathParts[pathParts.length - 1].split(\".\").pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = (type) => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js b/node_modules/@jimp/core/dist/utils/promisify.js similarity index 100% rename from project starter code/node_modules/@jimp/core/dist/utils/promisify.js rename to node_modules/@jimp/core/dist/utils/promisify.js diff --git a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map b/node_modules/@jimp/core/dist/utils/promisify.js.map similarity index 100% rename from project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map rename to node_modules/@jimp/core/dist/utils/promisify.js.map diff --git a/node_modules/@jimp/core/package.json b/node_modules/@jimp/core/package.json new file mode 100644 index 00000000..65183a5d --- /dev/null +++ b/node_modules/@jimp/core/package.json @@ -0,0 +1,50 @@ +{ + "name": "@jimp/core", + "version": "0.16.13", + "description": "Jimp core", + "main": "dist/index.js", + "module": "es/index.js", + "types": "types/index.d.ts", + "files": [ + "dist", + "es", + "index.d.ts", + "fonts", + "types" + ], + "repository": "jimp-dev/jimp", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register test/**/*.js", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "Oliver Moran ", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "any-base": "^1.1.0", + "buffer": "^5.2.0", + "exif-parser": "^0.1.12", + "file-type": "^16.5.4", + "load-bmfont": "^1.3.1", + "mkdirp": "^0.5.1", + "phin": "^2.9.1", + "pixelmatch": "^4.0.2", + "tinycolor2": "^1.4.1" + }, + "devDependencies": { + "should": "^13.2.3" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/core/types/etc.d.ts b/node_modules/@jimp/core/types/etc.d.ts new file mode 100644 index 00000000..e13192e6 --- /dev/null +++ b/node_modules/@jimp/core/types/etc.d.ts @@ -0,0 +1,93 @@ +import { Jimp } from "./jimp"; + +export interface Image { + bitmap: Bitmap; +} + +export type DecoderFn = (data: Buffer) => Bitmap; +export type EncoderFn = ( + image: ImageType +) => Buffer; + +export type GenericCallback = ( + this: TThis, + err: Error | null, + value: T +) => U; + +/** + * `jimp` must be defined otherwise `this` will not apply properly + * for custom configurations where plugins and types are needed + */ +export type ImageCallback = ( + this: jimp, + err: Error | null, + value: jimp, + coords: { + x: number; + y: number; + } +) => any; + +type BlendMode = { + mode: string; + opacitySource: number; + opacityDest: number; +}; + +type ChangeName = "background" | "scan" | "crop"; + +type ListenableName = + | "any" + | "initialized" + | "before-change" + | "changed" + | "before-clone" + | "cloned" + | ChangeName; + +type ListenerData = T extends "any" + ? any + : T extends ChangeName + ? { + eventName: "before-change" | "changed"; + methodName: T; + [key: string]: any; + } + : { + eventName: T; + methodName: T extends "initialized" + ? "constructor" + : T extends "before-change" | "changed" + ? ChangeName + : T extends "before-clone" | "cloned" + ? "clone" + : any; + }; + +type URLOptions = { + url: string; + compression?: boolean; + headers: { + [key: string]: any; + }; +}; + +export interface Bitmap { + data: Buffer; + width: number; + height: number; +} + +export interface RGB { + r: number; + g: number; + b: number; +} + +export interface RGBA { + r: number; + g: number; + b: number; + a: number; +} diff --git a/project starter code/node_modules/@jimp/core/types/functions.d.ts b/node_modules/@jimp/core/types/functions.d.ts similarity index 90% rename from project starter code/node_modules/@jimp/core/types/functions.d.ts rename to node_modules/@jimp/core/types/functions.d.ts index d7366054..de74902e 100644 --- a/project starter code/node_modules/@jimp/core/types/functions.d.ts +++ b/node_modules/@jimp/core/types/functions.d.ts @@ -1,4 +1,4 @@ -import {Jimp} from '@jimp/core/types/jimp'; +import { Jimp } from "./jimp"; export function addConstants( constants: [string, string | number], diff --git a/node_modules/@jimp/core/types/index.d.ts b/node_modules/@jimp/core/types/index.d.ts new file mode 100644 index 00000000..88bd53a7 --- /dev/null +++ b/node_modules/@jimp/core/types/index.d.ts @@ -0,0 +1,9 @@ +export * from "./etc"; +export * from "./functions"; +export * from "./plugins"; +export * from "./utils"; +import { Jimp, JimpConstructors } from "./jimp"; + +export { Jimp, JimpConstructors }; +declare const defaultExp: Jimp; +export default defaultExp; diff --git a/node_modules/@jimp/core/types/jimp.d.ts b/node_modules/@jimp/core/types/jimp.d.ts new file mode 100644 index 00000000..3b7d7a11 --- /dev/null +++ b/node_modules/@jimp/core/types/jimp.d.ts @@ -0,0 +1,246 @@ +import { + Bitmap, + ImageCallback, + URLOptions, + ListenableName, + ListenerData, + GenericCallback, + BlendMode, + RGBA, + RGB, +} from "./etc"; + +interface DiffReturn { + percent: number; + image: This; +} + +interface ScanIteratorReturn { + x: number; + y: number; + idx: number; + image: This; +} + +export interface JimpConstructors { + prototype: Jimp; + // Constants + AUTO: -1; + // blend modes + BLEND_SOURCE_OVER: string; + BLEND_DESTINATION_OVER: string; + BLEND_MULTIPLY: string; + BLEND_ADD: string; + BLEND_SCREEN: string; + BLEND_OVERLAY: string; + BLEND_DARKEN: string; + BLEND_LIGHTEN: string; + BLEND_HARDLIGHT: string; + BLEND_DIFFERENCE: string; + BLEND_EXCLUSION: string; + // Align modes for cover, contain, bit masks + HORIZONTAL_ALIGN_LEFT: 1; + HORIZONTAL_ALIGN_CENTER: 2; + HORIZONTAL_ALIGN_RIGHT: 4; + VERTICAL_ALIGN_TOP: 8; + VERTICAL_ALIGN_MIDDLE: 16; + VERTICAL_ALIGN_BOTTOM: 32; + // Edge Handling + EDGE_EXTEND: 1; + EDGE_WRAP: 2; + EDGE_CROP: 3; + + // Constructors + new (path: string, cb?: ImageCallback): this["prototype"]; + new ( + urlOptions: URLOptions, + cb?: ImageCallback + ): this["prototype"]; + new (image: Jimp, cb?: ImageCallback): this["prototype"]; + new (data: Buffer, cb?: ImageCallback): this["prototype"]; + new (data: Bitmap, cb?: ImageCallback): this["prototype"]; + new ( + w: number, + h: number, + cb?: ImageCallback + ): this["prototype"]; + new ( + w: number, + h: number, + background?: number | string, + cb?: ImageCallback + ): this["prototype"]; + // For custom constructors when using Jimp.appendConstructorOption + new (...args: any[]): this["prototype"]; + + // Functions + /** + * I'd like to make `Args` generic and used in `run` and `test` but alas, + * it's not possible RN: + * https://github.com/microsoft/TypeScript/issues/26113 + */ + appendConstructorOption< + Args extends any[], + J extends Jimp = this["prototype"] + >( + name: string, + test: (...args: any[]) => boolean, + run: ( + this: J, + resolve: (jimp?: J) => any, + reject: (reason: Error) => any, + ...args: any[] + ) => any + ): void; + read( + path: string, + cb?: ImageCallback + ): Promise; + read( + image: Jimp, + cb?: ImageCallback + ): Promise; + read( + data: Buffer, + cb?: ImageCallback + ): Promise; + read( + w: number, + h: number, + background?: number | string, + cb?: ImageCallback + ): Promise; + create(path: string): Promise; + create(image: Jimp): Promise; + create(data: Buffer): Promise; + create( + w: number, + h: number, + background?: number | string + ): Promise; + rgbaToInt( + r: number, + g: number, + b: number, + a: number, + cb?: GenericCallback + ): number; + intToRGBA(i: number, cb?: GenericCallback): RGBA; + cssColorToHex(cssColor: string): number; + limit255(n: number): number; + diff( + img1: Jimp, + img2: Jimp, + threshold?: number + ): DiffReturn; + distance(img1: Jimp, img2: Jimp): number; + compareHashes(hash1: string, hash2: string): number; + colorDiff(rgba1: RGB, rgba2: RGB): number; + colorDiff(rgba1: RGBA, rgba2: RGBA): number; +} + +export interface Jimp { + // Properties + bitmap: Bitmap; + _rgba: boolean; + _background: number; + _originalMime: string; + // Methods + on( + event: T, + cb: (data: ListenerData) => any + ): any; + parseBitmap( + data: Buffer, + path: string | null | undefined, + cb?: ImageCallback + ): void; + hasAlpha(): boolean; + getHeight(): number; + getWidth(): number; + inspect(): string; + toString(): string; + getMIME(): string; + getExtension(): string; + distanceFromHash(hash: string): number; + write(path: string, cb?: ImageCallback): this; + writeAsync(path: string): Promise; + rgba(bool: boolean, cb?: ImageCallback): this; + getBase64(mime: string, cb: GenericCallback): this; + getBase64Async(mime: string): Promise; + hash(cb?: GenericCallback): string; + hash( + base: number | null | undefined, + cb?: GenericCallback + ): string; + getBuffer(mime: string, cb: GenericCallback): this; + getBufferAsync(mime: string): Promise; + getPixelIndex( + x: number, + y: number, + cb?: GenericCallback + ): number; + getPixelIndex( + x: number, + y: number, + edgeHandling: number, + cb?: GenericCallback + ): number; + getPixelColor( + x: number, + y: number, + cb?: GenericCallback + ): number; + getPixelColour( + x: number, + y: number, + cb?: GenericCallback + ): number; + setPixelColor( + hex: number, + x: number, + y: number, + cb?: ImageCallback + ): this; + setPixelColour( + hex: number, + x: number, + y: number, + cb?: ImageCallback + ): this; + clone(cb?: ImageCallback): this; + cloneQuiet(cb?: ImageCallback): this; + background(hex: number, cb?: ImageCallback): this; + backgroundQuiet(hex: number, cb?: ImageCallback): this; + scan( + x: number, + y: number, + w: number, + h: number, + f: (this: this, x: number, y: number, idx: number) => any, + cb?: ImageCallback + ): this; + scanQuiet( + x: number, + y: number, + w: number, + h: number, + f: (this: this, x: number, y: number, idx: number) => any, + cb?: ImageCallback + ): this; + scanIterator( + x: number, + y: number, + w: number, + h: number + ): IterableIterator>; + + // Effect methods + composite( + src: Jimp, + x: number, + y: number, + options?: BlendMode, + cb?: ImageCallback + ): this; +} diff --git a/project starter code/node_modules/@jimp/core/types/plugins.d.ts b/node_modules/@jimp/core/types/plugins.d.ts similarity index 76% rename from project starter code/node_modules/@jimp/core/types/plugins.d.ts rename to node_modules/@jimp/core/types/plugins.d.ts index 26fe4dcd..62bf2ea9 100644 --- a/project starter code/node_modules/@jimp/core/types/plugins.d.ts +++ b/node_modules/@jimp/core/types/plugins.d.ts @@ -1,23 +1,17 @@ /** * These files pertain to the typings of plugins or types - * + * * They're not meant as utils to decode types, but rather * the type definitons themsleves for plugins and types of various kinds */ -import { - Image, - EncoderFn, - DecoderFn -} from '@jimp/core/types/etc'; +import { Image, EncoderFn, DecoderFn } from "./etc"; -import { - Omit -} from '@jimp/core/types/utils'; +import { Omit } from "./utils"; -export type IllformedPlugin = Omit & { +export type IllformedPlugin = Omit & { class?: never; constants?: never; -} +}; export interface WellFormedPlugin { mime?: { @@ -43,13 +37,13 @@ export interface WellFormedPlugin { type ClassOrConstantPlugin = WellFormedPlugin & ( - | Required, 'class'>> - | Required, 'constants'>> + | Required, "class">> + | Required, "constants">> ); // A Jimp type requires mime, but not class export type JimpType = WellFormedPlugin & - Required, 'mime'>>; + Required, "mime">>; // Jimp plugin either MUST have class OR constant or be illformed export type JimpPlugin = diff --git a/node_modules/@jimp/core/types/utils.d.ts b/node_modules/@jimp/core/types/utils.d.ts new file mode 100644 index 00000000..463321b9 --- /dev/null +++ b/node_modules/@jimp/core/types/utils.d.ts @@ -0,0 +1,132 @@ +import { JimpType, JimpPlugin } from "./plugins"; + +// This is required as providing type arrays gives a union of all the generic +// types in the array rather than an intersection +export type UnionToIntersection = ( + U extends any ? (k: U) => void : never +) extends (k: infer I) => void + ? I + : never; + +/** + * The values to be extracted from a WellFormedPlugin to put onto the Jimp instance + * Left loose as "any" in order to enable the GetPluginVal to work properly + */ +export type WellFormedValues = T extends { class: infer Class } + ? Class + : {}; + +/** + * The constants to be extracted from a WellFormedPlugin to put onto the Jimp instance + * Left loose as "any" in order to enable the GetPluginConstants to work properly + */ +export type WellFormedConstants = T extends { + constants: infer Constants; +} + ? Constants + : {}; + +// Util type for the functions that deal with `@jimp/custom` +// Must accept any or no props thanks to typing of the `plugins` intersected function +export type FunctionRet = Array<(...props: any[] | never) => T>; + +/** + * This conditional cannot be flipped. TS assumes that Q is `WellFormed` even + * it does not have the `class` or `constant` props. As a result, it will end + * up `undefined`. Because we're always extending `IllformedPlugin` on the + * plugins, this should work fine + */ +export type GetPluginVal = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> + ? WellFormedValues + : Q; + +export type GetPluginConst = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> + ? WellFormedConstants + : {}; + +export type GetPluginDecoders = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> + ? Q extends { decoders: infer Decoders } + ? Decoders + : {} + : {}; + +export type GetPluginEncoders = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> + ? Q extends { encoders: infer Encoders } + ? Encoders + : {} + : {}; + +type GetPluginFuncArrValues = + // Given an array of types infer `Q` (Q should be the type value) + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin value, may be ill-formed or well-formed + GetPluginVal + : // This should never be reached + undefined + : undefined; + +/** + * A helper type to get the values to be intersected with `Jimp` to give + * the proper typing given an array of functions for plugins and types + */ +export type GetIntersectionFromPlugins< + PluginFuncArr extends FunctionRet +> = UnionToIntersection< + Exclude, undefined> +>; + +type GetPluginFuncArrConsts = + // Given an array of types infer `Q` (Q should be the type value) + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin constants, may be ill-formed or well-formed + GetPluginConst + : // This should never be reached + undefined + : undefined; + +type GetPluginFuncArrEncoders = + // Given an array of types infer `Q` (Q should be the type value) + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin encoders, may be ill-formed or well-formed + GetPluginEncoders + : // This should never be reached + undefined + : undefined; + +type GetPluginFuncArrDecoders = + // Given an array of types infer `Q` (Q should be the type value) + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin decoders, may be ill-formed or well-formed + GetPluginDecoders + : // This should never be reached + undefined + : undefined; + +/** + * A helper type to get the statics to be intersected with `Jimp` to give + * the proper typing given an array of functions for plugins and types + */ +export type GetIntersectionFromPluginsStatics< + PluginFuncArr extends FunctionRet +> = UnionToIntersection> & { + encoders: UnionToIntersection>; + decoders: UnionToIntersection>; +}; + +/** + * While this was added to TS 3.5, in order to support down to TS 2.8, we need + * to export this and use it in sub-packges that utilize it + */ +export type Omit = Pick>; diff --git a/node_modules/@jimp/custom/CHANGELOG.md b/node_modules/@jimp/custom/CHANGELOG.md new file mode 100644 index 00000000..7c14f300 --- /dev/null +++ b/node_modules/@jimp/custom/CHANGELOG.md @@ -0,0 +1,59 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.10.0 (Mon Mar 30 2020) + +#### 🚀 Enhancement + +- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) + +#### Authors: 1 + +- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) + +--- + +# v0.9.6 (Wed Mar 18 2020) + +#### 🏠 Internal + +- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) + +#### Authors: 1 + +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/custom/LICENSE b/node_modules/@jimp/custom/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/custom/LICENSE rename to node_modules/@jimp/custom/LICENSE diff --git a/node_modules/@jimp/custom/README.md b/node_modules/@jimp/custom/README.md new file mode 100644 index 00000000..961d7333 --- /dev/null +++ b/node_modules/@jimp/custom/README.md @@ -0,0 +1,198 @@ +
+ +

@jimp/custom

+

Configure jimp with types and plugins.

+
+ +## Useful Defaults + +The following wil configure a `jimp` instance with the same functionality as the main `jimp` package. + +```js +import configure from "@jimp/custom"; +// all of jimp's default types +import types from "@jimp/types"; +// all of jimp's default types +import plugins from "@jimp/plugins"; + +configure({ + types: [types], + plugins: [plugins], +}); +``` + +## Available Methods + +### configure + +Takes a Jimp configuration and applies it to `@jimp/core`. + +Sample Jimp configuration: + +```js +import types from '@jimp/types'; + +import bmp from '@jimp/bmp'; +import jpeg from '@jimp/types'; +... + +configure({ + types: [types] +}) + +// or + +configure({ + types: [bmp, jpeg, ...] +}) +``` + +#### Extending Jimp Further + +You can use configure to add more types and plugins to a jimp multiple times. + +```js +let jimp = configure({ + types: [bmp], +}); + +jimp = configure( + { + types: [jpeg], + }, + jimp +); +``` + +## Type Definition + +To define a new Jimp image type write a function the takes the current Jimp configuration. In this function you can extend Jimp's internal data structures. + +This function must return an object whose key is the mime type and value is an array of valid file extensions. + +```js +const special = require('special-js'); + +const MIME_TYPE = 'image/special'; + +export default () => ({ + mime: {[MIME_TYPE], ['spec', 'special']}, + + constants: { + MIME_SPECIAL: MIME_TYPE + }, + + decoders: { + [MIME_TYPE]: data => special.decode(data) + }, + + encoders: { + [MIME_TYPE]: image => special.encode(image.bitmap) + } +}); +``` + +### Constants + +A jimp image type can expose as many constants as it wants. Each jimp type is required to expose a mime type. + +```js +constants: { + MIME_SPECIAL: MIME_TYPE +}, +``` + +### hasAlpha + +A image type can define whether it supports an alpha channel. + +```js +hasAlpha: { + MIME_SPECIAL: true +}, +``` + +### Decoder + +A function that when supplied with a buffer should return a bitmap with height and width. + +```js +decoders: { + [MIME_TYPE]: data => special.decode(data) +}, +``` + +### Encoder + +A function that when supplied with a Jimp image should return an encoded buffer. + +```js +encoders: { + [MIME_TYPE]: image => special.encode(image.bitmap) +} +``` + +### Class + +Add class properties and function to the Jimp constructor. + +```js +class: { + _quality: 100, + quality: function(n, cb) { + if (typeof n !== 'number') { + return throwError.call(this, 'n must be a number', cb); + } + + if (n < 0 || n > 100) { + return throwError.call(this, 'n must be a number 0 - 100', cb); + } + + this._quality = Math.round(n); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + } +}; +``` + +## Plugin Definition + +Defining a plugin has access to all the same things in the type definition. Mainly plugins use just the `constants` and `class` config options. + +Below is the `invert` plugin. If a plugin doesn return an object with `constants` and `class`, all keys are treated as class functions. + +```js +import { isNodePattern } from "@jimp/utils"; + +/** + * Inverts the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + invert(cb) { + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; + this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; + this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); +``` diff --git a/project starter code/node_modules/@jimp/custom/dist/index.js b/node_modules/@jimp/custom/dist/index.js similarity index 100% rename from project starter code/node_modules/@jimp/custom/dist/index.js rename to node_modules/@jimp/custom/dist/index.js diff --git a/node_modules/@jimp/custom/dist/index.js.map b/node_modules/@jimp/custom/dist/index.js.map new file mode 100644 index 00000000..c10c1212 --- /dev/null +++ b/node_modules/@jimp/custom/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;A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B,MAAAA,WAAW,CAACiB,MAAD,CAAX;AACD;AACF;;AAED,MAAIzB,aAAa,CAAC2B,KAAlB,EAAyB;AACvB3B,IAAAA,aAAa,CAAC2B,KAAd,CAAoBf,OAApB,CAA4BG,YAA5B;AAEAd,IAAAA,YAAY,CAACK,QAAb,qBACKL,YAAY,CAACK,QADlB,MAEKH,UAAU,CAACG,QAFhB;AAIAL,IAAAA,YAAY,CAACI,QAAb,qBACKJ,YAAY,CAACI,QADlB,MAEKF,UAAU,CAACE,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,MAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIJ,aAAa,CAAC4B,OAAlB,EAA2B;AACzB5B,IAAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange,\n} from \"@jimp/core\";\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {},\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value,\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach((mimeType) => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders,\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders,\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha,\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/custom/package.json b/node_modules/@jimp/custom/package.json new file mode 100644 index 00000000..61c55585 --- /dev/null +++ b/node_modules/@jimp/custom/package.json @@ -0,0 +1,27 @@ +{ + "name": "@jimp/custom", + "version": "0.16.13", + "description": "Interface to customize jimp configuration", + "main": "dist/index.js", + "module": "es/index.js", + "types": "types/index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/core": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/custom/src/index.js b/node_modules/@jimp/custom/src/index.js new file mode 100644 index 00000000..dddc7d90 --- /dev/null +++ b/node_modules/@jimp/custom/src/index.js @@ -0,0 +1,74 @@ +import Jimp, { + addType, + addJimpMethods, + addConstants, + jimpEvChange, +} from "@jimp/core"; + +export default function configure(configuration, jimpInstance = Jimp) { + const jimpConfig = { + hasAlpha: {}, + encoders: {}, + decoders: {}, + class: {}, + constants: {}, + }; + + function addToConfig(newConfig) { + Object.entries(newConfig).forEach(([key, value]) => { + jimpConfig[key] = { + ...jimpConfig[key], + ...value, + }; + }); + } + + function addImageType(typeModule) { + const type = typeModule(); + + if (Array.isArray(type.mime)) { + addType(...type.mime); + } else { + Object.entries(type.mime).forEach((mimeType) => addType(...mimeType)); + } + + delete type.mime; + addToConfig(type); + } + + function addPlugin(pluginModule) { + const plugin = pluginModule(jimpEvChange) || {}; + if (!plugin.class && !plugin.constants) { + // Default to class function + addToConfig({ class: plugin }); + } else { + addToConfig(plugin); + } + } + + if (configuration.types) { + configuration.types.forEach(addImageType); + + jimpInstance.decoders = { + ...jimpInstance.decoders, + ...jimpConfig.decoders, + }; + jimpInstance.encoders = { + ...jimpInstance.encoders, + ...jimpConfig.encoders, + }; + jimpInstance.hasAlpha = { + ...jimpInstance.hasAlpha, + ...jimpConfig.hasAlpha, + }; + } + + if (configuration.plugins) { + configuration.plugins.forEach(addPlugin); + } + + addJimpMethods(jimpConfig.class, jimpInstance); + addConstants(jimpConfig.constants, jimpInstance); + + return Jimp; +} diff --git a/node_modules/@jimp/custom/types/index.d.ts b/node_modules/@jimp/custom/types/index.d.ts new file mode 100644 index 00000000..4bdca8d0 --- /dev/null +++ b/node_modules/@jimp/custom/types/index.d.ts @@ -0,0 +1,40 @@ +// TypeScript Version: 3.1 +// See the `jimp` package index.d.ts for why the version is not 2.8 +import { + FunctionRet, + Jimp, + JimpPlugin, + JimpType, + GetIntersectionFromPlugins, + GetIntersectionFromPluginsStatics, + JimpConstructors, +} from "@jimp/core"; + +type JimpInstance< + TypesFuncArr extends FunctionRet | undefined, + PluginFuncArr extends FunctionRet | undefined, + J extends JimpConstructors +> = J & + GetIntersectionFromPluginsStatics< + Exclude + > & { + prototype: JimpType & + GetIntersectionFromPlugins< + Exclude + >; + }; + +declare function configure< + TypesFuncArr extends FunctionRet | undefined = undefined, + PluginFuncArr extends FunctionRet | undefined = undefined, + J extends JimpConstructors = JimpConstructors +>( + configuration: { + types?: TypesFuncArr; + plugins?: PluginFuncArr; + }, + jimpInstance?: J + // Since JimpInstance is required, we want to use the default `Jimp` type +): JimpInstance; + +export default configure; diff --git a/node_modules/@jimp/custom/types/test.ts b/node_modules/@jimp/custom/types/test.ts new file mode 100644 index 00000000..e0f77bb2 --- /dev/null +++ b/node_modules/@jimp/custom/types/test.ts @@ -0,0 +1,401 @@ +import configure from "@jimp/custom"; +import gif from "@jimp/gif"; +import png from "@jimp/png"; +import displace from "@jimp/plugin-displace"; +import resize from "@jimp/plugin-resize"; +import scale from "@jimp/plugin-scale"; +import types from "@jimp/types"; +import plugins from "@jimp/plugins"; +import * as Jimp from "jimp"; + +// configure should return a valid Jimp type with addons +const CustomJimp = configure({ + types: [gif, png], + plugins: [displace, resize], +}); + +test("should function the same as the `jimp` types", () => { + const FullCustomJimp = configure({ + types: [types], + plugins: [plugins], + }); + + const jimpInst = new FullCustomJimp("test"); + + // Main Jimp export should already have all of these already applied + // $ExpectError + jimpInst.read("Test"); + jimpInst.displace(jimpInst, 2); + jimpInst.resize(40, 40); + jimpInst.displace(jimpInst, 2); + jimpInst.shadow((err, val, coords) => {}); + jimpInst.fishEye({ r: 12 }); + jimpInst.circle({ radius: 12, x: 12, y: 12 }); + // $ExpectError + jimpInst.PNG_FILTER_NONE; + + // $ExpectError + jimpInst.test; + + // $ExpectError + jimpInst.func(); + + // Main Jimp export should already have all of these already applied + FullCustomJimp.read("Test"); + + // $ExpectType 0 + FullCustomJimp.PNG_FILTER_NONE; + + // $ExpectError + FullCustomJimp.test; + + // $ExpectError + FullCustomJimp.func(); + + test("can clone properly", async () => { + const baseImage = await FullCustomJimp.read("filename"); + const cloneBaseImage = baseImage.clone(); + + // $ExpectType number + cloneBaseImage._deflateLevel; + + test("can handle `this` returns on the core type properly", () => { + // $ExpectType number + cloneBaseImage.posterize(3)._quality; + }); + + test("can handle `this` returns properly", () => { + cloneBaseImage + .resize(1, 1) + .crop(0, 0, 0, 0) + .mask(cloneBaseImage, 2, 2) + .print("a" as any, 2, 2, "a" as any) + .resize(1, 1) + .quality(1) + .deflateLevel(2)._filterType; + }); + + test("can handle imageCallbacks `this` properly", () => { + cloneBaseImage.rgba(false, (_, jimpCBIn) => { + // $ExpectError + jimpCBIn.read("Test"); + jimpCBIn.displace(jimpInst, 2); + jimpCBIn.resize(40, 40); + // $ExpectType number + jimpCBIn._filterType; + + // $ExpectError + jimpCBIn.test; + + // $ExpectError + jimpCBIn.func(); + }); + }); + }); + + test("Can handle callback with constructor", () => { + const myBmpBuffer: Buffer = {} as any; + + Jimp.read(myBmpBuffer, (err, cbJimpInst) => { + // $ExpectError + cbJimpInst.read("Test"); + cbJimpInst.displace(jimpInst, 2); + cbJimpInst.resize(40, 40); + // $ExpectType number + cbJimpInst._filterType; + + // $ExpectError + cbJimpInst.test; + + // $ExpectError + cbJimpInst.func(); + }); + }); +}); + +test("can handle custom jimp", () => { + // Constants from types should be applied + // $ExpectType 0 + CustomJimp.PNG_FILTER_NONE; + + // Core functions should still work from Jimp + CustomJimp.read("Test"); + + // Constants should not(?) be applied from ill-formed plugins + // $ExpectError + CustomJimp.displace(CustomJimp, 2); + + // Methods should be applied from well-formed plugins only to the instance + // $ExpectError + CustomJimp.resize(40, 40); + + // Constants should be applied from well-formed plugins + CustomJimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + CustomJimp.test; + + // $ExpectError + CustomJimp.func(); + + const Jiimp = new CustomJimp("test"); + // Methods from types should be applied + Jiimp.deflateLevel(4); + // Constants from types should be applied to the static only + // $ExpectError + Jiimp.PNG_FILTER_NONE; + + // Core functions should still work from Jimp + Jiimp.getPixelColor(1, 1); + + // Constants should be applied from ill-formed plugins + Jiimp.displace(Jiimp, 2); + + // Methods should be applied from well-formed plugins + Jiimp.resize(40, 40); + + // Constants should not be applied to the object + // $ExpectError + Jiimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + Jiimp.test; + + // $ExpectError + Jiimp.func(); +}); + +test("can compose", () => { + const OtherCustomJimp = configure( + { + plugins: [scale], + }, + CustomJimp + ); + // Constants from types should be applied + // $ExpectType 0 + OtherCustomJimp.PNG_FILTER_NONE; + + // Core functions should still work from Jimp + OtherCustomJimp.read("Test"); + + // Constants should not be applied to the static instance from ill-formed plugins + // $ExpectError + OtherCustomJimp.displace(OtherCustomJimp, 2); + + // Methods should not be applied to the static instance from well-formed plugins + // $ExpectError + OtherCustomJimp.resize(40, 40); + + // Constants should be applied from well-formed plugins + OtherCustomJimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + OtherCustomJimp.test; + + // $ExpectError + OtherCustomJimp.func(); + + const Jiimp = new OtherCustomJimp("test"); + // Methods from types should be applied + Jiimp.deflateLevel(4); + // Constants from types should not be applied to objects + // $ExpectError + Jiimp.PNG_FILTER_NONE; + + // Methods from new plugins should be applied + Jiimp.scale(3); + + // Methods from types should be applied + Jiimp.filterType(4); + + // Core functions should still work from Jimp + Jiimp.getPixelColor(1, 1); + + // Constants should be applied from ill-formed plugins + Jiimp.displace(Jiimp, 2); + + // Methods should be applied from well-formed plugins + Jiimp.resize(40, 40); + + // Constants should not be applied from well-formed plugins to objects + // $ExpectError + Jiimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + Jiimp.test; + + // $ExpectError + Jiimp.func(); +}); + +test("can handle only plugins", () => { + const PluginsJimp = configure({ + plugins: [plugins], + }); + + // Core functions should still work from Jimp + PluginsJimp.read("Test"); + + // Constants should not be applied from ill-formed plugins + // $ExpectError + PluginsJimp.displace(PluginsJimp, 2); + + // Methods should be not be applied to from well-formed plugins to the top level + // $ExpectError + PluginsJimp.resize(40, 40); + + // Constants should be applied from well-formed plugins + // $ExpectType "nearestNeighbor" + PluginsJimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + PluginsJimp.test; + + // $ExpectError + PluginsJimp.func(); + + const Jiimp = new PluginsJimp("test"); + + // Core functions should still work from Jimp + Jiimp.getPixelColor(1, 1); + + // Constants should be applied from ill-formed plugins + Jiimp.displace(Jiimp, 2); + + // Methods should be applied from well-formed plugins + Jiimp.resize(40, 40); + + // Constants should be not applied to objects from well-formed plugins + // $ExpectError + Jiimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + Jiimp.test; + + // $ExpectError + Jiimp.func(); +}); + +test("can handle only all types", () => { + const TypesJimp = configure({ + types: [types], + }); + + // Methods from types should not be applied + // $ExpectError + TypesJimp.filterType(4); + // Constants from types should be applied + // $ExpectType 0 + TypesJimp.PNG_FILTER_NONE; + + // $ExpectError + TypesJimp.test; + + // $ExpectError + TypesJimp.func(); + + const Jiimp = new TypesJimp("test"); + // Methods from types should be applied + Jiimp.filterType(4); + // Constants from types should be not applied to objects + // $ExpectError + Jiimp.PNG_FILTER_NONE; + + // $ExpectError + Jiimp.test; + + // $ExpectError + Jiimp.func(); +}); + +test("can handle only one type", () => { + const PngJimp = configure({ + types: [png], + }); + + // Constants from other types should be not applied + // $ExpectError + PngJimp.MIME_TIFF; + + // Constants from types should be applied + // $ExpectType 0 + PngJimp.PNG_FILTER_NONE; + + // $ExpectError + PngJimp.test; + + // $ExpectError + PngJimp.func(); + + const Jiimp = new PngJimp("test"); + // Constants from other types should be not applied + // $ExpectError + Jiimp.MIME_TIFF; + + // Constants from types should not be applied to objects + // $ExpectError + Jiimp.PNG_FILTER_NONE; + + // $ExpectError + Jiimp.test; + + // $ExpectError + Jiimp.func(); +}); + +test("can handle only one plugin", () => { + const ResizeJimp = configure({ + plugins: [resize], + }); + + // Constants from other plugins should be not applied + // $ExpectError + ResizeJimp.FONT_SANS_8_BLACK; + + // Constants from plugin should be applied + // $ExpectType "nearestNeighbor" + ResizeJimp.RESIZE_NEAREST_NEIGHBOR; + + // $ExpectError + ResizeJimp.resize(2, 2); + + // $ExpectError + ResizeJimp.test; + + // $ExpectError + ResizeJimp.func(); + + const Jiimp: InstanceType = new ResizeJimp("test"); + // Constants from other plugins should be not applied + // $ExpectError + Jiimp.FONT_SANS_8_BLACK; + + // Constants from plugin should not be applied to the object + // $ExpectError + Jiimp.RESIZE_NEAREST_NEIGHBOR; + + Jiimp.resize(2, 2); + + // $ExpectError + Jiimp.test; + + // $ExpectError + Jiimp.func(); +}); + +test("Can handle appendConstructorOption", () => { + const AppendJimp = configure({}); + + AppendJimp.appendConstructorOption( + "Name of Option", + (args) => args.hasSomeCustomThing, + function (resolve, reject, args) { + // $ExpectError + this.bitmap = 3; + // $ExpectError + AppendJimp.resize(2, 2); + resolve(); + } + ); +}); diff --git a/project starter code/node_modules/@jimp/custom/types/tsconfig.json b/node_modules/@jimp/custom/types/tsconfig.json similarity index 100% rename from project starter code/node_modules/@jimp/custom/types/tsconfig.json rename to node_modules/@jimp/custom/types/tsconfig.json diff --git a/node_modules/@jimp/gif/CHANGELOG.md b/node_modules/@jimp/gif/CHANGELOG.md new file mode 100644 index 00000000..6a9f1c91 --- /dev/null +++ b/node_modules/@jimp/gif/CHANGELOG.md @@ -0,0 +1,48 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.13.0 (Fri Jun 05 2020) + +#### 🚀 Enhancement + +- Add single frame encoder for type-gif [#899](https://github.com/oliver-moran/jimp/pull/899) ([@jeffbseeking](https://github.com/jeffbseeking) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Jeff Bonnes ([@jeffbseeking](https://github.com/jeffbseeking)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/gif/LICENSE b/node_modules/@jimp/gif/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/gif/LICENSE rename to node_modules/@jimp/gif/LICENSE diff --git a/project starter code/node_modules/@jimp/gif/README.md b/node_modules/@jimp/gif/README.md similarity index 100% rename from project starter code/node_modules/@jimp/gif/README.md rename to node_modules/@jimp/gif/README.md diff --git a/node_modules/@jimp/gif/dist/index.js b/node_modules/@jimp/gif/dist/index.js new file mode 100644 index 00000000..5633a04f --- /dev/null +++ b/node_modules/@jimp/gif/dist/index.js @@ -0,0 +1,50 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _omggif = _interopRequireDefault(require("omggif")); + +var _gifwrap = require("gifwrap"); + +var MIME_TYPE = "image/gif"; + +var _default = function _default() { + return { + mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ["gif"]), + constants: { + MIME_GIF: MIME_TYPE + }, + decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { + var gifObj = new _omggif["default"].GifReader(data); + var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); + gifObj.decodeAndBlitFrameRGBA(0, gifData); + return { + data: gifData, + width: gifObj.width, + height: gifObj.height + }; + }), + encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { + var bitmap = new _gifwrap.BitmapImage(data.bitmap); + + _gifwrap.GifUtil.quantizeDekker(bitmap, 256); + + var newFrame = new _gifwrap.GifFrame(bitmap); + var gifCodec = new _gifwrap.GifCodec(); + return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { + return newGif.buffer; + }); + }) + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/gif/dist/index.js.map b/node_modules/@jimp/gif/dist/index.js.map new file mode 100644 index 00000000..55d22e17 --- /dev/null +++ b/node_modules/@jimp/gif/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEH;AADD,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAACK,IAAD,EAAU;AACrB,UAAMC,MAAM,GAAG,IAAIC,mBAAIC,SAAR,CAAkBH,IAAlB,CAAf;AACA,UAAMI,OAAO,GAAGC,MAAM,CAACC,KAAP,CAAaL,MAAM,CAACM,KAAP,GAAeN,MAAM,CAACO,MAAtB,GAA+B,CAA5C,CAAhB;AAEAP,MAAAA,MAAM,CAACQ,sBAAP,CAA8B,CAA9B,EAAiCL,OAAjC;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEI,OADD;AAELG,QAAAA,KAAK,EAAEN,MAAM,CAACM,KAFT;AAGLC,QAAAA,MAAM,EAAEP,MAAM,CAACO;AAHV,OAAP;AAKD,KAZK,CAPY;AAsBpBE,IAAAA,QAAQ,uCACLf,SADK,EACO,UAACK,IAAD,EAAU;AACrB,UAAMW,MAAM,GAAG,IAAIC,oBAAJ,CAAgBZ,IAAI,CAACW,MAArB,CAAf;;AACAE,uBAAQC,cAAR,CAAuBH,MAAvB,EAA+B,GAA/B;;AACA,UAAMI,QAAQ,GAAG,IAAIC,iBAAJ,CAAaL,MAAb,CAAjB;AACA,UAAMM,QAAQ,GAAG,IAAIC,iBAAJ,EAAjB;AACA,aAAOD,QAAQ,CAACE,SAAT,CAAmB,CAACJ,QAAD,CAAnB,EAA+B,EAA/B,EAAmCK,IAAnC,CAAwC,UAACC,MAAD,EAAY;AACzD,eAAOA,MAAM,CAACC,MAAd;AACD,OAFM,CAAP;AAGD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import GIF from \"omggif\";\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from \"gifwrap\";\n\nconst MIME_TYPE = \"image/gif\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"gif\"] },\n\n constants: {\n MIME_GIF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height,\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (data) => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then((newGif) => {\n return newGif.buffer;\n });\n },\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/gif/index.d.ts b/node_modules/@jimp/gif/index.d.ts new file mode 100644 index 00000000..d1b1c679 --- /dev/null +++ b/node_modules/@jimp/gif/index.d.ts @@ -0,0 +1,17 @@ +import { DecoderFn } from "@jimp/core"; + +interface Gif { + mime: { + "image/gif": string[]; + }; + + constants: { + MIME_GIF: "image/gif"; + }; + + decoders: { + "image/gif": DecoderFn; + }; +} + +export default function (): Gif; diff --git a/node_modules/@jimp/gif/package.json b/node_modules/@jimp/gif/package.json new file mode 100644 index 00000000..023efdd8 --- /dev/null +++ b/node_modules/@jimp/gif/package.json @@ -0,0 +1,32 @@ +{ + "name": "@jimp/gif", + "version": "0.16.13", + "description": "Default Jimp gif encoder/decoder.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "gifwrap": "^0.9.2", + "omggif": "^1.0.9" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/gif/src/index.js b/node_modules/@jimp/gif/src/index.js new file mode 100644 index 00000000..7acf2ff9 --- /dev/null +++ b/node_modules/@jimp/gif/src/index.js @@ -0,0 +1,39 @@ +import GIF from "omggif"; +import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap"; + +const MIME_TYPE = "image/gif"; + +export default () => ({ + mime: { [MIME_TYPE]: ["gif"] }, + + constants: { + MIME_GIF: MIME_TYPE, + }, + + decoders: { + [MIME_TYPE]: (data) => { + const gifObj = new GIF.GifReader(data); + const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); + + gifObj.decodeAndBlitFrameRGBA(0, gifData); + + return { + data: gifData, + width: gifObj.width, + height: gifObj.height, + }; + }, + }, + + encoders: { + [MIME_TYPE]: (data) => { + const bitmap = new BitmapImage(data.bitmap); + GifUtil.quantizeDekker(bitmap, 256); + const newFrame = new GifFrame(bitmap); + const gifCodec = new GifCodec(); + return gifCodec.encodeGif([newFrame], {}).then((newGif) => { + return newGif.buffer; + }); + }, + }, +}); diff --git a/node_modules/@jimp/gif/test/gif.test.js b/node_modules/@jimp/gif/test/gif.test.js new file mode 100644 index 00000000..7b316887 --- /dev/null +++ b/node_modules/@jimp/gif/test/gif.test.js @@ -0,0 +1,26 @@ +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import gif from "../src"; + +const jimp = configure({ types: [gif] }, Jimp); + +describe("GIF", () => { + const imagesDir = getTestDir(__dirname) + "/images"; + + it("load GIF", async () => { + const image = await jimp.read(imagesDir + "/flower.gif"); + image.getPixelColor(10, 10).should.be.equal(0xe5e6d9ff); + }); + + it("load animated GIF", async () => { + const image = await jimp.read(imagesDir + "/animated.gif"); + image.getPixelColor(10, 10).should.be.equal(0xa1d2f1ff); + }); + + it("export GIF", async () => { + const jgd = await jimp.read(imagesDir + "/flower.gif"); + const buffer = await jgd.getBufferAsync("image/gif"); + buffer.toString().startsWith("GIF").should.be.equal(true); + }); +}); diff --git a/project starter code/node_modules/@jimp/gif/test/images/animated.gif b/node_modules/@jimp/gif/test/images/animated.gif similarity index 100% rename from project starter code/node_modules/@jimp/gif/test/images/animated.gif rename to node_modules/@jimp/gif/test/images/animated.gif diff --git a/project starter code/node_modules/@jimp/gif/test/images/flower.gif b/node_modules/@jimp/gif/test/images/flower.gif similarity index 100% rename from project starter code/node_modules/@jimp/gif/test/images/flower.gif rename to node_modules/@jimp/gif/test/images/flower.gif diff --git a/node_modules/@jimp/jpeg/CHANGELOG.md b/node_modules/@jimp/jpeg/CHANGELOG.md new file mode 100644 index 00000000..e33a92ff --- /dev/null +++ b/node_modules/@jimp/jpeg/CHANGELOG.md @@ -0,0 +1,84 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.2 (Thu Sep 15 2022) + +#### 🐛 Bug Fix + +- Bump jpeg-js over 0.4.4 to avoid cve-2022-25851 [#1093](https://github.com/oliver-moran/jimp/pull/1093) ([@melhadad](https://github.com/melhadad)) + +#### Authors: 1 + +- Michael Elhadad ([@melhadad](https://github.com/melhadad)) + +--- + +# v0.16.1 (Fri Aug 28 2020) + +#### 🐛 Bug Fix + +- upgrade jpeg-js dependency [#933](https://github.com/oliver-moran/jimp/pull/933) (vincentdufrasnes@vincent-dufrasnes [@Chupsy](https://github.com/Chupsy)) + +#### Authors: 2 + +- Vincent Dufrasnes ([@Chupsy](https://github.com/Chupsy)) +- vincent dufrasnes (vincentdufrasnes@vincent-dufrasnes) + +--- + +# v0.12.1 (Tue May 19 2020) + +#### 🐛 Bug Fix + +- update jpeg-js [#892](https://github.com/oliver-moran/jimp/pull/892) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.10.0 (Mon Mar 30 2020) + +#### 🚀 Enhancement + +- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) + +#### Authors: 1 + +- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/jpeg/LICENSE b/node_modules/@jimp/jpeg/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/jpeg/LICENSE rename to node_modules/@jimp/jpeg/LICENSE diff --git a/project starter code/node_modules/@jimp/jpeg/README.md b/node_modules/@jimp/jpeg/README.md similarity index 100% rename from project starter code/node_modules/@jimp/jpeg/README.md rename to node_modules/@jimp/jpeg/README.md diff --git a/node_modules/@jimp/jpeg/dist/index.js b/node_modules/@jimp/jpeg/dist/index.js new file mode 100644 index 00000000..835f10cd --- /dev/null +++ b/node_modules/@jimp/jpeg/dist/index.js @@ -0,0 +1,61 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _jpegJs = _interopRequireDefault(require("jpeg-js")); + +var _utils = require("@jimp/utils"); + +var MIME_TYPE = "image/jpeg"; + +var _default = function _default() { + return { + mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ["jpeg", "jpg", "jpe"]), + constants: { + MIME_JPEG: MIME_TYPE + }, + decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), + encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { + return _jpegJs["default"].encode(image.bitmap, image._quality).data; + }), + "class": { + // The quality to be used when saving JPEG images + _quality: 100, + + /** + * Sets the quality of the image when saving as JPEG format (default is 100) + * @param {number} n The quality to use 0-100 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + quality: function quality(n, cb) { + if (typeof n !== "number") { + return _utils.throwError.call(this, "n must be a number", cb); + } + + if (n < 0 || n > 100) { + return _utils.throwError.call(this, "n must be a number 0 - 100", cb); + } + + this._quality = Math.round(n); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/jpeg/dist/index.js.map b/node_modules/@jimp/jpeg/dist/index.js.map new file mode 100644 index 00000000..11caf6f7 --- /dev/null +++ b/node_modules/@jimp/jpeg/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAACQ,KAAD;AAAA,aAAWH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAArD;AAAA,KADP,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from \"jpeg-js\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/jpeg\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"jpeg\", \"jpg\", \"jpe\"] },\n\n constants: {\n MIME_JPEG: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode,\n },\n\n encoders: {\n [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data,\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, \"n must be a number 0 - 100\", cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/jpeg/index.d.ts b/node_modules/@jimp/jpeg/index.d.ts new file mode 100644 index 00000000..94b86ba2 --- /dev/null +++ b/node_modules/@jimp/jpeg/index.d.ts @@ -0,0 +1,26 @@ +import { DecoderFn, EncoderFn, ImageCallback } from "@jimp/core"; + +interface JpegClass { + _quality: number; + quality: (n: number, cb?: ImageCallback) => this; +} + +interface Jpeg { + mime: { "image/jpeg": string[] }; + + constants: { + MIME_JPEG: "image/jpeg"; + }; + + encoders: { + "image/jpeg": EncoderFn; + }; + + decoders: { + "image/jpeg": DecoderFn; + }; + + class: JpegClass; +} + +export default function (): Jpeg; diff --git a/node_modules/@jimp/jpeg/package.json b/node_modules/@jimp/jpeg/package.json new file mode 100644 index 00000000..6859cbdd --- /dev/null +++ b/node_modules/@jimp/jpeg/package.json @@ -0,0 +1,38 @@ +{ + "name": "@jimp/jpeg", + "version": "0.16.13", + "description": "Default Jimp jpeg encoder/decoder.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "jpeg-js": "^0.4.2" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/jpeg/src/index.js b/node_modules/@jimp/jpeg/src/index.js new file mode 100644 index 00000000..489c8220 --- /dev/null +++ b/node_modules/@jimp/jpeg/src/index.js @@ -0,0 +1,48 @@ +import JPEG from "jpeg-js"; +import { throwError, isNodePattern } from "@jimp/utils"; + +const MIME_TYPE = "image/jpeg"; + +export default () => ({ + mime: { [MIME_TYPE]: ["jpeg", "jpg", "jpe"] }, + + constants: { + MIME_JPEG: MIME_TYPE, + }, + + decoders: { + [MIME_TYPE]: JPEG.decode, + }, + + encoders: { + [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data, + }, + + class: { + // The quality to be used when saving JPEG images + _quality: 100, + /** + * Sets the quality of the image when saving as JPEG format (default is 100) + * @param {number} n The quality to use 0-100 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + quality(n, cb) { + if (typeof n !== "number") { + return throwError.call(this, "n must be a number", cb); + } + + if (n < 0 || n > 100) { + return throwError.call(this, "n must be a number 0 - 100", cb); + } + + this._quality = Math.round(n); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + }, +}); diff --git a/project starter code/node_modules/@jimp/jpeg/test/images/cops.jpg b/node_modules/@jimp/jpeg/test/images/cops.jpg similarity index 100% rename from project starter code/node_modules/@jimp/jpeg/test/images/cops.jpg rename to node_modules/@jimp/jpeg/test/images/cops.jpg diff --git a/project starter code/node_modules/@jimp/jpeg/test/images/fillbytes.jpg b/node_modules/@jimp/jpeg/test/images/fillbytes.jpg similarity index 100% rename from project starter code/node_modules/@jimp/jpeg/test/images/fillbytes.jpg rename to node_modules/@jimp/jpeg/test/images/fillbytes.jpg diff --git a/node_modules/@jimp/jpeg/test/jpeg.test.js b/node_modules/@jimp/jpeg/test/jpeg.test.js new file mode 100644 index 00000000..6ee30b7c --- /dev/null +++ b/node_modules/@jimp/jpeg/test/jpeg.test.js @@ -0,0 +1,41 @@ +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import jpeg from "../src"; + +const jimp = configure({ types: [jpeg] }, Jimp); + +describe("JPEG", () => { + const imagesDir = getTestDir(__dirname) + "/images"; + + it("load JPG", async () => { + const image = await jimp.read(imagesDir + "/cops.jpg"); + + image.getPixelColor(10, 10).should.be.equal(0x3f4a02ff); + image.getPixelColor(220, 190).should.be.equal(0x5d94b6ff); + image.getPixelColor(350, 130).should.be.equal(0xdf7944ff); + }); + + it("load JPG with fill bytes", async () => { + const image = await jimp.read(imagesDir + "/fillbytes.jpg"); + + image.getPixelColor(10, 10).should.be.equal(0xaeb8c3ff); + image.getPixelColor(220, 190).should.be.equal(0x262b21ff); + image.getPixelColor(350, 130).should.be.equal(0x4e5d30ff); + }); + + it("export JPG", async () => { + const image = await jimp.read({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + image.quality(50); + const buffer = await image.getBufferAsync("image/jpeg"); + + buffer.toString().should.match(/^.{3,9}JFIF\u0000/); + }); +}); diff --git a/node_modules/@jimp/plugin-blit/CHANGELOG.md b/node_modules/@jimp/plugin-blit/CHANGELOG.md new file mode 100644 index 00000000..cf26b5c3 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/CHANGELOG.md @@ -0,0 +1,36 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-blit/LICENSE b/node_modules/@jimp/plugin-blit/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/LICENSE rename to node_modules/@jimp/plugin-blit/LICENSE diff --git a/node_modules/@jimp/plugin-blit/README.md b/node_modules/@jimp/plugin-blit/README.md new file mode 100644 index 00000000..7ceb4815 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/README.md @@ -0,0 +1,34 @@ +
+ +

@jimp/plugin-blit

+

Blit an image.

+
+ +> Blit - a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. + +## Usage + +Blits a source image on to this image + +- @param {Jimp} src image to blit +- @param {number} x the x position to blit the image +- @param {number} y the y position to blit the image +- @param {number} srcx (optional) the x position from which to crop the source image +- @param {number} srcy (optional) the y position from which to crop the source image +- @param {number} srcw (optional) the width to which to crop the source image +- @param {number} srch (optional) the height to which to crop the source image +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + const parrot = await jimp.read("test/party-parrot.png"); + + image.blit(parrot, x, y); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-blit/dist/index.js b/node_modules/@jimp/plugin-blit/dist/index.js new file mode 100644 index 00000000..0e237b8a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/index.js @@ -0,0 +1,99 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _utils = require("@jimp/utils"); + +var _default = function _default() { + return { + /** + * Blits a source image on to this image + * @param {Jimp} src the source Jimp instance + * @param {number} x the x position to blit the image + * @param {number} y the y position to blit the image + * @param {number} srcx (optional) the x position from which to crop the source image + * @param {number} srcy (optional) the y position from which to crop the source image + * @param {number} srcw (optional) the width to which to crop the source image + * @param {number} srch (optional) the height to which to crop the source image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { + if (!(src instanceof this.constructor)) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } + + if (typeof srcx === "function") { + cb = srcx; + srcx = 0; + srcy = 0; + srcw = src.bitmap.width; + srch = src.bitmap.height; + } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { + srcx = srcx || 0; + srcy = srcy || 0; + srcw = srcw || src.bitmap.width; + srch = srch || src.bitmap.height; + } else { + return _utils.throwError.call(this, "srcx, srcy, srcw, srch must be numbers", cb); + } // round input + + + x = Math.round(x); + y = Math.round(y); // round input + + srcx = Math.round(srcx); + srcy = Math.round(srcy); + srcw = Math.round(srcw); + srch = Math.round(srch); + var maxWidth = this.bitmap.width; + var maxHeight = this.bitmap.height; + var baseImage = this; + src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { + var xOffset = x + sx - srcx; + var yOffset = y + sy - srcy; + + if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { + var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); + var _src = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2], + a: this.bitmap.data[idx + 3] + }; + var dst = { + r: baseImage.bitmap.data[dstIdx], + g: baseImage.bitmap.data[dstIdx + 1], + b: baseImage.bitmap.data[dstIdx + 2], + a: baseImage.bitmap.data[dstIdx + 3] + }; + baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; + baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; + baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; + baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); + } + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/index.js.map b/node_modules/@jimp/plugin-blit/dist/index.js.map new file mode 100644 index 00000000..835bdb8e --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"mappings":";;;;;;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;;;;;;AAYAA,IAAAA,IAboB,gBAafC,GAbe,EAaVC,CAbU,EAaPC,CAbO,EAaJC,IAbI,EAaEC,IAbF,EAaQC,IAbR,EAacC,IAbd,EAaoBC,EAbpB,EAawB;AAC1C,U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,CAA/B,IAAoC,KAAKjB,WAAL,CAAiByB,QAAjB,CAClCD,GAAG,CAACD,CAAJ,GAAQ/B,IAAG,CAAC+B,CADsB,CAApC;AAGD;AACF,OAnCD;;AAqCA,UAAI,0BAAcxB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof srcx === \"function\") {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n \"srcx, srcy, srcw, srch must be numbers\",\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3],\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3],\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/index.d.ts b/node_modules/@jimp/plugin-blit/index.d.ts new file mode 100644 index 00000000..0caad70e --- /dev/null +++ b/node_modules/@jimp/plugin-blit/index.d.ts @@ -0,0 +1,17 @@ +import { Jimp, ImageCallback } from "@jimp/core"; + +interface Blit { + blit(src: Jimp, x: number, y: number, cb?: ImageCallback): this; + blit( + src: Jimp, + x: number, + y: number, + srcx: number, + srcy: number, + srcw: number, + srch: number, + cb?: ImageCallback + ): this; +} + +export default function (): Blit; diff --git a/node_modules/@jimp/plugin-blit/package.json b/node_modules/@jimp/plugin-blit/package.json new file mode 100644 index 00000000..76a9143d --- /dev/null +++ b/node_modules/@jimp/plugin-blit/package.json @@ -0,0 +1,38 @@ +{ + "name": "@jimp/plugin-blit", + "version": "0.16.13", + "description": "Blit an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/jpeg": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-blit/src/index.js b/node_modules/@jimp/plugin-blit/src/index.js new file mode 100644 index 00000000..133a5374 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/src/index.js @@ -0,0 +1,105 @@ +import { throwError, isNodePattern } from "@jimp/utils"; + +export default () => ({ + /** + * Blits a source image on to this image + * @param {Jimp} src the source Jimp instance + * @param {number} x the x position to blit the image + * @param {number} y the y position to blit the image + * @param {number} srcx (optional) the x position from which to crop the source image + * @param {number} srcy (optional) the y position from which to crop the source image + * @param {number} srcw (optional) the width to which to crop the source image + * @param {number} srch (optional) the height to which to crop the source image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blit(src, x, y, srcx, srcy, srcw, srch, cb) { + if (!(src instanceof this.constructor)) { + return throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); + } + + if (typeof srcx === "function") { + cb = srcx; + srcx = 0; + srcy = 0; + srcw = src.bitmap.width; + srch = src.bitmap.height; + } else if ( + typeof srcx === typeof srcy && + typeof srcy === typeof srcw && + typeof srcw === typeof srch + ) { + srcx = srcx || 0; + srcy = srcy || 0; + srcw = srcw || src.bitmap.width; + srch = srch || src.bitmap.height; + } else { + return throwError.call( + this, + "srcx, srcy, srcw, srch must be numbers", + cb + ); + } + + // round input + x = Math.round(x); + y = Math.round(y); + + // round input + srcx = Math.round(srcx); + srcy = Math.round(srcy); + srcw = Math.round(srcw); + srch = Math.round(srch); + + const maxWidth = this.bitmap.width; + const maxHeight = this.bitmap.height; + const baseImage = this; + + src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { + const xOffset = x + sx - srcx; + const yOffset = y + sy - srcy; + + if ( + xOffset >= 0 && + yOffset >= 0 && + maxWidth - xOffset > 0 && + maxHeight - yOffset > 0 + ) { + const dstIdx = baseImage.getPixelIndex(xOffset, yOffset); + const src = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2], + a: this.bitmap.data[idx + 3], + }; + + const dst = { + r: baseImage.bitmap.data[dstIdx], + g: baseImage.bitmap.data[dstIdx + 1], + b: baseImage.bitmap.data[dstIdx + 2], + a: baseImage.bitmap.data[dstIdx + 3], + }; + + baseImage.bitmap.data[dstIdx] = + ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r; + baseImage.bitmap.data[dstIdx + 1] = + ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g; + baseImage.bitmap.data[dstIdx + 2] = + ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b; + baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255( + dst.a + src.a + ); + } + }); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-blit/test/blit.test.js b/node_modules/@jimp/plugin-blit/test/blit.test.js new file mode 100644 index 00000000..d4e11a1a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/test/blit.test.js @@ -0,0 +1,235 @@ +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import jpeg from "@jimp/jpeg"; +import configure from "@jimp/custom"; + +import blit from "../src"; + +const jimp = configure({ types: [jpeg], plugins: [blit] }, Jimp); +const testDir = getTestDir(__dirname); + +describe("Blit over image", function () { + this.timeout(15000); + const targetJGD = mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ); + const srcJGD = mkJGD( + "□□□□□□", + "□▥▥▥▥□", + "□▥■■▥□", + "□▥■■▥□", + "□▥▥▥▥□", + "□□□□□□" + ); + + let targetImg; + let srcImg; // stores the Jimp instances of the JGD images above. + + before((done) => { + const img1 = jimp.read(targetJGD); + const img2 = jimp.read(srcJGD); + Promise.all([img1, img2]) + .then((images) => { + targetImg = images[0]; + srcImg = images[1]; + done(); + }) + .catch(done); + }); + + it("blit on top, with no crop", () => { + targetImg + .clone() + .blit(srcImg, 0, 0) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "□□□□□□▸▸", + "□▥▥▥▥□▸▸", + "□▥■■▥□▸▸", + "□▥■■▥□▸▸", + "□▥▥▥▥□◆◆", + "□□□□□□◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ) + ); + }); + + it("blit on middle, with no crop", () => { + targetImg + .clone() + .blit(srcImg, 1, 1) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴□□□□□□▸", + "▴□▥▥▥▥□▸", + "▴□▥■■▥□▸", + "▾□▥■■▥□◆", + "▾□▥▥▥▥□◆", + "▾□□□□□□◆", + "▾▾▾▾◆◆◆◆" + ) + ); + }); + + it("blit on middle, with x,y crop", () => { + targetImg + .clone() + .blit(srcImg, 2, 2, 1, 1, 5, 5) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▥▥▥▥□▸", + "▴▴▥■■▥□▸", + "▾▾▥■■▥□◆", + "▾▾▥▥▥▥□◆", + "▾▾□□□□□◆", + "▾▾▾▾◆◆◆◆" + ) + ); + }); + + it("blit on middle, with x,y,w,h crop", () => { + targetImg + .clone() + .blit(srcImg, 2, 2, 1, 1, 4, 4) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▥▥▥▥▸▸", + "▴▴▥■■▥▸▸", + "▾▾▥■■▥◆◆", + "▾▾▥▥▥▥◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ) + ); + }); + + it("blit partially out, on top-left", () => { + targetImg + .clone() + .blit(srcImg, -1, -1) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▥▥▥▥□▸▸▸", + "▥■■▥□▸▸▸", + "▥■■▥□▸▸▸", + "▥▥▥▥□▸▸▸", + "□□□□□◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ) + ); + }); + + it("blit partially out, on bottom-right", () => { + targetImg + .clone() + .blit(srcImg, 3, 3) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴□□□□□", + "▾▾▾□▥▥▥▥", + "▾▾▾□▥■■▥", + "▾▾▾□▥■■▥", + "▾▾▾□▥▥▥▥" + ) + ); + }); + + it("blit alpha", async () => { + const expectedImg = await Jimp.read(testDir + "/images/blit-alpha.png"); + const dice = await Jimp.read(testDir + "/images/dice.png"); + const image = await Jimp.read(testDir + "/images/cops.jpg"); + + image + .blit(dice, 0, 0) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + async function createCat(catNum, len) { + const imgHeight = 60; + + const butt = await Jimp.read(testDir + "/images/cat_butt.png"); + const head = await Jimp.read(testDir + "/images/cat_head.png"); + const fuzz = await Jimp.read(testDir + "/images/cat_fuzz.png"); + + let longCat = len; + longCat = longCat > 20 ? 20 : longCat; + longCat = longCat <= 1 ? 1 : longCat; + + const cat = + Math.floor(catNum * (head.bitmap.height / imgHeight)) * imgHeight; + + const newImage = await Jimp.create( + butt.bitmap.width + head.bitmap.width + fuzz.bitmap.width * longCat, + imgHeight, + 0x00000000 + ); + + newImage.blit(butt, 0, 0, 0, cat, butt.bitmap.width, imgHeight); + for (let i = 0; i < longCat; i++) { + newImage.blit( + fuzz, + butt.bitmap.width + fuzz.bitmap.width * i, + 0, + 0, + cat, + fuzz.bitmap.width, + imgHeight + ); + } + + newImage.blit( + head, + butt.bitmap.width + fuzz.bitmap.width * longCat, + 0, + 0, + cat, + head.bitmap.width, + imgHeight + ); + + return newImage; + } + + it("uses src params correctly", async () => { + const expectedSmall = await Jimp.read( + testDir + "/images/cat-results/small-cat.png" + ); + const small = await createCat(0.3, 1); + small.bitmap.data.should.be.deepEqual(expectedSmall.bitmap.data); + + const expectedMedium = await Jimp.read( + testDir + "/images/cat-results/medium-cat.png" + ); + const medium = await createCat(0.6, 7); + medium.bitmap.data.should.be.deepEqual(expectedMedium.bitmap.data); + + const expectedLarge = await Jimp.read( + testDir + "/images/cat-results/large-cat.png" + ); + const large = await createCat(0.9, 20); + large.bitmap.data.should.be.deepEqual(expectedLarge.bitmap.data); + }); +}); diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/blit-alpha.png b/node_modules/@jimp/plugin-blit/test/images/blit-alpha.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/blit-alpha.png rename to node_modules/@jimp/plugin-blit/test/images/blit-alpha.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cat-results/large-cat.png b/node_modules/@jimp/plugin-blit/test/images/cat-results/large-cat.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cat-results/large-cat.png rename to node_modules/@jimp/plugin-blit/test/images/cat-results/large-cat.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cat-results/medium-cat.png b/node_modules/@jimp/plugin-blit/test/images/cat-results/medium-cat.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cat-results/medium-cat.png rename to node_modules/@jimp/plugin-blit/test/images/cat-results/medium-cat.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cat-results/small-cat.png b/node_modules/@jimp/plugin-blit/test/images/cat-results/small-cat.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cat-results/small-cat.png rename to node_modules/@jimp/plugin-blit/test/images/cat-results/small-cat.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cat_butt.png b/node_modules/@jimp/plugin-blit/test/images/cat_butt.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cat_butt.png rename to node_modules/@jimp/plugin-blit/test/images/cat_butt.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cat_fuzz.png b/node_modules/@jimp/plugin-blit/test/images/cat_fuzz.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cat_fuzz.png rename to node_modules/@jimp/plugin-blit/test/images/cat_fuzz.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cat_head.png b/node_modules/@jimp/plugin-blit/test/images/cat_head.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cat_head.png rename to node_modules/@jimp/plugin-blit/test/images/cat_head.png diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/cops.jpg b/node_modules/@jimp/plugin-blit/test/images/cops.jpg similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/cops.jpg rename to node_modules/@jimp/plugin-blit/test/images/cops.jpg diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/images/dice.png b/node_modules/@jimp/plugin-blit/test/images/dice.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blit/test/images/dice.png rename to node_modules/@jimp/plugin-blit/test/images/dice.png diff --git a/node_modules/@jimp/plugin-blur/CHANGELOG.md b/node_modules/@jimp/plugin-blur/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-blur/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-blur/LICENSE b/node_modules/@jimp/plugin-blur/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blur/LICENSE rename to node_modules/@jimp/plugin-blur/LICENSE diff --git a/node_modules/@jimp/plugin-blur/README.md b/node_modules/@jimp/plugin-blur/README.md new file mode 100644 index 00000000..caa71583 --- /dev/null +++ b/node_modules/@jimp/plugin-blur/README.md @@ -0,0 +1,25 @@ +
+ +

@jimp/plugin-blur

+

Blur an image.

+
+ +A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker + +## Usage + +- @param {number} r the pixel radius of the blur +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.blur(5); +} + +main(); +``` diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js b/node_modules/@jimp/plugin-blur/dist/blur-tables.js similarity index 100% rename from project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js rename to node_modules/@jimp/plugin-blur/dist/blur-tables.js diff --git a/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map b/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map new file mode 100644 index 00000000..a1ceeb6f --- /dev/null +++ b/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/blur-tables.js"],"names":["mulTable","shgTable"],"mappings":";;;;;;AAAO,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EAYV,EAZU,EAYN,EAZM,EAYF,EAZE,EAYE,EAZF,EAYM,EAZN,EAYU,EAZV,EAYc,EAZd,EAYkB,EAZlB,EAYsB,EAZtB,EAY0B,EAZ1B,EAY8B,EAZ9B,EAYkC,EAZlC,EAYsC,EAZtC,EAY0C,EAZ1C,EAY8C,EAZ9C,EAYkD,EAZlD,EAatB,EAbsB,EAalB,EAbkB,EAad,EAbc,EAaV,EAbU,EAaN,EAbM,EAaF,EAbE,EAaE,EAbF,EAaM,EAbN,EAaU,EAbV,EAac,EAbd,EAakB,EAblB,EAasB,EAbtB,EAa0B,EAb1B,EAa8B,EAb9B,EAakC,EAblC,EAasC,EAbtC,EAa0C,EAb1C,EAa8C,EAb9C,EAakD,EAblD,EActB,EAdsB,EAclB,EAdkB,EAcd,EAdc,EAcV,EAdU,EAcN,EAdM,EAcF,EAdE,EAcE,EAdF,EAcM,EAdN,EAcU,EAdV,CAAjB","sourcesContent":["export const mulTable = [\n 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107,\n 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221,\n 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103,\n 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119,\n 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151,\n 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13,\n 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75,\n 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229,\n 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183,\n 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37,\n 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61,\n 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207,\n 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178,\n 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153,\n 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133,\n 66, 131, 65, 129, 1,\n];\n\nexport const shgTable = [\n 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18,\n 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20,\n 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21,\n 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20,\n 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22,\n 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18,\n 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22,\n 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24,\n 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24,\n 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22,\n 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23,\n 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25,\n 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25,\n 22, 25, 25, 25, 24, 25, 24, 25, 18,\n];\n"],"file":"blur-tables.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blur/dist/index.js b/node_modules/@jimp/plugin-blur/dist/index.js new file mode 100644 index 00000000..38f8bb5a --- /dev/null +++ b/node_modules/@jimp/plugin-blur/dist/index.js @@ -0,0 +1,182 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +var _blurTables = require("./blur-tables"); + +/* + Superfast Blur (0.5) + http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js + + Copyright (c) 2011 Mario Klingemann + + 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 _default = function _default() { + return { + /** + * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker + * @param {number} r the pixel radius of the blur + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blur: function blur(r, cb) { + if (typeof r !== "number") return _utils.throwError.call(this, "r must be a number", cb); + if (r < 1) return _utils.throwError.call(this, "r must be greater than 0", cb); + var rsum; + var gsum; + var bsum; + var asum; + var x; + var y; + var i; + var p; + var p1; + var p2; + var yp; + var yi; + var yw; + var pa; + var wm = this.bitmap.width - 1; + var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; + + var rad1 = r + 1; + var mulSum = _blurTables.mulTable[r]; + var shgSum = _blurTables.shgTable[r]; + var red = []; + var green = []; + var blue = []; + var alpha = []; + var vmin = []; + var vmax = []; + var iterations = 2; + + while (iterations-- > 0) { + yi = 0; + yw = 0; + + for (y = 0; y < this.bitmap.height; y++) { + rsum = this.bitmap.data[yw] * rad1; + gsum = this.bitmap.data[yw + 1] * rad1; + bsum = this.bitmap.data[yw + 2] * rad1; + asum = this.bitmap.data[yw + 3] * rad1; + + for (i = 1; i <= r; i++) { + p = yw + ((i > wm ? wm : i) << 2); + rsum += this.bitmap.data[p++]; + gsum += this.bitmap.data[p++]; + bsum += this.bitmap.data[p++]; + asum += this.bitmap.data[p]; + } + + for (x = 0; x < this.bitmap.width; x++) { + red[yi] = rsum; + green[yi] = gsum; + blue[yi] = bsum; + alpha[yi] = asum; + + if (y === 0) { + vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; + vmax[x] = (p = x - r) > 0 ? p << 2 : 0; + } + + p1 = yw + vmin[x]; + p2 = yw + vmax[x]; + rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + asum += this.bitmap.data[p1] - this.bitmap.data[p2]; + yi++; + } + + yw += this.bitmap.width << 2; + } + + for (x = 0; x < this.bitmap.width; x++) { + yp = x; + rsum = red[yp] * rad1; + gsum = green[yp] * rad1; + bsum = blue[yp] * rad1; + asum = alpha[yp] * rad1; + + for (i = 1; i <= r; i++) { + yp += i > hm ? 0 : this.bitmap.width; + rsum += red[yp]; + gsum += green[yp]; + bsum += blue[yp]; + asum += alpha[yp]; + } + + yi = x << 2; + + for (y = 0; y < this.bitmap.height; y++) { + pa = asum * mulSum >>> shgSum; + this.bitmap.data[yi + 3] = pa; // normalize alpha + + if (pa > 255) { + this.bitmap.data[yi + 3] = 255; + } + + if (pa > 0) { + pa = 255 / pa; + this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; + this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; + this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; + } else { + this.bitmap.data[yi + 2] = 0; + this.bitmap.data[yi + 1] = 0; + this.bitmap.data[yi] = 0; + } + + if (x === 0) { + vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; + vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; + } + + p1 = x + vmin[y]; + p2 = x + vmax[y]; + rsum += red[p1] - red[p2]; + gsum += green[p1] - green[p2]; + bsum += blue[p1] - blue[p2]; + asum += alpha[p1] - alpha[p2]; + yi += this.bitmap.width << 2; + } + } + } + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blur/dist/index.js.map b/node_modules/@jimp/plugin-blur/dist/index.js.map new file mode 100644 index 00000000..9892b9a1 --- /dev/null +++ b/node_modules/@jimp/plugin-blur/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB;;;;;;AAMAA,IAAAA,IAPoB,gBAOf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R,YAAAA,IAAI,IAAIwB,KAAK,CAACjB,EAAD,CAAL,GAAYiB,KAAK,CAAChB,EAAD,CAAzB;AACAP,YAAAA,IAAI,IAAIwB,IAAI,CAAClB,EAAD,CAAJ,GAAWkB,IAAI,CAACjB,EAAD,CAAvB;AACAN,YAAAA,IAAI,IAAIwB,KAAK,CAACnB,EAAD,CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\nimport { mulTable, shgTable } from \"./blur-tables\";\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== \"number\")\n return throwError.call(this, \"r must be a number\", cb);\n if (r < 1) return throwError.call(this, \"r must be greater than 0\", cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blur/index.d.ts b/node_modules/@jimp/plugin-blur/index.d.ts new file mode 100644 index 00000000..8e325774 --- /dev/null +++ b/node_modules/@jimp/plugin-blur/index.d.ts @@ -0,0 +1,7 @@ +import { ImageCallback } from "@jimp/core"; + +interface Blur { + blur(r: number, cb?: ImageCallback): this; +} + +export default function (): Blur; diff --git a/node_modules/@jimp/plugin-blur/package.json b/node_modules/@jimp/plugin-blur/package.json new file mode 100644 index 00000000..9f89b841 --- /dev/null +++ b/node_modules/@jimp/plugin-blur/package.json @@ -0,0 +1,30 @@ +{ + "name": "@jimp/plugin-blur", + "version": "0.16.13", + "description": "blur an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-blur/src/blur-tables.js b/node_modules/@jimp/plugin-blur/src/blur-tables.js new file mode 100644 index 00000000..b6300145 --- /dev/null +++ b/node_modules/@jimp/plugin-blur/src/blur-tables.js @@ -0,0 +1,35 @@ +export const mulTable = [ + 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, + 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, + 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, + 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, + 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, + 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, + 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, + 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, + 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, + 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, + 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, + 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, + 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, + 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, + 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, + 66, 131, 65, 129, 1, +]; + +export const shgTable = [ + 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, + 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, + 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, + 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, + 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, + 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, + 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, + 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, + 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, + 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, + 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, + 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, + 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, + 22, 25, 25, 25, 24, 25, 24, 25, 18, +]; diff --git a/node_modules/@jimp/plugin-blur/src/index.js b/node_modules/@jimp/plugin-blur/src/index.js new file mode 100644 index 00000000..d97ae3d6 --- /dev/null +++ b/node_modules/@jimp/plugin-blur/src/index.js @@ -0,0 +1,181 @@ +import { throwError, isNodePattern } from "@jimp/utils"; +import { mulTable, shgTable } from "./blur-tables"; + +/* + Superfast Blur (0.5) + http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js + + Copyright (c) 2011 Mario Klingemann + + 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. +*/ + +export default () => ({ + /** + * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker + * @param {number} r the pixel radius of the blur + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blur(r, cb) { + if (typeof r !== "number") + return throwError.call(this, "r must be a number", cb); + if (r < 1) return throwError.call(this, "r must be greater than 0", cb); + + let rsum; + let gsum; + let bsum; + let asum; + let x; + let y; + let i; + let p; + let p1; + let p2; + let yp; + let yi; + let yw; + let pa; + + const wm = this.bitmap.width - 1; + const hm = this.bitmap.height - 1; + // const wh = this.bitmap.width * this.bitmap.height; + const rad1 = r + 1; + + const mulSum = mulTable[r]; + const shgSum = shgTable[r]; + + const red = []; + const green = []; + const blue = []; + const alpha = []; + + const vmin = []; + const vmax = []; + + let iterations = 2; + + while (iterations-- > 0) { + yi = 0; + yw = 0; + + for (y = 0; y < this.bitmap.height; y++) { + rsum = this.bitmap.data[yw] * rad1; + gsum = this.bitmap.data[yw + 1] * rad1; + bsum = this.bitmap.data[yw + 2] * rad1; + asum = this.bitmap.data[yw + 3] * rad1; + + for (i = 1; i <= r; i++) { + p = yw + ((i > wm ? wm : i) << 2); + rsum += this.bitmap.data[p++]; + gsum += this.bitmap.data[p++]; + bsum += this.bitmap.data[p++]; + asum += this.bitmap.data[p]; + } + + for (x = 0; x < this.bitmap.width; x++) { + red[yi] = rsum; + green[yi] = gsum; + blue[yi] = bsum; + alpha[yi] = asum; + + if (y === 0) { + vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; + vmax[x] = (p = x - r) > 0 ? p << 2 : 0; + } + + p1 = yw + vmin[x]; + p2 = yw + vmax[x]; + + rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + asum += this.bitmap.data[p1] - this.bitmap.data[p2]; + + yi++; + } + + yw += this.bitmap.width << 2; + } + + for (x = 0; x < this.bitmap.width; x++) { + yp = x; + rsum = red[yp] * rad1; + gsum = green[yp] * rad1; + bsum = blue[yp] * rad1; + asum = alpha[yp] * rad1; + + for (i = 1; i <= r; i++) { + yp += i > hm ? 0 : this.bitmap.width; + rsum += red[yp]; + gsum += green[yp]; + bsum += blue[yp]; + asum += alpha[yp]; + } + + yi = x << 2; + + for (y = 0; y < this.bitmap.height; y++) { + pa = (asum * mulSum) >>> shgSum; + this.bitmap.data[yi + 3] = pa; + + // normalize alpha + if (pa > 255) { + this.bitmap.data[yi + 3] = 255; + } + + if (pa > 0) { + pa = 255 / pa; + this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa; + this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa; + this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa; + } else { + this.bitmap.data[yi + 2] = 0; + this.bitmap.data[yi + 1] = 0; + this.bitmap.data[yi] = 0; + } + + if (x === 0) { + vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; + vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; + } + + p1 = x + vmin[y]; + p2 = x + vmax[y]; + + rsum += red[p1] - red[p2]; + gsum += green[p1] - green[p2]; + bsum += blue[p1] - blue[p2]; + asum += alpha[p1] - alpha[p2]; + + yi += this.bitmap.width << 2; + } + } + } + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-circle/CHANGELOG.md b/node_modules/@jimp/plugin-circle/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-circle/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-circle/LICENSE b/node_modules/@jimp/plugin-circle/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-circle/LICENSE rename to node_modules/@jimp/plugin-circle/LICENSE diff --git a/node_modules/@jimp/plugin-circle/README.md b/node_modules/@jimp/plugin-circle/README.md new file mode 100644 index 00000000..689b3ab8 --- /dev/null +++ b/node_modules/@jimp/plugin-circle/README.md @@ -0,0 +1,25 @@ +
+ +

@jimp/plugin-circle

+

Creates a circle out of an image.

+
+ +## Usage + +- @param {function(Error, Jimp)} options (optional) radius, x, y +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.circle(); + // or + image.circle({ radius: 50, x: 25, y: 25 }); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-circle/dist/index.js b/node_modules/@jimp/plugin-circle/dist/index.js new file mode 100644 index 00000000..bb423d5f --- /dev/null +++ b/node_modules/@jimp/plugin-circle/dist/index.js @@ -0,0 +1,53 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Creates a circle out of an image. + * @param {function(Error, Jimp)} options (optional) radius, x, y + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + circle: function circle() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var cb = arguments.length > 1 ? arguments[1] : undefined; + + if (typeof options === "function") { + cb = options; + options = {}; + } + + var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; + var center = { + x: typeof options.x === "number" ? options.x : this.bitmap.width / 2, + y: typeof options.y === "number" ? options.y : this.bitmap.height / 2 + }; + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); + + if (radius - curR <= 0.0) { + this.bitmap.data[idx + 3] = 0; + } else if (radius - curR < 1.0) { + this.bitmap.data[idx + 3] = 255 * (radius - curR); + } + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-circle/dist/index.js.map b/node_modules/@jimp/plugin-circle/dist/index.js.map new file mode 100644 index 00000000..dc73d883 --- /dev/null +++ b/node_modules/@jimp/plugin-circle/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CACE,CADF,EAEE,CAFF,EAGE,KAAKN,MAAL,CAAYC,KAHd,EAIE,KAAKD,MAAL,CAAYE,MAJd,EAKE,UAAUE,CAAV,EAAaC,CAAb,EAAgBE,GAAhB,EAAqB;AACnB,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAfH;;AAkBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAzCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === \"number\" ? options.x : this.bitmap.width / 2,\n y: typeof options.y === \"number\" ? options.y : this.bitmap.height / 2,\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-circle/index.d.ts b/node_modules/@jimp/plugin-circle/index.d.ts new file mode 100644 index 00000000..302dda00 --- /dev/null +++ b/node_modules/@jimp/plugin-circle/index.d.ts @@ -0,0 +1,15 @@ +import { ImageCallback } from "@jimp/core"; + +interface Circle { + circle( + options?: { + radius: number; + x: number; + y: number; + }, + cb?: ImageCallback + ): this; + circle(cb?: ImageCallback): this; +} + +export default function (): Circle; diff --git a/node_modules/@jimp/plugin-circle/package.json b/node_modules/@jimp/plugin-circle/package.json new file mode 100644 index 00000000..f58b5fae --- /dev/null +++ b/node_modules/@jimp/plugin-circle/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/plugin-circle", + "version": "0.16.13", + "description": "Creates a circle out of an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-circle/src/index.js b/node_modules/@jimp/plugin-circle/src/index.js new file mode 100644 index 00000000..5d1a5c9c --- /dev/null +++ b/node_modules/@jimp/plugin-circle/src/index.js @@ -0,0 +1,51 @@ +import { isNodePattern } from "@jimp/utils"; + +/** + * Creates a circle out of an image. + * @param {function(Error, Jimp)} options (optional) radius, x, y + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + circle(options = {}, cb) { + if (typeof options === "function") { + cb = options; + options = {}; + } + + const radius = + options.radius || + (this.bitmap.width > this.bitmap.height + ? this.bitmap.height + : this.bitmap.width) / 2; + + const center = { + x: typeof options.x === "number" ? options.x : this.bitmap.width / 2, + y: typeof options.y === "number" ? options.y : this.bitmap.height / 2, + }; + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const curR = Math.sqrt( + Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2) + ); + + if (radius - curR <= 0.0) { + this.bitmap.data[idx + 3] = 0; + } else if (radius - curR < 1.0) { + this.bitmap.data[idx + 3] = 255 * (radius - curR); + } + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-circle/test/circle.test.js b/node_modules/@jimp/plugin-circle/test/circle.test.js new file mode 100644 index 00000000..19fc95d0 --- /dev/null +++ b/node_modules/@jimp/plugin-circle/test/circle.test.js @@ -0,0 +1,78 @@ +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import circle from "../src"; + +const jimp = configure({ plugins: [circle] }, Jimp); + +describe("Circle", () => { + it("makes a circle based on image height and width", async () => { + const expectedImg = await Jimp.read( + getTestDir(__dirname) + "/images/circled.png" + ); + const imgSrc = await jimp.read( + mkJGD( + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦" + ) + ); + + imgSrc.circle().bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + it("makes a circle using provided radius", async () => { + const expectedImg = await Jimp.read( + getTestDir(__dirname) + "/images/radius-3-circle.png" + ); + const imgSrc = await jimp.read( + mkJGD( + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦" + ) + ); + + imgSrc + .circle({ radius: 3 }) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + it("should ", async () => { + const expectedImg = await Jimp.read( + getTestDir(__dirname) + "/images/x-y-circle.png" + ); + const imgSrc = await jimp.read( + mkJGD( + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦" + ) + ); + + imgSrc + .circle({ radius: 5, x: 5, y: 5 }) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); +}); diff --git a/project starter code/node_modules/@jimp/plugin-circle/test/images/circled.png b/node_modules/@jimp/plugin-circle/test/images/circled.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-circle/test/images/circled.png rename to node_modules/@jimp/plugin-circle/test/images/circled.png diff --git a/project starter code/node_modules/@jimp/plugin-circle/test/images/radius-3-circle.png b/node_modules/@jimp/plugin-circle/test/images/radius-3-circle.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-circle/test/images/radius-3-circle.png rename to node_modules/@jimp/plugin-circle/test/images/radius-3-circle.png diff --git a/project starter code/node_modules/@jimp/plugin-circle/test/images/x-y-circle.png b/node_modules/@jimp/plugin-circle/test/images/x-y-circle.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-circle/test/images/x-y-circle.png rename to node_modules/@jimp/plugin-circle/test/images/x-y-circle.png diff --git a/node_modules/@jimp/plugin-color/CHANGELOG.md b/node_modules/@jimp/plugin-color/CHANGELOG.md new file mode 100644 index 00000000..e0fea7c1 --- /dev/null +++ b/node_modules/@jimp/plugin-color/CHANGELOG.md @@ -0,0 +1,41 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Fix edgeHandling types [#1080](https://github.com/jimp-dev/jimp/pull/1080) ([@domdomegg](https://github.com/domdomegg)) + +#### ⚠️ Pushed to `master` + +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Adam Jones ([@domdomegg](https://github.com/domdomegg)) +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-color/LICENSE b/node_modules/@jimp/plugin-color/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-color/LICENSE rename to node_modules/@jimp/plugin-color/LICENSE diff --git a/node_modules/@jimp/plugin-color/README.md b/node_modules/@jimp/plugin-color/README.md new file mode 100644 index 00000000..1b4c800f --- /dev/null +++ b/node_modules/@jimp/plugin-color/README.md @@ -0,0 +1,262 @@ +
+ +

@jimp/plugin-color

+

Jimp color methods.

+
+ +Bitmap manipulation to adjust the color in an image. + +## color + +Apply multiple color modification rules + +- @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.color([{ apply: "red", params: [100] }]); +} + +main(); +``` + +Jimp supports advanced colour manipulation using a single method as follows: + +```js +image.color([ + { apply: "hue", params: [-90] }, + { apply: "lighten", params: [50] }, + { apply: "xor", params: ["#06D"] }, +]); +``` + +The method supports the following modifiers: + +| Modifier | Description | +| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **lighten** {amount} | Lighten the color a given amount, from 0 to 100. Providing 100 will always return white (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **brighten** {amount} | Brighten the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **darken** {amount} | Darken the color a given amount, from 0 to 100. Providing 100 will always return black (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **desaturate** {amount} | Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **saturate** {amount} | Saturate the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **greyscale** {amount} | Completely desaturates a color into greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **spin** {degree} | Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing - since it sets the hue back to what it was before. (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **hue** {degree} | Alias for **spin** | +| **mix** {color, amount} | Mixes colors by their RGB component values. Amount is opacity of overlaying color | +| **tint** {amount} | Same as applying **mix** with white color | +| **shade** {amount} | Same as applying **mix** with black color | +| **xor** {color} | Treats the two colors as bitfields and applies an XOR operation to the red, green, and blue components | +| **red** {amount} | Modify Red component by a given amount | +| **green** {amount} | Modify Green component by a given amount | +| **blue** {amount} | Modify Blue component by a given amount | + +## brightness + +Adjusts the brightness of the image + +- @param {number} val the amount to adjust the brightness, a number between -1 and +1 +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.brightness(20); +} + +main(); +``` + +## contrast + +Adjusts the contrast of the image + +- @param {number} val the amount to adjust the contrast, a number between -1 and +1 +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.contrast(70); +} + +main(); +``` + +## posterize + +Apply a posterize effect + +- @param {number} n the amount to adjust the contrast, minimum threshold is two +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.posterize(5); +} + +main(); +``` + +## opacity + +Multiplies the opacity of each pixel by a factor between 0 and 1 + +- @param {number} f A number, the factor by which to multiply the opacity of each pixel +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.opacity(80); +} + +main(); +``` + +## sepia + +Applies a sepia tone to the image + +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.sepia(); +} + +main(); +``` + +## fade + +Fades each pixel by a factor between 0 and 1 + +- @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.fade(0.7); +} + +main(); +``` + +## convolution + +Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanation with examples at [GIMP's Convolution Matrix plugin](https://docs.gimp.org/2.6/en/plug-in-convmatrix.html) + +- @param {array} kernel a matrix to weight the neighbors sum +- @param {number} edgeHandling (optional) define how to sum pixels from outside the border +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.convolution( + [ + [-1, -1, -1], + [-1, 8, -1], + [-1, -1, -1], + ], + jimp.EDGE_EXTEND + ); +} + +main(); +``` + +## opaque + +Set the alpha channel on every pixel to fully opaque + +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.opaque(); +} + +main(); +``` + +## pixelate + +Pixelates the image or a region + +- @param {number} size the size of the pixels +- @param {number} x (optional) the x position of the region to pixelate +- @param {number} y (optional) the y position of the region to pixelate +- @param {number} w (optional) the width of the region to pixelate +- @param {number} h (optional) the height of the region to pixelate +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.pixelate(10); +} + +main(); +``` + +## convolute + +Applies a convolution kernel to the image or a region + +- @param {array} kernel the convolution kernel +- @param {number} x (optional) the x position of the region to apply convolution to +- @param {number} y (optional) the y position of the region to apply convolution to +- @param {number} w (optional) the width of the region to apply convolution to +- @param {number} h (optional) the height of the region to apply convolution to +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + // make me better + image.pixelate(kernal); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-color/dist/index.js b/node_modules/@jimp/plugin-color/dist/index.js new file mode 100644 index 00000000..e733f3ad --- /dev/null +++ b/node_modules/@jimp/plugin-color/dist/index.js @@ -0,0 +1,567 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _tinycolor = _interopRequireDefault(require("tinycolor2")); + +var _utils = require("@jimp/utils"); + +function applyKernel(im, kernel, x, y) { + var value = [0, 0, 0]; + var size = (kernel.length - 1) / 2; + + for (var kx = 0; kx < kernel.length; kx += 1) { + for (var ky = 0; ky < kernel[kx].length; ky += 1) { + var idx = im.getPixelIndex(x + kx - size, y + ky - size); + value[0] += im.bitmap.data[idx] * kernel[kx][ky]; + value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; + value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; + } + } + + return value; +} + +var isDef = function isDef(v) { + return typeof v !== "undefined" && v !== null; +}; + +function greyscale(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); + this.bitmap.data[idx] = grey; + this.bitmap.data[idx + 1] = grey; + this.bitmap.data[idx + 2] = grey; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; +} + +function mix(clr, clr2) { + var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; + return { + r: (clr2.r - clr.r) * (p / 100) + clr.r, + g: (clr2.g - clr.g) * (p / 100) + clr.g, + b: (clr2.b - clr.b) * (p / 100) + clr.b + }; +} + +function colorFn(actions, cb) { + var _this = this; + + if (!actions || !Array.isArray(actions)) { + return _utils.throwError.call(this, "actions must be an array", cb); + } + + actions = actions.map(function (action) { + if (action.apply === "xor" || action.apply === "mix") { + action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); + } + + return action; + }); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var clr = { + r: _this.bitmap.data[idx], + g: _this.bitmap.data[idx + 1], + b: _this.bitmap.data[idx + 2] + }; + + var colorModifier = function colorModifier(i, amount) { + return _this.constructor.limit255(clr[i] + amount); + }; + + actions.forEach(function (action) { + if (action.apply === "mix") { + clr = mix(clr, action.params[0], action.params[1]); + } else if (action.apply === "tint") { + clr = mix(clr, { + r: 255, + g: 255, + b: 255 + }, action.params[0]); + } else if (action.apply === "shade") { + clr = mix(clr, { + r: 0, + g: 0, + b: 0 + }, action.params[0]); + } else if (action.apply === "xor") { + clr = { + r: clr.r ^ action.params[0].r, + g: clr.g ^ action.params[0].g, + b: clr.b ^ action.params[0].b + }; + } else if (action.apply === "red") { + clr.r = colorModifier("r", action.params[0]); + } else if (action.apply === "green") { + clr.g = colorModifier("g", action.params[0]); + } else if (action.apply === "blue") { + clr.b = colorModifier("b", action.params[0]); + } else { + var _clr; + + if (action.apply === "hue") { + action.apply = "spin"; + } + + clr = (0, _tinycolor["default"])(clr); + + if (!clr[action.apply]) { + return _utils.throwError.call(_this, "action " + action.apply + " not supported", cb); + } + + clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); + } + }); + _this.bitmap.data[idx] = clr.r; + _this.bitmap.data[idx + 1] = clr.g; + _this.bitmap.data[idx + 2] = clr.b; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; +} + +var _default = function _default() { + return { + /** + * Adjusts the brightness of the image + * @param {number} val the amount to adjust the brightness, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + brightness: function brightness(val, cb) { + if (typeof val !== "number") { + return _utils.throwError.call(this, "val must be numbers", cb); + } + + if (val < -1 || val > +1) { + return _utils.throwError.call(this, "val must be a number between -1 and +1", cb); + } + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + if (val < 0.0) { + this.bitmap.data[idx] *= 1 + val; + this.bitmap.data[idx + 1] *= 1 + val; + this.bitmap.data[idx + 2] *= 1 + val; + } else { + this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val; + this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val; + this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val; + } + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Adjusts the contrast of the image + * @param {number} val the amount to adjust the contrast, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + contrast: function contrast(val, cb) { + if (typeof val !== "number") { + return _utils.throwError.call(this, "val must be numbers", cb); + } + + if (val < -1 || val > +1) { + return _utils.throwError.call(this, "val must be a number between -1 and +1", cb); + } + + var factor = (val + 1) / (1 - val); + + function adjust(value) { + value = Math.floor(factor * (value - 127) + 127); + return value < 0 ? 0 : value > 255 ? 255 : value; + } + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); + this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); + this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Apply a posterize effect + * @param {number} n the amount to adjust the contrast, minimum threshold is two + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + posterize: function posterize(n, cb) { + if (typeof n !== "number") { + return _utils.throwError.call(this, "n must be numbers", cb); + } + + if (n < 2) { + n = 2; + } // minimum of 2 levels + + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; + this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; + this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Removes colour from the image using ITU Rec 709 luminance values + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + greyscale: greyscale, + // Alias of greyscale for our American friends + grayscale: greyscale, + + /** + * Multiplies the opacity of each pixel by a factor between 0 and 1 + * @param {number} f A number, the factor by which to multiply the opacity of each pixel + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opacity: function opacity(f, cb) { + if (typeof f !== "number") return _utils.throwError.call(this, "f must be a number", cb); + if (f < 0 || f > 1) return _utils.throwError.call(this, "f must be a number from 0 to 1", cb); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var v = this.bitmap.data[idx + 3] * f; + this.bitmap.data[idx + 3] = v; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Applies a sepia tone to the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + sepia: function sepia(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var red = this.bitmap.data[idx]; + var green = this.bitmap.data[idx + 1]; + var blue = this.bitmap.data[idx + 2]; + red = red * 0.393 + green * 0.769 + blue * 0.189; + green = red * 0.349 + green * 0.686 + blue * 0.168; + blue = red * 0.272 + green * 0.534 + blue * 0.131; + this.bitmap.data[idx] = red < 255 ? red : 255; + this.bitmap.data[idx + 1] = green < 255 ? green : 255; + this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Fades each pixel by a factor between 0 and 1 + * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + fade: function fade(f, cb) { + if (typeof f !== "number") { + return _utils.throwError.call(this, "f must be a number", cb); + } + + if (f < 0 || f > 1) { + return _utils.throwError.call(this, "f must be a number from 0 to 1", cb); + } // this method is an alternative to opacity (which may be deprecated) + + + this.opacity(1 - f); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Adds each element of the image to its local neighbors, weighted by the kernel + * @param {array} kernel a matrix to weight the neighbors sum + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + convolution: function convolution(kernel, edgeHandling, cb) { + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + + if (!edgeHandling) { + edgeHandling = this.constructor.EDGE_EXTEND; + } + + var newData = Buffer.from(this.bitmap.data); + var kRows = kernel.length; + var kCols = kernel[0].length; + var rowEnd = Math.floor(kRows / 2); + var colEnd = Math.floor(kCols / 2); + var rowIni = -rowEnd; + var colIni = -colEnd; + var weight; + var rSum; + var gSum; + var bSum; + var ri; + var gi; + var bi; + var xi; + var yi; + var idxi; + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + bSum = 0; + gSum = 0; + rSum = 0; + + for (var row = rowIni; row <= rowEnd; row++) { + for (var col = colIni; col <= colEnd; col++) { + xi = x + col; + yi = y + row; + weight = kernel[row + rowEnd][col + colEnd]; + idxi = this.getPixelIndex(xi, yi, edgeHandling); + + if (idxi === -1) { + bi = 0; + gi = 0; + ri = 0; + } else { + ri = this.bitmap.data[idxi + 0]; + gi = this.bitmap.data[idxi + 1]; + bi = this.bitmap.data[idxi + 2]; + } + + rSum += weight * ri; + gSum += weight * gi; + bSum += weight * bi; + } + } + + if (rSum < 0) { + rSum = 0; + } + + if (gSum < 0) { + gSum = 0; + } + + if (bSum < 0) { + bSum = 0; + } + + if (rSum > 255) { + rSum = 255; + } + + if (gSum > 255) { + gSum = 255; + } + + if (bSum > 255) { + bSum = 255; + } + + newData[idx + 0] = rSum; + newData[idx + 1] = gSum; + newData[idx + 2] = bSum; + }); + this.bitmap.data = newData; + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Set the alpha channel on every pixel to fully opaque + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opaque: function opaque(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx + 3] = 255; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Pixelates the image or a region + * @param {number} size the size of the pixels + * @param {number} x (optional) the x position of the region to pixelate + * @param {number} y (optional) the y position of the region to pixelate + * @param {number} w (optional) the width of the region to pixelate + * @param {number} h (optional) the height of the region to pixelate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + pixelate: function pixelate(size, x, y, w, h, cb) { + if (typeof x === "function") { + cb = x; + h = null; + w = null; + y = null; + x = null; + } else { + if (typeof size !== "number") { + return _utils.throwError.call(this, "size must be a number", cb); + } + + if (isDef(x) && typeof x !== "number") { + return _utils.throwError.call(this, "x must be a number", cb); + } + + if (isDef(y) && typeof y !== "number") { + return _utils.throwError.call(this, "y must be a number", cb); + } + + if (isDef(w) && typeof w !== "number") { + return _utils.throwError.call(this, "w must be a number", cb); + } + + if (isDef(h) && typeof h !== "number") { + return _utils.throwError.call(this, "h must be a number", cb); + } + } + + var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; + x = x || 0; + y = y || 0; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + var source = this.cloneQuiet(); + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + xx = size * Math.floor(xx / size); + yx = size * Math.floor(yx / size); + var value = applyKernel(source, kernel, xx, yx); + this.bitmap.data[idx] = value[0]; + this.bitmap.data[idx + 1] = value[1]; + this.bitmap.data[idx + 2] = value[2]; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Applies a convolution kernel to the image or a region + * @param {array} kernel the convolution kernel + * @param {number} x (optional) the x position of the region to apply convolution to + * @param {number} y (optional) the y position of the region to apply convolution to + * @param {number} w (optional) the width of the region to apply convolution to + * @param {number} h (optional) the height of the region to apply convolution to + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + convolute: function convolute(kernel, x, y, w, h, cb) { + if (!Array.isArray(kernel)) return _utils.throwError.call(this, "the kernel must be an array", cb); + + if (typeof x === "function") { + cb = x; + x = null; + y = null; + w = null; + h = null; + } else { + if (isDef(x) && typeof x !== "number") { + return _utils.throwError.call(this, "x must be a number", cb); + } + + if (isDef(y) && typeof y !== "number") { + return _utils.throwError.call(this, "y must be a number", cb); + } + + if (isDef(w) && typeof w !== "number") { + return _utils.throwError.call(this, "w must be a number", cb); + } + + if (isDef(h) && typeof h !== "number") { + return _utils.throwError.call(this, "h must be a number", cb); + } + } + + var ksize = (kernel.length - 1) / 2; + x = isDef(x) ? x : ksize; + y = isDef(y) ? y : ksize; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + var source = this.cloneQuiet(); + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + var value = applyKernel(source, kernel, xx, yx); + this.bitmap.data[idx] = this.constructor.limit255(value[0]); + this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); + this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Apply multiple color modification rules + * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + color: colorFn, + colour: colorFn + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-color/dist/index.js.map b/node_modules/@jimp/plugin-color/dist/index.js.map new file mode 100644 index 00000000..d477bda8 --- /dev/null +++ b/node_modules/@jimp/plugin-color/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","ksize","color","colour"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,SAASA,WAAT,CAAqBC,EAArB,EAAyBC,MAAzB,EAAiCC,CAAjC,EAAoCC,CAApC,EAAuC;AACrC,MAAMC,KAAK,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAd;AACA,MAAMC,IAAI,GAAG,CAACJ,MAA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esContent":["import tinyColor from \"tinycolor2\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = (v) => typeof v !== \"undefined\" && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b,\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, \"actions must be an array\", cb);\n }\n\n actions = actions.map((action) => {\n if (action.apply === \"xor\" || action.apply === \"mix\") {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach((action) => {\n if (action.apply === \"mix\") {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === \"tint\") {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === \"shade\") {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === \"xor\") {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b,\n };\n } else if (action.apply === \"red\") {\n clr.r = colorModifier(\"r\", action.params[0]);\n } else if (action.apply === \"green\") {\n clr.g = colorModifier(\"g\", action.params[0]);\n } else if (action.apply === \"blue\") {\n clr.b = colorModifier(\"b\", action.params[0]);\n } else {\n if (action.apply === \"hue\") {\n action.apply = \"spin\";\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n \"action \" + action.apply + \" not supported\",\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n if (val < 0.0) {\n this.bitmap.data[idx] *= 1 + val;\n this.bitmap.data[idx + 1] *= 1 + val;\n this.bitmap.data[idx + 2] *= 1 + val;\n } else {\n this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be numbers\", cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== \"number\")\n return throwError.call(this, \"f must be a number\", cb);\n if (f < 0 || f > 1)\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n }\n );\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx + 3] = 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === \"function\") {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== \"number\") {\n return throwError.call(this, \"size must be a number\", cb);\n }\n\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16],\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, \"the kernel must be an array\", cb);\n\n if (typeof x === \"function\") {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn,\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-color/index.d.ts b/node_modules/@jimp/plugin-color/index.d.ts new file mode 100644 index 00000000..44a4ce5e --- /dev/null +++ b/node_modules/@jimp/plugin-color/index.d.ts @@ -0,0 +1,56 @@ +import { ImageCallback } from "@jimp/core"; + +type ColorActionName = + | "mix" + | "tint" + | "shade" + | "xor" + | "red" + | "green" + | "blue" + | "hue"; + +type ColorAction = { + apply: ColorActionName; + params: any; +}; + +interface Color { + brightness(val: number, cb?: ImageCallback): this; + contrast(val: number, cb?: ImageCallback): this; + posterize(n: number, cb?: ImageCallback): this; + greyscale(cb?: ImageCallback): this; + grayscale(cb?: ImageCallback): this; + opacity(f: number, cb?: ImageCallback): this; + sepia(cb?: ImageCallback): this; + fade(f: number, cb?: ImageCallback): this; + convolution(kernel: number[][], cb?: ImageCallback): this; + convolution( + kernel: number[][], + edgeHandling: number, + cb?: ImageCallback + ): this; + opaque(cb?: ImageCallback): this; + pixelate(size: number, cb?: ImageCallback): this; + pixelate( + size: number, + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + convolute(kernel: number[][], cb?: ImageCallback): this; + convolute( + kernel: number[][], + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + color(actions: ColorAction[], cb?: ImageCallback): this; + colour(actions: ColorAction[], cb?: ImageCallback): this; +} + +export default function (): Color; diff --git a/node_modules/@jimp/plugin-color/package.json b/node_modules/@jimp/plugin-color/package.json new file mode 100644 index 00000000..91891777 --- /dev/null +++ b/node_modules/@jimp/plugin-color/package.json @@ -0,0 +1,39 @@ +{ + "name": "@jimp/plugin-color", + "version": "0.16.13", + "description": "Bitmap manipulation to adjust the color in an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "tinycolor2": "^1.4.1" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13", + "@jimp/types": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-color/src/index.js b/node_modules/@jimp/plugin-color/src/index.js new file mode 100644 index 00000000..1531a2a1 --- /dev/null +++ b/node_modules/@jimp/plugin-color/src/index.js @@ -0,0 +1,630 @@ +import tinyColor from "tinycolor2"; +import { throwError, isNodePattern } from "@jimp/utils"; + +function applyKernel(im, kernel, x, y) { + const value = [0, 0, 0]; + const size = (kernel.length - 1) / 2; + + for (let kx = 0; kx < kernel.length; kx += 1) { + for (let ky = 0; ky < kernel[kx].length; ky += 1) { + const idx = im.getPixelIndex(x + kx - size, y + ky - size); + + value[0] += im.bitmap.data[idx] * kernel[kx][ky]; + value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; + value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; + } + } + + return value; +} + +const isDef = (v) => typeof v !== "undefined" && v !== null; + +function greyscale(cb) { + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const grey = parseInt( + 0.2126 * this.bitmap.data[idx] + + 0.7152 * this.bitmap.data[idx + 1] + + 0.0722 * this.bitmap.data[idx + 2], + 10 + ); + + this.bitmap.data[idx] = grey; + this.bitmap.data[idx + 1] = grey; + this.bitmap.data[idx + 2] = grey; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; +} + +function mix(clr, clr2, p = 50) { + return { + r: (clr2.r - clr.r) * (p / 100) + clr.r, + g: (clr2.g - clr.g) * (p / 100) + clr.g, + b: (clr2.b - clr.b) * (p / 100) + clr.b, + }; +} + +function colorFn(actions, cb) { + if (!actions || !Array.isArray(actions)) { + return throwError.call(this, "actions must be an array", cb); + } + + actions = actions.map((action) => { + if (action.apply === "xor" || action.apply === "mix") { + action.params[0] = tinyColor(action.params[0]).toRgb(); + } + + return action; + }); + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { + let clr = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2], + }; + + const colorModifier = (i, amount) => + this.constructor.limit255(clr[i] + amount); + + actions.forEach((action) => { + if (action.apply === "mix") { + clr = mix(clr, action.params[0], action.params[1]); + } else if (action.apply === "tint") { + clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]); + } else if (action.apply === "shade") { + clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]); + } else if (action.apply === "xor") { + clr = { + r: clr.r ^ action.params[0].r, + g: clr.g ^ action.params[0].g, + b: clr.b ^ action.params[0].b, + }; + } else if (action.apply === "red") { + clr.r = colorModifier("r", action.params[0]); + } else if (action.apply === "green") { + clr.g = colorModifier("g", action.params[0]); + } else if (action.apply === "blue") { + clr.b = colorModifier("b", action.params[0]); + } else { + if (action.apply === "hue") { + action.apply = "spin"; + } + + clr = tinyColor(clr); + + if (!clr[action.apply]) { + return throwError.call( + this, + "action " + action.apply + " not supported", + cb + ); + } + + clr = clr[action.apply](...action.params).toRgb(); + } + }); + + this.bitmap.data[idx] = clr.r; + this.bitmap.data[idx + 1] = clr.g; + this.bitmap.data[idx + 2] = clr.b; + }); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; +} + +export default () => ({ + /** + * Adjusts the brightness of the image + * @param {number} val the amount to adjust the brightness, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + brightness(val, cb) { + if (typeof val !== "number") { + return throwError.call(this, "val must be numbers", cb); + } + + if (val < -1 || val > +1) { + return throwError.call( + this, + "val must be a number between -1 and +1", + cb + ); + } + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + if (val < 0.0) { + this.bitmap.data[idx] *= 1 + val; + this.bitmap.data[idx + 1] *= 1 + val; + this.bitmap.data[idx + 2] *= 1 + val; + } else { + this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val; + this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val; + this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val; + } + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Adjusts the contrast of the image + * @param {number} val the amount to adjust the contrast, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + contrast(val, cb) { + if (typeof val !== "number") { + return throwError.call(this, "val must be numbers", cb); + } + + if (val < -1 || val > +1) { + return throwError.call( + this, + "val must be a number between -1 and +1", + cb + ); + } + + const factor = (val + 1) / (1 - val); + + function adjust(value) { + value = Math.floor(factor * (value - 127) + 127); + + return value < 0 ? 0 : value > 255 ? 255 : value; + } + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); + this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); + this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Apply a posterize effect + * @param {number} n the amount to adjust the contrast, minimum threshold is two + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + posterize(n, cb) { + if (typeof n !== "number") { + return throwError.call(this, "n must be numbers", cb); + } + + if (n < 2) { + n = 2; + } // minimum of 2 levels + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = + (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255; + this.bitmap.data[idx + 1] = + (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) * + 255; + this.bitmap.data[idx + 2] = + (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) * + 255; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Removes colour from the image using ITU Rec 709 luminance values + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + greyscale, + + // Alias of greyscale for our American friends + grayscale: greyscale, + + /** + * Multiplies the opacity of each pixel by a factor between 0 and 1 + * @param {number} f A number, the factor by which to multiply the opacity of each pixel + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opacity(f, cb) { + if (typeof f !== "number") + return throwError.call(this, "f must be a number", cb); + if (f < 0 || f > 1) + return throwError.call(this, "f must be a number from 0 to 1", cb); + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const v = this.bitmap.data[idx + 3] * f; + this.bitmap.data[idx + 3] = v; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Applies a sepia tone to the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + sepia(cb) { + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + let red = this.bitmap.data[idx]; + let green = this.bitmap.data[idx + 1]; + let blue = this.bitmap.data[idx + 2]; + + red = red * 0.393 + green * 0.769 + blue * 0.189; + green = red * 0.349 + green * 0.686 + blue * 0.168; + blue = red * 0.272 + green * 0.534 + blue * 0.131; + + this.bitmap.data[idx] = red < 255 ? red : 255; + this.bitmap.data[idx + 1] = green < 255 ? green : 255; + this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Fades each pixel by a factor between 0 and 1 + * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + fade(f, cb) { + if (typeof f !== "number") { + return throwError.call(this, "f must be a number", cb); + } + + if (f < 0 || f > 1) { + return throwError.call(this, "f must be a number from 0 to 1", cb); + } + + // this method is an alternative to opacity (which may be deprecated) + this.opacity(1 - f); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Adds each element of the image to its local neighbors, weighted by the kernel + * @param {array} kernel a matrix to weight the neighbors sum + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + convolution(kernel, edgeHandling, cb) { + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + + if (!edgeHandling) { + edgeHandling = this.constructor.EDGE_EXTEND; + } + + const newData = Buffer.from(this.bitmap.data); + const kRows = kernel.length; + const kCols = kernel[0].length; + const rowEnd = Math.floor(kRows / 2); + const colEnd = Math.floor(kCols / 2); + const rowIni = -rowEnd; + const colIni = -colEnd; + + let weight; + let rSum; + let gSum; + let bSum; + let ri; + let gi; + let bi; + let xi; + let yi; + let idxi; + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + bSum = 0; + gSum = 0; + rSum = 0; + + for (let row = rowIni; row <= rowEnd; row++) { + for (let col = colIni; col <= colEnd; col++) { + xi = x + col; + yi = y + row; + weight = kernel[row + rowEnd][col + colEnd]; + idxi = this.getPixelIndex(xi, yi, edgeHandling); + + if (idxi === -1) { + bi = 0; + gi = 0; + ri = 0; + } else { + ri = this.bitmap.data[idxi + 0]; + gi = this.bitmap.data[idxi + 1]; + bi = this.bitmap.data[idxi + 2]; + } + + rSum += weight * ri; + gSum += weight * gi; + bSum += weight * bi; + } + } + + if (rSum < 0) { + rSum = 0; + } + + if (gSum < 0) { + gSum = 0; + } + + if (bSum < 0) { + bSum = 0; + } + + if (rSum > 255) { + rSum = 255; + } + + if (gSum > 255) { + gSum = 255; + } + + if (bSum > 255) { + bSum = 255; + } + + newData[idx + 0] = rSum; + newData[idx + 1] = gSum; + newData[idx + 2] = bSum; + } + ); + + this.bitmap.data = newData; + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Set the alpha channel on every pixel to fully opaque + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opaque(cb) { + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx + 3] = 255; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Pixelates the image or a region + * @param {number} size the size of the pixels + * @param {number} x (optional) the x position of the region to pixelate + * @param {number} y (optional) the y position of the region to pixelate + * @param {number} w (optional) the width of the region to pixelate + * @param {number} h (optional) the height of the region to pixelate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + pixelate(size, x, y, w, h, cb) { + if (typeof x === "function") { + cb = x; + h = null; + w = null; + y = null; + x = null; + } else { + if (typeof size !== "number") { + return throwError.call(this, "size must be a number", cb); + } + + if (isDef(x) && typeof x !== "number") { + return throwError.call(this, "x must be a number", cb); + } + + if (isDef(y) && typeof y !== "number") { + return throwError.call(this, "y must be a number", cb); + } + + if (isDef(w) && typeof w !== "number") { + return throwError.call(this, "w must be a number", cb); + } + + if (isDef(h) && typeof h !== "number") { + return throwError.call(this, "h must be a number", cb); + } + } + + const kernel = [ + [1 / 16, 2 / 16, 1 / 16], + [2 / 16, 4 / 16, 2 / 16], + [1 / 16, 2 / 16, 1 / 16], + ]; + + x = x || 0; + y = y || 0; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + + const source = this.cloneQuiet(); + + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + xx = size * Math.floor(xx / size); + yx = size * Math.floor(yx / size); + + const value = applyKernel(source, kernel, xx, yx); + + this.bitmap.data[idx] = value[0]; + this.bitmap.data[idx + 1] = value[1]; + this.bitmap.data[idx + 2] = value[2]; + }); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Applies a convolution kernel to the image or a region + * @param {array} kernel the convolution kernel + * @param {number} x (optional) the x position of the region to apply convolution to + * @param {number} y (optional) the y position of the region to apply convolution to + * @param {number} w (optional) the width of the region to apply convolution to + * @param {number} h (optional) the height of the region to apply convolution to + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + convolute(kernel, x, y, w, h, cb) { + if (!Array.isArray(kernel)) + return throwError.call(this, "the kernel must be an array", cb); + + if (typeof x === "function") { + cb = x; + x = null; + y = null; + w = null; + h = null; + } else { + if (isDef(x) && typeof x !== "number") { + return throwError.call(this, "x must be a number", cb); + } + + if (isDef(y) && typeof y !== "number") { + return throwError.call(this, "y must be a number", cb); + } + + if (isDef(w) && typeof w !== "number") { + return throwError.call(this, "w must be a number", cb); + } + + if (isDef(h) && typeof h !== "number") { + return throwError.call(this, "h must be a number", cb); + } + } + + const ksize = (kernel.length - 1) / 2; + + x = isDef(x) ? x : ksize; + y = isDef(y) ? y : ksize; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + + const source = this.cloneQuiet(); + + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + const value = applyKernel(source, kernel, xx, yx); + + this.bitmap.data[idx] = this.constructor.limit255(value[0]); + this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); + this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); + }); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Apply multiple color modification rules + * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + color: colorFn, + colour: colorFn, +}); diff --git a/node_modules/@jimp/plugin-color/test/color.test.js b/node_modules/@jimp/plugin-color/test/color.test.js new file mode 100644 index 00000000..562808bf --- /dev/null +++ b/node_modules/@jimp/plugin-color/test/color.test.js @@ -0,0 +1,49 @@ +import { Jimp, donutJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import color from "../src"; + +const jimp = configure({ plugins: [color] }, Jimp); + +describe("canvas color transformation", () => { + const redDonutJGD = donutJGD(0x00000000, 0xff000088, 0xff0000ff); + + it("can apply more than one color transformation", async () => { + const image = await jimp.read(redDonutJGD); + const newJGD = image + .color([ + { apply: "hue", params: [-180] }, + { apply: "lighten", params: [25] }, + ]) + .getJGDSync(); + + newJGD.should.be.sameJGD(donutJGD(0x40404000, 0x80ffff88, 0x80ffffff)); + }); + + it("lighten", async () => { + const image = await jimp.read(redDonutJGD); + + image + .color([{ apply: "lighten", params: [25] }]) + .getJGDSync() + .should.be.sameJGD(donutJGD(0x40404000, 0xff808088, 0xff8080ff)); + }); + + it("brighten", async () => { + const image = await jimp.read(redDonutJGD); + + image + .color([{ apply: "brighten", params: [25] }]) + .getJGDSync() + .should.be.sameJGD(donutJGD(0x40404000, 0xff404088, 0xff4040ff)); + }); + + it("spin hue", async () => { + const image = await jimp.read(redDonutJGD); + + image + .color([{ apply: "hue", params: [150] }]) + .getJGDSync() + .should.be.sameJGD(donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff)); + }); +}); diff --git a/node_modules/@jimp/plugin-color/test/convolution.test.js b/node_modules/@jimp/plugin-color/test/convolution.test.js new file mode 100644 index 00000000..2bf66085 --- /dev/null +++ b/node_modules/@jimp/plugin-color/test/convolution.test.js @@ -0,0 +1,188 @@ +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import types from "@jimp/types"; + +import color from "../src"; + +const jimp = configure({ types: [types], plugins: [color] }, Jimp); + +describe("Convolution", function () { + this.timeout(15000); + + const imgs = [ + jimp.read( + mkJGD( + "22222222", + "22222222", + "22888822", + "22888822", + "22888822", + "22888822", + "22222222", + "22222222" + ) + ), + jimp.read( + mkJGD( + "88222222", + "88222222", + "22222222", + "22222222", + "22222222", + "22222222", + "22222222", + "22222222" + ) + ), + ]; + + let imgMid; + let imgTopLeft; // stores the Jimp instances of the JGD images above. + + before((done) => { + Promise.all(imgs) + .then((imgs) => { + imgMid = imgs[0]; + imgTopLeft = imgs[1]; + done(); + }) + .catch(done); + }); + + const sharpM = [ + [-1, -1, 0], + [-1, 1, 1], + [0, 1, 1], + ]; + + it("3x3 sharp matrix on EDGE_EXTEND", (done) => { + imgMid + .clone() + .convolution(sharpM) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "22222222", + "28EEE822", + "2EFFF802", + "2EF88002", + "2EF88002", + "28800002", + "22000002", + "22222222" + ), + "Mid light block" + ); + imgTopLeft + .clone() + .convolution(sharpM) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "80022222", + "00022222", + "00022222", + "22222222", + "22222222", + "22222222", + "22222222", + "22222222" + ), + "Top left light block" + ); + done(); + }); + + it("3x3 sharp matrix on EDGE_WRAP", (done) => { + imgMid + .clone() + .convolution(sharpM, jimp.EDGE_WRAP) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "66666666", + "28EEE822", + "2EFFF802", + "2EF88002", + "2EF88002", + "28800002", + "22000002", + "22222222" + ), + "Mid light block" + ); + imgTopLeft + .clone() + .convolution(sharpM, jimp.EDGE_WRAP) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "FC06666F", + "80022228", + "00022222", + "22222222", + "22222222", + "22222222", + "22222222", + "E8222228" + ), + "Top left light block" + ); + done(); + }); + + it("3x3 sharp matrix on EDGE_CROP", (done) => { + imgMid + .clone() + .convolution(sharpM, jimp.EDGE_CROP) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "86666662", + "68EEE820", + "6EFFF800", + "6EF88000", + "6EF88000", + "68800000", + "62000000", + "20000000" + ), + "Mid light block" + ); + imgTopLeft + .clone() + .convolution(sharpM, jimp.EDGE_CROP) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "FC066662", + "C0022220", + "00022220", + "62222220", + "62222220", + "62222220", + "62222220", + "20000000" + ), + "Top left light block" + ); + done(); + }); + + it("new pixel value is greater than 255", async () => { + const expectedImg = await jimp.read( + getTestDir(__dirname) + "/images/qr-convoluted.png" + ); + const image = await jimp.read(getTestDir(__dirname) + "/images/qr.jpg"); + + image + .convolution([ + [0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 0, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0], + ]) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); +}); diff --git a/project starter code/node_modules/@jimp/plugin-color/test/images/qr-convoluted.png b/node_modules/@jimp/plugin-color/test/images/qr-convoluted.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-color/test/images/qr-convoluted.png rename to node_modules/@jimp/plugin-color/test/images/qr-convoluted.png diff --git a/project starter code/node_modules/@jimp/plugin-color/test/images/qr.jpg b/node_modules/@jimp/plugin-color/test/images/qr.jpg similarity index 100% rename from project starter code/node_modules/@jimp/plugin-color/test/images/qr.jpg rename to node_modules/@jimp/plugin-color/test/images/qr.jpg diff --git a/node_modules/@jimp/plugin-contain/CHANGELOG.md b/node_modules/@jimp/plugin-contain/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-contain/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-contain/LICENSE b/node_modules/@jimp/plugin-contain/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-contain/LICENSE rename to node_modules/@jimp/plugin-contain/LICENSE diff --git a/node_modules/@jimp/plugin-contain/README.md b/node_modules/@jimp/plugin-contain/README.md new file mode 100644 index 00000000..187cdc75 --- /dev/null +++ b/node_modules/@jimp/plugin-contain/README.md @@ -0,0 +1,59 @@ +
+ +

@jimp/plugin-contain

+

Contain an image within a height and width.

+
+ +Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. + +## Usage + +- @param {number} w the width to resize the image to +- @param {number} h the height to resize the image to +- @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment +- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.contain(150, 100); +} + +main(); +``` + +### Align modes + +The following constants can be passed to `image.contain`: + +```js +Jimp.HORIZONTAL_ALIGN_LEFT; +Jimp.HORIZONTAL_ALIGN_CENTER; +Jimp.HORIZONTAL_ALIGN_RIGHT; + +Jimp.VERTICAL_ALIGN_TOP; +Jimp.VERTICAL_ALIGN_MIDDLE; +Jimp.VERTICAL_ALIGN_BOTTOM; +``` + +For example: + +```js +image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); +image.contain( + 250, + 250, + Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM +); +``` + +Default align mode for `image.contain` is: + +```js +Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; +``` diff --git a/node_modules/@jimp/plugin-contain/dist/index.js b/node_modules/@jimp/plugin-contain/dist/index.js new file mode 100644 index 00000000..77b211de --- /dev/null +++ b/node_modules/@jimp/plugin-contain/dist/index.js @@ -0,0 +1,75 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + contain: function contain(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } // permit any sort of optional parameters combination + + + if (typeof alignBits === "string") { + if (typeof mode === "function" && typeof cb === "undefined") cb = mode; + mode = alignBits; + alignBits = null; + } + + if (typeof alignBits === "function") { + if (typeof cb === "undefined") cb = alignBits; + mode = null; + alignBits = null; + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; + var hbits = alignBits & (1 << 3) - 1; + var vbits = alignBits >> 3; // check if more flags than one is in the bit sets + + if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { + return _utils.throwError.call(this, "only use one flag per alignment direction", cb); + } + + var alignH = hbits >> 1; // 0, 1, 2 + + var alignV = vbits >> 1; // 0, 1, 2 + + var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; + var c = this.cloneQuiet().scale(f, mode); + this.resize(w, h, mode); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + }); + this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-contain/dist/index.js.map b/node_modules/@jimp/plugin-contain/dist/index.js.map new file mode 100644 index 00000000..e534381f --- /dev/null +++ b/node_modules/@jimp/plugin-contain/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,OADoB,mBACZC,CADY,EACTC,CADS,EACNC,SADM,EACKC,IADL,EACWC,EADX,EACe;AACjC,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD,OAHgC,CAKjC;;;AACA,UAAI,OAAOF,SAAP,KAAqB,Q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AAL,CAAYE,MAAxC,GACIhB,CAAC,GAAG,KAAKc,MAAL,CAAYE,MADpB,GAEIjB,CAAC,GAAG,KAAKe,MAAL,CAAYC,KAHtB;AAIA,UAAME,CAAC,GAAG,KAAKC,UAAL,GAAkBC,KAAlB,CAAwBN,CAAxB,EAA2BX,IAA3B,CAAV;AAEA,WAAKkB,MAAL,CAAYrB,CAAZ,EAAeC,CAAf,EAAkBE,IAAlB;AACA,WAAKmB,SAAL,CACE,CADF,EAEE,CAFF,EAGE,KAAKP,MAAL,CAAYC,KAHd,EAIE,KAAKD,MAAL,CAAYE,MAJd,EAKE,UAAUM,CAAV,EAAaC,CAAb,EAAgBC,GAAhB,EAAqB;AACnB,aAAKV,MAAL,CAAYW,IAAZ,CAAiBC,aAAjB,CAA+B,KAAKC,WAApC,EAAiDH,GAAjD;AACD,OAPH;AASA,WAAKI,IAAL,CACEX,CADF,EAEG,CAAC,KAAKH,MAAL,CAAYC,KAAZ,GAAoBE,CAAC,CAACH,MAAF,CAASC,KAA9B,IAAuC,CAAxC,GAA6CJ,MAF/C,EAGG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBC,CAAC,CAACH,MAAF,CAASE,MAA/B,IAAyC,CAA1C,GAA+CJ,MAHjD;;AAMA,UAAI,0BAAcT,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3EmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === \"string\") {\n if (typeof mode === \"function\" && typeof cb === \"undefined\") cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === \"function\") {\n if (typeof cb === \"undefined\") cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-contain/index.d.ts b/node_modules/@jimp/plugin-contain/index.d.ts new file mode 100644 index 00000000..8c3306d3 --- /dev/null +++ b/node_modules/@jimp/plugin-contain/index.d.ts @@ -0,0 +1,21 @@ +import { ImageCallback } from "@jimp/core"; + +interface Contain { + contain(w: number, h: number, cb?: ImageCallback): this; + contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; + contain( + w: number, + h: number, + alignBits?: number, + cb?: ImageCallback + ): this; + contain( + w: number, + h: number, + alignBits?: number, + mode?: string, + cb?: ImageCallback + ): this; +} + +export default function (): Contain; diff --git a/node_modules/@jimp/plugin-contain/package.json b/node_modules/@jimp/plugin-contain/package.json new file mode 100644 index 00000000..3a91ace7 --- /dev/null +++ b/node_modules/@jimp/plugin-contain/package.json @@ -0,0 +1,43 @@ +{ + "name": "@jimp/plugin-contain", + "version": "0.16.13", + "description": "contain an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/plugin-scale": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-contain/src/index.js b/node_modules/@jimp/plugin-contain/src/index.js new file mode 100644 index 00000000..1736343c --- /dev/null +++ b/node_modules/@jimp/plugin-contain/src/index.js @@ -0,0 +1,88 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + contain(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } + + // permit any sort of optional parameters combination + if (typeof alignBits === "string") { + if (typeof mode === "function" && typeof cb === "undefined") cb = mode; + mode = alignBits; + alignBits = null; + } + + if (typeof alignBits === "function") { + if (typeof cb === "undefined") cb = alignBits; + mode = null; + alignBits = null; + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + alignBits = + alignBits || + this.constructor.HORIZONTAL_ALIGN_CENTER | + this.constructor.VERTICAL_ALIGN_MIDDLE; + const hbits = alignBits & ((1 << 3) - 1); + const vbits = alignBits >> 3; + + // check if more flags than one is in the bit sets + if ( + !( + (hbits !== 0 && !(hbits & (hbits - 1))) || + (vbits !== 0 && !(vbits & (vbits - 1))) + ) + ) { + return throwError.call( + this, + "only use one flag per alignment direction", + cb + ); + } + + const alignH = hbits >> 1; // 0, 1, 2 + const alignV = vbits >> 1; // 0, 1, 2 + + const f = + w / h > this.bitmap.width / this.bitmap.height + ? h / this.bitmap.height + : w / this.bitmap.width; + const c = this.cloneQuiet().scale(f, mode); + + this.resize(w, h, mode); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + } + ); + this.blit( + c, + ((this.bitmap.width - c.bitmap.width) / 2) * alignH, + ((this.bitmap.height - c.bitmap.height) / 2) * alignV + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-contain/test/contain.test.js b/node_modules/@jimp/plugin-contain/test/contain.test.js new file mode 100644 index 00000000..19739a27 --- /dev/null +++ b/node_modules/@jimp/plugin-contain/test/contain.test.js @@ -0,0 +1,131 @@ +import { Jimp, mkJGD, hasOwnProp } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import blit from "@jimp/plugin-blit"; +import resize from "@jimp/plugin-resize"; +import scale from "@jimp/plugin-scale"; + +import contain from "../src"; + +const jimp = configure({ plugins: [scale, resize, blit, contain] }, Jimp); + +describe("All align combinations for contain", () => { + const verticalJGD = mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ); + + const horizontalJGD = mkJGD( + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆" + ); + + let vertical; + let horizontal; // stores the Jimp instances of the JGD images above. + + before((done) => { + const img1 = jimp.read(verticalJGD); + const img2 = jimp.read(horizontalJGD); + Promise.all([img1, img2]) + .then((images) => { + vertical = images[0]; + horizontal = images[1]; + done(); + }) + .catch(done); + }); + + const tests = {}; // Stores the expected result for each alignment combination. + tests["LEFT TOP"] = { + contain: { + verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "), + horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "), + }, + }; + tests["CENTER TOP"] = { + contain: { + verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "), + horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "), + }, + }; + tests["RIGHT TOP"] = { + contain: { + verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"), + horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "), + }, + }; + + tests["LEFT MIDDLE"] = { + contain: { + verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "), + horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "), + }, + }; + tests["CENTER MIDDLE"] = { + contain: { + verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "), + horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "), + }, + }; + tests["RIGHT MIDDLE"] = { + contain: { + verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"), + horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "), + }, + }; + + tests["LEFT BOTTOM"] = { + contain: { + verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "), + horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"), + }, + }; + tests["CENTER BOTTOM"] = { + contain: { + verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "), + horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"), + }, + }; + tests["RIGHT BOTTOM"] = { + contain: { + verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"), + horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"), + }, + }; + + function runAlignTest(align) { + const jgdContainV = tests[align].contain.verti; + const jgdContainH = tests[align].contain.horiz; + let a = align.split(" "); + a = Jimp["HORIZONTAL_ALIGN_" + a[0]] | Jimp["VERTICAL_ALIGN_" + a[1]]; + it("contain aligned to " + align, () => { + vertical + .clone() + .contain(6, 6, a) + .getJGDSync() + .should.be.sameJGD(jgdContainV, "Vertical image"); + horizontal + .clone() + .contain(6, 6, a) + .getJGDSync() + .should.be.sameJGD(jgdContainH, "Horizontal image"); + }); + } + + for (const align in tests) if (hasOwnProp(tests, align)) runAlignTest(align); +}); diff --git a/node_modules/@jimp/plugin-cover/CHANGELOG.md b/node_modules/@jimp/plugin-cover/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-cover/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-cover/LICENSE b/node_modules/@jimp/plugin-cover/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-cover/LICENSE rename to node_modules/@jimp/plugin-cover/LICENSE diff --git a/node_modules/@jimp/plugin-cover/README.md b/node_modules/@jimp/plugin-cover/README.md new file mode 100644 index 00000000..8313aa2c --- /dev/null +++ b/node_modules/@jimp/plugin-cover/README.md @@ -0,0 +1,54 @@ +
+ +

@jimp/plugin-cover

+
+ +Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. + +## Usage + +- @param {number} w the width to resize the image to +- @param {number} h the height to resize the image to +- @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment +- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.cover(150, 100); +} + +main(); +``` + +### Align modes + +The following constants can be passed to `image.cover`: + +```js +Jimp.HORIZONTAL_ALIGN_LEFT; +Jimp.HORIZONTAL_ALIGN_CENTER; +Jimp.HORIZONTAL_ALIGN_RIGHT; + +Jimp.VERTICAL_ALIGN_TOP; +Jimp.VERTICAL_ALIGN_MIDDLE; +Jimp.VERTICAL_ALIGN_BOTTOM; +``` + +For example: + +```js +image.cover(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); +image.cover(250, 250, Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM); +``` + +Default align mode for `image.cover` is: + +```js +Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; +``` diff --git a/node_modules/@jimp/plugin-cover/dist/index.js b/node_modules/@jimp/plugin-cover/dist/index.js new file mode 100644 index 00000000..9dec0381 --- /dev/null +++ b/node_modules/@jimp/plugin-cover/dist/index.js @@ -0,0 +1,59 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + cover: function cover(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } + + if (alignBits && typeof alignBits === "function" && typeof cb === "undefined") { + cb = alignBits; + alignBits = null; + mode = null; + } else if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; + var hbits = alignBits & (1 << 3) - 1; + var vbits = alignBits >> 3; // check if more flags than one is in the bit sets + + if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, "only use one flag per alignment direction", cb); + var alignH = hbits >> 1; // 0, 1, 2 + + var alignV = vbits >> 1; // 0, 1, 2 + + var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; + this.scale(f, mode); + this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-cover/dist/index.js.map b/node_modules/@jimp/plugin-cover/dist/index.js.map new file mode 100644 index 00000000..e0713d42 --- /dev/null +++ b/node_modules/@jimp/plugin-cover/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,KADoB,iBACdC,CADc,EACXC,CADW,EACRC,SADQ,EACGC,IADH,EACSC,EADT,EACa;AAC/B,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UACEF,SAAS,IACT,OAAOA,SAAP,KAAqB,UADrB,IAEA,OAAOE,EAAP,KAAc,WAHhB,EAIE;AACAA,QAAAA,EAAE,GAAGF,SAAL;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACAC,QAAAA,IAAI,GAAG,IAAP;AACD,OARD,MAQO,IAAI,OAAOA,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAClEA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAEDD,MAAAA,SAAS,GACPA,SAAS,IACT,KAAKK,WAAL,CAAiBC,uBAAjB,GACE,KAAKD,WAAL,CAAiBE,qBAHrB;AAIA,UAAMC,KAAK,GAAGR,SAAS,GAAI,CAAC,KAAK,CAAN,IAAW,CAAtC;AACA,UAAMS,KAAK,GAAGT,SAAS,IAAI,CAA3B,CAvB+B,CAyB/B;;AACA,UACE,EACGQ,KAAK,KAAK,CAAV,IAAe,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAnB,CAAhB,IACCC,KAAK,KAAK,CAAV,IAAe,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAnB,CAFlB,CADF,EAME,OAAON,kBAAWC,IAAX,CACL,IADK,EAEL,2CAFK,EAGLF,EAHK,CAAP;AAMF,UAAMQ,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAtC+B,CAsCJ;;AAC3B,UAAMG,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAvC+B,CAuCJ;;AAE3B,UAAMG,CAAC,GACLd,CAAC,GAAGC,CAAJ,GAAQ,KAAKc,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAxC,GACIjB,CAAC,GAAG,KAAKe,MAAL,CAAYC,KADpB,GAEIf,CAAC,GAAG,KAAKc,MAAL,CAAYE,MAHtB;AAIA,WAAKC,KAAL,CAAWJ,CAAX,EAAcX,IAAd;AACA,WAAKgB,IAAL,CACG,CAAC,KAAKJ,MAAL,CAAYC,KAAZ,GAAoBhB,CAArB,IAA0B,CAA3B,GAAgCY,MADlC,EAEG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBhB,CAAtB,IAA2B,CAA5B,GAAiCY,MAFnC,EAGEb,CAHF,EAIEC,CAJF;;AAOA,UAAI,0BAAcG,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === \"function\" &&\n typeof cb === \"undefined\"\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-cover/index.d.ts b/node_modules/@jimp/plugin-cover/index.d.ts new file mode 100644 index 00000000..6a9e5d1c --- /dev/null +++ b/node_modules/@jimp/plugin-cover/index.d.ts @@ -0,0 +1,20 @@ +import { ImageCallback } from "@jimp/core"; + +interface Cover { + cover(w: number, h: number, cb?: ImageCallback): this; + cover( + w: number, + h: number, + alignBits?: number, + cb?: ImageCallback + ): this; + cover( + w: number, + h: number, + alignBits?: number, + mode?: string, + cb?: ImageCallback + ): this; +} + +export default function (): Cover; diff --git a/node_modules/@jimp/plugin-cover/package.json b/node_modules/@jimp/plugin-cover/package.json new file mode 100644 index 00000000..0e7a6a6d --- /dev/null +++ b/node_modules/@jimp/plugin-cover/package.json @@ -0,0 +1,43 @@ +{ + "name": "@jimp/plugin-cover", + "version": "0.16.13", + "description": "cover an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/plugin-crop": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/plugin-scale": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-cover/src/index.js b/node_modules/@jimp/plugin-cover/src/index.js new file mode 100644 index 00000000..37a0f1b7 --- /dev/null +++ b/node_modules/@jimp/plugin-cover/src/index.js @@ -0,0 +1,72 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + cover(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } + + if ( + alignBits && + typeof alignBits === "function" && + typeof cb === "undefined" + ) { + cb = alignBits; + alignBits = null; + mode = null; + } else if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + alignBits = + alignBits || + this.constructor.HORIZONTAL_ALIGN_CENTER | + this.constructor.VERTICAL_ALIGN_MIDDLE; + const hbits = alignBits & ((1 << 3) - 1); + const vbits = alignBits >> 3; + + // check if more flags than one is in the bit sets + if ( + !( + (hbits !== 0 && !(hbits & (hbits - 1))) || + (vbits !== 0 && !(vbits & (vbits - 1))) + ) + ) + return throwError.call( + this, + "only use one flag per alignment direction", + cb + ); + + const alignH = hbits >> 1; // 0, 1, 2 + const alignV = vbits >> 1; // 0, 1, 2 + + const f = + w / h > this.bitmap.width / this.bitmap.height + ? w / this.bitmap.width + : h / this.bitmap.height; + this.scale(f, mode); + this.crop( + ((this.bitmap.width - w) / 2) * alignH, + ((this.bitmap.height - h) / 2) * alignV, + w, + h + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-cover/test/cover.test.js b/node_modules/@jimp/plugin-cover/test/cover.test.js new file mode 100644 index 00000000..121fa442 --- /dev/null +++ b/node_modules/@jimp/plugin-cover/test/cover.test.js @@ -0,0 +1,131 @@ +import { Jimp, mkJGD, hasOwnProp } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import crop from "@jimp/plugin-crop"; +import scale from "@jimp/plugin-scale"; +import resize from "@jimp/plugin-resize"; + +import cover from "../src"; + +const jimp = configure({ plugins: [resize, scale, crop, cover] }, Jimp); + +describe("All align combinations for cover", () => { + const verticalJGD = mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ); + + const horizontalJGD = mkJGD( + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆" + ); + + let vertical; + let horizontal; // stores the Jimp instances of the JGD images above. + + before((done) => { + const img1 = jimp.read(verticalJGD); + const img2 = jimp.read(horizontalJGD); + Promise.all([img1, img2]) + .then((images) => { + vertical = images[0]; + horizontal = images[1]; + done(); + }) + .catch(done); + }); + + const tests = {}; // Stores the expected result for each alignment combination. + tests["LEFT TOP"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"), + horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"), + }, + }; + tests["CENTER TOP"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"), + horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + }, + }; + tests["RIGHT TOP"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"), + horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"), + }, + }; + + tests["LEFT MIDDLE"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"), + }, + }; + tests["CENTER MIDDLE"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + }, + }; + tests["RIGHT MIDDLE"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"), + }, + }; + + tests["LEFT BOTTOM"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"), + }, + }; + tests["CENTER BOTTOM"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + }, + }; + tests["RIGHT BOTTOM"] = { + cover: { + verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"), + }, + }; + + function runAlignTest(align) { + const jgdCoverV = tests[align].cover.verti; + const jgdCoverH = tests[align].cover.horiz; + let a = align.split(" "); + a = Jimp["HORIZONTAL_ALIGN_" + a[0]] | Jimp["VERTICAL_ALIGN_" + a[1]]; + it("cover aligned to " + align, () => { + vertical + .clone() + .cover(4, 4, a) + .getJGDSync() + .should.be.sameJGD(jgdCoverV, "Vertical image"); + horizontal + .clone() + .cover(4, 4, a) + .getJGDSync() + .should.be.sameJGD(jgdCoverH, "Horizontal image"); + }); + } + + for (const align in tests) if (hasOwnProp(tests, align)) runAlignTest(align); +}); diff --git a/node_modules/@jimp/plugin-crop/CHANGELOG.md b/node_modules/@jimp/plugin-crop/CHANGELOG.md new file mode 100644 index 00000000..bfa0db7b --- /dev/null +++ b/node_modules/@jimp/plugin-crop/CHANGELOG.md @@ -0,0 +1,52 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- fixed plugin-crop full width slices math [#1073](https://github.com/jimp-dev/jimp/pull/1073) ([@endreszabo](https://github.com/endreszabo)) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Endre Szabo ([@endreszabo](https://github.com/endreszabo)) + +--- + +# v0.16.0 (Sat Aug 08 2020) + +#### 🚀 Enhancement + +- added ability to ignore sides on autocrop [#924](https://github.com/oliver-moran/jimp/pull/924) ([@cbanfiel](https://github.com/cbanfiel)) + +#### Authors: 1 + +- Chad Banfield ([@cbanfiel](https://github.com/cbanfiel)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-crop/LICENSE b/node_modules/@jimp/plugin-crop/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-crop/LICENSE rename to node_modules/@jimp/plugin-crop/LICENSE diff --git a/node_modules/@jimp/plugin-crop/README.md b/node_modules/@jimp/plugin-crop/README.md new file mode 100644 index 00000000..64689368 --- /dev/null +++ b/node_modules/@jimp/plugin-crop/README.md @@ -0,0 +1,56 @@ +
+ +

@jimp/plugin-crop

+

Crop an image.

+
+ +## Crop + +Crops the image at a given point to a give size + +- @param {number} x the x coordinate to crop form +- @param {number} y the y coordinate to crop form +- @param w the width of the crop region +- @param h the height of the crop region +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.crop(150, 150); +} + +main(); +``` + +## AutoCrop + +AutoCrop same color borders from this image + +- @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) +- @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) + +or + +- @param {object} options object + - tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) + - cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) + - cropSymmetric (optional): flag to force cropping top be symmetric. north and south / east and west are cropped by the same value + - leaveBorder (optional): integer of how many pixels of the background color to leave around the image + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.autocrop(); + image.autocrop({ cropOnlyFrames: false, cropSymmetric: true }); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-crop/dist/index.js b/node_modules/@jimp/plugin-crop/dist/index.js new file mode 100644 index 00000000..1b58ec6a --- /dev/null +++ b/node_modules/@jimp/plugin-crop/dist/index.js @@ -0,0 +1,287 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = pluginCrop; + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _utils = require("@jimp/utils"); + +/* eslint-disable no-labels */ +function pluginCrop(event) { + /** + * Crops the image at a given point to a give size + * @param {number} x the x coordinate to crop form + * @param {number} y the y coordinate to crop form + * @param w the width of the crop region + * @param h the height of the crop region + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + event("crop", function (x, y, w, h, cb) { + if (typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "x and y must be numbers", cb); + if (typeof w !== "number" || typeof h !== "number") return _utils.throwError.call(this, "w and h must be numbers", cb); // round input + + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + + if (x === 0 && w === this.bitmap.width) { + // shortcut + var start = w * y + x << 2; + var end = start + (h * w << 2); + this.bitmap.data = this.bitmap.data.slice(start, end); + } else { + var bitmap = Buffer.allocUnsafe(w * h * 4); + var offset = 0; + this.scanQuiet(x, y, w, h, function (x, y, idx) { + var data = this.bitmap.data.readUInt32BE(idx, true); + bitmap.writeUInt32BE(data, offset, true); + offset += 4; + }); + this.bitmap.data = bitmap; + } + + this.bitmap.width = w; + this.bitmap.height = h; + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }); + return { + "class": { + /** + * Autocrop same color borders from this image + * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) + * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) + * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) + * @returns {Jimp} this for chaining of methods + */ + autocrop: function autocrop() { + var w = this.bitmap.width; + var h = this.bitmap.height; + var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image + + var cb; // callback + + var leaveBorder = 0; // Amount of pixels in border to leave + + var tolerance = 0.0002; // percent of color difference tolerance (default value) + + var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" + // i.e. all 4 sides have some border (default value) + + var cropSymmetric = false; // flag to force cropping top be symmetric. + // i.e. north and south / east and west are cropped by the same value + + var ignoreSides = { + north: false, + south: false, + east: false, + west: false + }; // parse arguments + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + for (var a = 0, len = args.length; a < len; a++) { + if (typeof args[a] === "number") { + // tolerance value passed + tolerance = args[a]; + } + + if (typeof args[a] === "boolean") { + // cropOnlyFrames value passed + cropOnlyFrames = args[a]; + } + + if (typeof args[a] === "function") { + // callback value passed + cb = args[a]; + } + + if ((0, _typeof2["default"])(args[a]) === "object") { + // config object passed + var config = args[a]; + + if (typeof config.tolerance !== "undefined") { + tolerance = config.tolerance; + } + + if (typeof config.cropOnlyFrames !== "undefined") { + cropOnlyFrames = config.cropOnlyFrames; + } + + if (typeof config.cropSymmetric !== "undefined") { + cropSymmetric = config.cropSymmetric; + } + + if (typeof config.leaveBorder !== "undefined") { + leaveBorder = config.leaveBorder; + } + + if (typeof config.ignoreSides !== "undefined") { + ignoreSides = config.ignoreSides; + } + } + } + /** + * All borders must be of the same color as the top left pixel, to be cropped. + * It should be possible to crop borders each with a different color, + * but since there are many ways for corners to intersect, it would + * introduce unnecessary complexity to the algorithm. + */ + // scan each side for same color borders + + + var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color + + var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides + + var northPixelsToCrop = 0; + var eastPixelsToCrop = 0; + var southPixelsToCrop = 0; + var westPixelsToCrop = 0; // north side (scan rows from north to south) + + colorTarget = this.getPixelColor(0, 0); + + if (!ignoreSides.north) { + north: for (var y = 0; y < h - minPixelsPerSide; y++) { + for (var x = 0; x < w; x++) { + var colorXY = this.getPixelColor(x, y); + var rgba2 = this.constructor.intToRGBA(colorXY); + + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break north; + } + } // this row contains all pixels with the same color: increment this side pixels to crop + + + northPixelsToCrop++; + } + } // east side (scan columns from east to west) + + + colorTarget = this.getPixelColor(w, 0); + + if (!ignoreSides.east) { + east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { + for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { + var _colorXY = this.getPixelColor(_x, _y); + + var _rgba = this.constructor.intToRGBA(_colorXY); + + if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break east; + } + } // this column contains all pixels with the same color: increment this side pixels to crop + + + eastPixelsToCrop++; + } + } // south side (scan rows from south to north) + + + colorTarget = this.getPixelColor(0, h); + + if (!ignoreSides.south) { + south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { + for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { + var _colorXY2 = this.getPixelColor(_x2, _y2); + + var _rgba2 = this.constructor.intToRGBA(_colorXY2); + + if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break south; + } + } // this row contains all pixels with the same color: increment this side pixels to crop + + + southPixelsToCrop++; + } + } // west side (scan columns from west to east) + + + colorTarget = this.getPixelColor(w, h); + + if (!ignoreSides.west) { + west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { + for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { + var _colorXY3 = this.getPixelColor(_x3, _y3); + + var _rgba3 = this.constructor.intToRGBA(_colorXY3); + + if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break west; + } + } // this column contains all pixels with the same color: increment this side pixels to crop + + + westPixelsToCrop++; + } + } // decide if a crop is needed + + + var doCrop = false; // apply leaveBorder + + westPixelsToCrop -= leaveBorder; + eastPixelsToCrop -= leaveBorder; + northPixelsToCrop -= leaveBorder; + southPixelsToCrop -= leaveBorder; + + if (cropSymmetric) { + var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); + var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); + westPixelsToCrop = horizontal; + eastPixelsToCrop = horizontal; + northPixelsToCrop = vertical; + southPixelsToCrop = vertical; + } // make sure that crops are >= 0 + + + westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; + eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; + northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; + southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks + + var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); + var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); + + if (cropOnlyFrames) { + // crop image if all sides should be cropped + doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; + } else { + // crop image if at least one side should be cropped + doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; + } + + if (doCrop) { + // do the real crop + this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); + } + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + } + }; +} + +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-crop/dist/index.js.map b/node_modules/@jimp/plugin-crop/dist/index.js.map new file mode 100644 index 00000000..8edd8835 --- /dev/null +++ b/node_modules/@jimp/plugin-crop/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"mappings":";;;;;;;;;;;AAEA;;AAFA;AAIe,SAASA,UAAT,CAAoBC,KAApB,EAA2B;AACxC;;;;;;;;;AASAA,EAAAA,KAAK,CAAC,MAAD,EAAS,UAAUC,CAAV,EAAaC,CAAb,EAAgBC,CAAhB,EAAmBC,CAAnB,EAAsBC,EAAtB,EAA0B;AACtC,QAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACF,QAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP,CAJoC,CAMtC;;AACAJ,IAAAA,CAAC,GAAGO,IAAI,CAACC,KAAL,CAAWR,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGI,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAJ;;AAEA,QAAIH,CAAC,KAAK,CAAN,IAA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C,iBAAiB,GAAGF,iBAAxB,CADH;;AAGA,YAAIjB,cAAJ,EAAoB;AAClB;AACAwB,UAAAA,MAAM,GACJN,gBAAgB,KAAK,CAArB,IACAD,iBAAiB,KAAK,CADtB,IAEAG,gBAAgB,KAAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD,SAPD,MAOO;AACL;AACAK,UAAAA,MAAM,GACJN,gBAAgB,KAAK,CAArB,IACAD,iBAAiB,KAAK,CADtB,IAEAG,gBAAgB,KAAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD;;AAED,YAAIK,MAAJ,EAAY;AACV;AACA,eAAKM,IAAL,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event(\"crop\", function (x, y, w, h, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n if (typeof w !== \"number\" || typeof h !== \"number\")\n return throwError.call(this, \"w and h must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = start + ((h * w) << 2);\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function (x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false,\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === \"number\") {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === \"boolean\") {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === \"function\") {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === \"object\") {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== \"undefined\") {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== \"undefined\") {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== \"undefined\") {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== \"undefined\") {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== \"undefined\") {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n };\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-crop/index.d.ts b/node_modules/@jimp/plugin-crop/index.d.ts new file mode 100644 index 00000000..48550b4f --- /dev/null +++ b/node_modules/@jimp/plugin-crop/index.d.ts @@ -0,0 +1,46 @@ +import { Jimp, ImageCallback } from "@jimp/core"; + +interface CropClass { + crop( + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + cropQuiet( + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + autocrop(tolerance?: number, cb?: ImageCallback): this; + autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): this; + autocrop( + tolerance?: number, + cropOnlyFrames?: boolean, + cb?: ImageCallback + ): this; + autocrop( + options: { + tolerance?: number; + cropOnlyFrames?: boolean; + cropSymmetric?: boolean; + leaveBorder?: number; + ignoreSides?: { + north: boolean; + south: boolean; + east: boolean; + west: boolean; + }; + }, + cb?: ImageCallback + ): this; +} + +interface Crop { + class: CropClass; +} + +export default function (): Crop; diff --git a/node_modules/@jimp/plugin-crop/package.json b/node_modules/@jimp/plugin-crop/package.json new file mode 100644 index 00000000..ec1f3e56 --- /dev/null +++ b/node_modules/@jimp/plugin-crop/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/plugin-crop", + "version": "0.16.13", + "description": "crop an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-crop/src/index.js b/node_modules/@jimp/plugin-crop/src/index.js new file mode 100644 index 00000000..5cb13d47 --- /dev/null +++ b/node_modules/@jimp/plugin-crop/src/index.js @@ -0,0 +1,293 @@ +/* eslint-disable no-labels */ + +import { throwError, isNodePattern } from "@jimp/utils"; + +export default function pluginCrop(event) { + /** + * Crops the image at a given point to a give size + * @param {number} x the x coordinate to crop form + * @param {number} y the y coordinate to crop form + * @param w the width of the crop region + * @param h the height of the crop region + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + event("crop", function (x, y, w, h, cb) { + if (typeof x !== "number" || typeof y !== "number") + return throwError.call(this, "x and y must be numbers", cb); + if (typeof w !== "number" || typeof h !== "number") + return throwError.call(this, "w and h must be numbers", cb); + + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + + if (x === 0 && w === this.bitmap.width) { + // shortcut + const start = (w * y + x) << 2; + const end = start + ((h * w) << 2); + + this.bitmap.data = this.bitmap.data.slice(start, end); + } else { + const bitmap = Buffer.allocUnsafe(w * h * 4); + let offset = 0; + + this.scanQuiet(x, y, w, h, function (x, y, idx) { + const data = this.bitmap.data.readUInt32BE(idx, true); + bitmap.writeUInt32BE(data, offset, true); + offset += 4; + }); + + this.bitmap.data = bitmap; + } + + this.bitmap.width = w; + this.bitmap.height = h; + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }); + + return { + class: { + /** + * Autocrop same color borders from this image + * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) + * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) + * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) + * @returns {Jimp} this for chaining of methods + */ + autocrop(...args) { + const w = this.bitmap.width; + const h = this.bitmap.height; + const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image + + let cb; // callback + let leaveBorder = 0; // Amount of pixels in border to leave + let tolerance = 0.0002; // percent of color difference tolerance (default value) + let cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" + // i.e. all 4 sides have some border (default value) + let cropSymmetric = false; // flag to force cropping top be symmetric. + // i.e. north and south / east and west are cropped by the same value + let ignoreSides = { + north: false, + south: false, + east: false, + west: false, + }; + + // parse arguments + for (let a = 0, len = args.length; a < len; a++) { + if (typeof args[a] === "number") { + // tolerance value passed + tolerance = args[a]; + } + + if (typeof args[a] === "boolean") { + // cropOnlyFrames value passed + cropOnlyFrames = args[a]; + } + + if (typeof args[a] === "function") { + // callback value passed + cb = args[a]; + } + + if (typeof args[a] === "object") { + // config object passed + const config = args[a]; + + if (typeof config.tolerance !== "undefined") { + ({ tolerance } = config); + } + + if (typeof config.cropOnlyFrames !== "undefined") { + ({ cropOnlyFrames } = config); + } + + if (typeof config.cropSymmetric !== "undefined") { + ({ cropSymmetric } = config); + } + + if (typeof config.leaveBorder !== "undefined") { + ({ leaveBorder } = config); + } + + if (typeof config.ignoreSides !== "undefined") { + ({ ignoreSides } = config); + } + } + } + + /** + * All borders must be of the same color as the top left pixel, to be cropped. + * It should be possible to crop borders each with a different color, + * but since there are many ways for corners to intersect, it would + * introduce unnecessary complexity to the algorithm. + */ + + // scan each side for same color borders + let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color + const rgba1 = this.constructor.intToRGBA(colorTarget); + + // for north and east sides + let northPixelsToCrop = 0; + let eastPixelsToCrop = 0; + let southPixelsToCrop = 0; + let westPixelsToCrop = 0; + + // north side (scan rows from north to south) + colorTarget = this.getPixelColor(0, 0); + if (!ignoreSides.north) { + north: for (let y = 0; y < h - minPixelsPerSide; y++) { + for (let x = 0; x < w; x++) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break north; + } + } + + // this row contains all pixels with the same color: increment this side pixels to crop + northPixelsToCrop++; + } + } + + // east side (scan columns from east to west) + colorTarget = this.getPixelColor(w, 0); + if (!ignoreSides.east) { + east: for (let x = 0; x < w - minPixelsPerSide; x++) { + for (let y = 0 + northPixelsToCrop; y < h; y++) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break east; + } + } + + // this column contains all pixels with the same color: increment this side pixels to crop + eastPixelsToCrop++; + } + } + + // south side (scan rows from south to north) + colorTarget = this.getPixelColor(0, h); + + if (!ignoreSides.south) { + south: for ( + let y = h - 1; + y >= northPixelsToCrop + minPixelsPerSide; + y-- + ) { + for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break south; + } + } + + // this row contains all pixels with the same color: increment this side pixels to crop + southPixelsToCrop++; + } + } + + // west side (scan columns from west to east) + colorTarget = this.getPixelColor(w, h); + if (!ignoreSides.west) { + west: for ( + let x = w - 1; + x >= 0 + eastPixelsToCrop + minPixelsPerSide; + x-- + ) { + for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { + // this pixel is too distant from the first one: abort this side scan + break west; + } + } + + // this column contains all pixels with the same color: increment this side pixels to crop + westPixelsToCrop++; + } + } + + // decide if a crop is needed + let doCrop = false; + + // apply leaveBorder + westPixelsToCrop -= leaveBorder; + eastPixelsToCrop -= leaveBorder; + northPixelsToCrop -= leaveBorder; + southPixelsToCrop -= leaveBorder; + + if (cropSymmetric) { + const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); + const vertical = Math.min(northPixelsToCrop, southPixelsToCrop); + westPixelsToCrop = horizontal; + eastPixelsToCrop = horizontal; + northPixelsToCrop = vertical; + southPixelsToCrop = vertical; + } + + // make sure that crops are >= 0 + westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; + eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; + northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; + southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; + + // safety checks + const widthOfRemainingPixels = + w - (westPixelsToCrop + eastPixelsToCrop); + const heightOfRemainingPixels = + h - (southPixelsToCrop + northPixelsToCrop); + + if (cropOnlyFrames) { + // crop image if all sides should be cropped + doCrop = + eastPixelsToCrop !== 0 && + northPixelsToCrop !== 0 && + westPixelsToCrop !== 0 && + southPixelsToCrop !== 0; + } else { + // crop image if at least one side should be cropped + doCrop = + eastPixelsToCrop !== 0 || + northPixelsToCrop !== 0 || + westPixelsToCrop !== 0 || + southPixelsToCrop !== 0; + } + + if (doCrop) { + // do the real crop + this.crop( + eastPixelsToCrop, + northPixelsToCrop, + widthOfRemainingPixels, + heightOfRemainingPixels + ); + } + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + }, + }; +} diff --git a/node_modules/@jimp/plugin-crop/test/autocrop.test.js b/node_modules/@jimp/plugin-crop/test/autocrop.test.js new file mode 100644 index 00000000..915fb7c9 --- /dev/null +++ b/node_modules/@jimp/plugin-crop/test/autocrop.test.js @@ -0,0 +1,429 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import crop from "../src"; + +const jimp = configure({ plugins: [crop] }, Jimp); + +describe("Autocrop", () => { + it("image with transparent surround color", async () => { + const imgSrc = await jimp.read( + mkJGD( + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); + + imgSrc + .autocrop() + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("image with opaque surround color", async () => { + const imgSrc = await jimp.read( + mkJGD( + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥◆◆▥▥▥▥", + "▥▥▥◆▦▦◆▥▥▥", + "▥▥◆▦▦▦▦◆▥▥", + "▥▥▥◆▦▦◆▥▥▥", + "▥▥▥▥◆◆▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" + ) + ); + + imgSrc + .autocrop() + .getJGDSync() + .should.be.sameJGD( + mkJGD("▥▥◆◆▥▥", "▥◆▦▦◆▥", "◆▦▦▦▦◆", "▥◆▦▦◆▥", "▥▥◆◆▥▥") + ); + }); + + it("image with one color border", async () => { + const imgSrc = await jimp.read( + mkJGD( + "▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥ ◆◆ ▥▥", + "▥▥ ◆▦▦◆ ▥▥", + "▥▥ ◆▦▦▦▦◆ ▥▥", + "▥▥ ◆▦▦◆ ▥▥", + "▥▥ ◆◆ ▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥" + ) + ); + + imgSrc + .autocrop() + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("image border with small variation", async () => { + const imgSrc = await jimp.read( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + imgSrc + .clone() + .autocrop() + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + imgSrc + .clone() + .autocrop(0.005) + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("image border with small variation configured by options", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + imgSrc + .clone() + .autocrop() + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + imgSrc + .clone() + .autocrop({ tolerance: 0.005 }) + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("image without frame", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "▥▥ ◆◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆▦▦▦▦◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆◆ ", + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" + ) + ); + + imgSrc + .autocrop(false) + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("image without frame configured by options", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "▥▥ ◆◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆▦▦▦▦◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆◆ ", + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" + ) + ); + + imgSrc + .autocrop({ cropOnlyFrames: false }) + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("image with symmetric border configured by options", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥ ◆◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆◆ ▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥" + ) + ); + + imgSrc + .autocrop({ cropSymmetric: true }) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ◆◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆▦▦▦▦◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆◆ ▥▥", + "▥▥▥▥▥▥▥▥▥▥" + ) + ); + }); + + it("image without frame and with symmetric border configured by options", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "▥▥ ◆◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆◆ ▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥" + ) + ); + imgSrc + .autocrop({ cropSymmetric: true, cropOnlyFrames: false }) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ◆◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆▦▦▦▦◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆◆ ▥▥", + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" + ) + ); + }); + + it("image without frame and with some border left", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + + imgSrc + .autocrop({ + tolerance: 0.005, + leaveBorder: 1, + }) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "3232323232", + "2 ◆◆ 3", + "3 ◆▦▦◆ 2", + "2 ◆▦▦▦▦◆ 3", + "3 ◆▦▦◆ 2", + "2 ◆◆ 3", + "3232323232" + ) + ); + }); + + it('image not cropped given an out of bounds "leaveBorder" value ', async () => { + const imgSrc = await Jimp.read( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + + imgSrc + .autocrop({ + tolerance: 0.005, + leaveBorder: 100, + }) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + }); + + it("image with top and bottom frame and leaveBorder", async () => { + const imgSrc = await Jimp.read( + mkJGD( + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥" + ) + ); + imgSrc + .autocrop({ cropSymmetric: true, cropOnlyFrames: false, leaveBorder: 2 }) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥" + ) + ); + }); + + it("ignore sides north", async () => { + const imgSrc = await jimp.read( + mkJGD( + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); + + imgSrc + .autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } }) + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ", " ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ") + ); + }); + + it("ignore sides south and west", async () => { + const imgSrc = await jimp.read( + mkJGD( + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); + + imgSrc + .autocrop({ + cropOnlyFrames: false, + ignoreSides: { west: true, south: true }, + }) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ◆◆ ", + " ◆▦▦◆ ", + "◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); + }); + + it("ignore sides east", async () => { + const imgSrc = await jimp.read( + mkJGD( + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); + + imgSrc + .autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } }) + .getJGDSync() + .should.be.sameJGD( + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ") + ); + }); +}); diff --git a/node_modules/@jimp/plugin-crop/test/crop.test.js b/node_modules/@jimp/plugin-crop/test/crop.test.js new file mode 100644 index 00000000..734e2788 --- /dev/null +++ b/node_modules/@jimp/plugin-crop/test/crop.test.js @@ -0,0 +1,65 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import crop from "../src"; + +const jimp = configure({ plugins: [crop] }, Jimp); + +describe("crop", () => { + // 6x5 size + const testImage = mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ "); + + it("full width from top", async () => { + const imgSrc = await jimp.read(testImage); + + imgSrc + .crop(0, 0, 6, 2) + .getJGDSync() + .should.be.sameJGD(mkJGD(" ◆◆ ", " ◆▦▦◆ ")); + }); + + it("full width from bottom", async () => { + const imgSrc = await jimp.read(testImage); + + imgSrc + .crop(0, 3, 6, 2) + .getJGDSync() + .should.be.sameJGD(mkJGD(" ◆▦▦◆ ", " ◆◆ ")); + }); + + it("full width from middle", async () => { + const imgSrc = await jimp.read(testImage); + + imgSrc + .crop(0, 2, 6, 2) + .getJGDSync() + .should.be.sameJGD(mkJGD("◆▦▦▦▦◆", " ◆▦▦◆ ")); + }); + + it("full height from left", async () => { + const imgSrc = await jimp.read(testImage); + + imgSrc + .crop(0, 0, 2, 5) + .getJGDSync() + .should.be.sameJGD(mkJGD(" ", " ◆", "◆▦", " ◆", " ")); + }); + + it("full height from right", async () => { + const imgSrc = await jimp.read(testImage); + + imgSrc + .crop(4, 0, 2, 5) + .getJGDSync() + .should.be.sameJGD(mkJGD(" ", "◆ ", "▦◆", "◆ ", " ")); + }); + + it("full height from middle", async () => { + const imgSrc = await jimp.read(testImage); + + imgSrc + .crop(2, 0, 2, 5) + .getJGDSync() + .should.be.sameJGD(mkJGD("◆◆", "▦▦", "▦▦", "▦▦", "◆◆")); + }); +}); diff --git a/node_modules/@jimp/plugin-displace/CHANGELOG.md b/node_modules/@jimp/plugin-displace/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-displace/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-displace/LICENSE b/node_modules/@jimp/plugin-displace/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-displace/LICENSE rename to node_modules/@jimp/plugin-displace/LICENSE diff --git a/node_modules/@jimp/plugin-displace/README.md b/node_modules/@jimp/plugin-displace/README.md new file mode 100644 index 00000000..d74a2447 --- /dev/null +++ b/node_modules/@jimp/plugin-displace/README.md @@ -0,0 +1,27 @@ +
+ +

@jimp/plugin-displace

+

Displace an image.

+
+ +Displaces the image based on the provided displacement map + +## Usage + +- @param {object} map the source Jimp instance +- @param {number} offset the maximum displacement value +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + // Make me better! + image.displace(map, 10); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-displace/dist/index.js b/node_modules/@jimp/plugin-displace/dist/index.js new file mode 100644 index 00000000..caa1a1fd --- /dev/null +++ b/node_modules/@jimp/plugin-displace/dist/index.js @@ -0,0 +1,53 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _utils = require("@jimp/utils"); + +/** + * Displaces the image based on the provided displacement map + * @param {object} map the source Jimp instance + * @param {number} offset the maximum displacement value + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + displace: function displace(map, offset, cb) { + if ((0, _typeof2["default"])(map) !== "object" || map.constructor !== this.constructor) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof offset !== "number") { + return _utils.throwError.call(this, "factor must be a number", cb); + } + + var source = this.cloneQuiet(); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var displacement = map.bitmap.data[idx] / 256 * offset; + displacement = Math.round(displacement); + var ids = this.getPixelIndex(x + displacement, y); + this.bitmap.data[ids] = source.bitmap.data[idx]; + this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; + this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-displace/dist/index.js.map b/node_modules/@jimp/plugin-displace/dist/index.js.map new file mode 100644 index 00000000..d525666d --- /dev/null +++ b/node_modules/@jimp/plugin-displace/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,yBAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,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AACD;;AAED,aAAO,IAAP;AACD;AAhCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== \"object\" || map.constructor !== this.constructor) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof offset !== \"number\") {\n return throwError.call(this, \"factor must be a number\", cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-displace/index.d.ts b/node_modules/@jimp/plugin-displace/index.d.ts new file mode 100644 index 00000000..d2ea79bf --- /dev/null +++ b/node_modules/@jimp/plugin-displace/index.d.ts @@ -0,0 +1,7 @@ +import { Jimp, ImageCallback } from "@jimp/core"; + +interface Displace { + displace(map: Jimp, offset: number, cb?: ImageCallback): this; +} + +export default function (): Displace; diff --git a/node_modules/@jimp/plugin-displace/package.json b/node_modules/@jimp/plugin-displace/package.json new file mode 100644 index 00000000..b0ac1284 --- /dev/null +++ b/node_modules/@jimp/plugin-displace/package.json @@ -0,0 +1,30 @@ +{ + "name": "@jimp/plugin-displace", + "version": "0.16.13", + "description": "displace an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-displace/src/index.js b/node_modules/@jimp/plugin-displace/src/index.js new file mode 100644 index 00000000..4dcd4403 --- /dev/null +++ b/node_modules/@jimp/plugin-displace/src/index.js @@ -0,0 +1,43 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Displaces the image based on the provided displacement map + * @param {object} map the source Jimp instance + * @param {number} offset the maximum displacement value + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + displace(map, offset, cb) { + if (typeof map !== "object" || map.constructor !== this.constructor) { + return throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof offset !== "number") { + return throwError.call(this, "factor must be a number", cb); + } + + const source = this.cloneQuiet(); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + let displacement = (map.bitmap.data[idx] / 256) * offset; + displacement = Math.round(displacement); + + const ids = this.getPixelIndex(x + displacement, y); + this.bitmap.data[ids] = source.bitmap.data[idx]; + this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; + this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-dither/CHANGELOG.md b/node_modules/@jimp/plugin-dither/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-dither/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-dither/LICENSE b/node_modules/@jimp/plugin-dither/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-dither/LICENSE rename to node_modules/@jimp/plugin-dither/LICENSE diff --git a/node_modules/@jimp/plugin-dither/README.md b/node_modules/@jimp/plugin-dither/README.md new file mode 100644 index 00000000..b384599d --- /dev/null +++ b/node_modules/@jimp/plugin-dither/README.md @@ -0,0 +1,26 @@ +
+ +

@jimp/plugin-dither

+

Apply a dither effect to an image.

+
+ +> Dither - is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often one of the last stages of mastering audio to a CD. + +## Usage + +Apply a ordered dithering effect + +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.dither565(); +} + +main(); +``` diff --git a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js b/node_modules/@jimp/plugin-dither/dist/index.js similarity index 100% rename from project starter code/node_modules/@jimp/plugin-dither/dist/index.js rename to node_modules/@jimp/plugin-dither/dist/index.js diff --git a/node_modules/@jimp/plugin-dither/dist/index.js.map b/node_modules/@jimp/plugin-dither/dist/index.js.map new file mode 100644 index 00000000..b96091f4 --- /dev/null +++ b/node_modules/@jimp/plugin-dither/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,MAAT,CAAgBC,EAAhB,EAAoB;AAClB,MAAMC,YAAY,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,EAAV,EAAc,EAAd,EAAkB,CAAlB,EAAqB,EAArB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,EAA/B,EAAmC,CAAnC,EAAsC,EA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function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither,\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-dither/index.d.ts b/node_modules/@jimp/plugin-dither/index.d.ts new file mode 100644 index 00000000..9f2415df --- /dev/null +++ b/node_modules/@jimp/plugin-dither/index.d.ts @@ -0,0 +1,8 @@ +import { ImageCallback } from "@jimp/core"; + +interface Dither { + dither565(cb?: ImageCallback): this; + dither16(cb?: ImageCallback): this; +} + +export default function (): Dither; diff --git a/node_modules/@jimp/plugin-dither/package.json b/node_modules/@jimp/plugin-dither/package.json new file mode 100644 index 00000000..5a1d627d --- /dev/null +++ b/node_modules/@jimp/plugin-dither/package.json @@ -0,0 +1,30 @@ +{ + "name": "@jimp/plugin-dither", + "version": "0.16.13", + "description": "Dither an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-dither/src/index.js b/node_modules/@jimp/plugin-dither/src/index.js new file mode 100644 index 00000000..c5ce9ece --- /dev/null +++ b/node_modules/@jimp/plugin-dither/src/index.js @@ -0,0 +1,40 @@ +import { isNodePattern } from "@jimp/utils"; + +/** + * Apply a ordered dithering effect + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +function dither(cb) { + const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const thresholdId = ((y & 3) << 2) + (x % 4); + const dither = rgb565Matrix[thresholdId]; + this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); + this.bitmap.data[idx + 1] = Math.min( + this.bitmap.data[idx + 1] + dither, + 0xff + ); + this.bitmap.data[idx + 2] = Math.min( + this.bitmap.data[idx + 2] + dither, + 0xff + ); + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; +} + +export default () => ({ + dither565: dither, + dither16: dither, +}); diff --git a/node_modules/@jimp/plugin-fisheye/CHANGELOG.md b/node_modules/@jimp/plugin-fisheye/CHANGELOG.md new file mode 100644 index 00000000..5bd13a6a --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/CHANGELOG.md @@ -0,0 +1,47 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.2 (Thu Sep 15 2022) + +#### 📝 Documentation + +- added the "e" back to @jimp/plugin-fisheye [#947](https://github.com/oliver-moran/jimp/pull/947) ([@mynameismax](https://github.com/mynameismax)) + +#### Authors: 1 + +- Max ([@mynameismax](https://github.com/mynameismax)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/LICENSE b/node_modules/@jimp/plugin-fisheye/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-fisheye/LICENSE rename to node_modules/@jimp/plugin-fisheye/LICENSE diff --git a/node_modules/@jimp/plugin-fisheye/README.md b/node_modules/@jimp/plugin-fisheye/README.md new file mode 100644 index 00000000..3a1ae13c --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/README.md @@ -0,0 +1,27 @@ +
+ +

@jimp/plugin-fisheye

+

Apply a fisheye effect to an image

+
+ +## Usage + +- @param {function(Error, Jimp)} options (optional) radius +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.fisheye(); + // or + image.fisheye({ r: 1.6 }); +} + +main(); +``` + +Produces nice images with [@jimp/plugin-circle](../plugin-circle). diff --git a/node_modules/@jimp/plugin-fisheye/babel.config.js b/node_modules/@jimp/plugin-fisheye/babel.config.js new file mode 100644 index 00000000..13e2603a --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/babel.config.js @@ -0,0 +1,38 @@ +module.exports = (api) => { + api.cache(true); + + return { + presets: [ + [ + "@babel/env", + { + useBuiltIns: "usage", + }, + ], + ], + + plugins: [ + "@babel/proposal-class-properties", + "@babel/syntax-object-rest-spread", + process.env.BABEL_ENV !== "module" && "add-module-exports", + [ + "transform-inline-environment-variables", + { include: ["BABEL_ENV", "ENV"] }, + ], + ].filter(Boolean), + + env: { + test: { + plugins: ["istanbul"], + }, + development: { + plugins: [process.env.ENV !== "browser" && "source-map-support"].filter( + Boolean + ), + }, + module: { + presets: [["@babel/env", { modules: false }]], + }, + }, + }; +}; diff --git a/node_modules/@jimp/plugin-fisheye/dist/index.js b/node_modules/@jimp/plugin-fisheye/dist/index.js new file mode 100644 index 00000000..fba91290 --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/dist/index.js @@ -0,0 +1,65 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Creates a circle out of an image. + * @param {object} options (optional) r: radius of effect + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + fisheye: function fisheye() { + var _this = this; + + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + r: 2.5 + }; + var cb = arguments.length > 1 ? arguments[1] : undefined; + + if (typeof options === "function") { + cb = options; + options = { + r: 2.5 + }; + } + + var source = this.cloneQuiet(); + var _source$bitmap = source.bitmap, + width = _source$bitmap.width, + height = _source$bitmap.height; + source.scanQuiet(0, 0, width, height, function (x, y) { + var hx = x / width; + var hy = y / height; + var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); + var rn = 2 * Math.pow(r, options.r); + var cosA = (hx - 0.5) / r; + var sinA = (hy - 0.5) / r; + var newX = Math.round((rn * cosA + 0.5) * width); + var newY = Math.round((rn * sinA + 0.5) * height); + var color = source.getPixelColor(newX, newY); + + _this.setPixelColor(color, x, y); + }); + /* Set center pixel color, otherwise it will be transparent */ + + this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-fisheye/dist/index.js.map b/node_modules/@jimp/plugin-fisheye/dist/index.js.map new file mode 100644 index 00000000..4ff401d5 --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,OADoB,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,IAAoBX,MAA/B,CAAb;AACA,YAAMe,KAAK,GAAGnB,MAAM,CAACoB,aAAP,CAAqBJ,IAArB,EAA2BE,IAA3B,CAAd;;AAEA,QAAA,KAAI,CAACG,aAAL,CAAmBF,KAAnB,EAA0Bb,CAA1B,EAA6BC,CAA7B;AACD,OAZD;AAcA;;AACA,WAAKc,aAAL,CACErB,MAAM,CAACoB,aAAP,CAAqBjB,KAAK,GAAG,CAA7B,EAAgCC,MAAM,GAAG,CAAzC,CADF,EAEED,KAAK,GAAG,CAFV,EAGEC,MAAM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-fisheye/index.d.ts b/node_modules/@jimp/plugin-fisheye/index.d.ts new file mode 100644 index 00000000..693b6f33 --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/index.d.ts @@ -0,0 +1,8 @@ +import { ImageCallback } from "@jimp/core"; + +interface Fisheye { + fishEye(opts?: { r: number }, cb?: ImageCallback): this; + fishEye(cb?: ImageCallback): this; +} + +export default function (): Fisheye; diff --git a/node_modules/@jimp/plugin-fisheye/package.json b/node_modules/@jimp/plugin-fisheye/package.json new file mode 100644 index 00000000..6b9f695b --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/plugin-fisheye", + "version": "0.16.13", + "description": "Apply a fisheye effect to an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-fisheye/src/index.js b/node_modules/@jimp/plugin-fisheye/src/index.js new file mode 100644 index 00000000..15c5b51d --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/src/index.js @@ -0,0 +1,46 @@ +import { isNodePattern } from "@jimp/utils"; + +/** + * Creates a circle out of an image. + * @param {object} options (optional) r: radius of effect + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + fisheye(options = { r: 2.5 }, cb) { + if (typeof options === "function") { + cb = options; + options = { r: 2.5 }; + } + + const source = this.cloneQuiet(); + const { width, height } = source.bitmap; + + source.scanQuiet(0, 0, width, height, (x, y) => { + const hx = x / width; + const hy = y / height; + const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); + const rn = 2 * Math.pow(r, options.r); + const cosA = (hx - 0.5) / r; + const sinA = (hy - 0.5) / r; + const newX = Math.round((rn * cosA + 0.5) * width); + const newY = Math.round((rn * sinA + 0.5) * height); + const color = source.getPixelColor(newX, newY); + + this.setPixelColor(color, x, y); + }); + + /* Set center pixel color, otherwise it will be transparent */ + this.setPixelColor( + source.getPixelColor(width / 2, height / 2), + width / 2, + height / 2 + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js b/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js new file mode 100644 index 00000000..b8f5aa1e --- /dev/null +++ b/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js @@ -0,0 +1,77 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import fisheye from "../src"; + +const jimp = configure({ plugins: [fisheye] }, Jimp); + +describe("Fisheye", () => { + it("should create fisheye lens to image", async () => { + const imgNormal = await jimp.read( + mkJGD( + "0000000000", + "0001221000", + "0022222200", + "0122112210", + "0221001220", + "0221001220", + "0122112210", + "0022222200", + "0001221000", + "0000000000" + ) + ); + const imgBulged = await jimp.read( + mkJGD( + "0001221000", + "0221112220", + "0220000121", + "1100000112", + "2100000012", + "2100000012", + "1200000012", + "0211000222", + "0221111220", + "0012222200" + ) + ); + + imgNormal.fisheye().getJGDSync().should.be.sameJGD(imgBulged.getJGDSync()); + }); + + it("should create fisheye lens to image with radius", async () => { + const imgNormal = await jimp.read( + mkJGD( + "0000000000", + "0000000000", + "0000000000", + "0000000000", + "0001111000", + "0001111000", + "0000000000", + "0000000000", + "0000000000", + "0000000000" + ) + ); + const imgBulged = await jimp.read( + mkJGD( + "■■■■■■■■■■", + "■■■■■■■■■■", + "■■■■■■■■■■", + "■■■11111■■", + "■■111111■■", + "■■111111■■", + "■■■■111■■■", + "■■■■■■■■■■", + "■■■■■■■■■■", + "■■■■■■■■■■" + ) + ); + + imgNormal + .fisheye({ r: 1.8 }) + .getJGDSync() + .should.be.sameJGD(imgBulged.getJGDSync()); + }); +}); diff --git a/node_modules/@jimp/plugin-flip/CHANGELOG.md b/node_modules/@jimp/plugin-flip/CHANGELOG.md new file mode 100644 index 00000000..ecf1d4df --- /dev/null +++ b/node_modules/@jimp/plugin-flip/CHANGELOG.md @@ -0,0 +1,47 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.10.3 (Mon Apr 20 2020) + +#### 🐛 Bug Fix + +- Simplify and fix flip [#879](https://github.com/oliver-moran/jimp/pull/879) ([@skalee](https://github.com/skalee)) + +#### Authors: 1 + +- Sebastian Skałacki ([@skalee](https://github.com/skalee)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-flip/LICENSE b/node_modules/@jimp/plugin-flip/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-flip/LICENSE rename to node_modules/@jimp/plugin-flip/LICENSE diff --git a/node_modules/@jimp/plugin-flip/README.md b/node_modules/@jimp/plugin-flip/README.md new file mode 100644 index 00000000..dd7ecaf5 --- /dev/null +++ b/node_modules/@jimp/plugin-flip/README.md @@ -0,0 +1,30 @@ +
+ +

@jimp/plugin-flip

+

flip an image.

+
+ +Flip the image horizontally or vertically. Defaults to horizontal. + +Also aliased as `mirror` + +## Usage + +- @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally +- @param {boolean} vertical a Boolean, if true the image will be flipped vertically +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.flip(); + image.mirror(); + image.flip(false, true); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-flip/dist/index.js b/node_modules/@jimp/plugin-flip/dist/index.js new file mode 100644 index 00000000..b3f82f1b --- /dev/null +++ b/node_modules/@jimp/plugin-flip/dist/index.js @@ -0,0 +1,48 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Flip the image horizontally + * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally + * @param {boolean} vertical a Boolean, if true the image will be flipped vertically + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +function flipFn(horizontal, vertical, cb) { + if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") return _utils.throwError.call(this, "horizontal and vertical must be Booleans", cb); + var bitmap = Buffer.alloc(this.bitmap.data.length); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var _x = horizontal ? this.bitmap.width - 1 - x : x; + + var _y = vertical ? this.bitmap.height - 1 - y : y; + + var _idx = this.bitmap.width * _y + _x << 2; + + var data = this.bitmap.data.readUInt32BE(idx); + bitmap.writeUInt32BE(data, _idx); + }); + this.bitmap.data = Buffer.from(bitmap); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; +} + +var _default = function _default() { + return { + flip: flipFn, + mirror: flipFn + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-flip/dist/index.js.map b/node_modules/@jimp/plugin-flip/dist/index.js.map new file mode 100644 index 00000000..afa7b12f --- /dev/null +++ b/node_modules/@jimp/plugin-flip/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt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SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== \"boolean\" || typeof vertical !== \"boolean\")\n return throwError.call(\n this,\n \"horizontal and vertical must be Booleans\",\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n }\n );\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn,\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-flip/index.d.ts b/node_modules/@jimp/plugin-flip/index.d.ts new file mode 100644 index 00000000..3f1efd66 --- /dev/null +++ b/node_modules/@jimp/plugin-flip/index.d.ts @@ -0,0 +1,12 @@ +import { ImageCallback } from "@jimp/core"; + +interface Flip { + flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; + mirror( + horizontal: boolean, + vertical: boolean, + cb?: ImageCallback + ): this; +} + +export default function (): Flip; diff --git a/node_modules/@jimp/plugin-flip/package.json b/node_modules/@jimp/plugin-flip/package.json new file mode 100644 index 00000000..8b4f801b --- /dev/null +++ b/node_modules/@jimp/plugin-flip/package.json @@ -0,0 +1,31 @@ +{ + "name": "@jimp/plugin-flip", + "version": "0.16.13", + "description": "flip an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-rotate": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-flip/src/index.js b/node_modules/@jimp/plugin-flip/src/index.js new file mode 100644 index 00000000..01064ac1 --- /dev/null +++ b/node_modules/@jimp/plugin-flip/src/index.js @@ -0,0 +1,46 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Flip the image horizontally + * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally + * @param {boolean} vertical a Boolean, if true the image will be flipped vertically + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +function flipFn(horizontal, vertical, cb) { + if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") + return throwError.call( + this, + "horizontal and vertical must be Booleans", + cb + ); + + const bitmap = Buffer.alloc(this.bitmap.data.length); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const _x = horizontal ? this.bitmap.width - 1 - x : x; + const _y = vertical ? this.bitmap.height - 1 - y : y; + const _idx = (this.bitmap.width * _y + _x) << 2; + const data = this.bitmap.data.readUInt32BE(idx); + + bitmap.writeUInt32BE(data, _idx); + } + ); + + this.bitmap.data = Buffer.from(bitmap); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; +} + +export default () => ({ + flip: flipFn, + mirror: flipFn, +}); diff --git a/node_modules/@jimp/plugin-flip/test/flipping.test.js b/node_modules/@jimp/plugin-flip/test/flipping.test.js new file mode 100644 index 00000000..fb17d203 --- /dev/null +++ b/node_modules/@jimp/plugin-flip/test/flipping.test.js @@ -0,0 +1,99 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; + +import configure from "@jimp/custom"; + +import flip from "../src"; + +const jimp = configure({ plugins: [flip] }, Jimp); + +describe("Flipping plugin", () => { + it("can flip horizontally", async () => { + const src = await jimp.read( + mkJGD( + "AAAABBBB", + "AAABAAAB", + "ABABABAB", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" + ) + ); + + const result = src.flip(true, false); + + result + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "BBBBAAAA", + "BAAABAAA", + "BABABABA", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" + ) + ); + }); + + it("can flip vertically", async () => { + const src = await jimp.read( + mkJGD( + "AAAABBBB", + "AAABAAAB", + "ABABABAB", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" + ) + ); + + const result = src.flip(false, true); + + result + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "AACCCCAA", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "ABABABAB", + "AAABAAAB", + "AAAABBBB" + ) + ); + }); + + it("can flip both horizontally and vertically at once", async () => { + const src = await jimp.read( + mkJGD( + "AAAABBBB", + "AAABAAAB", + "ABABABAB", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" + ) + ); + + const result = src.flip(true, true); + + result + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "AACCCCAA", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "BABABABA", + "BAAABAAA", + "BBBBAAAA" + ) + ); + }); +}); diff --git a/node_modules/@jimp/plugin-gaussian/CHANGELOG.md b/node_modules/@jimp/plugin-gaussian/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/LICENSE b/node_modules/@jimp/plugin-gaussian/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-gaussian/LICENSE rename to node_modules/@jimp/plugin-gaussian/LICENSE diff --git a/node_modules/@jimp/plugin-gaussian/README.md b/node_modules/@jimp/plugin-gaussian/README.md new file mode 100644 index 00000000..0f15ca98 --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/README.md @@ -0,0 +1,25 @@ +
+ +

@jimp/plugin-gaussian

+

Gaussian blur an image.

+
+ +Applies a true Gaussian blur to the image (warning: this is VERY slow) + +## Usage + +- @param {number} r the pixel radius of the blur +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.gaussian(15); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-gaussian/dist/index.js b/node_modules/@jimp/plugin-gaussian/dist/index.js new file mode 100644 index 00000000..d4312c8c --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/dist/index.js @@ -0,0 +1,87 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Applies a true Gaussian blur to the image (warning: this is VERY slow) + * @param {number} r the pixel radius of the blur + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + gaussian: function gaussian(r, cb) { + // http://blog.ivank.net/fastest-gaussian-blur.html + if (typeof r !== "number") { + return _utils.throwError.call(this, "r must be a number", cb); + } + + if (r < 1) { + return _utils.throwError.call(this, "r must be greater than 0", cb); + } + + var rs = Math.ceil(r * 2.57); // significant radius + + var range = rs * 2 + 1; + var rr2 = r * r * 2; + var rr2pi = rr2 * Math.PI; + var weights = []; + + for (var y = 0; y < range; y++) { + weights[y] = []; + + for (var x = 0; x < range; x++) { + var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); + weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; + } + } + + for (var _y = 0; _y < this.bitmap.height; _y++) { + for (var _x = 0; _x < this.bitmap.width; _x++) { + var red = 0; + var green = 0; + var blue = 0; + var alpha = 0; + var wsum = 0; + + for (var iy = 0; iy < range; iy++) { + for (var ix = 0; ix < range; ix++) { + var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); + var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); + var weight = weights[iy][ix]; + + var _idx = y1 * this.bitmap.width + x1 << 2; + + red += this.bitmap.data[_idx] * weight; + green += this.bitmap.data[_idx + 1] * weight; + blue += this.bitmap.data[_idx + 2] * weight; + alpha += this.bitmap.data[_idx + 3] * weight; + wsum += weight; + } + + var idx = _y * this.bitmap.width + _x << 2; + this.bitmap.data[idx] = Math.round(red / wsum); + this.bitmap.data[idx + 1] = Math.round(green / wsum); + this.bitmap.data[idx + 2] = Math.round(blue / wsum); + this.bitmap.data[idx + 3] = Math.round(alpha / wsum); + } + } + } + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-gaussian/dist/index.js.map b/node_modules/@jimp/plugin-gaussian/dist/index.js.map new file mode 100644 index 00000000..b0a9e436 --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"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,IAAI,IAAI,KAAKL,MAAL,CAAYgB,IAAZ,CAAiBD,IAAG,GAAG,CAAvB,IAA4BD,MAApC;AACAR,cAAAA,KAAK,IAAI,KAAKN,MAAL,CAAYgB,IAAZ,CAAiBD,IAAG,GAAG,CAAvB,IAA4BD,MAArC;AACAP,cAAAA,IAAI,IAAIO,MAAR;AACD;;AAED,gBAAMC,GAAG,GAAInB,EAAC,GAAG,KAAKI,MAAL,CAAYE,KAAhB,GAAwBL,EAAzB,IAA+B,CAA3C;AAEA,iBAAKG,MAAL,CAAYgB,IAAZ,CAAiBD,GAAjB,IAAwB1B,IAAI,CAAC4B,KAAL,CAAWd,GAAG,GAAGI,IAAjB,CAAxB;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWb,KAAK,GAAGG,IAAnB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWZ,IAAI,GAAGE,IAAlB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWX,KAAK,GAAGC,IAAnB,CAA5B;AACD;AACF;AACF;;AAED,UAAI,0BAActB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArEmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== \"number\") {\n return throwError.call(this, \"r must be a number\", cb);\n }\n\n if (r < 1) {\n return throwError.call(this, \"r must be greater than 0\", cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(\n this.bitmap.width - 1,\n Math.max(0, ix + x - rs)\n );\n const y1 = Math.min(\n this.bitmap.height - 1,\n Math.max(0, iy + y - rs)\n );\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-gaussian/index.d.ts b/node_modules/@jimp/plugin-gaussian/index.d.ts new file mode 100644 index 00000000..4f9114c9 --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/index.d.ts @@ -0,0 +1,7 @@ +import { ImageCallback } from "@jimp/core"; + +interface Gaussian { + gaussian(r: number, cb?: ImageCallback): this; +} + +export default function (): Gaussian; diff --git a/node_modules/@jimp/plugin-gaussian/package.json b/node_modules/@jimp/plugin-gaussian/package.json new file mode 100644 index 00000000..c78a8cd2 --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/package.json @@ -0,0 +1,30 @@ +{ + "name": "@jimp/plugin-gaussian", + "version": "0.16.13", + "description": "gaussian blur an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-gaussian/src/index.js b/node_modules/@jimp/plugin-gaussian/src/index.js new file mode 100644 index 00000000..21528cb6 --- /dev/null +++ b/node_modules/@jimp/plugin-gaussian/src/index.js @@ -0,0 +1,79 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Applies a true Gaussian blur to the image (warning: this is VERY slow) + * @param {number} r the pixel radius of the blur + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + gaussian(r, cb) { + // http://blog.ivank.net/fastest-gaussian-blur.html + if (typeof r !== "number") { + return throwError.call(this, "r must be a number", cb); + } + + if (r < 1) { + return throwError.call(this, "r must be greater than 0", cb); + } + + const rs = Math.ceil(r * 2.57); // significant radius + const range = rs * 2 + 1; + const rr2 = r * r * 2; + const rr2pi = rr2 * Math.PI; + + const weights = []; + + for (let y = 0; y < range; y++) { + weights[y] = []; + for (let x = 0; x < range; x++) { + const dsq = (x - rs) ** 2 + (y - rs) ** 2; + weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; + } + } + + for (let y = 0; y < this.bitmap.height; y++) { + for (let x = 0; x < this.bitmap.width; x++) { + let red = 0; + let green = 0; + let blue = 0; + let alpha = 0; + let wsum = 0; + + for (let iy = 0; iy < range; iy++) { + for (let ix = 0; ix < range; ix++) { + const x1 = Math.min( + this.bitmap.width - 1, + Math.max(0, ix + x - rs) + ); + const y1 = Math.min( + this.bitmap.height - 1, + Math.max(0, iy + y - rs) + ); + const weight = weights[iy][ix]; + const idx = (y1 * this.bitmap.width + x1) << 2; + + red += this.bitmap.data[idx] * weight; + green += this.bitmap.data[idx + 1] * weight; + blue += this.bitmap.data[idx + 2] * weight; + alpha += this.bitmap.data[idx + 3] * weight; + wsum += weight; + } + + const idx = (y * this.bitmap.width + x) << 2; + + this.bitmap.data[idx] = Math.round(red / wsum); + this.bitmap.data[idx + 1] = Math.round(green / wsum); + this.bitmap.data[idx + 2] = Math.round(blue / wsum); + this.bitmap.data[idx + 3] = Math.round(alpha / wsum); + } + } + } + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-invert/CHANGELOG.md b/node_modules/@jimp/plugin-invert/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-invert/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-invert/LICENSE b/node_modules/@jimp/plugin-invert/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-invert/LICENSE rename to node_modules/@jimp/plugin-invert/LICENSE diff --git a/node_modules/@jimp/plugin-invert/README.md b/node_modules/@jimp/plugin-invert/README.md new file mode 100644 index 00000000..e201f584 --- /dev/null +++ b/node_modules/@jimp/plugin-invert/README.md @@ -0,0 +1,24 @@ +
+ +

@jimp/plugin-invert

+

Invert an image's colors.

+
+ +Invert an image's colors. + +## Usage + +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.invert(); +} + +main(); +``` diff --git a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js b/node_modules/@jimp/plugin-invert/dist/index.js similarity index 100% rename from project starter code/node_modules/@jimp/plugin-invert/dist/index.js rename to node_modules/@jimp/plugin-invert/dist/index.js diff --git a/node_modules/@jimp/plugin-invert/dist/index.js.map b/node_modules/@jimp/plugin-invert/dist/index.js.map new file mode 100644 index 00000000..317ed895 --- /dev/null +++ b/node_modules/@jimp/plugin-invert/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CACE,CADF,EAEE,CAFF,EAGE,KAAKC,MAAL,CAAYC,KAHd,EAIE,KAAKD,MAAL,CAAYE,MAJd,EAKE,UAAUC,CAAV,EAAaC,CAAb,EAAgBC,GAAhB,EAAqB;AACnB,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OATH;;AAYA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAnBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-invert/index.d.ts b/node_modules/@jimp/plugin-invert/index.d.ts new file mode 100644 index 00000000..483b5430 --- /dev/null +++ b/node_modules/@jimp/plugin-invert/index.d.ts @@ -0,0 +1,7 @@ +import { ImageCallback } from "@jimp/core"; + +interface Invert { + invert(cb?: ImageCallback): this; +} + +export default function (): Invert; diff --git a/node_modules/@jimp/plugin-invert/package.json b/node_modules/@jimp/plugin-invert/package.json new file mode 100644 index 00000000..093b6ca2 --- /dev/null +++ b/node_modules/@jimp/plugin-invert/package.json @@ -0,0 +1,30 @@ +{ + "name": "@jimp/plugin-invert", + "version": "0.16.13", + "description": "invert an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-invert/src/index.js b/node_modules/@jimp/plugin-invert/src/index.js new file mode 100644 index 00000000..44ad9302 --- /dev/null +++ b/node_modules/@jimp/plugin-invert/src/index.js @@ -0,0 +1,28 @@ +import { isNodePattern } from "@jimp/utils"; + +/** + * Inverts the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + invert(cb) { + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; + this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; + this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-mask/CHANGELOG.md b/node_modules/@jimp/plugin-mask/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-mask/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-mask/LICENSE b/node_modules/@jimp/plugin-mask/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-mask/LICENSE rename to node_modules/@jimp/plugin-mask/LICENSE diff --git a/node_modules/@jimp/plugin-mask/README.md b/node_modules/@jimp/plugin-mask/README.md new file mode 100644 index 00000000..840ce372 --- /dev/null +++ b/node_modules/@jimp/plugin-mask/README.md @@ -0,0 +1,26 @@ +
+ +

@jimp/plugin-mask

+

mask an image with another image.

+
+ +Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. + +## Usage + +- @param {Jimp} src the source Jimp instance +- @param {number} x the horizontal position to blit the image +- @param {number} y the vertical position to blit the image +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + const mask = await jimp.read("test/mask.png"); + + image.mask(mask); +} +``` diff --git a/node_modules/@jimp/plugin-mask/dist/index.js b/node_modules/@jimp/plugin-mask/dist/index.js new file mode 100644 index 00000000..79a6f19b --- /dev/null +++ b/node_modules/@jimp/plugin-mask/dist/index.js @@ -0,0 +1,62 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. + * @param {Jimp} src the source Jimp instance + * @param {number} x the horizontal position to blit the image + * @param {number} y the vertical position to blit the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + mask: function mask(src) { + var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var cb = arguments.length > 3 ? arguments[3] : undefined; + + if (!(src instanceof this.constructor)) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } // round input + + + x = Math.round(x); + y = Math.round(y); + var w = this.bitmap.width; + var h = this.bitmap.height; + var baseImage = this; + src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { + var destX = x + sx; + var destY = y + sy; + + if (destX >= 0 && destY >= 0 && destX < w && destY < h) { + var dstIdx = baseImage.getPixelIndex(destX, destY); + var data = this.bitmap.data; + var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; + baseImage.bitmap.data[dstIdx + 3] *= avg / 255; + } + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-mask/dist/index.js.map b/node_modules/@jimp/plugin-mask/dist/index.js.map new file mode 100644 index 00000000..40cda516 --- /dev/null +++ b/node_modules/@jimp/plugin-mask/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;eAQe;AAAA,SAAO;AACpBA,IAAAA,IADoB,gBACfC,GADe,EACQ;AAAA,UAAlBC,CAAkB,uEAAd,CAAc;AAAA,UAAXC,CAAW,uEAAP,CAAO;AAAA,UAAJC,EAAI;;AAC1B,UAAI,EAAEH,GAAG,YAAY,KAAKI,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD,OAPyB,CAS1B;;;AACAF,MAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,MAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AAEA,UAAMO,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAAtB;AACA,UAAMC,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAAtB;AACA,UAAMC,SAAS,GAAG,IAAlB;AAEAd,MAAAA,GAAG,CAACe,SAAJ,CACE,CADF,EAEE,CAFF,EAGEf,GAAG,CAACU,MAAJ,CAAWC,KAHb,EAIEX,GAAG,CAACU,MAAJ,CAAWG,MAJb,EAKE,UAAUG,EAAV,EAAcC,EAAd,EAAkBC,GAAlB,EAAuB;AACrB,YAAMC,KAAK,GAAGlB,CAAC,GAAGe,EAAlB;AACA,YAAMI,KAAK,GAAGlB,CAAC,GAAGe,EAAlB;;AAEA,YAAIE,KAAK,IAAI,CAAT,IAAcC,KAAK,IAAI,CAAvB,IAA4BD,KAAK,GAAGV,CAApC,IAAyCW,KAAK,GAAGR,CAArD,EAAwD;AACtD,cAAMS,MAAM,GAAGP,SAAS,CAACQ,aAAV,CAAwBH,KAAxB,EAA+BC,KAA/B,CAAf;AADsD,cAE9CG,IAF8C,GAErC,KAAKb,MAFgC,CAE9Ca,IAF8C;AAGtD,cAAMC,GAAG,GAAG,CAACD,IAAI,CAACL,GAAG,GAAG,CAAP,CAAJ,GAAgBK,IAAI,CAACL,GAAG,GAAG,CAAP,CAApB,GAAgCK,IAAI,CAACL,GAAG,GAAG,CAAP,CAArC,IAAkD,CAA9D;AAEAJ,UAAAA,SAAS,CAACJ,MAAV,CAAiBa,IAAjB,CAAsBF,MAAM,GAAG,CAA/B,KAAqCG,GAAG,GAAG,GAA3C;AACD;AACF,OAhBH;;AAmBA,UAAI,0BAAcrB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA1CmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-mask/index.d.ts b/node_modules/@jimp/plugin-mask/index.d.ts new file mode 100644 index 00000000..8effa592 --- /dev/null +++ b/node_modules/@jimp/plugin-mask/index.d.ts @@ -0,0 +1,7 @@ +import { ImageCallback, Jimp } from "@jimp/core"; + +interface Mask { + mask(src: Jimp, x: number, y: number, cb?: ImageCallback): this; +} + +export default function (): Mask; diff --git a/node_modules/@jimp/plugin-mask/package.json b/node_modules/@jimp/plugin-mask/package.json new file mode 100644 index 00000000..eea0bd57 --- /dev/null +++ b/node_modules/@jimp/plugin-mask/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/plugin-mask", + "version": "0.16.13", + "description": "mask an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-mask/src/index.js b/node_modules/@jimp/plugin-mask/src/index.js new file mode 100644 index 00000000..2a6b32d4 --- /dev/null +++ b/node_modules/@jimp/plugin-mask/src/index.js @@ -0,0 +1,54 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. + * @param {Jimp} src the source Jimp instance + * @param {number} x the horizontal position to blit the image + * @param {number} y the vertical position to blit the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + mask(src, x = 0, y = 0, cb) { + if (!(src instanceof this.constructor)) { + return throwError.call(this, "The source must be a Jimp image", cb); + } + + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); + } + + // round input + x = Math.round(x); + y = Math.round(y); + + const w = this.bitmap.width; + const h = this.bitmap.height; + const baseImage = this; + + src.scanQuiet( + 0, + 0, + src.bitmap.width, + src.bitmap.height, + function (sx, sy, idx) { + const destX = x + sx; + const destY = y + sy; + + if (destX >= 0 && destY >= 0 && destX < w && destY < h) { + const dstIdx = baseImage.getPixelIndex(destX, destY); + const { data } = this.bitmap; + const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; + + baseImage.bitmap.data[dstIdx + 3] *= avg / 255; + } + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-mask/test/mask.test.js b/node_modules/@jimp/plugin-mask/test/mask.test.js new file mode 100644 index 00000000..373bc099 --- /dev/null +++ b/node_modules/@jimp/plugin-mask/test/mask.test.js @@ -0,0 +1,173 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import mask from "../src"; + +const jimp = configure({ plugins: [mask] }, Jimp); + +describe("Mask", () => { + let imgSrcOpaq; + let imgSrcAlpa; + let maskGrayBig; + let maskGraySmall; + let maskColor; + + before((done) => { + Promise.all([ + jimp.read(mkJGD("▴□▾□■□", "■▴■▾■□", "■□▴□▾□", "■□■▴■▾")), + jimp.read(mkJGD("▴▵▾▿", "▴▵▾▿", "▴▵▾▿")), + jimp.read(mkJGD("048840", "8CFFC8", "8CFFC8", "048840")), + jimp.read(mkJGD("0369", "369C", "69CF")), + jimp.read(mkJGD("▴▴▾▾", "▪▪▰▰", "□□□□")), + ]) + .then((imgs) => { + imgSrcOpaq = imgs[0]; + imgSrcAlpa = imgs[1]; + maskGrayBig = imgs[2]; + maskGraySmall = imgs[3]; + maskColor = imgs[4]; + done(); + }) + .catch(done); + }); + + it("Affect opaque image with a gray mask with the same size", () => { + imgSrcOpaq + .clone() + .mask(maskGrayBig) + .getJGDSync() + .should.be.sameJGD({ + width: 6, + height: 4, + data: [ + 0xff000000, 0xffffff44, 0x0000ff88, 0xffffff88, 0x00000044, + 0xffffff00, 0x00000088, 0xff0000cc, 0x000000ff, 0x0000ffff, + 0x000000cc, 0xffffff88, 0x00000088, 0xffffffcc, 0xff0000ff, + 0xffffffff, 0x0000ffcc, 0xffffff88, 0x00000000, 0xffffff44, + 0x00000088, 0xff000088, 0x00000044, 0x0000ff00, + ], + }); + }); + + it("Affect opaque image with a gray mask with the same size, blited", () => { + imgSrcOpaq + .clone() + .mask(maskGrayBig, 1, 1) + .getJGDSync() + .should.be.sameJGD({ + width: 6, + height: 4, + data: [ + 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, + 0xffffffff, 0x000000ff, 0xff000000, 0x00000044, 0x0000ff88, + 0x00000088, 0xffffff44, 0x000000ff, 0xffffff88, 0xff0000cc, + 0xffffffff, 0x0000ffff, 0xffffffcc, 0x000000ff, 0xffffff88, + 0x000000cc, 0xff0000ff, 0x000000ff, 0x0000ffcc, + ], + }); + }); + + it("Affect opaque image with a gray mask with the same size, blited negative", () => { + imgSrcOpaq + .clone() + .mask(maskGrayBig, -1, -1) + .getJGDSync() + .should.be.sameJGD({ + width: 6, + height: 4, + data: [ + 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffcc, 0x00000088, + 0xffffffff, 0x000000cc, 0xff0000ff, 0x000000ff, 0x0000ffcc, + 0x00000088, 0xffffffff, 0x00000044, 0xffffff88, 0xff000088, + 0xffffff44, 0x0000ff00, 0xffffffff, 0x000000ff, 0xffffffff, + 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff, + ], + }); + }); + + it("Affect opaque image with a smaller gray mask", () => { + imgSrcOpaq + .clone() + .mask(maskGraySmall) + .getJGDSync() + .should.be.sameJGD({ + width: 6, + height: 4, + data: [ + 0xff000000, 0xffffff33, 0x0000ff66, 0xffffff99, 0x000000ff, + 0xffffffff, 0x00000033, 0xff000066, 0x00000099, 0x0000ffcc, + 0x000000ff, 0xffffffff, 0x00000066, 0xffffff99, 0xff0000cc, + 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff, + 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff, + ], + }); + }); + + it("Affect opaque image with a smaller gray mask, blited", () => { + imgSrcOpaq + .clone() + .mask(maskGraySmall, 1, 1) + .getJGDSync() + .should.be.sameJGD({ + width: 6, + height: 4, + data: [ + 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, + 0xffffffff, 0x000000ff, 0xff000000, 0x00000033, 0x0000ff66, + 0x00000099, 0xffffffff, 0x000000ff, 0xffffff33, 0xff000066, + 0xffffff99, 0x0000ffcc, 0xffffffff, 0x000000ff, 0xffffff66, + 0x00000099, 0xff0000cc, 0x000000ff, 0x0000ffff, + ], + }); + }); + + it("Affect alpha image with a bigger gray mask", () => { + imgSrcAlpa + .clone() + .mask(maskGrayBig) + .getJGDSync() + .should.be.sameJGD({ + width: 4, + height: 3, + data: [ + 0xff000000, 0xff000021, 0x0000ff88, 0x0000ff43, 0xff000088, + 0xff000065, 0x0000ffff, 0x0000ff7f, 0xff000088, 0xff000065, + 0x0000ffff, 0x0000ff7f, + ], + }); + }); + + it("Affect alpha image with a bigger gray mask, blited", () => { + imgSrcAlpa + .clone() + .mask(maskGrayBig, -1, -1) + .getJGDSync() + .should.be.sameJGD({ + width: 4, + height: 3, + data: [ + 0xff0000cc, 0xff00007f, 0x0000ffff, 0x0000ff65, 0xff0000cc, + 0xff00007f, 0x0000ffff, 0x0000ff65, 0xff000044, 0xff000043, + 0x0000ff88, 0x0000ff21, + ], + }); + }); + + it("Affect opaque image with a colored mask", () => { + imgSrcOpaq + .clone() + .mask(maskColor, 1, 1) + .getJGDSync() + .should.be.sameJGD({ + width: 6, + height: 4, + data: [ + 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, + 0xffffffff, 0x000000ff, 0xff000055, 0x00000055, 0x0000ff55, + 0x00000055, 0xffffffff, 0x000000ff, 0xffffffaa, 0xff0000aa, + 0xffffffaa, 0x0000ffaa, 0xffffffff, 0x000000ff, 0xffffffff, + 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff, + ], + }); + }); +}); diff --git a/node_modules/@jimp/plugin-normalize/CHANGELOG.md b/node_modules/@jimp/plugin-normalize/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-normalize/LICENSE b/node_modules/@jimp/plugin-normalize/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-normalize/LICENSE rename to node_modules/@jimp/plugin-normalize/LICENSE diff --git a/node_modules/@jimp/plugin-normalize/README.md b/node_modules/@jimp/plugin-normalize/README.md new file mode 100644 index 00000000..19ba914d --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/README.md @@ -0,0 +1,24 @@ +
+ +

@jimp/plugin-normalize

+

Normalize an image's colors.

+
+ +Normalizes an images color by computing a histogram. + +## Usage + +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.normalize(); +} + +main(); +``` diff --git a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js b/node_modules/@jimp/plugin-normalize/dist/index.js similarity index 100% rename from project starter code/node_modules/@jimp/plugin-normalize/dist/index.js rename to node_modules/@jimp/plugin-normalize/dist/index.js diff --git a/node_modules/@jimp/plugin-normalize/dist/index.js.map b/node_modules/@jimp/plugin-normalize/dist/index.js.map new file mode 100644 index 00000000..5d2e75a7 --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIA,SAASA,SAAT,GAAqB;AACnB,MAAMA,SAAS,GAAG;AAChBC,IAAAA,CAAC,EAAE,IAAIC,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CADa;AAEhBC,IAAAA,CAAC,EAAE,IAAIF,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CAFa;AAGhBE,IAAAA,CAAC,EAAE,IAAIH,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB;AAHa,GAAlB;AAMA,OAAKG,SAAL,CACE,CADF,EAEE,CAFF,EAGE,KAAKC,MAAL,CAAYC,KAHd,EAIE,KAAKD,MAAL,CAAYE,MAJd,EAKE,UAAUC,CAAV,EAAaC,CAAb,EAAgBC,KAAhB,EAAuB;AACrBZ,IAAAA,SAAS,CAACC,CAAV,CAAY,KAAKM,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACAZ,IAAAA,SAAS,CAACI,CAAV,CAAY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aC,CAAb,EAAgBgB,GAAhB,EAAqB;AACnB,YAAM1B,CAAC,GAAG,KAAKM,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,CAAV;AACA,YAAMvB,CAAC,GAAG,KAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,CAAV;AACA,YAAMtB,CAAC,GAAG,KAAKE,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,CAAV;AAEA,aAAKpB,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACb,CAAD,EAAIyB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAJ,EAAiByB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKM,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACV,CAAD,EAAIsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAJ,EAAiBsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACT,CAAD,EAAIqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAJ,EAAiBqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACD,OAbH;;AAgBA,UAAI,0BAAckB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0),\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, index) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n }\n );\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function (value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function (histogramChannel) {\n return [\n histogramChannel.findIndex((value) => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex((value) => value > 0),\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b),\n };\n\n // apply value transformations\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-normalize/index.d.ts b/node_modules/@jimp/plugin-normalize/index.d.ts new file mode 100644 index 00000000..1ae996dc --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/index.d.ts @@ -0,0 +1,7 @@ +import { ImageCallback } from "@jimp/core"; + +interface Normalize { + normalize(cb?: ImageCallback): this; +} + +export default function (): Normalize; diff --git a/node_modules/@jimp/plugin-normalize/package.json b/node_modules/@jimp/plugin-normalize/package.json new file mode 100644 index 00000000..3da939c1 --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/plugin-normalize", + "version": "0.16.13", + "description": "normalize an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-normalize/src/index.js b/node_modules/@jimp/plugin-normalize/src/index.js new file mode 100644 index 00000000..57a696ca --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/src/index.js @@ -0,0 +1,90 @@ +import { isNodePattern } from "@jimp/utils"; + +/** + * Get an image's histogram + * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) + */ +function histogram() { + const histogram = { + r: new Array(256).fill(0), + g: new Array(256).fill(0), + b: new Array(256).fill(0), + }; + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, index) { + histogram.r[this.bitmap.data[index + 0]]++; + histogram.g[this.bitmap.data[index + 1]]++; + histogram.b[this.bitmap.data[index + 2]]++; + } + ); + + return histogram; +} + +/** + * Normalize values + * @param {integer} value Pixel channel value. + * @param {integer} min Minimum value for channel + * @param {integer} max Maximum value for channel + * @return {integer} normalized values + */ +const normalize = function (value, min, max) { + return ((value - min) * 255) / (max - min); +}; + +const getBounds = function (histogramChannel) { + return [ + histogramChannel.findIndex((value) => value > 0), + 255 - + histogramChannel + .slice() + .reverse() + .findIndex((value) => value > 0), + ]; +}; + +/** + * Normalizes the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + normalize(cb) { + const h = histogram.call(this); + + // store bounds (minimum and maximum values) + const bounds = { + r: getBounds(h.r), + g: getBounds(h.g), + b: getBounds(h.b), + }; + + // apply value transformations + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const r = this.bitmap.data[idx + 0]; + const g = this.bitmap.data[idx + 1]; + const b = this.bitmap.data[idx + 2]; + + this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]); + this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]); + this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]); + } + ); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-normalize/test/normalize.test.js b/node_modules/@jimp/plugin-normalize/test/normalize.test.js new file mode 100644 index 00000000..fc67fec7 --- /dev/null +++ b/node_modules/@jimp/plugin-normalize/test/normalize.test.js @@ -0,0 +1,39 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import normalize from "../src"; + +const jimp = configure({ plugins: [normalize] }, Jimp); + +describe("Normalize", () => { + it("change grayscale image", async () => { + const image = await jimp.read(mkJGD("36▦", "6▦9", "▦9C")); + + image + .normalize() + .getJGDSync() + .should.be.sameJGD(mkJGD("■5▦", "5▦A", "▦A□")); + }); + + it("change red/blue image", async () => { + const image = await jimp.read({ + width: 3, + height: 2, + data: [ + 0x000000ff, 0x400022ff, 0x40002200, 0x400000ff, 0x000022ff, 0x800055ff, + ], + }); + + image + .normalize() + .getJGDSync() + .should.be.sameJGD({ + width: 3, + height: 2, + data: [ + 0x000000ff, 0x7f0066ff, 0x7f006600, 0x7f0000ff, 0x000066ff, + 0xff00ffff, + ], + }); + }); +}); diff --git a/node_modules/@jimp/plugin-print/CHANGELOG.md b/node_modules/@jimp/plugin-print/CHANGELOG.md new file mode 100644 index 00000000..23f8c511 --- /dev/null +++ b/node_modules/@jimp/plugin-print/CHANGELOG.md @@ -0,0 +1,71 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Update README.md [#1120](https://github.com/jimp-dev/jimp/pull/1120) ([@mfuatnuroglu](https://github.com/mfuatnuroglu)) + +#### ⚠️ Pushed to `master` + +- try this ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- [@mfuatnuroglu](https://github.com/mfuatnuroglu) +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.10.1 (Sun Apr 05 2020) + +#### 📝 Documentation + +- Fix a `loadFont` and case inconsistency of `jimp` [#868](https://github.com/oliver-moran/jimp/pull/868) ([@xinbenlv](https://github.com/xinbenlv)) + +#### Authors: 1 + +- xinbenlv ([@xinbenlv](https://github.com/xinbenlv)) + +--- + +# v0.9.5 (Tue Mar 03 2020) + +#### 🐛 Bug Fix + +- `@jimp/plugin-print` + - Export font type [#838](https://github.com/oliver-moran/jimp/pull/838) ([@DomiR](https://github.com/DomiR)) + +#### 📝 Documentation + +- `@jimp/plugin-print` + - Added ttf2fnt.com to the list [#845](https://github.com/oliver-moran/jimp/pull/845) ([@mbejda](https://github.com/mbejda)) + +#### Authors: 1 + +- Dominique Rau ([@DomiR](https://github.com/DomiR)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-print/LICENSE b/node_modules/@jimp/plugin-print/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/LICENSE rename to node_modules/@jimp/plugin-print/LICENSE diff --git a/node_modules/@jimp/plugin-print/README.md b/node_modules/@jimp/plugin-print/README.md new file mode 100644 index 00000000..4d395c87 --- /dev/null +++ b/node_modules/@jimp/plugin-print/README.md @@ -0,0 +1,173 @@ +
+ +

@jimp/plugin-print

+

Print text on an image.

+
+ +Jimp supports basic typography using BMFont format (.fnt) even ones in different languages! Just find a bitmap font that is suitable [bitmap fonts](https://en.wikipedia.org/wiki/Bitmap_fonts). + +Online tools are also available to convert TTF fonts to BMFont format. They can be used to create color font or sprite packs. + +:star: [ttf2fnt](https://ttf2fnt.com/) + +:star: [Littera](http://kvazars.com/littera/) + +:star: [Hiero](https://github.com/libgdx/libgdx/wiki/Hiero) + +## Included Fonts + +- `Jimp.FONT_SANS_8_BLACK` +- `Jimp.FONT_SANS_10_BLACK` +- `Jimp.FONT_SANS_12_BLACK` +- `Jimp.FONT_SANS_14_BLACK` +- `Jimp.FONT_SANS_16_BLACK` +- `Jimp.FONT_SANS_32_BLACK` +- `Jimp.FONT_SANS_64_BLACK` +- `Jimp.FONT_SANS_128_BLACK` +- `Jimp.FONT_SANS_8_WHITE` +- `Jimp.FONT_SANS_16_WHITE` +- `Jimp.FONT_SANS_32_WHITE` +- `Jimp.FONT_SANS_64_WHITE` +- `Jimp.FONT_SANS_128_WHITE` + +## loadFont + +Loads a bitmap font from a file + +- @param {string} file the file path of a .fnt file +- @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded +- @returns {Promise} a promise + +```js +import Jimp from "jimp"; + +async function main() { + const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); +} + +main(); +``` + +## print + +Draws a text on a image on a given boundary + +- @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command +- @param {number} x the x position to start drawing the text +- @param {number} y the y position to start drawing the text +- @param {string} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) +- @param {number} maxWidth (optional) the boundary width to draw in +- @param {number} maxHeight (optional) the boundary height to draw in +- @param {function(Error, Jimp)} cb (optional) a function to call when the text is written + +```js +import Jimp from "jimp"; + +async function main() { + const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); + const image = await Jimp.read(1000, 1000, 0x0000ffff); + + image.print(font, 10, 10, "Hello World!"); +} + +main(); +``` + +### Alignment + +Alignment modes are supported by replacing the `str` argument with an object containing `text`, `alignmentX` and `alignmentY`. `alignmentX` defaults to `Jimp.HORIZONTAL_ALIGN_LEFT` and `alignmentY` defaults to `Jimp.VERTICAL_ALIGN_TOP`. + +You can align text using the following constants. + +```js +Jimp.HORIZONTAL_ALIGN_LEFT; +Jimp.HORIZONTAL_ALIGN_CENTER; +Jimp.HORIZONTAL_ALIGN_RIGHT; + +Jimp.VERTICAL_ALIGN_TOP; +Jimp.VERTICAL_ALIGN_MIDDLE; +Jimp.VERTICAL_ALIGN_BOTTOM; +``` + +Default align modes for `image.print` are: + +```js +{ + alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT, + alignmentY: Jimp.VERTICAL_ALIGN_TOP +} +``` + +```js +const font = await Jimp.loadFont(pathOrURL); + +// prints 'Hello world!' on an image, middle and center-aligned +image.print( + font, + x, + y, + { + text: "Hello world!", + alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, + }, + maxWidth, + maxHeight +); +``` + +**Note**: although `maxWidth` and `maxHeight` parameters are optional to `print()`, they are needed to correctly align the text using the requested alignment mode. + +#### Staggering Text + +If you need to stagger text position along the x or y-axis the print method also returns the final coordinates as an argument to the callback. + +```js +const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); + +image.print( + font, + 10, + 10, + "Hello world that wraps!", + 50, + (err, image, { x, y }) => { + image.print(font, x, y + 20, "More text on another line", 50); + } +); +``` + +## measureText + +Measure how wide a piece of text will be. + +```js +import Jimp from "jimp"; + +async function main() { + const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); + const image = await Jimp.read(1000, 1000, 0x0000ffff); + + Jimp.measureText(font, "Hello World!"); +} + +main(); +``` + +## measureTextHeight + +Measure how tall a piece of text will be. + +```js +import Jimp from "jimp"; + +async function main() { + const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); + const image = await Jimp.read(1000, 1000, 0x0000ffff); + + Jimp.measureTextHeight(font, "Hello World!", 100); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-print/dist/index.js b/node_modules/@jimp/plugin-print/dist/index.js new file mode 100644 index 00000000..8dd27c05 --- /dev/null +++ b/node_modules/@jimp/plugin-print/dist/index.js @@ -0,0 +1,261 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _path = _interopRequireDefault(require("path")); + +var _loadBmfont = _interopRequireDefault(require("load-bmfont")); + +var _utils = require("@jimp/utils"); + +var _measureText = require("./measure-text"); + +function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { + if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { + return 0; + } + + if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { + return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; + } + + return maxWidth - (0, _measureText.measureText)(font, line); +} + +function drawCharacter(image, font, x, y, _char) { + if (_char.width > 0 && _char.height > 0) { + var characterPage = font.pages[_char.page]; + image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); + } + + return image; +} + +function printText(font, x, y, text, defaultCharWidth) { + for (var i = 0; i < text.length; i++) { + var _char2 = void 0; + + if (font.chars[text[i]]) { + _char2 = text[i]; + } else if (/\s/.test(text[i])) { + _char2 = ""; + } else { + _char2 = "?"; + } + + var fontChar = font.chars[_char2] || {}; + var fontKerning = font.kernings[_char2]; + drawCharacter(this, font, x, y, fontChar || {}); + var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; + x += kerning + (fontChar.xadvance || defaultCharWidth); + } +} + +function splitLines(font, text, maxWidth) { + var words = text.split(" "); + var lines = []; + var currentLine = []; + var longestLine = 0; + words.forEach(function (word) { + var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(" "); + var length = (0, _measureText.measureText)(font, line); + + if (length <= maxWidth) { + if (length > longestLine) { + longestLine = length; + } + + currentLine.push(word); + } else { + lines.push(currentLine); + currentLine = [word]; + } + }); + lines.push(currentLine); + return { + lines: lines, + longestLine: longestLine + }; +} + +function loadPages(Jimp, dir, pages) { + var newPages = pages.map(function (page) { + return Jimp.read(dir + "/" + page); + }); + return Promise.all(newPages); +} + +var dir = process.env.DIRNAME || "".concat(__dirname, "/../"); + +var _default = function _default() { + return { + constants: { + measureText: _measureText.measureText, + measureTextHeight: _measureText.measureTextHeight, + FONT_SANS_8_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"), + FONT_SANS_10_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"), + FONT_SANS_12_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"), + FONT_SANS_14_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"), + FONT_SANS_16_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"), + FONT_SANS_32_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"), + FONT_SANS_64_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"), + FONT_SANS_128_BLACK: _path["default"].join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"), + FONT_SANS_8_WHITE: _path["default"].join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"), + FONT_SANS_16_WHITE: _path["default"].join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"), + FONT_SANS_32_WHITE: _path["default"].join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"), + FONT_SANS_64_WHITE: _path["default"].join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"), + FONT_SANS_128_WHITE: _path["default"].join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"), + + /** + * Loads a bitmap font from a file + * @param {string} file the file path of a .fnt file + * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded + * @returns {Promise} a promise + */ + loadFont: function loadFont(file, cb) { + var _this = this; + + if (typeof file !== "string") return _utils.throwError.call(this, "file must be a string", cb); + return new Promise(function (resolve, reject) { + cb = cb || function (err, font) { + if (err) reject(err);else resolve(font); + }; + + (0, _loadBmfont["default"])(file, function (err, font) { + var chars = {}; + var kernings = {}; + + if (err) { + return _utils.throwError.call(_this, err, cb); + } + + for (var i = 0; i < font.chars.length; i++) { + chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; + } + + for (var _i = 0; _i < font.kernings.length; _i++) { + var firstString = String.fromCharCode(font.kernings[_i].first); + kernings[firstString] = kernings[firstString] || {}; + kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; + } + + loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { + cb(null, { + chars: chars, + kernings: kernings, + pages: pages, + common: font.common, + info: font.info + }); + }); + }); + }); + } + }, + "class": { + /** + * Draws a text on a image on a given boundary + * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command + * @param {number} x the x position to start drawing the text + * @param {number} y the y position to start drawing the text + * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) + * @param {number} maxWidth (optional) the boundary width to draw in + * @param {number} maxHeight (optional) the boundary height to draw in + * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written + * @returns {Jimp} this for chaining of methods + */ + print: function print(font, x, y, text, maxWidth, maxHeight, cb) { + var _this2 = this; + + if (typeof maxWidth === "function" && typeof cb === "undefined") { + cb = maxWidth; + maxWidth = Infinity; + } + + if (typeof maxWidth === "undefined") { + maxWidth = Infinity; + } + + if (typeof maxHeight === "function" && typeof cb === "undefined") { + cb = maxHeight; + maxHeight = Infinity; + } + + if (typeof maxHeight === "undefined") { + maxHeight = Infinity; + } + + if ((0, _typeof2["default"])(font) !== "object") { + return _utils.throwError.call(this, "font must be a Jimp loadFont", cb); + } + + if (typeof x !== "number" || typeof y !== "number" || typeof maxWidth !== "number") { + return _utils.throwError.call(this, "x, y and maxWidth must be numbers", cb); + } + + if (typeof maxWidth !== "number") { + return _utils.throwError.call(this, "maxWidth must be a number", cb); + } + + if (typeof maxHeight !== "number") { + return _utils.throwError.call(this, "maxHeight must be a number", cb); + } + + var alignmentX; + var alignmentY; + + if ((0, _typeof2["default"])(text) === "object" && text.text !== null && text.text !== undefined) { + alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; + var _text = text; + text = _text.text; + } else { + alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = this.constructor.VERTICAL_ALIGN_TOP; + text = text.toString(); + } + + if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { + y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); + } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { + y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; + } + + var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; + + var _splitLines = splitLines(font, text, maxWidth), + lines = _splitLines.lines, + longestLine = _splitLines.longestLine; + + lines.forEach(function (line) { + var lineString = line.join(" "); + var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); + printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); + y += font.common.lineHeight; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this, { + x: x + longestLine, + y: y + }); + } + + return this; + } + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-print/dist/index.js.map b/node_modules/@jimp/plugin-print/dist/index.js.map new file mode 100644 index 00000000..05413275 --- /dev/null +++ b/node_modules/@jimp/plugin-print/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","lineHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,SAASA,uBAAT,CAAiCC,SAAjC,EAA4CC,IAA5C,EAAkDC,IAAlD,EAAwDC,QAAxD,EAAkEC,SAAlE,EAA6E;AAC3E,MAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAA5B,EAAmD;AACjD,WAAO,CAAP;AACD;;AAED,MAAID,SAAS,KAAKJ,SAAS,CAACM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AA,YAqEvCgC,KArEuC,eAqEvCA,KArEuC;AAAA,YAqEhCE,WArEgC,eAqEhCA,WArEgC;;AAuE/CF,QAAAA,KAAK,CAACG,OAAN,CAAc,UAACpC,IAAD,EAAU;AACtB,cAAMoG,UAAU,GAAGpG,IAAI,CAACsC,IAAL,CAAU,GAAV,CAAnB;AACA,cAAM+D,cAAc,GAAGxG,uBAAuB,CAC5C,MAAI,CAACgG,WADuC,EAE5C9F,IAF4C,EAG5CqG,UAH4C,EAI5CnG,QAJ4C,EAK5CyF,UAL4C,CAA9C;AAQAxE,UAAAA,SAAS,CAACsD,IAAV,CACE,MADF,EAEEzE,IAFF,EAGEQ,CAAC,GAAG8F,cAHN,EAIE7F,CAJF,EAKE4F,UALF,EAMEhF,gBANF;AASAZ,UAAAA,CAAC,IAAIT,IAAI,CAACsF,MAAL,CAAYiB,UAAjB;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from \"path\";\nimport bMFont from \"load-bmfont\";\nimport { isNodePattern, throwError } from \"@jimp/utils\";\nimport { measureText, measureTextHeight } from \"./measure-text\";\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = \"\";\n } else {\n char = \"?\";\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(\" \");\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach((word) => {\n const line = [...currentLine, word].join(\" \");\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine,\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map((page) => {\n return Jimp.read(dir + \"/\" + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt\"\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt\"\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt\"\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt\"\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt\"\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt\"\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt\"\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt\"\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt\"\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt\"\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt\"\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt\"\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt\"\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== \"string\")\n return throwError.call(this, \"file must be a string\", cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function (err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then((pages) => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info,\n });\n });\n });\n });\n },\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === \"function\" && typeof cb === \"undefined\") {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === \"undefined\") {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === \"function\" && typeof cb === \"undefined\") {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === \"undefined\") {\n maxHeight = Infinity;\n }\n\n if (typeof font !== \"object\") {\n return throwError.call(this, \"font must be a Jimp loadFont\", cb);\n }\n\n if (\n typeof x !== \"number\" ||\n typeof y !== \"number\" ||\n typeof maxWidth !== \"number\"\n ) {\n return throwError.call(this, \"x, y and maxWidth must be numbers\", cb);\n }\n\n if (typeof maxWidth !== \"number\") {\n return throwError.call(this, \"maxWidth must be a number\", cb);\n }\n\n if (typeof maxHeight !== \"number\") {\n return throwError.call(this, \"maxHeight must be a number\", cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === \"object\" &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach((line) => {\n const lineString = line.join(\" \");\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n },\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-print/dist/measure-text.js b/node_modules/@jimp/plugin-print/dist/measure-text.js new file mode 100644 index 00000000..42939fae --- /dev/null +++ b/node_modules/@jimp/plugin-print/dist/measure-text.js @@ -0,0 +1,41 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.measureText = measureText; +exports.measureTextHeight = measureTextHeight; + +function measureText(font, text) { + var x = 0; + + for (var i = 0; i < text.length; i++) { + if (font.chars[text[i]]) { + var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; + x += (font.chars[text[i]].xadvance || 0) + kerning; + } + } + + return x; +} + +function measureTextHeight(font, text, maxWidth) { + var words = text.split(" "); + var line = ""; + var textTotalHeight = font.common.lineHeight; + + for (var n = 0; n < words.length; n++) { + var testLine = line + words[n] + " "; + var testWidth = measureText(font, testLine); + + if (testWidth > maxWidth && n > 0) { + textTotalHeight += font.common.lineHeight; + line = words[n] + " "; + } else { + line = testLine; + } + } + + return textTotalHeight; +} +//# sourceMappingURL=measure-text.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-print/dist/measure-text.js.map b/node_modules/@jimp/plugin-print/dist/measure-text.js.map new file mode 100644 index 00000000..724d20aa --- /dev/null +++ b/node_modules/@jimp/plugin-print/dist/measure-text.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,CAAJ,EAAyB;AACvB,UAAMG,OAAO,GACXN,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,KAA0BH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CAA1B,GACIH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CADJ,GAEI,CAHN;AAKAD,MAAAA,CAAC,IAAI,CAACF,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,EAAoBK,QAApB,IAAgC,CAAjC,IAAsCF,OAA3C;AACD;AACF;;AAED,SAAOJ,CAAP;AACD;;AAEM,SAASO,iBAAT,CAA2BT,IAA3B,EAAiCC,IAAjC,EAAuCS,QAAvC,EAAiD;AACtD,MAAMC,KAAK,GAAGV,IAAI,CAACW,KAAL,CAAW,GAAX,CAAd;AACA,MAAIC,IAAI,GAAG,EAAX;AACA,MAAIC,eAAe,GAAGd,IAAI,CAACe,MAAL,CAAYC,UAAlC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAAK,CAACP,MAA1B,EAAkCa,CAAC,EAAnC,EAAuC;AACrC,QAAMC,QAAQ,GAAGL,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAZ,GAAkB,GAAnC;AACA,QAAME,SAAS,GAAGpB,WAAW,CAACC,IAAD,EAAOkB,QAAP,CAA7B;;AAEA,QAAIC,SAAS,GAAGT,QAAZ,IAAwBO,CAAC,GAAG,CAAhC,EAAmC;AACjCH,MAAAA,eAAe,IAAId,IAAI,CAACe,MAAL,CAAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(\" \");\n let line = \"\";\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + \" \";\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + \" \";\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/Apache License.txt b/node_modules/@jimp/plugin-print/fonts/open-sans/Apache License.txt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/Apache License.txt rename to node_modules/@jimp/plugin-print/fonts/open-sans/Apache License.txt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-10-black/open-sans-10-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-12-black/open-sans-12-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-14-black/open-sans-14-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png b/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png rename to node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png diff --git a/node_modules/@jimp/plugin-print/index.d.ts b/node_modules/@jimp/plugin-print/index.d.ts new file mode 100644 index 00000000..c5c9cd3e --- /dev/null +++ b/node_modules/@jimp/plugin-print/index.d.ts @@ -0,0 +1,125 @@ +import { GenericCallback, ImageCallback } from "@jimp/core"; + +export interface FontChar { + id: number; + x: number; + y: number; + width: number; + height: number; + xoffset: number; + yoffset: number; + xadvance: number; + page: number; + chnl: number; +} + +export interface FontInfo { + face: string; + size: number; + bold: number; + italic: number; + charset: string; + unicode: number; + stretchH: number; + smooth: number; + aa: number; + padding: [number, number, number, number]; + spacing: [number, number]; +} + +export interface FontCommon { + lineHeight: number; + base: number; + scaleW: number; + scaleH: number; + pages: number; + packed: number; + alphaChnl: number; + redChnl: number; + greenChnl: number; + blueChnl: number; +} + +export interface Font { + chars: { + [char: string]: FontChar; + }; + kernings: { + [firstString: string]: { + [secondString: string]: number; + }; + }; + pages: string[]; + common: FontCommon; + info: FontInfo; +} + +type PrintableText = + | any + | { + text: string; + alignmentX: number; + alignmentY: number; + }; + +interface PrintClass { + // Text methods + print( + font: Font, + x: number, + y: number, + text: PrintableText, + cb?: ImageCallback + ): this; + print( + font: Font, + x: number, + y: number, + text: PrintableText, + maxWidth?: number, + cb?: ImageCallback + ): this; + print( + font: Font, + x: number, + y: number, + text: PrintableText, + maxWidth?: number, + maxHeight?: number, + cb?: ImageCallback + ): this; +} + +interface Print { + constants: { + measureText(font: Font, text: PrintableText): number; + measureTextHeight( + font: Font, + text: PrintableText, + maxWidth: number + ): number; + + // Font locations + FONT_SANS_8_BLACK: string; + FONT_SANS_10_BLACK: string; + FONT_SANS_12_BLACK: string; + FONT_SANS_14_BLACK: string; + FONT_SANS_16_BLACK: string; + FONT_SANS_32_BLACK: string; + FONT_SANS_64_BLACK: string; + FONT_SANS_128_BLACK: string; + + FONT_SANS_8_WHITE: string; + FONT_SANS_16_WHITE: string; + FONT_SANS_32_WHITE: string; + FONT_SANS_64_WHITE: string; + FONT_SANS_128_WHITE: string; + + loadFont(file: string): Promise; + loadFont(file: string, cb: GenericCallback): Promise; + }; + + class: PrintClass; +} + +export default function (): Print; diff --git a/node_modules/@jimp/plugin-print/package.json b/node_modules/@jimp/plugin-print/package.json new file mode 100644 index 00000000..e443c64c --- /dev/null +++ b/node_modules/@jimp/plugin-print/package.json @@ -0,0 +1,40 @@ +{ + "name": "@jimp/plugin-print", + "version": "0.16.13", + "description": "print an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "load-bmfont": "^1.4.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-print/src/index.js b/node_modules/@jimp/plugin-print/src/index.js new file mode 100644 index 00000000..df71548b --- /dev/null +++ b/node_modules/@jimp/plugin-print/src/index.js @@ -0,0 +1,322 @@ +import Path from "path"; +import bMFont from "load-bmfont"; +import { isNodePattern, throwError } from "@jimp/utils"; +import { measureText, measureTextHeight } from "./measure-text"; + +function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { + if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { + return 0; + } + + if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { + return (maxWidth - measureText(font, line)) / 2; + } + + return maxWidth - measureText(font, line); +} + +function drawCharacter(image, font, x, y, char) { + if (char.width > 0 && char.height > 0) { + const characterPage = font.pages[char.page]; + + image.blit( + characterPage, + x + char.xoffset, + y + char.yoffset, + char.x, + char.y, + char.width, + char.height + ); + } + + return image; +} + +function printText(font, x, y, text, defaultCharWidth) { + for (let i = 0; i < text.length; i++) { + let char; + + if (font.chars[text[i]]) { + char = text[i]; + } else if (/\s/.test(text[i])) { + char = ""; + } else { + char = "?"; + } + + const fontChar = font.chars[char] || {}; + const fontKerning = font.kernings[char]; + + drawCharacter(this, font, x, y, fontChar || {}); + + const kerning = + fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; + + x += kerning + (fontChar.xadvance || defaultCharWidth); + } +} + +function splitLines(font, text, maxWidth) { + const words = text.split(" "); + const lines = []; + let currentLine = []; + let longestLine = 0; + + words.forEach((word) => { + const line = [...currentLine, word].join(" "); + const length = measureText(font, line); + + if (length <= maxWidth) { + if (length > longestLine) { + longestLine = length; + } + + currentLine.push(word); + } else { + lines.push(currentLine); + currentLine = [word]; + } + }); + + lines.push(currentLine); + + return { + lines, + longestLine, + }; +} + +function loadPages(Jimp, dir, pages) { + const newPages = pages.map((page) => { + return Jimp.read(dir + "/" + page); + }); + + return Promise.all(newPages); +} + +const dir = process.env.DIRNAME || `${__dirname}/../`; + +export default () => ({ + constants: { + measureText, + measureTextHeight, + FONT_SANS_8_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt" + ), + FONT_SANS_10_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt" + ), + FONT_SANS_12_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt" + ), + FONT_SANS_14_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt" + ), + FONT_SANS_16_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt" + ), + FONT_SANS_32_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt" + ), + FONT_SANS_64_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt" + ), + FONT_SANS_128_BLACK: Path.join( + dir, + "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt" + ), + + FONT_SANS_8_WHITE: Path.join( + dir, + "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt" + ), + FONT_SANS_16_WHITE: Path.join( + dir, + "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt" + ), + FONT_SANS_32_WHITE: Path.join( + dir, + "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt" + ), + FONT_SANS_64_WHITE: Path.join( + dir, + "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt" + ), + FONT_SANS_128_WHITE: Path.join( + dir, + "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt" + ), + + /** + * Loads a bitmap font from a file + * @param {string} file the file path of a .fnt file + * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded + * @returns {Promise} a promise + */ + loadFont(file, cb) { + if (typeof file !== "string") + return throwError.call(this, "file must be a string", cb); + + return new Promise((resolve, reject) => { + cb = + cb || + function (err, font) { + if (err) reject(err); + else resolve(font); + }; + + bMFont(file, (err, font) => { + const chars = {}; + const kernings = {}; + + if (err) { + return throwError.call(this, err, cb); + } + + for (let i = 0; i < font.chars.length; i++) { + chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; + } + + for (let i = 0; i < font.kernings.length; i++) { + const firstString = String.fromCharCode(font.kernings[i].first); + kernings[firstString] = kernings[firstString] || {}; + kernings[firstString][ + String.fromCharCode(font.kernings[i].second) + ] = font.kernings[i].amount; + } + + loadPages(this, Path.dirname(file), font.pages).then((pages) => { + cb(null, { + chars, + kernings, + pages, + common: font.common, + info: font.info, + }); + }); + }); + }); + }, + }, + + class: { + /** + * Draws a text on a image on a given boundary + * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command + * @param {number} x the x position to start drawing the text + * @param {number} y the y position to start drawing the text + * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) + * @param {number} maxWidth (optional) the boundary width to draw in + * @param {number} maxHeight (optional) the boundary height to draw in + * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written + * @returns {Jimp} this for chaining of methods + */ + print(font, x, y, text, maxWidth, maxHeight, cb) { + if (typeof maxWidth === "function" && typeof cb === "undefined") { + cb = maxWidth; + maxWidth = Infinity; + } + + if (typeof maxWidth === "undefined") { + maxWidth = Infinity; + } + + if (typeof maxHeight === "function" && typeof cb === "undefined") { + cb = maxHeight; + maxHeight = Infinity; + } + + if (typeof maxHeight === "undefined") { + maxHeight = Infinity; + } + + if (typeof font !== "object") { + return throwError.call(this, "font must be a Jimp loadFont", cb); + } + + if ( + typeof x !== "number" || + typeof y !== "number" || + typeof maxWidth !== "number" + ) { + return throwError.call(this, "x, y and maxWidth must be numbers", cb); + } + + if (typeof maxWidth !== "number") { + return throwError.call(this, "maxWidth must be a number", cb); + } + + if (typeof maxHeight !== "number") { + return throwError.call(this, "maxHeight must be a number", cb); + } + + let alignmentX; + let alignmentY; + + if ( + typeof text === "object" && + text.text !== null && + text.text !== undefined + ) { + alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; + ({ text } = text); + } else { + alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = this.constructor.VERTICAL_ALIGN_TOP; + text = text.toString(); + } + + if ( + maxHeight !== Infinity && + alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM + ) { + y += maxHeight - measureTextHeight(font, text, maxWidth); + } else if ( + maxHeight !== Infinity && + alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE + ) { + y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2; + } + + const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; + const { lines, longestLine } = splitLines(font, text, maxWidth); + + lines.forEach((line) => { + const lineString = line.join(" "); + const alignmentWidth = xOffsetBasedOnAlignment( + this.constructor, + font, + lineString, + maxWidth, + alignmentX + ); + + printText.call( + this, + font, + x + alignmentWidth, + y, + lineString, + defaultCharWidth + ); + + y += font.common.lineHeight; + }); + + if (isNodePattern(cb)) { + cb.call(this, null, this, { x: x + longestLine, y }); + } + + return this; + }, + }, +}); diff --git a/node_modules/@jimp/plugin-print/src/measure-text.js b/node_modules/@jimp/plugin-print/src/measure-text.js new file mode 100644 index 00000000..a86dfbe3 --- /dev/null +++ b/node_modules/@jimp/plugin-print/src/measure-text.js @@ -0,0 +1,36 @@ +export function measureText(font, text) { + let x = 0; + + for (let i = 0; i < text.length; i++) { + if (font.chars[text[i]]) { + const kerning = + font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] + ? font.kernings[text[i]][text[i + 1]] + : 0; + + x += (font.chars[text[i]].xadvance || 0) + kerning; + } + } + + return x; +} + +export function measureTextHeight(font, text, maxWidth) { + const words = text.split(" "); + let line = ""; + let textTotalHeight = font.common.lineHeight; + + for (let n = 0; n < words.length; n++) { + const testLine = line + words[n] + " "; + const testWidth = measureText(font, testLine); + + if (testWidth > maxWidth && n > 0) { + textTotalHeight += font.common.lineHeight; + line = words[n] + " "; + } else { + line = testLine; + } + } + + return textTotalHeight; +} diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK-positioned.png b/node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK-positioned.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK-positioned.png rename to node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK-positioned.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK.png b/node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK.png rename to node_modules/@jimp/plugin-print/test/images/SANS_16_BLACK.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_16_WHITE.png b/node_modules/@jimp/plugin-print/test/images/SANS_16_WHITE.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_16_WHITE.png rename to node_modules/@jimp/plugin-print/test/images/SANS_16_WHITE.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_32_BLACK.png b/node_modules/@jimp/plugin-print/test/images/SANS_32_BLACK.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_32_BLACK.png rename to node_modules/@jimp/plugin-print/test/images/SANS_32_BLACK.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_32_WHITE.png b/node_modules/@jimp/plugin-print/test/images/SANS_32_WHITE.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_32_WHITE.png rename to node_modules/@jimp/plugin-print/test/images/SANS_32_WHITE.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_64_BLACK.png b/node_modules/@jimp/plugin-print/test/images/SANS_64_BLACK.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_64_BLACK.png rename to node_modules/@jimp/plugin-print/test/images/SANS_64_BLACK.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_64_WHITE.png b/node_modules/@jimp/plugin-print/test/images/SANS_64_WHITE.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_64_WHITE.png rename to node_modules/@jimp/plugin-print/test/images/SANS_64_WHITE.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_8_BLACK.png b/node_modules/@jimp/plugin-print/test/images/SANS_8_BLACK.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_8_BLACK.png rename to node_modules/@jimp/plugin-print/test/images/SANS_8_BLACK.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/SANS_8_WHITE.png b/node_modules/@jimp/plugin-print/test/images/SANS_8_WHITE.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/SANS_8_WHITE.png rename to node_modules/@jimp/plugin-print/test/images/SANS_8_WHITE.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/bottom-aligned-y.png b/node_modules/@jimp/plugin-print/test/images/bottom-aligned-y.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/bottom-aligned-y.png rename to node_modules/@jimp/plugin-print/test/images/bottom-aligned-y.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/bottom-aligned.png b/node_modules/@jimp/plugin-print/test/images/bottom-aligned.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/bottom-aligned.png rename to node_modules/@jimp/plugin-print/test/images/bottom-aligned.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/center-aligned.png b/node_modules/@jimp/plugin-print/test/images/center-aligned.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/center-aligned.png rename to node_modules/@jimp/plugin-print/test/images/center-aligned.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/left-aligned.png b/node_modules/@jimp/plugin-print/test/images/left-aligned.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/left-aligned.png rename to node_modules/@jimp/plugin-print/test/images/left-aligned.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/middle-aligned-y.png b/node_modules/@jimp/plugin-print/test/images/middle-aligned-y.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/middle-aligned-y.png rename to node_modules/@jimp/plugin-print/test/images/middle-aligned-y.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/middle-aligned.png b/node_modules/@jimp/plugin-print/test/images/middle-aligned.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/middle-aligned.png rename to node_modules/@jimp/plugin-print/test/images/middle-aligned.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/print-number.png b/node_modules/@jimp/plugin-print/test/images/print-number.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/print-number.png rename to node_modules/@jimp/plugin-print/test/images/print-number.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/right-aligned.png b/node_modules/@jimp/plugin-print/test/images/right-aligned.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/right-aligned.png rename to node_modules/@jimp/plugin-print/test/images/right-aligned.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/spacing.png b/node_modules/@jimp/plugin-print/test/images/spacing.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/spacing.png rename to node_modules/@jimp/plugin-print/test/images/spacing.png diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/unknown-char-test.png b/node_modules/@jimp/plugin-print/test/images/unknown-char-test.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-print/test/images/unknown-char-test.png rename to node_modules/@jimp/plugin-print/test/images/unknown-char-test.png diff --git a/node_modules/@jimp/plugin-print/test/print.test.js b/node_modules/@jimp/plugin-print/test/print.test.js new file mode 100644 index 00000000..b0292a3c --- /dev/null +++ b/node_modules/@jimp/plugin-print/test/print.test.js @@ -0,0 +1,284 @@ +/* eslint key-spacing: ["error", { "align": "value" }] */ + +import { Jimp, getTestDir, hasOwnProp } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import blit from "@jimp/plugin-blit"; + +import print from "../src"; + +const jimp = configure({ plugins: [print, blit] }, Jimp); + +async function createTextImage( + width, + height, + font, + { x = 0, y = 0, text, maxWidth, maxHeight } +) { + const loadedFont = await jimp.loadFont(font); + const image = await Jimp.create(width, height, 0xffffffff); + + return image.print(loadedFont, x, y, text, maxWidth, maxHeight); +} + +describe("Write text over image", function () { + this.timeout(30000); + + const fontDefs = { + SANS_8_BLACK: { w: 28, h: 28, bg: 0xffffffff }, + + SANS_16_BLACK: { w: 54, h: 54, bg: 0xffffffff }, + SANS_32_BLACK: { w: 114, h: 114, bg: 0xffffffff }, + SANS_64_BLACK: { w: 220, h: 220, bg: 0xffffffff }, + + SANS_8_WHITE: { w: 28, h: 28, bg: 0x000000ff }, + + SANS_16_WHITE: { w: 54, h: 54, bg: 0x000000ff }, + SANS_32_WHITE: { w: 114, h: 114, bg: 0x000000ff }, + SANS_64_WHITE: { w: 220, h: 220, bg: 0x000000ff }, + }; + + for (const fontName in fontDefs) + if (hasOwnProp(fontDefs, fontName)) + ((fontName, conf) => { + it("Jimp preset " + fontName + " bitmap font", async () => { + const font = await jimp.loadFont(Jimp["FONT_" + fontName]); + const expected = + getTestDir(__dirname) + "/images/" + fontName + ".png"; + + const expectedImg = await Jimp.read(expected); + const image = await Jimp.create(conf.w, conf.h, conf.bg); + + image + .print(font, 0, 0, "This is only a test.", image.bitmap.width) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + })(fontName, fontDefs[fontName]); + + it("Jimp preset SANS_16_BLACK bitmap font positioned", async () => { + const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); + const expected = + getTestDir(__dirname) + "/images/SANS_16_BLACK-positioned.png"; + const expectedImg = await Jimp.read(expected); + const image = await Jimp.create("300", "100", 0xff8800ff); + + image + .print(font, 150, 50, "This is only a test.", 100) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + it("Jimp loads font from URL", async () => { + const font = await Jimp.loadFont( + "https://raw.githubusercontent.com/jimp-dev/jimp/master/packages/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt" + ); + const expected = + getTestDir(__dirname) + "/images/SANS_16_BLACK-positioned.png"; + const expectedImg = await Jimp.read(expected); + const image = await Jimp.create("300", "100", 0xff8800ff); + + image + .print(font, 150, 50, "This is only a test.", 100) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + it("Jimp renders ? for unknown characters", async () => { + const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); + + const expected = getTestDir(__dirname) + "/images/unknown-char-test.png"; + const expectedImg = await Jimp.read(expected); + const image = await Jimp.read("300", "100", 0xff8800ff); + + image + .print(font, 0, 0, "ツ ツ ツ", 100) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + it("Jimp can print numbers too", async () => { + const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK); + + const expected = getTestDir(__dirname) + "/images/print-number.png"; + const expectedImg = await Jimp.read(expected); + const image = await Jimp.read("300", "100", 0xff8800ff); + + image + .print(font, 0, 0, 12345678, 100) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); + + it("left-align text by default", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/left-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: "This is only a test.", + + maxWidth: 100, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("left-align text by default when passing object", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/left-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: { text: "This is only a test." }, + + maxWidth: 100, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("left-align text when passing object with alignmentX", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/left-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: { + text: "This is only a test.", + + alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT, + }, + maxWidth: 100, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("center-align text when passing object with alignmentX", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/center-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: { + text: "This is only a test.", + + alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, + }, + maxWidth: 100, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("right-align text when passing object with alignmentX", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/right-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: { + text: "This is only a test.", + + alignmentX: Jimp.HORIZONTAL_ALIGN_RIGHT, + }, + maxWidth: 100, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("middle-align text when passing object with alignmentY", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/middle-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: { + text: "This is only a test.", + + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, + }, + maxWidth: 100, + + maxHeight: 240, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("middle-align text when passing object with alignmentY can offset y", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/middle-aligned-y.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + y: 50, + + text: { + text: "This is only a test.", + + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, + }, + maxWidth: 100, + + maxHeight: 240, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("bottom-align text when passing object with alignmentY", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/bottom-aligned.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + text: { + text: "This is only a test.", + + alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM, + }, + maxWidth: 100, + + maxHeight: 240, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("bottom-align text when passing object with alignmentY offset y", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/bottom-aligned-y.png" + ); + const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { + y: 100, + + text: { + text: "This is only a test.", + + alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM, + }, + maxWidth: 100, + + maxHeight: 100, + }); + + expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + }); + + it("exposes print y position in cb", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/spacing.png" + ); + + const loadedFont = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); + const image = await Jimp.create(500, 500, 0xffffffff); + + image.print( + loadedFont, + 0, + 0, + "One two three four fix six seven eight nine ten eleven twelve", + 250, + (err, image, { x, y }) => { + image.print( + loadedFont, + x, + y + 50, + "thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty", + 250 + ); + } + ); + + expectedImage.bitmap.data.should.be.deepEqual(image.bitmap.data); + }); +}); diff --git a/node_modules/@jimp/plugin-resize/CHANGELOG.md b/node_modules/@jimp/plugin-resize/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-resize/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-resize/LICENSE b/node_modules/@jimp/plugin-resize/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-resize/LICENSE rename to node_modules/@jimp/plugin-resize/LICENSE diff --git a/node_modules/@jimp/plugin-resize/README.md b/node_modules/@jimp/plugin-resize/README.md new file mode 100644 index 00000000..a74dbdff --- /dev/null +++ b/node_modules/@jimp/plugin-resize/README.md @@ -0,0 +1,61 @@ +
+ +

@jimp/plugin-resize

+

Resize an image.

+
+ +Resizes the image to a set width and height using a 2-pass bilinear algorithm/ + +## Usage + +- @param {number} w the width to resize the image to (or Jimp.AUTO) +- @param {number} h the height to resize the image to (or Jimp.AUTO) +- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + // Read the image. + const image = await jimp.read("test/image.png"); + + // Resize the image to width 150 and auto height. + await image.resize(150, jimp.AUTO); + + // Save and overwrite the image + await image.writeAsync("test/image.png"); +} + +main(); +``` + +## Auto + +`Jimp.AUTO` can be passes to either the height or width and jimp will scale the image accordingly. `Jimp.AUTO` cannot be both height and width. + +```js +// resize the height to 250 and scale the width accordingly +image.resize(Jimp.AUTO, 250); +// resize the width to 250 and scale the height accordingly +image.resize(250, Jimp.AUTO); +``` + +### Resize modes + +The default resizing algorithm uses a bilinear method. + +Optionally, the following constants can be passed to choose a particular resizing algorithm: + +```js +Jimp.RESIZE_NEAREST_NEIGHBOR; +Jimp.RESIZE_BILINEAR; +Jimp.RESIZE_BICUBIC; +Jimp.RESIZE_HERMITE; +Jimp.RESIZE_BEZIER; +``` + +```js +image.resize(250, 250, Jimp.RESIZE_BEZIER); +``` diff --git a/node_modules/@jimp/plugin-resize/dist/index.js b/node_modules/@jimp/plugin-resize/dist/index.js new file mode 100644 index 00000000..5facc581 --- /dev/null +++ b/node_modules/@jimp/plugin-resize/dist/index.js @@ -0,0 +1,96 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +var _resize = _interopRequireDefault(require("./modules/resize")); + +var _resize2 = _interopRequireDefault(require("./modules/resize2")); + +var _default = function _default() { + return { + constants: { + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor", + RESIZE_BILINEAR: "bilinearInterpolation", + RESIZE_BICUBIC: "bicubicInterpolation", + RESIZE_HERMITE: "hermiteInterpolation", + RESIZE_BEZIER: "bezierInterpolation" + }, + "class": { + /** + * Resizes the image to a set width and height using a 2-pass bilinear algorithm + * @param {number} w the width to resize the image to (or Jimp.AUTO) + * @param {number} h the height to resize the image to (or Jimp.AUTO) + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + resize: function resize(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + if (w === this.constructor.AUTO && h === this.constructor.AUTO) { + return _utils.throwError.call(this, "w and h cannot both be set to auto", cb); + } + + if (w === this.constructor.AUTO) { + w = this.bitmap.width * (h / this.bitmap.height); + } + + if (h === this.constructor.AUTO) { + h = this.bitmap.height * (w / this.bitmap.width); + } + + if (w < 0 || h < 0) { + return _utils.throwError.call(this, "w and h must be positive numbers", cb); + } // round inputs + + + w = Math.round(w); + h = Math.round(h); + + if (typeof _resize2["default"][mode] === "function") { + var dst = { + data: Buffer.alloc(w * h * 4), + width: w, + height: h + }; + + _resize2["default"][mode](this.bitmap, dst); + + this.bitmap = dst; + } else { + var image = this; + var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { + image.bitmap.data = Buffer.from(buffer); + image.bitmap.width = w; + image.bitmap.height = h; + }); + resize.resize(this.bitmap.data); + } + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-resize/dist/index.js.map b/node_modules/@jimp/plugin-resize/dist/index.js.map new file mode 100644 index 00000000..4f6cf9b8 --- /dev/null +++ b/node_modules/@jimp/plugin-resize/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe;AAAA,SAAO;AACpBA,IAAAA,SAAS,EAAE;AACTC,MAAAA,uBAAuB,EAAE,iBADhB;AAETC,MAAAA,eAAe,EAAE,uBAFR;AAGTC,MAAAA,cAAc,EAAE,sBAHP;AAITC,MAAAA,cAAc,EAAE,sBAJP;AAKTC,MAAAA,aAAa,EAAE;AALN,KADS;AASpB,aAAO;AACL;;;;;;;;AAQAC,MAAAA,MATK,kBASEC,CATF,EASKC,CATL,EASQC,IATR,EAScC,EATd,EASkB;AACrB,YAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,iBAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,YAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,UAAAA,EAAE,GAAGD,IAAL;AACAA,UAAAA,IAAI,GAAG,IAAP;AACD;;AAED,YAAIF,CAAC,KAAK,KAAKM,WAAL,CAAiBC,IAAvB,IAA+BN,CAAC,KAAK,KAAKK,WA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Eb,KAAKD,MAAL,CAAYE,MAFC,EAGbV,CAHa,EAIbC,CAJa,EAKb,IALa,EAMb,IANa,EAOb,UAACmB,MAAD,EAAY;AACVF,YAAAA,KAAK,CAACV,MAAN,CAAaO,IAAb,GAAoBC,MAAM,CAACK,IAAP,CAAYD,MAAZ,CAApB;AACAF,YAAAA,KAAK,CAACV,MAAN,CAAaC,KAAb,GAAqBT,CAArB;AACAkB,YAAAA,KAAK,CAACV,MAAN,CAAaE,MAAb,GAAsBT,CAAtB;AACD,WAXY,CAAf;AAaAF,UAAAA,MAAM,CAACA,MAAP,CAAc,KAAKS,MAAL,CAAYO,IAA1B;AACD;;AAED,YAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtEI;AATa,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n RESIZE_BILINEAR: \"bilinearInterpolation\",\n RESIZE_BICUBIC: \"bicubicInterpolation\",\n RESIZE_HERMITE: \"hermiteInterpolation\",\n RESIZE_BEZIER: \"bezierInterpolation\",\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, \"w and h must be positive numbers\", cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === \"function\") {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n (buffer) => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-resize/dist/modules/resize.js b/node_modules/@jimp/plugin-resize/dist/modules/resize.js new file mode 100644 index 00000000..05c89c0d --- /dev/null +++ b/node_modules/@jimp/plugin-resize/dist/modules/resize.js @@ -0,0 +1,406 @@ +"use strict"; + +// JavaScript Image Resizer (c) 2012 - Grant Galitz +// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 +function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { + this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); + this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); + this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); + this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); + this.colorChannels = blendAlpha ? 4 : 3; + this.interpolationPass = Boolean(interpolationPass); + this.resizeCallback = typeof resizeCallback === "function" ? resizeCallback : function () {}; + this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; + this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; + this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; + this.widthPassResultSize = this.targetWidthMultipliedByChannels * this.heightOriginal; + this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; + this.initialize(); +} + +Resize.prototype.initialize = function () { + // Perform some checks: + if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { + this.configurePasses(); + } else { + throw new Error("Invalid settings specified for the resizer."); + } +}; + +Resize.prototype.configurePasses = function () { + if (this.widthOriginal === this.targetWidth) { + // Bypass the width resizer pass: + this.resizeWidth = this.bypassResizer; + } else { + // Setup the width resizer pass: + this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; + + if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { + this.initializeFirstPassBuffers(true); + this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; + } else { + this.initializeFirstPassBuffers(false); + this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; + } + } + + if (this.heightOriginal === this.targetHeight) { + // Bypass the height resizer pass: + this.resizeHeight = this.bypassResizer; + } else { + // Setup the height resizer pass: + this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; + + if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { + this.initializeSecondPassBuffers(true); + this.resizeHeight = this.resizeHeightInterpolated; + } else { + this.initializeSecondPassBuffers(false); + this.resizeHeight = this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; + } + } +}; + +Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { + var channelsNum = fourthChannel ? 4 : 3; + var ratioWeight = this.ratioWeightWidthPass; + var outputBuffer = this.widthBuffer; + var weight = 0; + var finalOffset = 0; + var pixelOffset = 0; + var firstWeight = 0; + var secondWeight = 0; + var targetPosition; // Handle for only one interpolation input being valid for start calculation: + + for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { + for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { + outputBuffer[finalOffset] = buffer[pixelOffset]; + outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; + outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; + if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; + } + } // Adjust for overshoot of the last pass's counter: + + + weight -= 1 / 3; + var interpolationWidthSourceReadStop; + + for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { + // Calculate weightings: + secondWeight = weight % 1; + firstWeight = 1 - secondWeight; // Interpolate: + + for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { + outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; + outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; + outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; + if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; + } + } // Handle for only one interpolation input being valid for end calculation: + + + for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { + for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { + outputBuffer[finalOffset] = buffer[pixelOffset]; + outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; + outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; + if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; + } + } + + return outputBuffer; +}; + +Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { + var channelsNum = fourthChannel ? 4 : 3; + var ratioWeight = this.ratioWeightWidthPass; + var ratioWeightDivisor = 1 / ratioWeight; + var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; + var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; + var output = this.outputWidthWorkBench; + var outputBuffer = this.widthBuffer; + var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; + var weight = 0; + var amountToNext = 0; + var actualPosition = 0; + var currentPosition = 0; + var line = 0; + var pixelOffset = 0; + var outputOffset = 0; + var multiplier = 1; + var r = 0; + var g = 0; + var b = 0; + var a = 0; + + do { + for (line = 0; line < this.originalHeightMultipliedByChannels;) { + output[line++] = 0; + output[line++] = 0; + output[line++] = 0; + + if (fourthChannel) { + output[line++] = 0; + trustworthyColorsCount[line / channelsNum - 1] = 0; + } + } + + weight = ratioWeight; + + do { + amountToNext = 1 + actualPosition - currentPosition; + multiplier = Math.min(weight, amountToNext); + + for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { + r = buffer[pixelOffset]; + g = buffer[++pixelOffset]; + b = buffer[++pixelOffset]; + a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent + + output[line++] += (a ? r : 0) * multiplier; + output[line++] += (a ? g : 0) * multiplier; + output[line++] += (a ? b : 0) * multiplier; + + if (fourthChannel) { + output[line++] += a * multiplier; + trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; + } + } + + if (weight >= amountToNext) { + actualPosition += channelsNum; + currentPosition = actualPosition; + weight -= amountToNext; + } else { + currentPosition += weight; + break; + } + } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); + + for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { + weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; + multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; + outputBuffer[pixelOffset] = output[line++] * multiplier; + outputBuffer[++pixelOffset] = output[line++] * multiplier; + outputBuffer[++pixelOffset] = output[line++] * multiplier; + if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; + } + + outputOffset += channelsNum; + } while (outputOffset < this.targetWidthMultipliedByChannels); + + return outputBuffer; +}; + +Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { + var ratioWeight = this.ratioWeightHeightPass; + var ratioWeightDivisor = 1 / ratioWeight; + var output = this.outputHeightWorkBench; + var outputBuffer = this.heightBuffer; + var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; + var weight = 0; + var amountToNext = 0; + var actualPosition = 0; + var currentPosition = 0; + var pixelOffset = 0; + var outputOffset = 0; + var caret = 0; + var multiplier = 1; + var r = 0; + var g = 0; + var b = 0; + var a = 0; + + do { + for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { + output[pixelOffset++] = 0; + output[pixelOffset++] = 0; + output[pixelOffset++] = 0; + + if (fourthChannel) { + output[pixelOffset++] = 0; + trustworthyColorsCount[pixelOffset / 4 - 1] = 0; + } + } + + weight = ratioWeight; + + do { + amountToNext = 1 + actualPosition - currentPosition; + multiplier = Math.min(weight, amountToNext); + caret = actualPosition; + + for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { + r = buffer[caret++]; + g = buffer[caret++]; + b = buffer[caret++]; + a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent + + output[pixelOffset++] += (a ? r : 0) * multiplier; + output[pixelOffset++] += (a ? g : 0) * multiplier; + output[pixelOffset++] += (a ? b : 0) * multiplier; + + if (fourthChannel) { + output[pixelOffset++] += a * multiplier; + trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; + } + } + + if (weight >= amountToNext) { + actualPosition = caret; + currentPosition = actualPosition; + weight -= amountToNext; + } else { + currentPosition += weight; + break; + } + } while (weight > 0 && actualPosition < this.widthPassResultSize); + + for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { + weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; + multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; + outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); + outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); + outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); + + if (fourthChannel) { + outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); + } + } + } while (outputOffset < this.finalResultSize); + + return outputBuffer; +}; + +Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { + return this._resizeWidthInterpolatedRGBChannels(buffer, false); +}; + +Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { + return this._resizeWidthInterpolatedRGBChannels(buffer, true); +}; + +Resize.prototype.resizeWidthRGB = function (buffer) { + return this._resizeWidthRGBChannels(buffer, false); +}; + +Resize.prototype.resizeWidthRGBA = function (buffer) { + return this._resizeWidthRGBChannels(buffer, true); +}; + +Resize.prototype.resizeHeightInterpolated = function (buffer) { + var ratioWeight = this.ratioWeightHeightPass; + var outputBuffer = this.heightBuffer; + var weight = 0; + var finalOffset = 0; + var pixelOffset = 0; + var pixelOffsetAccumulated = 0; + var pixelOffsetAccumulated2 = 0; + var firstWeight = 0; + var secondWeight = 0; + var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: + + for (; weight < 1 / 3; weight += ratioWeight) { + for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { + outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); + } + } // Adjust for overshoot of the last pass's counter: + + + weight -= 1 / 3; + + for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { + // Calculate weightings: + secondWeight = weight % 1; + firstWeight = 1 - secondWeight; // Interpolate: + + pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; + pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; + + for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { + outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); + } + } // Handle for only one interpolation input being valid for end calculation: + + + while (finalOffset < this.finalResultSize) { + for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { + outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); + } + } + + return outputBuffer; +}; + +Resize.prototype.resizeHeightRGB = function (buffer) { + return this._resizeHeightRGBChannels(buffer, false); +}; + +Resize.prototype.resizeHeightRGBA = function (buffer) { + return this._resizeHeightRGBChannels(buffer, true); +}; + +Resize.prototype.resize = function (buffer) { + this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); +}; + +Resize.prototype.bypassResizer = function (buffer) { + // Just return the buffer passed: + return buffer; +}; + +Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { + // Initialize the internal width pass buffers: + this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); + + if (!BILINEARAlgo) { + this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); + + if (this.colorChannels > 3) { + this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); + } + } +}; + +Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { + // Initialize the internal height pass buffers: + this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); + + if (!BILINEARAlgo) { + this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); + + if (this.colorChannels > 3) { + this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); + } + } +}; + +Resize.prototype.generateFloatBuffer = function (bufferLength) { + // Generate a float32 typed array buffer: + try { + return new Float32Array(bufferLength); + } catch (error) { + return []; + } +}; + +Resize.prototype.generateFloat64Buffer = function (bufferLength) { + // Generate a float64 typed array buffer: + try { + return new Float64Array(bufferLength); + } catch (error) { + return []; + } +}; + +Resize.prototype.generateUint8Buffer = function (bufferLength) { + // Generate a uint8 typed array buffer: + try { + return new Uint8Array(bufferLength); + } catch (error) { + return []; + } +}; + +module.exports = Resize; +//# sourceMappingURL=resize.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map b/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map new file mode 100644 index 00000000..da4bf2ad --- /dev/null +++ b/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,aADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,cAPF,EAQE;AACA,OAAKN,aAAL,GAAqBO,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWT,aAAX,KAA6B,CAAtC,CAArB;AACA,OAAKC,cAAL,GAAsBM,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWR,cAAX,KAA8B,CAAvC,CAAtB;AACA,OAAKC,WAAL,GAAmBK,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWP,WAAX,KAA2B,CAApC,CAAnB;AACA,OAAKC,YAAL,GAAoBI,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWN,YAAX,KAA4B,CAArC,CAApB;AACA,OAAKO,aAAL,GAAqBN,UAAU,GAAG,CAAH,GAAO,CAAtC;AACA,OAAKC,iBAAL,GAAyBM,OAAO,CAACN,iBAAD,CAAhC;AACA,OAAKC,cAAL,GACE,OAAOA,cAAP,KAA0B,UAA1B,GAAuCA,cAAv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,GAAyC,UAAUE,YAAV,EAAwB;AAC/D;AACA,MAAI;AACF,WAAO,IAAIG,YAAJ,CAAiBH,YAAjB,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASArF,MAAM,CAACmB,SAAP,CAAiB+D,mBAAjB,GAAuC,UAAUC,YAAV,EAAwB;AAC7D;AACA,MAAI;AACF,WAAO,IAAII,UAAJ,CAAeJ,YAAf,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASAG,MAAM,CAACC,OAAP,GAAiBzF,MAAjB","sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === \"function\" ? resizeCallback : function () {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function () {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error(\"Invalid settings specified for the resizer.\");\n }\n};\n\nResize.prototype.configurePasses = function () {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function (\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function (buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function (buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function (buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function (bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function (bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function (bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js b/node_modules/@jimp/plugin-resize/dist/modules/resize2.js similarity index 100% rename from project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js rename to node_modules/@jimp/plugin-resize/dist/modules/resize2.js diff --git a/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map b/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map new file mode 100644 index 00000000..8183e69f --- /dev/null +++ b/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,eADe,2BACCC,GADD,EACMC,GADN,EACW;AACxB,QAAMC,IAAI,GAAGF,GAAG,CAACG,KAAjB;AACA,QAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAjB;AAEA,QAAMC,IAAI,GAAGL,GAAG,CAACE,KAAjB;AACA,QAAMI,IAAI,GAAGN,GAAG,CAACI,MAAjB;AAEA,QAAMG,MAAM,GAAGR,GAAG,CAACS,IAAnB;AACA,QAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAnB;;AAEA,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,IAApB,EAA0BI,CAAC,EAA3B,EAA+B;AAC7B,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,IAApB,EAA0BM,CAAC,EAA3B,EAA+B;AAC7B,YAAIC,MAAM,GAAG,C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A7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function (k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function (x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function (x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function (x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n },\n};\n"],"file":"resize2.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-resize/index.d.ts b/node_modules/@jimp/plugin-resize/index.d.ts new file mode 100644 index 00000000..58b3cdcb --- /dev/null +++ b/node_modules/@jimp/plugin-resize/index.d.ts @@ -0,0 +1,21 @@ +import { ImageCallback } from "@jimp/core"; + +interface ResizeClass { + resize(w: number, h: number, cb?: ImageCallback): this; + resize(w: number, h: number, mode?: string, cb?: ImageCallback): this; +} + +interface Resize { + constants: { + // resize methods + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor"; + RESIZE_BILINEAR: "bilinearInterpolation"; + RESIZE_BICUBIC: "bicubicInterpolation"; + RESIZE_HERMITE: "hermiteInterpolation"; + RESIZE_BEZIER: "bezierInterpolation"; + }; + + class: ResizeClass; +} + +export default function (): Resize; diff --git a/node_modules/@jimp/plugin-resize/package.json b/node_modules/@jimp/plugin-resize/package.json new file mode 100644 index 00000000..550d992b --- /dev/null +++ b/node_modules/@jimp/plugin-resize/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/plugin-resize", + "version": "0.16.13", + "description": "Resize an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-resize/src/index.js b/node_modules/@jimp/plugin-resize/src/index.js new file mode 100644 index 00000000..2c77df99 --- /dev/null +++ b/node_modules/@jimp/plugin-resize/src/index.js @@ -0,0 +1,87 @@ +import { throwError, isNodePattern } from "@jimp/utils"; + +import Resize from "./modules/resize"; +import Resize2 from "./modules/resize2"; + +export default () => ({ + constants: { + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor", + RESIZE_BILINEAR: "bilinearInterpolation", + RESIZE_BICUBIC: "bicubicInterpolation", + RESIZE_HERMITE: "hermiteInterpolation", + RESIZE_BEZIER: "bezierInterpolation", + }, + + class: { + /** + * Resizes the image to a set width and height using a 2-pass bilinear algorithm + * @param {number} w the width to resize the image to (or Jimp.AUTO) + * @param {number} h the height to resize the image to (or Jimp.AUTO) + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + resize(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + if (w === this.constructor.AUTO && h === this.constructor.AUTO) { + return throwError.call(this, "w and h cannot both be set to auto", cb); + } + + if (w === this.constructor.AUTO) { + w = this.bitmap.width * (h / this.bitmap.height); + } + + if (h === this.constructor.AUTO) { + h = this.bitmap.height * (w / this.bitmap.width); + } + + if (w < 0 || h < 0) { + return throwError.call(this, "w and h must be positive numbers", cb); + } + + // round inputs + w = Math.round(w); + h = Math.round(h); + + if (typeof Resize2[mode] === "function") { + const dst = { + data: Buffer.alloc(w * h * 4), + width: w, + height: h, + }; + Resize2[mode](this.bitmap, dst); + this.bitmap = dst; + } else { + const image = this; + const resize = new Resize( + this.bitmap.width, + this.bitmap.height, + w, + h, + true, + true, + (buffer) => { + image.bitmap.data = Buffer.from(buffer); + image.bitmap.width = w; + image.bitmap.height = h; + } + ); + resize.resize(this.bitmap.data); + } + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + }, +}); diff --git a/node_modules/@jimp/plugin-resize/src/modules/resize.js b/node_modules/@jimp/plugin-resize/src/modules/resize.js new file mode 100644 index 00000000..d4c86147 --- /dev/null +++ b/node_modules/@jimp/plugin-resize/src/modules/resize.js @@ -0,0 +1,548 @@ +// JavaScript Image Resizer (c) 2012 - Grant Galitz +// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 + +function Resize( + widthOriginal, + heightOriginal, + targetWidth, + targetHeight, + blendAlpha, + interpolationPass, + resizeCallback +) { + this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); + this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); + this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); + this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); + this.colorChannels = blendAlpha ? 4 : 3; + this.interpolationPass = Boolean(interpolationPass); + this.resizeCallback = + typeof resizeCallback === "function" ? resizeCallback : function () {}; + + this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; + this.originalWidthMultipliedByChannels = + this.widthOriginal * this.colorChannels; + this.originalHeightMultipliedByChannels = + this.heightOriginal * this.colorChannels; + this.widthPassResultSize = + this.targetWidthMultipliedByChannels * this.heightOriginal; + this.finalResultSize = + this.targetWidthMultipliedByChannels * this.targetHeight; + this.initialize(); +} + +Resize.prototype.initialize = function () { + // Perform some checks: + if ( + this.widthOriginal > 0 && + this.heightOriginal > 0 && + this.targetWidth > 0 && + this.targetHeight > 0 + ) { + this.configurePasses(); + } else { + throw new Error("Invalid settings specified for the resizer."); + } +}; + +Resize.prototype.configurePasses = function () { + if (this.widthOriginal === this.targetWidth) { + // Bypass the width resizer pass: + this.resizeWidth = this.bypassResizer; + } else { + // Setup the width resizer pass: + this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; + if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { + this.initializeFirstPassBuffers(true); + this.resizeWidth = + this.colorChannels === 4 + ? this.resizeWidthInterpolatedRGBA + : this.resizeWidthInterpolatedRGB; + } else { + this.initializeFirstPassBuffers(false); + this.resizeWidth = + this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; + } + } + + if (this.heightOriginal === this.targetHeight) { + // Bypass the height resizer pass: + this.resizeHeight = this.bypassResizer; + } else { + // Setup the height resizer pass: + this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; + if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { + this.initializeSecondPassBuffers(true); + this.resizeHeight = this.resizeHeightInterpolated; + } else { + this.initializeSecondPassBuffers(false); + this.resizeHeight = + this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; + } + } +}; + +Resize.prototype._resizeWidthInterpolatedRGBChannels = function ( + buffer, + fourthChannel +) { + const channelsNum = fourthChannel ? 4 : 3; + const ratioWeight = this.ratioWeightWidthPass; + const outputBuffer = this.widthBuffer; + + let weight = 0; + let finalOffset = 0; + let pixelOffset = 0; + let firstWeight = 0; + let secondWeight = 0; + let targetPosition; + + // Handle for only one interpolation input being valid for start calculation: + for ( + targetPosition = 0; + weight < 1 / 3; + targetPosition += channelsNum, weight += ratioWeight + ) { + for ( + finalOffset = targetPosition, pixelOffset = 0; + finalOffset < this.widthPassResultSize; + pixelOffset += this.originalWidthMultipliedByChannels, + finalOffset += this.targetWidthMultipliedByChannels + ) { + outputBuffer[finalOffset] = buffer[pixelOffset]; + outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; + outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; + if (fourthChannel) + outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; + } + } + + // Adjust for overshoot of the last pass's counter: + weight -= 1 / 3; + let interpolationWidthSourceReadStop; + + for ( + interpolationWidthSourceReadStop = this.widthOriginal - 1; + weight < interpolationWidthSourceReadStop; + targetPosition += channelsNum, weight += ratioWeight + ) { + // Calculate weightings: + secondWeight = weight % 1; + firstWeight = 1 - secondWeight; + // Interpolate: + for ( + finalOffset = targetPosition, + pixelOffset = Math.floor(weight) * channelsNum; + finalOffset < this.widthPassResultSize; + pixelOffset += this.originalWidthMultipliedByChannels, + finalOffset += this.targetWidthMultipliedByChannels + ) { + outputBuffer[finalOffset + 0] = + buffer[pixelOffset + 0] * firstWeight + + buffer[pixelOffset + channelsNum + 0] * secondWeight; + outputBuffer[finalOffset + 1] = + buffer[pixelOffset + 1] * firstWeight + + buffer[pixelOffset + channelsNum + 1] * secondWeight; + outputBuffer[finalOffset + 2] = + buffer[pixelOffset + 2] * firstWeight + + buffer[pixelOffset + channelsNum + 2] * secondWeight; + if (fourthChannel) + outputBuffer[finalOffset + 3] = + buffer[pixelOffset + 3] * firstWeight + + buffer[pixelOffset + channelsNum + 3] * secondWeight; + } + } + + // Handle for only one interpolation input being valid for end calculation: + for ( + interpolationWidthSourceReadStop = + this.originalWidthMultipliedByChannels - channelsNum; + targetPosition < this.targetWidthMultipliedByChannels; + targetPosition += channelsNum + ) { + for ( + finalOffset = targetPosition, + pixelOffset = interpolationWidthSourceReadStop; + finalOffset < this.widthPassResultSize; + pixelOffset += this.originalWidthMultipliedByChannels, + finalOffset += this.targetWidthMultipliedByChannels + ) { + outputBuffer[finalOffset] = buffer[pixelOffset]; + outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; + outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; + if (fourthChannel) + outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; + } + } + + return outputBuffer; +}; + +Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { + const channelsNum = fourthChannel ? 4 : 3; + const ratioWeight = this.ratioWeightWidthPass; + const ratioWeightDivisor = 1 / ratioWeight; + const nextLineOffsetOriginalWidth = + this.originalWidthMultipliedByChannels - channelsNum + 1; + const nextLineOffsetTargetWidth = + this.targetWidthMultipliedByChannels - channelsNum + 1; + const output = this.outputWidthWorkBench; + const outputBuffer = this.widthBuffer; + const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; + + let weight = 0; + let amountToNext = 0; + let actualPosition = 0; + let currentPosition = 0; + let line = 0; + let pixelOffset = 0; + let outputOffset = 0; + let multiplier = 1; + let r = 0; + let g = 0; + let b = 0; + let a = 0; + + do { + for (line = 0; line < this.originalHeightMultipliedByChannels; ) { + output[line++] = 0; + output[line++] = 0; + output[line++] = 0; + if (fourthChannel) { + output[line++] = 0; + trustworthyColorsCount[line / channelsNum - 1] = 0; + } + } + + weight = ratioWeight; + + do { + amountToNext = 1 + actualPosition - currentPosition; + multiplier = Math.min(weight, amountToNext); + for ( + line = 0, pixelOffset = actualPosition; + line < this.originalHeightMultipliedByChannels; + pixelOffset += nextLineOffsetOriginalWidth + ) { + r = buffer[pixelOffset]; + g = buffer[++pixelOffset]; + b = buffer[++pixelOffset]; + a = fourthChannel ? buffer[++pixelOffset] : 255; + // Ignore RGB values if pixel is completely transparent + output[line++] += (a ? r : 0) * multiplier; + output[line++] += (a ? g : 0) * multiplier; + output[line++] += (a ? b : 0) * multiplier; + if (fourthChannel) { + output[line++] += a * multiplier; + trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; + } + } + + if (weight >= amountToNext) { + actualPosition += channelsNum; + currentPosition = actualPosition; + weight -= amountToNext; + } else { + currentPosition += weight; + break; + } + } while ( + weight > 0 && + actualPosition < this.originalWidthMultipliedByChannels + ); + + for ( + line = 0, pixelOffset = outputOffset; + line < this.originalHeightMultipliedByChannels; + pixelOffset += nextLineOffsetTargetWidth + ) { + weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; + multiplier = fourthChannel + ? weight + ? 1 / weight + : 0 + : ratioWeightDivisor; + outputBuffer[pixelOffset] = output[line++] * multiplier; + outputBuffer[++pixelOffset] = output[line++] * multiplier; + outputBuffer[++pixelOffset] = output[line++] * multiplier; + if (fourthChannel) + outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; + } + + outputOffset += channelsNum; + } while (outputOffset < this.targetWidthMultipliedByChannels); + + return outputBuffer; +}; + +Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { + const ratioWeight = this.ratioWeightHeightPass; + const ratioWeightDivisor = 1 / ratioWeight; + const output = this.outputHeightWorkBench; + const outputBuffer = this.heightBuffer; + const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; + + let weight = 0; + let amountToNext = 0; + let actualPosition = 0; + let currentPosition = 0; + let pixelOffset = 0; + let outputOffset = 0; + let caret = 0; + let multiplier = 1; + let r = 0; + let g = 0; + let b = 0; + let a = 0; + + do { + for ( + pixelOffset = 0; + pixelOffset < this.targetWidthMultipliedByChannels; + + ) { + output[pixelOffset++] = 0; + output[pixelOffset++] = 0; + output[pixelOffset++] = 0; + + if (fourthChannel) { + output[pixelOffset++] = 0; + trustworthyColorsCount[pixelOffset / 4 - 1] = 0; + } + } + + weight = ratioWeight; + + do { + amountToNext = 1 + actualPosition - currentPosition; + multiplier = Math.min(weight, amountToNext); + caret = actualPosition; + + for ( + pixelOffset = 0; + pixelOffset < this.targetWidthMultipliedByChannels; + + ) { + r = buffer[caret++]; + g = buffer[caret++]; + b = buffer[caret++]; + a = fourthChannel ? buffer[caret++] : 255; + // Ignore RGB values if pixel is completely transparent + output[pixelOffset++] += (a ? r : 0) * multiplier; + output[pixelOffset++] += (a ? g : 0) * multiplier; + output[pixelOffset++] += (a ? b : 0) * multiplier; + + if (fourthChannel) { + output[pixelOffset++] += a * multiplier; + trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; + } + } + + if (weight >= amountToNext) { + actualPosition = caret; + currentPosition = actualPosition; + weight -= amountToNext; + } else { + currentPosition += weight; + break; + } + } while (weight > 0 && actualPosition < this.widthPassResultSize); + + for ( + pixelOffset = 0; + pixelOffset < this.targetWidthMultipliedByChannels; + + ) { + weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; + multiplier = fourthChannel + ? weight + ? 1 / weight + : 0 + : ratioWeightDivisor; + outputBuffer[outputOffset++] = Math.round( + output[pixelOffset++] * multiplier + ); + outputBuffer[outputOffset++] = Math.round( + output[pixelOffset++] * multiplier + ); + outputBuffer[outputOffset++] = Math.round( + output[pixelOffset++] * multiplier + ); + + if (fourthChannel) { + outputBuffer[outputOffset++] = Math.round( + output[pixelOffset++] * ratioWeightDivisor + ); + } + } + } while (outputOffset < this.finalResultSize); + + return outputBuffer; +}; + +Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { + return this._resizeWidthInterpolatedRGBChannels(buffer, false); +}; + +Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { + return this._resizeWidthInterpolatedRGBChannels(buffer, true); +}; + +Resize.prototype.resizeWidthRGB = function (buffer) { + return this._resizeWidthRGBChannels(buffer, false); +}; + +Resize.prototype.resizeWidthRGBA = function (buffer) { + return this._resizeWidthRGBChannels(buffer, true); +}; + +Resize.prototype.resizeHeightInterpolated = function (buffer) { + const ratioWeight = this.ratioWeightHeightPass; + const outputBuffer = this.heightBuffer; + + let weight = 0; + let finalOffset = 0; + let pixelOffset = 0; + let pixelOffsetAccumulated = 0; + let pixelOffsetAccumulated2 = 0; + let firstWeight = 0; + let secondWeight = 0; + let interpolationHeightSourceReadStop; + + // Handle for only one interpolation input being valid for start calculation: + for (; weight < 1 / 3; weight += ratioWeight) { + for ( + pixelOffset = 0; + pixelOffset < this.targetWidthMultipliedByChannels; + + ) { + outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); + } + } + + // Adjust for overshoot of the last pass's counter: + weight -= 1 / 3; + + for ( + interpolationHeightSourceReadStop = this.heightOriginal - 1; + weight < interpolationHeightSourceReadStop; + weight += ratioWeight + ) { + // Calculate weightings: + secondWeight = weight % 1; + firstWeight = 1 - secondWeight; + // Interpolate: + pixelOffsetAccumulated = + Math.floor(weight) * this.targetWidthMultipliedByChannels; + pixelOffsetAccumulated2 = + pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; + for ( + pixelOffset = 0; + pixelOffset < this.targetWidthMultipliedByChannels; + ++pixelOffset + ) { + outputBuffer[finalOffset++] = Math.round( + buffer[pixelOffsetAccumulated++] * firstWeight + + buffer[pixelOffsetAccumulated2++] * secondWeight + ); + } + } + + // Handle for only one interpolation input being valid for end calculation: + while (finalOffset < this.finalResultSize) { + for ( + pixelOffset = 0, + pixelOffsetAccumulated = + interpolationHeightSourceReadStop * + this.targetWidthMultipliedByChannels; + pixelOffset < this.targetWidthMultipliedByChannels; + ++pixelOffset + ) { + outputBuffer[finalOffset++] = Math.round( + buffer[pixelOffsetAccumulated++] + ); + } + } + + return outputBuffer; +}; + +Resize.prototype.resizeHeightRGB = function (buffer) { + return this._resizeHeightRGBChannels(buffer, false); +}; + +Resize.prototype.resizeHeightRGBA = function (buffer) { + return this._resizeHeightRGBChannels(buffer, true); +}; + +Resize.prototype.resize = function (buffer) { + this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); +}; + +Resize.prototype.bypassResizer = function (buffer) { + // Just return the buffer passed: + return buffer; +}; + +Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { + // Initialize the internal width pass buffers: + this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); + + if (!BILINEARAlgo) { + this.outputWidthWorkBench = this.generateFloatBuffer( + this.originalHeightMultipliedByChannels + ); + + if (this.colorChannels > 3) { + this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer( + this.heightOriginal + ); + } + } +}; + +Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { + // Initialize the internal height pass buffers: + this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); + + if (!BILINEARAlgo) { + this.outputHeightWorkBench = this.generateFloatBuffer( + this.targetWidthMultipliedByChannels + ); + + if (this.colorChannels > 3) { + this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer( + this.targetWidth + ); + } + } +}; + +Resize.prototype.generateFloatBuffer = function (bufferLength) { + // Generate a float32 typed array buffer: + try { + return new Float32Array(bufferLength); + } catch (error) { + return []; + } +}; + +Resize.prototype.generateFloat64Buffer = function (bufferLength) { + // Generate a float64 typed array buffer: + try { + return new Float64Array(bufferLength); + } catch (error) { + return []; + } +}; + +Resize.prototype.generateUint8Buffer = function (bufferLength) { + // Generate a uint8 typed array buffer: + try { + return new Uint8Array(bufferLength); + } catch (error) { + return []; + } +}; + +module.exports = Resize; diff --git a/node_modules/@jimp/plugin-resize/src/modules/resize2.js b/node_modules/@jimp/plugin-resize/src/modules/resize2.js new file mode 100644 index 00000000..0b74dc8f --- /dev/null +++ b/node_modules/@jimp/plugin-resize/src/modules/resize2.js @@ -0,0 +1,293 @@ +/** + * Copyright (c) 2015 Guyon Roche + * + * 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 = { + nearestNeighbor(src, dst) { + const wSrc = src.width; + const hSrc = src.height; + + const wDst = dst.width; + const hDst = dst.height; + + const bufSrc = src.data; + const bufDst = dst.data; + + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + let posDst = (i * wDst + j) * 4; + + const iSrc = Math.floor((i * hSrc) / hDst); + const jSrc = Math.floor((j * wSrc) / wDst); + let posSrc = (iSrc * wSrc + jSrc) * 4; + + bufDst[posDst++] = bufSrc[posSrc++]; + bufDst[posDst++] = bufSrc[posSrc++]; + bufDst[posDst++] = bufSrc[posSrc++]; + bufDst[posDst++] = bufSrc[posSrc++]; + } + } + }, + + bilinearInterpolation(src, dst) { + const wSrc = src.width; + const hSrc = src.height; + + const wDst = dst.width; + const hDst = dst.height; + + const bufSrc = src.data; + const bufDst = dst.data; + + const interpolate = function (k, kMin, vMin, kMax, vMax) { + // special case - k is integer + if (kMin === kMax) { + return vMin; + } + + return Math.round((k - kMin) * vMax + (kMax - k) * vMin); + }; + + const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) { + let posMin = (yMin * wSrc + xMin) * 4 + offset; + let posMax = (yMin * wSrc + xMax) * 4 + offset; + const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); + + // special case, y is integer + if (yMax === yMin) { + bufDst[pos + offset] = vMin; + } else { + posMin = (yMax * wSrc + xMin) * 4 + offset; + posMax = (yMax * wSrc + xMax) * 4 + offset; + const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); + + bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); + } + }; + + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + const posDst = (i * wDst + j) * 4; + // x & y in src coordinates + const x = (j * wSrc) / wDst; + const xMin = Math.floor(x); + const xMax = Math.min(Math.ceil(x), wSrc - 1); + + const y = (i * hSrc) / hDst; + const yMin = Math.floor(y); + const yMax = Math.min(Math.ceil(y), hSrc - 1); + + assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); + assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); + assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); + assign(posDst, 3, x, xMin, xMax, y, yMin, yMax); + } + } + }, + + _interpolate2D(src, dst, options, interpolate) { + const bufSrc = src.data; + const bufDst = dst.data; + + const wSrc = src.width; + const hSrc = src.height; + + const wDst = dst.width; + const hDst = dst.height; + + // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares + const wM = Math.max(1, Math.floor(wSrc / wDst)); + const wDst2 = wDst * wM; + const hM = Math.max(1, Math.floor(hSrc / hDst)); + const hDst2 = hDst * hM; + + // =========================================================== + // Pass 1 - interpolate rows + // buf1 has width of dst2 and height of src + const buf1 = Buffer.alloc(wDst2 * hSrc * 4); + for (let i = 0; i < hSrc; i++) { + for (let j = 0; j < wDst2; j++) { + // i in src coords, j in dst coords + + // calculate x in src coords + // this interpolation requires 4 sample points and the two inner ones must be real + // the outer points can be fudged for the edges. + // therefore (wSrc-1)/wDst2 + const x = (j * (wSrc - 1)) / wDst2; + const xPos = Math.floor(x); + const t = x - xPos; + const srcPos = (i * wSrc + xPos) * 4; + const buf1Pos = (i * wDst2 + j) * 4; + + for (let k = 0; k < 4; k++) { + const kPos = srcPos + k; + const x0 = + xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; + const x1 = bufSrc[kPos]; + const x2 = bufSrc[kPos + 4]; + const x3 = + xPos < wSrc - 2 + ? bufSrc[kPos + 8] + : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; + buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); + } + } + } + // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); + + // =========================================================== + // Pass 2 - interpolate columns + // buf2 has width and height of dst2 + const buf2 = Buffer.alloc(wDst2 * hDst2 * 4); + for (let i = 0; i < hDst2; i++) { + for (let j = 0; j < wDst2; j++) { + // i&j in dst2 coords + + // calculate y in buf1 coords + // this interpolation requires 4 sample points and the two inner ones must be real + // the outer points can be fudged for the edges. + // therefore (hSrc-1)/hDst2 + const y = (i * (hSrc - 1)) / hDst2; + const yPos = Math.floor(y); + const t = y - yPos; + const buf1Pos = (yPos * wDst2 + j) * 4; + const buf2Pos = (i * wDst2 + j) * 4; + for (let k = 0; k < 4; k++) { + const kPos = buf1Pos + k; + const y0 = + yPos > 0 + ? buf1[kPos - wDst2 * 4] + : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4]; + const y1 = buf1[kPos]; + const y2 = buf1[kPos + wDst2 * 4]; + const y3 = + yPos < hSrc - 2 + ? buf1[kPos + wDst2 * 8] + : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos]; + + buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t); + } + } + } + // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); + + // =========================================================== + // Pass 3 - scale to dst + const m = wM * hM; + if (m > 1) { + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + // i&j in dst bounded coords + let r = 0; + let g = 0; + let b = 0; + let a = 0; + let realColors = 0; + + for (let y = 0; y < hM; y++) { + const yPos = i * hM + y; + + for (let x = 0; x < wM; x++) { + const xPos = j * wM + x; + const xyPos = (yPos * wDst2 + xPos) * 4; + const pixelAlpha = buf2[xyPos + 3]; + + if (pixelAlpha) { + r += buf2[xyPos]; + g += buf2[xyPos + 1]; + b += buf2[xyPos + 2]; + realColors++; + } + + a += pixelAlpha; + } + } + + const pos = (i * wDst + j) * 4; + bufDst[pos] = realColors ? Math.round(r / realColors) : 0; + bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; + bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; + bufDst[pos + 3] = Math.round(a / m); + } + } + } else { + // replace dst buffer with buf2 + dst.data = buf2; + } + }, + + bicubicInterpolation(src, dst, options) { + const interpolateCubic = function (x0, x1, x2, x3, t) { + const a0 = x3 - x2 - x0 + x1; + const a1 = x0 - x1 - a0; + const a2 = x2 - x0; + const a3 = x1; + return Math.max( + 0, + Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3) + ); + }; + + return this._interpolate2D(src, dst, options, interpolateCubic); + }, + + hermiteInterpolation(src, dst, options) { + const interpolateHermite = function (x0, x1, x2, x3, t) { + const c0 = x1; + const c1 = 0.5 * (x2 - x0); + const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; + const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); + return Math.max( + 0, + Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0)) + ); + }; + + return this._interpolate2D(src, dst, options, interpolateHermite); + }, + + bezierInterpolation(src, dst, options) { + // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) + // to predict control points (a & b) to be placed at n+0.5 + // ya(n) = y(n) + (y(n+1)-y(n-1))/4 + // yb(n) = y(n+1) - (y(n+2)-y(n))/4 + // then use std bezier to interpolate [n,n+1) + // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3 + // note the 3* factor for the two control points + // for edge cases, can choose: + // y(-1) = y(0) - 2*(y(1)-y(0)) + // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) + // but can go with y(-1) = y(0) and y(w) = y(w-1) + const interpolateBezier = function (x0, x1, x2, x3, t) { + // x1, x2 are the knots, use x0 and x3 to calculate control points + const cp1 = x1 + (x2 - x0) / 4; + const cp2 = x2 - (x3 - x1) / 4; + const nt = 1 - t; + const c0 = x1 * nt * nt * nt; + const c1 = 3 * cp1 * nt * nt * t; + const c2 = 3 * cp2 * nt * t * t; + const c3 = x2 * t * t * t; + return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); + }; + + return this._interpolate2D(src, dst, options, interpolateBezier); + }, +}; diff --git a/node_modules/@jimp/plugin-resize/test/resize.test.js b/node_modules/@jimp/plugin-resize/test/resize.test.js new file mode 100644 index 00000000..7f759084 --- /dev/null +++ b/node_modules/@jimp/plugin-resize/test/resize.test.js @@ -0,0 +1,301 @@ +import { Jimp, mkJGD, hashForEach } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import resize from "../src"; + +const jimp = configure({ plugins: [resize] }, Jimp); + +describe("Resize images", () => { + const testImages = [ + { + title: "max contrast 8x8", + src: jimp.read( + mkJGD( + "■■■■□□□□", + "■■■■□□□□", + "■■■■□□□□", + "■■■■□□□□", + "□□□□■■■■", + "□□□□■■■■", + "□□□□■■■■", + "□□□□■■■■" + ) + ), + results: { + "default 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"), + "NEAREST_NEIGHBOR 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"), + "BILINEAR 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"), + "BICUBIC 4x4": { + width: 4, + height: 4, + data: [ + 0x000000ff, 0x000000ff, 0xbfbfbfff, 0xffffffff, 0x000000ff, + 0x000000ff, 0xbfbfbfff, 0xffffffff, 0xbfbfbfff, 0xbfbfbfff, + 0x5f5f5fff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff, + 0x000000ff, + ], + }, + "HERMITE 4x4": { + width: 4, + height: 4, + data: [ + 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0x000000ff, + 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0x606060ff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff, + 0x000000ff, + ], + }, + "BEZIER 4x4": { + width: 4, + height: 4, + data: [ + 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0x000000ff, + 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0x606060ff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff, + 0x000000ff, + ], + }, + "default 5x2": mkJGD("■■▦□□", "□□▦■■"), + "NEAREST_NEIGHBOR 5x2": mkJGD("■■■□□", "□□□■■"), + "BILINEAR 5x2": mkJGD("■■3□□", "□□C■■"), + "BICUBIC 5x2": { + width: 5, + height: 2, + data: [ + 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff, + 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff, + ], + }, + "HERMITE 5x2": { + width: 5, + height: 2, + data: [ + 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff, + 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff, + ], + }, + "BEZIER 5x2": { + width: 5, + height: 2, + data: [ + 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff, + 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff, + ], + }, + }, + }, + /**********************************************************************/ + { + title: "max contrast 12x12 with dots", + src: jimp.read( + mkJGD( + "■■■■■■□□□□□□", + "■■■■■■□□□□□□", + "■■■□■■□□■□□□", + "■■■■■■□□□□□□", + "■■■■■■□□□□□□", + "■■■■■■□□□□□□", + "□□□□□□■■■■■■", + "□□□□□□■■■■■■", + "□□□□□□■■■■■■", + "□□□■□□■■□■■■", + "□□□□□□■■■■■■", + "□□□□□□■■■■■■" + ) + ), + results: { + "default 6x6": mkJGD( + "■■■□□□", + "■▩■□▥□", + "■■■□□□", + "□□□■■■", + "□▥□■▩■", + "□□□■■■" + ), + "NEAREST_NEIGHBOR 6x6": mkJGD( + "■■■□□□", + "■■■□■□", + "■■■□□□", + "□□□■■■", + "□□□■■■", + "□□□■■■" + ), + "BILINEAR 6x6": mkJGD( + "■■■□□□", + "■■■□■□", + "■■■□□□", + "□□□■■■", + "□□□■■■", + "□□□■■■" + ), + "BICUBIC 6x6": { + width: 6, + height: 6, + data: [ + 0x000000ff, 0x000000ff, 0x000000ff, 0xbfbfbfff, 0xffffffff, + 0xffffffff, 0x000000ff, 0x474747ff, 0x202020ff, 0xbfbfbfff, + 0x979797ff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff, + 0xbfbfbfff, 0xffffffff, 0xffffffff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x5f5f5fff, 0x404040ff, 0x404040ff, 0xffffffff, + 0xeeeeeeff, 0xf7f7f7ff, 0x404040ff, 0x181818ff, 0x000000ff, + 0xffffffff, 0xc9c9c9ff, 0xe6e6e6ff, 0x404040ff, 0x4e4e4eff, + 0x000000ff, + ], + }, + "HERMITE 6x6": { + width: 6, + height: 6, + data: [ + 0x000000ff, 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, + 0xffffffff, 0x000000ff, 0x404040ff, 0x191919ff, 0xc0c0c0ff, + 0xa6a6a6ff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff, + 0xc0c0c0ff, 0xffffffff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0xc0c0c0ff, 0x606060ff, 0x404040ff, 0x404040ff, 0xffffffff, + 0xf3f3f3ff, 0xfafafaff, 0x404040ff, 0x111111ff, 0x000000ff, + 0xffffffff, 0xcbcbcbff, 0xebebebff, 0x404040ff, 0x484848ff, + 0x000000ff, + ], + }, + "BEZIER 6x6": { + width: 6, + height: 6, + data: [ + 0x000000ff, 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, + 0xffffffff, 0x000000ff, 0x444444ff, 0x1d1d1dff, 0xc0c0c0ff, + 0x9f9f9fff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff, + 0xc0c0c0ff, 0xffffffff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0xc0c0c0ff, 0x606060ff, 0x404040ff, 0x404040ff, 0xffffffff, + 0xf0f0f0ff, 0xf9f9f9ff, 0x404040ff, 0x151515ff, 0x000000ff, + 0xffffffff, 0xcacacaff, 0xe9e9e9ff, 0x404040ff, 0x4b4b4bff, + 0x000000ff, + ], + }, + }, + }, + /**********************************************************************/ + { + title: "mutch contrast 4x4", + src: jimp.read(mkJGD("▩▩▥▥", "▩▩▥▥", "▥▥▩▩", "▥▥▩▩")), + results: { + "default 6x6": { + width: 6, + height: 6, + data: [ + 0x404040ff, 0x404040ff, 0x404040ff, 0x959595ff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0x959595ff, + 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, + 0x959595ff, 0xbfbfbfff, 0xbfbfbfff, 0x959595ff, 0x959595ff, + 0x959595ff, 0x787878ff, 0x6a6a6aff, 0x6a6a6aff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x404040ff, + 0x404040ff, + ], + }, + "NEAREST_NEIGHBOR 6x6": { + width: 6, + height: 6, + data: [ + 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, + 0x404040ff, + ], + }, + "BILINEAR 6x6": { + width: 6, + height: 6, + data: [ + 0x404040ff, 0x404040ff, 0x6a6a6aff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x6a6a6aff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x6a6a6aff, 0x787878ff, + 0x959595ff, 0x959595ff, 0x959595ff, 0xbfbfbfff, 0xbfbfbfff, + 0x959595ff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, + 0xbfbfbfff, 0x959595ff, 0x404040ff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0x959595ff, 0x404040ff, 0x404040ff, + 0x404040ff, + ], + }, + "BICUBIC 6x6": { + width: 6, + height: 6, + data: [ + 0x404040ff, 0x303030ff, 0x404040ff, 0x7f7f7fff, 0xbfbfbfff, + 0xcececeff, 0x303030ff, 0x1c1c1cff, 0x303030ff, 0x7f7f7fff, + 0xcececeff, 0xe1e1e1ff, 0x404040ff, 0x303030ff, 0x404040ff, + 0x7f7f7fff, 0xbfbfbfff, 0xcececeff, 0x7f7f7fff, 0x7f7f7fff, + 0x7f7f7fff, 0x7f7f7fff, 0x7f7f7fff, 0x7f7f7fff, 0xbfbfbfff, + 0xcececeff, 0xbfbfbfff, 0x7f7f7fff, 0x404040ff, 0x303030ff, + 0xcececeff, 0xe1e1e1ff, 0xcececeff, 0x7f7f7fff, 0x303030ff, + 0x1c1c1cff, + ], + }, + "HERMITE 6x6": { + width: 6, + height: 6, + data: [ + 0x404040ff, 0x383838ff, 0x404040ff, 0x808080ff, 0xbfbfbfff, + 0xc7c7c7ff, 0x383838ff, 0x2f2f2fff, 0x383838ff, 0x808080ff, + 0xc7c7c7ff, 0xd0d0d0ff, 0x404040ff, 0x383838ff, 0x404040ff, + 0x808080ff, 0xbfbfbfff, 0xc7c7c7ff, 0x808080ff, 0x808080ff, + 0x808080ff, 0x808080ff, 0x808080ff, 0x808080ff, 0xbfbfbfff, + 0xc7c7c7ff, 0xbfbfbfff, 0x808080ff, 0x404040ff, 0x383838ff, + 0xc7c7c7ff, 0xd0d0d0ff, 0xc7c7c7ff, 0x808080ff, 0x383838ff, + 0x2f2f2fff, + ], + }, + "BEZIER 6x6": { + width: 6, + height: 6, + data: [ + 0x404040ff, 0x343434ff, 0x404040ff, 0x808080ff, 0xbfbfbfff, + 0xcbcbcbff, 0x343434ff, 0x262626ff, 0x343434ff, 0x808080ff, + 0xcbcbcbff, 0xd9d9d9ff, 0x404040ff, 0x343434ff, 0x404040ff, + 0x808080ff, 0xbfbfbfff, 0xcbcbcbff, 0x808080ff, 0x808080ff, + 0x808080ff, 0x808080ff, 0x808080ff, 0x808080ff, 0xbfbfbfff, + 0xcbcbcbff, 0xbfbfbfff, 0x808080ff, 0x404040ff, 0x343434ff, + 0xcbcbcbff, 0xd9d9d9ff, 0xcbcbcbff, 0x808080ff, 0x343434ff, + 0x262626ff, + ], + }, + }, + }, + ]; + + before((done) => { + const srcImgs = testImages.map((test) => test.src); + Promise.all(srcImgs) + .then((imgsJimp) => { + for (let i = 0; i < imgsJimp.length; i++) { + testImages[i].src = imgsJimp[i]; + } + + done(); + }) + .catch(done); + }); + + function testEach(test) { + describe(test.title, () => { + hashForEach(test.results, (expectedTitle, expectedJgd) => { + const mode = Jimp["RESIZE_" + expectedTitle.split(" ")[0]]; + const size = expectedTitle + .split(" ")[1] + .split("x") + .map((n) => parseInt(n, 10)); + it("to " + expectedTitle, () => { + test.src + .clone() + .resize(size[0], size[1], mode) + .getJGDSync() + .should.be.sameJGD(expectedJgd); + }); + }); + }); + } + + testImages.forEach(testEach); +}); diff --git a/node_modules/@jimp/plugin-rotate/CHANGELOG.md b/node_modules/@jimp/plugin-rotate/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-rotate/LICENSE b/node_modules/@jimp/plugin-rotate/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-rotate/LICENSE rename to node_modules/@jimp/plugin-rotate/LICENSE diff --git a/node_modules/@jimp/plugin-rotate/README.md b/node_modules/@jimp/plugin-rotate/README.md new file mode 100644 index 00000000..6bacc7da --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/README.md @@ -0,0 +1,26 @@ +
+ +

@jimp/plugin-rotate

+

Rotate an image.

+
+ +Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. + +## Usage + +- @param {number} deg the number of degrees to rotate the image by +- @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.rotate(90); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-rotate/dist/index.js b/node_modules/@jimp/plugin-rotate/dist/index.js new file mode 100644 index 00000000..c0a1fb6f --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/dist/index.js @@ -0,0 +1,139 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. + * @param {number} deg the number of degrees to rotate the image by + * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed + */ +function advancedRotate(deg, mode) { + deg %= 360; + var rad = deg * Math.PI / 180; + var cosine = Math.cos(rad); + var sine = Math.sin(rad); // the final width and height will change if resize == true + + var w = this.bitmap.width; + var h = this.bitmap.height; + + if (mode === true || typeof mode === "string") { + // resize the image to it maximum dimension and blit the existing image + // onto the center so that when it is rotated the image is kept in bounds + // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle + // Plus 1 border pixel to ensure to show all rotated result for some cases. + w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; + h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. + + if (w % 2 !== 0) { + w++; + } + + if (h % 2 !== 0) { + h++; + } + + var c = this.cloneQuiet(); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + }); + var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); + this.resize(max, max, mode); + this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); + } + + var bW = this.bitmap.width; + var bH = this.bitmap.height; + var dstBuffer = Buffer.alloc(this.bitmap.data.length); + + function createTranslationFunction(deltaX, deltaY) { + return function (x, y) { + return { + x: x + deltaX, + y: y + deltaY + }; + }; + } + + var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); + var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); + + for (var y = 1; y <= bH; y++) { + for (var x = 1; x <= bW; x++) { + var cartesian = translate2Cartesian(x, y); + var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); + var dstIdx = bW * (y - 1) + x - 1 << 2; + + if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { + var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; + var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); + } else { + // reset off-image pixels + dstBuffer.writeUInt32BE(this._background, dstIdx); + } + } + } + + this.bitmap.data = dstBuffer; + + if (mode === true || typeof mode === "string") { + // now crop the image to the final size + var _x = bW / 2 - w / 2; + + var _y = bH / 2 - h / 2; + + this.crop(_x, _y, w, h); + } +} + +var _default = function _default() { + return { + /** + * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. + * @param {number} deg the number of degrees to rotate the image by + * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + rotate: function rotate(deg, mode, cb) { + // enable overloading + if (typeof mode === "undefined" || mode === null) { + // e.g. image.resize(120); + // e.g. image.resize(120, null, cb); + // e.g. image.resize(120, undefined, cb); + mode = true; + } + + if (typeof mode === "function" && typeof cb === "undefined") { + // e.g. image.resize(120, cb); + cb = mode; + mode = true; + } + + if (typeof deg !== "number") { + return _utils.throwError.call(this, "deg must be a number", cb); + } + + if (typeof mode !== "boolean" && typeof mode !== "string") { + return _utils.throwError.call(this, "mode must be a boolean or a string", cb); + } + + advancedRotate.call(this, deg, mode, cb); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-rotate/dist/index.js.map b/node_modules/@jimp/plugin-rotate/dist/index.js.map new file mode 100644 index 00000000..04439465 --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAAAA,GAAG,IAAI,GAAP;AACA,MAAME,GAAG,GAAIF,GAAG,GAAGG,IAAI,CAACC,EAAZ,GAAkB,GAA9B;AACA,MAAMC,MAAM,GAAGF,IAAI,CAACG,GAAL,CAASJ,GAAT,CAAf;AACA,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAL,CAASN,GAAT,CAAb,CAJiC,CAMjC;;AACA,MAAIO,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAApB;AACA,MAAIC,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAApB;;AAEA,MAAIZ,IAAI,KAAK,IAAT,IAAiB,OAAOA,IAAP,KAAgB,QAArC,EAA+C;AAC7C;AACA;AAEA;AACA;AACAQ,IAAAA,CAAC,GACCN,IAAI,CAACW,IAAL,CACEX,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYC,KAAZ,GAAoBN,MAA7B,IACEF,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYG,MAAZ,GAAqBN,IAA9B,CAFJ,IAGI,CAJN;AAKAK,IAAAA,CAAC,GACCT,IAAI,CAACW,IAAL,CACEX,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYC,KAAZ,GAAoBJ,IAA7B,IACEJ,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYG,MAAZ,GAAqBR,MAA9B,C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9C,IAAP,KAAgB,SAAhB,IAA6B,OAAOA,IAAP,KAAgB,QAAjD,EAA2D;AACzD,eAAO+C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAEDhD,MAAAA,cAAc,CAACkD,IAAf,CAAoB,IAApB,EAA0BjD,GAA1B,EAA+BC,IAA/B,EAAqC8C,EAArC;;AAEA,UAAI,0BAAcA,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAtCmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === \"string\") {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function (x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY,\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === \"string\") {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === \"undefined\" || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== \"number\") {\n return throwError.call(this, \"deg must be a number\", cb);\n }\n\n if (typeof mode !== \"boolean\" && typeof mode !== \"string\") {\n return throwError.call(this, \"mode must be a boolean or a string\", cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-rotate/index.d.ts b/node_modules/@jimp/plugin-rotate/index.d.ts new file mode 100644 index 00000000..23d2aa2f --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/index.d.ts @@ -0,0 +1,8 @@ +import { ImageCallback } from "@jimp/core"; + +interface Rotate { + rotate(deg: number, cb?: ImageCallback): this; + rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; +} + +export default function (): Rotate; diff --git a/node_modules/@jimp/plugin-rotate/package.json b/node_modules/@jimp/plugin-rotate/package.json new file mode 100644 index 00000000..759cc59d --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/package.json @@ -0,0 +1,43 @@ +{ + "name": "@jimp/plugin-rotate", + "version": "0.16.13", + "description": "Rotate an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/plugin-crop": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-rotate/src/index.js b/node_modules/@jimp/plugin-rotate/src/index.js new file mode 100644 index 00000000..7b0712a8 --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/src/index.js @@ -0,0 +1,152 @@ +import { throwError, isNodePattern } from "@jimp/utils"; + +/** + * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. + * @param {number} deg the number of degrees to rotate the image by + * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed + */ +function advancedRotate(deg, mode) { + deg %= 360; + const rad = (deg * Math.PI) / 180; + const cosine = Math.cos(rad); + const sine = Math.sin(rad); + + // the final width and height will change if resize == true + let w = this.bitmap.width; + let h = this.bitmap.height; + + if (mode === true || typeof mode === "string") { + // resize the image to it maximum dimension and blit the existing image + // onto the center so that when it is rotated the image is kept in bounds + + // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle + // Plus 1 border pixel to ensure to show all rotated result for some cases. + w = + Math.ceil( + Math.abs(this.bitmap.width * cosine) + + Math.abs(this.bitmap.height * sine) + ) + 1; + h = + Math.ceil( + Math.abs(this.bitmap.width * sine) + + Math.abs(this.bitmap.height * cosine) + ) + 1; + // Ensure destination to have even size to a better result. + if (w % 2 !== 0) { + w++; + } + + if (h % 2 !== 0) { + h++; + } + + const c = this.cloneQuiet(); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + } + ); + + const max = Math.max(w, h, this.bitmap.width, this.bitmap.height); + this.resize(max, max, mode); + + this.blit( + c, + this.bitmap.width / 2 - c.bitmap.width / 2, + this.bitmap.height / 2 - c.bitmap.height / 2 + ); + } + + const bW = this.bitmap.width; + const bH = this.bitmap.height; + const dstBuffer = Buffer.alloc(this.bitmap.data.length); + + function createTranslationFunction(deltaX, deltaY) { + return function (x, y) { + return { + x: x + deltaX, + y: y + deltaY, + }; + }; + } + + const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); + const translate2Screen = createTranslationFunction( + bW / 2 + 0.5, + bH / 2 + 0.5 + ); + + for (let y = 1; y <= bH; y++) { + for (let x = 1; x <= bW; x++) { + const cartesian = translate2Cartesian(x, y); + const source = translate2Screen( + cosine * cartesian.x - sine * cartesian.y, + cosine * cartesian.y + sine * cartesian.x + ); + const dstIdx = (bW * (y - 1) + x - 1) << 2; + + if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { + const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2; + const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); + } else { + // reset off-image pixels + dstBuffer.writeUInt32BE(this._background, dstIdx); + } + } + } + + this.bitmap.data = dstBuffer; + + if (mode === true || typeof mode === "string") { + // now crop the image to the final size + const x = bW / 2 - w / 2; + const y = bH / 2 - h / 2; + this.crop(x, y, w, h); + } +} + +export default () => ({ + /** + * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. + * @param {number} deg the number of degrees to rotate the image by + * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + rotate(deg, mode, cb) { + // enable overloading + if (typeof mode === "undefined" || mode === null) { + // e.g. image.resize(120); + // e.g. image.resize(120, null, cb); + // e.g. image.resize(120, undefined, cb); + mode = true; + } + + if (typeof mode === "function" && typeof cb === "undefined") { + // e.g. image.resize(120, cb); + cb = mode; + mode = true; + } + + if (typeof deg !== "number") { + return throwError.call(this, "deg must be a number", cb); + } + + if (typeof mode !== "boolean" && typeof mode !== "string") { + return throwError.call(this, "mode must be a boolean or a string", cb); + } + + advancedRotate.call(this, deg, mode, cb); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-rotate/test/rotation.test.js b/node_modules/@jimp/plugin-rotate/test/rotation.test.js new file mode 100644 index 00000000..c86db73f --- /dev/null +++ b/node_modules/@jimp/plugin-rotate/test/rotation.test.js @@ -0,0 +1,636 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import blit from "@jimp/plugin-blit"; +import crop from "@jimp/plugin-crop"; +import resize from "@jimp/plugin-resize"; + +import rotate from "../src"; + +const jimp = configure({ plugins: [rotate, blit, crop, resize] }, Jimp); + +describe("Rotate a image with even size", () => { + let imgSrc = null; + + before((done) => { + jimp + .read( + mkJGD( + "▰▴▴▴▪▪▪▰", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▦▪▪▪▴▴▴▦" + ) + ) + .then((imgJimp) => { + imgSrc = imgJimp; + done(); + }) + .catch(done); + }); + + it("1 degrees", () => { + imgSrc + .clone() + .rotate(1, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▰▴▴▴▪▪▪▰ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▦▪▪▪▴▴▴▦ ", + " ", + " " + ) + ); + }); + + it("91 degrees", () => { + imgSrc + .clone() + .rotate(91, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + "▰▪▪▪▴▴▴▦ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▰▴▴▴▪▪▪▦ ", + " " + ) + ); + }); + + it("30 degrees", () => { + imgSrc + .clone() + .rotate(30, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▰▰ ", + " ▪▪▪▪ ", + " ▴▪▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▴▴▴ ", + "▴▴▴▴▪▴▴▴▴▴ ", + " ▴▴▪▪▴▴▴▴▦ ", + " ▪▪▪▪▪▴▴▴ ", + " ▪▪▪▪▪ ", + " ▪▪▪ ", + " ▦ ", + " " + ) + ); + }); + + it("45 degrees", () => { + imgSrc + .clone() + .rotate(45, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▰ ", + " ▪▪▪ ", + " ▪▪▪▪▪ ", + " ▴▴▪▪▪▪▴ ", + " ▴▴▴▴▪▪▴▴▴ ", + "▰▰▴▴▴▴▴▴▴▴▦ ", + " ▴▴▴▴▪▪▴▴▴ ", + " ▴▴▪▪▪▪▴ ", + " ▪▪▪▪▪ ", + " ▪▪▪ ", + " ▦ ", + " ", + " " + ) + ); + }); + + it("60 degrees", () => { + imgSrc + .clone() + .rotate(60, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▰ ", + " ▪▪▪ ", + " ▪▪▪▪▪ ", + " ▪▪▪▪▪▴▴▴ ", + " ▴▴▪▪▴▴▴▴▦ ", + "▴▴▴▴▪▴▴▴▴▴ ", + "▴▴▴▴▪▪▴▴▴ ", + "▴▴▴▴▪▪▪▪ ", + " ▴▪▪▪▪▪ ", + " ▪▪▪▪ ", + " ▦▦ ", + " " + ) + ); + }); + + it("90 degrees", () => { + imgSrc + .clone() + .rotate(90, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + "▰▪▪▪▴▴▴▦ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▰▴▴▴▪▪▪▦ ", + " " + ) + ); + }); + + it("120 degrees", () => { + imgSrc + .clone() + .rotate(120, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▴▦ ", + " ▴▴▴▴ ", + " ▪▪▴▴▴▴ ", + "▰▪▪▪▴▴▴▴▪ ", + "▰▪▪▪▪▴▴▪▪▪ ", + " ▪▪▪▪▪▪▪▪▪ ", + " ▪▪▴▴▴▪▪▪▪▦ ", + " ▴▴▴▴▴▪▪ ", + " ▴▴▴▴▪ ", + " ▴▴▴ ", + " " + ) + ); + }); + + it("135 degrees", () => { + imgSrc + .clone() + .rotate(135, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ", + " ▦ ", + " ▴▴▴ ", + " ▴▴▴▴▴ ", + " ▪▪▴▴▴▪▪ ", + " ▪▪▪▪▴▪▪▪▪ ", + " ▰▪▪▪▪▴▪▪▪▪▦ ", + " ▪▪▪▴▴▴▪▪▪ ", + " ▪▴▴▴▴▴▪ ", + " ▴▴▴▴▴ ", + " ▴▰▴ ", + " ▰ ", + " " + ) + ); + }); + + it("180 degrees", () => { + imgSrc + .clone() + .rotate(180, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▦▴▴▴▪▪▪▦ ", + " ▴▴▴▴▪▪▪▪ ", + " ▴▴▴▴▪▪▪▪ ", + " ▴▴▴▴▪▪▪▪ ", + " ▪▪▪▪▴▴▴▴ ", + " ▪▪▪▪▴▴▴▴ ", + " ▪▪▪▪▴▴▴▴ ", + " ▰▪▪▪▴▴▴▰ ", + " " + ) + ); + }); + + it("225 degrees", () => { + imgSrc + .clone() + .rotate(225, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▦ ", + " ▪▪▪ ", + " ▪▪▪▪▪ ", + " ▴▪▪▪▪▴▴ ", + " ▴▴▴▪▪▴▴▴▴ ", + " ▦▴▴▴▴▴▴▴▴▰▰ ", + " ▴▴▴▪▪▴▴▴▴ ", + " ▴▪▪▪▪▴▴ ", + " ▪▪▪▪▪ ", + " ▪▪▪ ", + " ▰ ", + " ", + " " + ) + ); + }); + + it("270 degrees", () => { + imgSrc + .clone() + .rotate(270, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▦▪▪▪▴▴▴▰ ", + " ▪▪▪▪▴▴▴▴ ", + " ▪▪▪▪▴▴▴▴ ", + " ▪▪▪▪▴▴▴▴ ", + " ▴▴▴▴▪▪▪▪ ", + " ▴▴▴▴▪▪▪▪ ", + " ▴▴▴▴▪▪▪▪ ", + " ▦▴▴▴▪▪▪▰ ", + " ", + " " + ) + ); + }); + + it("315 degrees", () => { + imgSrc + .clone() + .rotate(315, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▰ ", + " ▴▰▴ ", + " ▴▴▴▴▴ ", + " ▪▴▴▴▴▴▪ ", + " ▪▪▪▴▴▴▪▪▪ ", + " ▦▪▪▪▪▴▪▪▪▪▰ ", + " ▪▪▪▪▴▪▪▪▪ ", + " ▪▪▴▴▴▪▪ ", + " ▴▴▴▴▴ ", + " ▴▴▴ ", + " ▦ ", + " ", + " ", + " " + ) + ); + }); + + it("360 degrees", () => { + imgSrc + .clone() + .rotate(360, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▰▴▴▴▪▪▪▰ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▦▪▪▪▴▴▴▦ ", + " ", + " " + ) + ); + }); +}); + +describe("Rotate a image with odd size", () => { + let imgSrc = null; + before((done) => { + jimp + .read( + mkJGD( + "▴▴▴▦▪▪▪", + "▴▴▴▦▪▪▪", + "▴▴▴▦▪▪▪", + "▦▦▦▦▦▦▦", + "▴▴▴▦▴▴▴", + "▴▴▴▦▴▴▴", + "▴▴▴▦▴▴▴" + ) + ) + .then((imgJimp) => { + imgSrc = imgJimp; + done(); + }) + .catch(done); + }); + + it("45 degrees", () => { + imgSrc + .clone() + .rotate(45, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▪ ", + " ▪▪▪ ", + " ▦▪▪▪▦ ", + " ▴▴▦▪▦▴▴ ", + " ▴▴▴▴▦▴▴▴▴ ", + " ▴▴▦▴▦▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); + }); + + it("135 degrees", () => { + imgSrc + .clone() + .rotate(135, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▦▴▴▴▦ ", + " ▪▪▦▴▦▴▴ ", + " ▪▪▪▪▦▴▴▴▴ ", + " ▪▪▦▴▦▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); + }); + + it("225 degrees", () => { + imgSrc + .clone() + .rotate(225, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▦▴▦▴▴ ", + " ▴▴▴▴▦▴▴▴▴ ", + " ▴▴▦▪▦▴▴ ", + " ▦▪▪▪▦ ", + " ▪▪▪ ", + " ▪ ", + " ", + " " + ) + ); + }); + + it("315 degrees", () => { + imgSrc + .clone() + .rotate(315, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▦▴▦▪▪ ", + " ▴▴▴▴▦▪▪▪▪ ", + " ▴▴▦▴▦▪▪ ", + " ▦▴▴▴▦ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); + }); +}); + +describe("Rotate a non-square image", () => { + let imgSrc = null; + before((done) => { + jimp + .read(mkJGD("▴▴▴▴▪▪▪▪", "▴▴▴▴▪▪▪▪", "▦▦▦▦▴▴▴▴", "▦▦▦▦▴▴▴▴")) + .then((imgJimp) => { + imgSrc = imgJimp; + done(); + }) + .catch(done); + }); + + it("1 degrees", () => { + imgSrc + .clone() + .rotate(1, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▦▦▦▦▴▴▴▴ ", + "▦▦▦▦▴▴▴▴ ", + " ", + " " + ) + ); + }); + + it("10 degrees", () => { + imgSrc + .clone() + .rotate(10, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▪ ", + " ▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▴ ", + "▴▴▦▦▴▴▴▴ ", + "▦▦▦▦▴▴▴ ", + "▦▦ ", + " ", + " " + ) + ); + }); + + it("30 degrees", () => { + imgSrc + .clone() + .rotate(30, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▪▪ ", + " ▪▪▪▪ ", + " ▴▴▪▪▴▴▴ ", + "▴▴▴▦▴▴▴ ", + "▴▴▦▦▴▴ ", + "▦▦▦▦ ", + " ▦ ", + " ", + " " + ) + ); + }); + + it("45 degrees", () => { + imgSrc + .clone() + .rotate(45, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▪▪ ", + " ▪▪▪▴ ", + " ▴▪▪▴▴▴ ", + " ▴▴▴▴▴▴ ", + "▴▴▴▦▦▴ ", + "▴▴▦▦▦ ", + " ▦▦▦ ", + " ▦ ", + " " + ) + ); + }); + + it("90 degrees", () => { + imgSrc + .clone() + .rotate(90, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + "▪▪▴▴ ", + "▪▪▴▴ ", + "▪▪▴▴ ", + "▪▪▴▴ ", + "▴▴▦▦ ", + "▴▴▦▦ ", + "▴▴▦▦ ", + "▴▴▦▦ ", + " " + ) + ); + }); + + it("135 degrees", () => { + imgSrc + .clone() + .rotate(135, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▪▪▴▴▴ ", + " ▪▪▪▴▦▦ ", + " ▪▪▴▦▦▦ ", + " ▴▴▴▦▦▦ ", + " ▴▴▴▦ ", + " ▴▴ ", + " " + ) + ); + }); + + it("180 degrees", () => { + imgSrc + .clone() + .rotate(180, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ", + " ▴▴▴▴▦▦▦▦ ", + " ▴▴▴▴▦▦▦▦ ", + " ▪▪▪▪▴▴▴▴ ", + " ▪▪▪▪▴▴▴▴ ", + " " + ) + ); + }); + + it("225 degrees", () => { + imgSrc + .clone() + .rotate(225, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▦ ", + " ▦▦▦ ", + " ▦▦▦▴▴ ", + " ▴▦▦▴▴▴ ", + " ▴▴▴▴▴▴ ", + " ▴▴▴▪▪▴ ", + " ▴▪▪▪ ", + " ▪▪ ", + " ", + " " + ) + ); + }); + + it("315 degrees", () => { + imgSrc + .clone() + .rotate(315, true) + .getJGDSync() + .should.be.sameJGD( + mkJGD( + " ▴▴ ", + " ▦▴▴▴ ", + "▦▦▦▴▴▴ ", + " ▦▦▦▴▪▪ ", + " ▦▦▴▪▪▪ ", + " ▴▴▴▪▪ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); + }); +}); diff --git a/node_modules/@jimp/plugin-scale/CHANGELOG.md b/node_modules/@jimp/plugin-scale/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/plugin-scale/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-scale/LICENSE b/node_modules/@jimp/plugin-scale/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-scale/LICENSE rename to node_modules/@jimp/plugin-scale/LICENSE diff --git a/node_modules/@jimp/plugin-scale/README.md b/node_modules/@jimp/plugin-scale/README.md new file mode 100644 index 00000000..708a7771 --- /dev/null +++ b/node_modules/@jimp/plugin-scale/README.md @@ -0,0 +1,48 @@ +
+ +

@jimp/plugin-scale

+

Scale an image.

+
+ +## scale + +Uniformly scales the image by a factor. + +- @param {number} f the factor to scale the image by +- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.scale(2); + image.scale(2, jimp.RESIZE_BEZIER); +} + +main(); +``` + +## scaleToFit + +Scale the image to the largest size that fits inside the rectangle that has the given width and height. + +- @param {number} w the width to resize the image to +- @param {number} h the height to resize the image to +- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.scaleToFit(100, 100); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-scale/dist/index.js b/node_modules/@jimp/plugin-scale/dist/index.js new file mode 100644 index 00000000..a89343d3 --- /dev/null +++ b/node_modules/@jimp/plugin-scale/dist/index.js @@ -0,0 +1,76 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +var _default = function _default() { + return { + /** + * Uniformly scales the image by a factor. + * @param {number} f the factor to scale the image by + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scale: function scale(f, mode, cb) { + if (typeof f !== "number") { + return _utils.throwError.call(this, "f must be a number", cb); + } + + if (f < 0) { + return _utils.throwError.call(this, "f must be a positive number", cb); + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + var w = this.bitmap.width * f; + var h = this.bitmap.height * f; + this.resize(w, h, mode); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Scale the image to the largest size that fits inside the rectangle that has the given width and height. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scaleToFit: function scaleToFit(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; + this.scale(f, mode); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-scale/dist/index.js.map b/node_modules/@jimp/plugin-scale/dist/index.js.map new file mode 100644 index 00000000..fe17665a --- /dev/null +++ b/node_modules/@jimp/plugin-scale/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,C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,KAAKC,MAAL,CAAYC,KAHtB;AAIA,WAAKR,KAAL,CAAWC,CAAX,EAAcC,IAAd;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0) {\n return throwError.call(this, \"f must be a positive number\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-scale/index.d.ts b/node_modules/@jimp/plugin-scale/index.d.ts new file mode 100644 index 00000000..28c26ba2 --- /dev/null +++ b/node_modules/@jimp/plugin-scale/index.d.ts @@ -0,0 +1,15 @@ +import { ImageCallback } from "@jimp/core"; + +interface Scale { + scale(f: number, cb?: ImageCallback): this; + scale(f: number, mode?: string, cb?: ImageCallback): this; + scaleToFit(w: number, h: number, cb?: ImageCallback): this; + scaleToFit( + w: number, + h: number, + mode?: string, + cb?: ImageCallback + ): this; +} + +export default function (): Scale; diff --git a/node_modules/@jimp/plugin-scale/package.json b/node_modules/@jimp/plugin-scale/package.json new file mode 100644 index 00000000..30eff760 --- /dev/null +++ b/node_modules/@jimp/plugin-scale/package.json @@ -0,0 +1,31 @@ +{ + "name": "@jimp/plugin-scale", + "version": "0.16.13", + "description": "scale an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-scale/src/index.js b/node_modules/@jimp/plugin-scale/src/index.js new file mode 100644 index 00000000..f67ce2b3 --- /dev/null +++ b/node_modules/@jimp/plugin-scale/src/index.js @@ -0,0 +1,66 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +export default () => ({ + /** + * Uniformly scales the image by a factor. + * @param {number} f the factor to scale the image by + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scale(f, mode, cb) { + if (typeof f !== "number") { + return throwError.call(this, "f must be a number", cb); + } + + if (f < 0) { + return throwError.call(this, "f must be a positive number", cb); + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + const w = this.bitmap.width * f; + const h = this.bitmap.height * f; + this.resize(w, h, mode); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Scale the image to the largest size that fits inside the rectangle that has the given width and height. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scaleToFit(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } + + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + + const f = + w / h > this.bitmap.width / this.bitmap.height + ? h / this.bitmap.height + : w / this.bitmap.width; + this.scale(f, mode); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/node_modules/@jimp/plugin-shadow/CHANGELOG.md b/node_modules/@jimp/plugin-shadow/CHANGELOG.md new file mode 100644 index 00000000..57102be3 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/CHANGELOG.md @@ -0,0 +1,48 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.4 (Tue Mar 03 2020) + +#### 🐛 Bug Fix + +- `@jimp/plugin-shadow` + - Update plugin-shadow type definition. [#841](https://github.com/oliver-moran/jimp/pull/841) ([@lekoaf](https://github.com/lekoaf)) + +#### Authors: 1 + +- Martin ([@lekoaf](https://github.com/lekoaf)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-shadow/LICENSE b/node_modules/@jimp/plugin-shadow/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-shadow/LICENSE rename to node_modules/@jimp/plugin-shadow/LICENSE diff --git a/node_modules/@jimp/plugin-shadow/README.md b/node_modules/@jimp/plugin-shadow/README.md new file mode 100644 index 00000000..b068cd22 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/README.md @@ -0,0 +1,30 @@ +
+ +

@jimp/plugin-shadow

+

Creates a shadow on an image.

+
+ +## Usage + +- @param {function(Error, Jimp)} options (optional) + - opacity - opacity of the shadow between 0 and 1 + - size,- of the shadow + - blur - how blurry the shadow is + - x - x position of shadow + - y - y position of shadow +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.shadow(); + // or + image.shadow({ opacity: 0.8, size: 1.2, blur: 10, x: -75, y: -75 }); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-shadow/babel.config.js b/node_modules/@jimp/plugin-shadow/babel.config.js new file mode 100644 index 00000000..13e2603a --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/babel.config.js @@ -0,0 +1,38 @@ +module.exports = (api) => { + api.cache(true); + + return { + presets: [ + [ + "@babel/env", + { + useBuiltIns: "usage", + }, + ], + ], + + plugins: [ + "@babel/proposal-class-properties", + "@babel/syntax-object-rest-spread", + process.env.BABEL_ENV !== "module" && "add-module-exports", + [ + "transform-inline-environment-variables", + { include: ["BABEL_ENV", "ENV"] }, + ], + ].filter(Boolean), + + env: { + test: { + plugins: ["istanbul"], + }, + development: { + plugins: [process.env.ENV !== "browser" && "source-map-support"].filter( + Boolean + ), + }, + module: { + presets: [["@babel/env", { modules: false }]], + }, + }, + }; +}; diff --git a/node_modules/@jimp/plugin-shadow/dist/index.js b/node_modules/@jimp/plugin-shadow/dist/index.js new file mode 100644 index 00000000..77a4cc11 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/dist/index.js @@ -0,0 +1,77 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Creates a circle out of an image. + * @param {function(Error, Jimp)} options (optional) + * opacity - opacity of the shadow between 0 and 1 + * size,- of the shadow + * blur - how blurry the shadow is + * x- x position of shadow + * y - y position of shadow + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +var _default = function _default() { + return { + shadow: function shadow() { + var _this = this; + + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var cb = arguments.length > 1 ? arguments[1] : undefined; + + if (typeof options === "function") { + cb = options; + options = {}; + } + + var _options = options, + _options$opacity = _options.opacity, + opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, + _options$size = _options.size, + size = _options$size === void 0 ? 1.1 : _options$size, + _options$x = _options.x, + x = _options$x === void 0 ? -25 : _options$x, + _options$y = _options.y, + y = _options$y === void 0 ? 25 : _options$y, + _options$blur = _options.blur, + blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image + + var orig = this.clone(); + var shadow = this.clone(); // turn all it's pixels black + + shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { + shadow.bitmap.data[idx] = 0x00; + shadow.bitmap.data[idx + 1] = 0x00; + shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, + + shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); + _this.bitmap.data[idx] = 0x00; + _this.bitmap.data[idx + 1] = 0x00; + _this.bitmap.data[idx + 2] = 0x00; + _this.bitmap.data[idx + 3] = 0x00; + }); // enlarge it. This creates a "shadow". + + shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. + + this.composite(shadow, x, y); + this.composite(orig, 0, 0); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-shadow/dist/index.js.map b/node_modules/@jimp/plugin-shadow/dist/index.js.map new file mode 100644 index 00000000..9fd96612 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAJsB,qBAM0CA,OAN1C;AAAA,sCAMfE,OANe;AAAA,UAMfA,OANe,iCAML,GANK;AAAA,mCAMAC,IANA;AAAA,UAMAA,IANA,8BAMO,GANP;AAAA,gCAMYC,CANZ;AAAA,UAMYA,CANZ,2BAMgB,CAAC,EANjB;AAAA,gCAMqBC,CANrB;AAAA,UAMqBA,CANrB,2BAMyB,EANzB;AAAA,mCAM6BC,IAN7B;AAAA,UAM6BA,IAN7B,8BAMoC,CANpC,kBAQvB;;AACA,UAAMC,IAAI,GAAG,KAAKC,KAAL,EAAb;AACA,UAAMT,MAAM,GAAG,KAAKS,KAAL,EAAf,CAVuB,CAYvB;;AACAT,MAAAA,MAAM,CAACU,IAAP,CACE,CADF,EAEE,CAFF,EAGEV,MAAM,CAACW,MAAP,CAAcC,KAHhB,EAIEZ,MAAM,CAACW,MAAP,CAAcE,MAJhB,EAKE,UAACR,CAAD,EAAIC,CAAJ,EAAOQ,GAAP,EAAe;AACbd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAnB,IAA0B,IAA1B;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8B,IAA9B;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8B,IAA9B,CAHa,CAIb;;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8Bd,MAAM,CAACgB,WAAP,CAAmBC,QAAnB,CAC5BjB,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8BX,OADF,CAA9B;AAIA,QAAA,KAAI,CAACQ,MAAL,CAAYI,IAAZ,CAAiBD,GAAjB,IAAwB,IAAxB;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACD,OAlBH,EAbuB,CAkCvB;;AACAd,MAAAA,MAAM,CACHkB,MADH,CACUlB,MAAM,CAACW,MAAP,CAAcC,KAAd,GAAsBR,IADhC,EACsCJ,MAAM,CAACW,MAAP,CAAcE,MAAd,GAAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-shadow/index.d.ts b/node_modules/@jimp/plugin-shadow/index.d.ts new file mode 100644 index 00000000..4e3c4841 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/index.d.ts @@ -0,0 +1,17 @@ +import { ImageCallback } from "@jimp/core"; + +interface Shadow { + shadow( + options?: { + size?: number; + opacity?: number; + blur: number; + x?: number; + y?: number; + }, + cb?: ImageCallback + ): this; + shadow(cb?: ImageCallback): this; +} + +export default function (): Shadow; diff --git a/node_modules/@jimp/plugin-shadow/package.json b/node_modules/@jimp/plugin-shadow/package.json new file mode 100644 index 00000000..a8e3ebbb --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/package.json @@ -0,0 +1,41 @@ +{ + "name": "@jimp/plugin-shadow", + "version": "0.16.13", + "description": "Creates a shadow on an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blur": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/plugin-blur": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-shadow/src/index.js b/node_modules/@jimp/plugin-shadow/src/index.js new file mode 100644 index 00000000..81c23c41 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/src/index.js @@ -0,0 +1,64 @@ +import { isNodePattern } from "@jimp/utils"; + +/** + * Creates a circle out of an image. + * @param {function(Error, Jimp)} options (optional) + * opacity - opacity of the shadow between 0 and 1 + * size,- of the shadow + * blur - how blurry the shadow is + * x- x position of shadow + * y - y position of shadow + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ +export default () => ({ + shadow(options = {}, cb) { + if (typeof options === "function") { + cb = options; + options = {}; + } + + const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options; + + // clone the image + const orig = this.clone(); + const shadow = this.clone(); + + // turn all it's pixels black + shadow.scan( + 0, + 0, + shadow.bitmap.width, + shadow.bitmap.height, + (x, y, idx) => { + shadow.bitmap.data[idx] = 0x00; + shadow.bitmap.data[idx + 1] = 0x00; + shadow.bitmap.data[idx + 2] = 0x00; + // up the opacity a little, + shadow.bitmap.data[idx + 3] = shadow.constructor.limit255( + shadow.bitmap.data[idx + 3] * opacity + ); + + this.bitmap.data[idx] = 0x00; + this.bitmap.data[idx + 1] = 0x00; + this.bitmap.data[idx + 2] = 0x00; + this.bitmap.data[idx + 3] = 0x00; + } + ); + + // enlarge it. This creates a "shadow". + shadow + .resize(shadow.bitmap.width * size, shadow.bitmap.height * size) + .blur(blur); + + // Then blit the "shadow" onto the background and the image on top of that. + this.composite(shadow, x, y); + this.composite(orig, 0, 0); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/project starter code/node_modules/@jimp/plugin-shadow/test/images/shadow.png b/node_modules/@jimp/plugin-shadow/test/images/shadow.png similarity index 100% rename from project starter code/node_modules/@jimp/plugin-shadow/test/images/shadow.png rename to node_modules/@jimp/plugin-shadow/test/images/shadow.png diff --git a/node_modules/@jimp/plugin-shadow/test/shadow.test.js b/node_modules/@jimp/plugin-shadow/test/shadow.test.js new file mode 100644 index 00000000..7f2e4dc9 --- /dev/null +++ b/node_modules/@jimp/plugin-shadow/test/shadow.test.js @@ -0,0 +1,31 @@ +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import resize from "@jimp/plugin-resize"; +import blur from "@jimp/plugin-blur"; + +import shadow from "../src"; + +const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp); + +describe("Shadow", () => { + it("creates a shadow", async () => { + const expectedImg = await jimp.read( + getTestDir(__dirname) + "/images/shadow.png" + ); + const testImage = await jimp.read( + mkJGD( + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); + + testImage + .shadow({ x: -1, y: 1, blur: 1 }) + .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + }); +}); diff --git a/node_modules/@jimp/plugin-threshold/CHANGELOG.md b/node_modules/@jimp/plugin-threshold/CHANGELOG.md new file mode 100644 index 00000000..8ad0c783 --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/CHANGELOG.md @@ -0,0 +1,47 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.7 (Fri Mar 27 2020) + +#### 🐛 Bug Fix + +- Relax version range of plugin-threshold peerDependencies [#859](https://github.com/oliver-moran/jimp/pull/859) ([@pasieronen](https://github.com/pasieronen)) + +#### Authors: 1 + +- Pasi Eronen ([@pasieronen](https://github.com/pasieronen)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-threshold/LICENSE b/node_modules/@jimp/plugin-threshold/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugin-threshold/LICENSE rename to node_modules/@jimp/plugin-threshold/LICENSE diff --git a/node_modules/@jimp/plugin-threshold/README.md b/node_modules/@jimp/plugin-threshold/README.md new file mode 100644 index 00000000..57271c3b --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/README.md @@ -0,0 +1,30 @@ +
+ +

@jimp/plugin-threshold

+

Lightens an image.

+
+ +This is useful as a simplified method for processing scanned drawings, signatures, etc + +## Usage + +- @param {number} options object + - max: A number auto limited between 0 - 255 + - replace: (optional) A number auto limited between 0 - 255 (default 255) + - autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) +- @param {function(Error, Jimp)} cb (optional) a callback for when complete + +```js +import jimp from "jimp"; + +async function main() { + const image = await jimp.read("test/image.png"); + + image.threshold({ max: 150 }); + // or + image.threshold({ max: 200, replace: 200, autoGreyscale: false }); +} + +main(); +``` diff --git a/node_modules/@jimp/plugin-threshold/babel.config.js b/node_modules/@jimp/plugin-threshold/babel.config.js new file mode 100644 index 00000000..13e2603a --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/babel.config.js @@ -0,0 +1,38 @@ +module.exports = (api) => { + api.cache(true); + + return { + presets: [ + [ + "@babel/env", + { + useBuiltIns: "usage", + }, + ], + ], + + plugins: [ + "@babel/proposal-class-properties", + "@babel/syntax-object-rest-spread", + process.env.BABEL_ENV !== "module" && "add-module-exports", + [ + "transform-inline-environment-variables", + { include: ["BABEL_ENV", "ENV"] }, + ], + ].filter(Boolean), + + env: { + test: { + plugins: ["istanbul"], + }, + development: { + plugins: [process.env.ENV !== "browser" && "source-map-support"].filter( + Boolean + ), + }, + module: { + presets: [["@babel/env", { modules: false }]], + }, + }, + }; +}; diff --git a/node_modules/@jimp/plugin-threshold/dist/index.js b/node_modules/@jimp/plugin-threshold/dist/index.js new file mode 100644 index 00000000..398bd57e --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/dist/index.js @@ -0,0 +1,67 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _utils = require("@jimp/utils"); + +/** + * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default + * @param {number} options object + * max: A number auto limited between 0 - 255 + * replace: (optional) A number auto limited between 0 - 255 (default 255) + * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) + * @param {number} cb (optional) a callback for when complete + * @return {this} this for chaining of methods + */ +var _default = function _default() { + return { + threshold: function threshold(_ref, cb) { + var _this = this; + + var max = _ref.max, + _ref$replace = _ref.replace, + replace = _ref$replace === void 0 ? 255 : _ref$replace, + _ref$autoGreyscale = _ref.autoGreyscale, + autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; + + if (typeof max !== "number") { + return _utils.throwError.call(this, "max must be a number", cb); + } + + if (typeof replace !== "number") { + return _utils.throwError.call(this, "replace must be a number", cb); + } + + if (typeof autoGreyscale !== "boolean") { + return _utils.throwError.call(this, "autoGreyscale must be a boolean", cb); + } + + max = this.constructor.limit255(max); + replace = this.constructor.limit255(replace); + + if (autoGreyscale) { + this.greyscale(); + } + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; + _this.bitmap.data[idx] = grey; + _this.bitmap.data[idx + 1] = grey; + _this.bitmap.data[idx + 2] = grey; + }); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-threshold/dist/index.js.map b/node_modules/@jimp/plugin-threshold/dist/index.js.map new file mode 100644 index 00000000..0fe67355 --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,SADoB,2BACoCC,EADpC,EACwC;AAAA;;AAAA,UAAhDC,GAAgD,QAAhDA,GAAgD;AAAA,8BAA3CC,OAA2C;AAAA,UAA3CA,OAA2C,6BAAjC,GAAiC;AAAA,oCAA5BC,aAA4B;AAAA,UAA5BA,aAA4B,mCAAZ,IAAY;;AAC1D,UAAI,OAAOF,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CL,EAA9C,CAAP;AACD;;AAED,UAAI,OAAOE,OAAP,KAAmB,QAAvB,EAAiC;AAC/B,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDL,EAAlD,CAAP;AACD;;AAED,UAAI,OAAOG,aAAP,KAAyB,SAA7B,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDL,EAAzD,CAAP;AACD;;AAEDC,MAAAA,GAAG,GAAG,KAAKK,WAAL,CAAiBC,QAAjB,CAA0BN,GAA1B,CAAN;AACAC,MAAAA,OAAO,GAAG,KAAKI,WAAL,CAAiBC,QAAjB,CAA0BL,OAA1B,CAAV;;AAEA,UAAIC,aAAJ,EAAmB;AACjB,aAAKK,SAAL;AACD;;AAED,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAACC,CAAD,EAAIC,CAAJ,EAAOC,GAAP,EAAe;AACzE,YAAMC,IAAI,GACR,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBd,GAAxB,GAA8B,KAAI,CAACS,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,CAA9B,GAAsDb,OADxD;AAGA,QAAA,KAAI,CAACQ,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBC,IAAxB;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACD,OAPD;;AASA,UAAI,0BAAchB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAnCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== \"number\") {\n return throwError.call(this, \"max must be a number\", cb);\n }\n\n if (typeof replace !== \"number\") {\n return throwError.call(this, \"replace must be a number\", cb);\n }\n\n if (typeof autoGreyscale !== \"boolean\") {\n return throwError.call(this, \"autoGreyscale must be a boolean\", cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-threshold/index.d.ts b/node_modules/@jimp/plugin-threshold/index.d.ts new file mode 100644 index 00000000..96ad193f --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/index.d.ts @@ -0,0 +1,14 @@ +import { ImageCallback } from "@jimp/core"; + +interface Threshold { + threshold( + opts: { + max: number; + replace?: number; + autoGreyscale?: boolean; + }, + cb?: ImageCallback + ): this; +} + +export default function (): Threshold; diff --git a/node_modules/@jimp/plugin-threshold/package.json b/node_modules/@jimp/plugin-threshold/package.json new file mode 100644 index 00000000..6a4d57bf --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/package.json @@ -0,0 +1,42 @@ +{ + "name": "@jimp/plugin-threshold", + "version": "0.16.13", + "description": "Lightens an image.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-color": ">=0.8.0", + "@jimp/plugin-resize": ">=0.8.0" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/jpeg": "^0.16.13", + "@jimp/plugin-color": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugin-threshold/src/index.js b/node_modules/@jimp/plugin-threshold/src/index.js new file mode 100644 index 00000000..fad06bac --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/src/index.js @@ -0,0 +1,48 @@ +import { isNodePattern, throwError } from "@jimp/utils"; + +/** + * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default + * @param {number} options object + * max: A number auto limited between 0 - 255 + * replace: (optional) A number auto limited between 0 - 255 (default 255) + * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) + * @param {number} cb (optional) a callback for when complete + * @return {this} this for chaining of methods + */ +export default () => ({ + threshold({ max, replace = 255, autoGreyscale = true }, cb) { + if (typeof max !== "number") { + return throwError.call(this, "max must be a number", cb); + } + + if (typeof replace !== "number") { + return throwError.call(this, "replace must be a number", cb); + } + + if (typeof autoGreyscale !== "boolean") { + return throwError.call(this, "autoGreyscale must be a boolean", cb); + } + + max = this.constructor.limit255(max); + replace = this.constructor.limit255(replace); + + if (autoGreyscale) { + this.greyscale(); + } + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { + const grey = + this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace; + + this.bitmap.data[idx] = grey; + this.bitmap.data[idx + 1] = grey; + this.bitmap.data[idx + 2] = grey; + }); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, +}); diff --git a/project starter code/node_modules/@jimp/plugin-threshold/test/images/hands.jpg b/node_modules/@jimp/plugin-threshold/test/images/hands.jpg similarity index 100% rename from project starter code/node_modules/@jimp/plugin-threshold/test/images/hands.jpg rename to node_modules/@jimp/plugin-threshold/test/images/hands.jpg diff --git a/project starter code/node_modules/@jimp/plugin-threshold/test/images/hands_mx200_rp255.jpg b/node_modules/@jimp/plugin-threshold/test/images/hands_mx200_rp255.jpg similarity index 100% rename from project starter code/node_modules/@jimp/plugin-threshold/test/images/hands_mx200_rp255.jpg rename to node_modules/@jimp/plugin-threshold/test/images/hands_mx200_rp255.jpg diff --git a/node_modules/@jimp/plugin-threshold/test/threshold.test.js b/node_modules/@jimp/plugin-threshold/test/threshold.test.js new file mode 100644 index 00000000..325f8313 --- /dev/null +++ b/node_modules/@jimp/plugin-threshold/test/threshold.test.js @@ -0,0 +1,30 @@ +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import jpeg from "@jimp/jpeg"; +import color from "@jimp/plugin-color"; +import resize from "@jimp/plugin-resize"; + +import threshold from "../src"; + +const jimp = configure( + { types: [jpeg], plugins: [threshold, color, resize] }, + Jimp +); + +describe("Threshold", function () { + this.timeout(15000); + + it("defines default threshold for lighter backgrounds", async () => { + const expectedImage = await jimp.read( + getTestDir(__dirname) + "/images/hands_mx200_rp255.jpg" + ); + const testImage = await jimp.read( + getTestDir(__dirname) + "/images/hands.jpg" + ); + + testImage + .threshold({ max: 200, replace: 255 }) + .hash() + .should.be.equal(expectedImage.hash()); + }); +}); diff --git a/node_modules/@jimp/plugins/CHANGELOG.md b/node_modules/@jimp/plugins/CHANGELOG.md new file mode 100644 index 00000000..dbaa66e5 --- /dev/null +++ b/node_modules/@jimp/plugins/CHANGELOG.md @@ -0,0 +1,59 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.8 (Sat Mar 28 2020) + +#### 🐛 Bug Fix + +- Export the four missing plugins from plugin package [#866](https://github.com/oliver-moran/jimp/pull/866) ([@crutchcorn](https://github.com/crutchcorn)) + +#### Authors: 1 + +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) + +--- + +# v0.9.7 (Fri Mar 27 2020) + +#### 🐛 Bug Fix + +- Added missing plugins to the types [#863](https://github.com/oliver-moran/jimp/pull/863) ([@crutchcorn](https://github.com/crutchcorn)) + +#### Authors: 1 + +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugins/LICENSE b/node_modules/@jimp/plugins/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/plugins/LICENSE rename to node_modules/@jimp/plugins/LICENSE diff --git a/project starter code/node_modules/@jimp/plugins/README.md b/node_modules/@jimp/plugins/README.md similarity index 100% rename from project starter code/node_modules/@jimp/plugins/README.md rename to node_modules/@jimp/plugins/README.md diff --git a/project starter code/node_modules/@jimp/plugins/dist/index.js b/node_modules/@jimp/plugins/dist/index.js similarity index 100% rename from project starter code/node_modules/@jimp/plugins/dist/index.js rename to node_modules/@jimp/plugins/dist/index.js diff --git a/node_modules/@jimp/plugins/dist/index.js.map b/node_modules/@jimp/plugins/dist/index.js.map new file mode 100644 index 00000000..7abc2a38 --- /dev/null +++ b/node_modules/@jimp/plugins/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAACC,YAAD,EAAkB;AAC/B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAACC,YAAD,EAAkB;AACvD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport blit from \"@jimp/plugin-blit\";\nimport blur from \"@jimp/plugin-blur\";\nimport circle from \"@jimp/plugin-circle\";\nimport color from \"@jimp/plugin-color\";\nimport contain from \"@jimp/plugin-contain\";\nimport cover from \"@jimp/plugin-cover\";\nimport crop from \"@jimp/plugin-crop\";\nimport displace from \"@jimp/plugin-displace\";\nimport dither from \"@jimp/plugin-dither\";\nimport fisheye from \"@jimp/plugin-fisheye\";\nimport flip from \"@jimp/plugin-flip\";\nimport gaussian from \"@jimp/plugin-gaussian\";\nimport invert from \"@jimp/plugin-invert\";\nimport mask from \"@jimp/plugin-mask\";\nimport normalize from \"@jimp/plugin-normalize\";\nimport print from \"@jimp/plugin-print\";\nimport resize from \"@jimp/plugin-resize\";\nimport rotate from \"@jimp/plugin-rotate\";\nimport scale from \"@jimp/plugin-scale\";\nimport shadow from \"@jimp/plugin-shadow\";\nimport threshold from \"@jimp/plugin-threshold\";\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold,\n];\n\nexport default (jimpEvChange) => {\n const initializedPlugins = plugins.map((pluginModule) => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/plugins/index.d.ts b/node_modules/@jimp/plugins/index.d.ts new file mode 100644 index 00000000..0184bbcc --- /dev/null +++ b/node_modules/@jimp/plugins/index.d.ts @@ -0,0 +1,76 @@ +import blit from "@jimp/plugin-blit"; +import blur from "@jimp/plugin-blur"; +import circle from "@jimp/plugin-circle"; +import color from "@jimp/plugin-color"; +import contain from "@jimp/plugin-contain"; +import cover from "@jimp/plugin-cover"; +import crop from "@jimp/plugin-crop"; +import displace from "@jimp/plugin-displace"; +import dither from "@jimp/plugin-dither"; +import fisheye from "@jimp/plugin-fisheye"; +import flip from "@jimp/plugin-flip"; +import gaussian from "@jimp/plugin-gaussian"; +import invert from "@jimp/plugin-invert"; +import mask from "@jimp/plugin-mask"; +import normalize from "@jimp/plugin-normalize"; +import print from "@jimp/plugin-print"; +import resize from "@jimp/plugin-resize"; +import rotate from "@jimp/plugin-rotate"; +import scale from "@jimp/plugin-scale"; +import shadow from "@jimp/plugin-shadow"; +import threshold from "@jimp/plugin-threshold"; + +type BlitRet = ReturnType; +type BlurRet = ReturnType; +type CircleRet = ReturnType; +type ColorRet = ReturnType; +type ContainRet = ReturnType; +type CoverRet = ReturnType; +type CropRet = ReturnType; +type DisplaceRet = ReturnType; +type DitherRet = ReturnType; +type FlipRet = ReturnType; +type FisheyeRet = ReturnType; +type GaussianRet = ReturnType; +type InvertRet = ReturnType; +type MaskRet = ReturnType; +type NormalizeRet = ReturnType; +type PrintRet = ReturnType; +type ResizeRet = ReturnType; +type RotateRet = ReturnType; +type ScaleRet = ReturnType; +type ShadowRet = ReturnType; +type ThresholdRet = ReturnType; + +/** + * This is made union and not intersection to avoid issues with + * `IllformedPlugin` and `WellFormedPlugin` when using typings with Jimp + * generic + * + * In reality, this should be an intersection but our type data isn't + * clever enough to figure out what's a class and what's not/etc + */ +type Plugins = + | BlitRet + | BlurRet + | CircleRet + | ColorRet + | ContainRet + | CoverRet + | CropRet + | DisplaceRet + | DitherRet + | FlipRet + | FisheyeRet + | GaussianRet + | InvertRet + | MaskRet + | NormalizeRet + | PrintRet + | ResizeRet + | RotateRet + | ScaleRet + | ShadowRet + | ThresholdRet; + +export default function (): Plugins; diff --git a/node_modules/@jimp/plugins/package.json b/node_modules/@jimp/plugins/package.json new file mode 100644 index 00000000..6f3bcc22 --- /dev/null +++ b/node_modules/@jimp/plugins/package.json @@ -0,0 +1,51 @@ +{ + "name": "@jimp/plugins", + "version": "0.16.13", + "description": "Default Jimp plugin.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/plugin-blur": "^0.16.13", + "@jimp/plugin-circle": "^0.16.13", + "@jimp/plugin-color": "^0.16.13", + "@jimp/plugin-contain": "^0.16.13", + "@jimp/plugin-cover": "^0.16.13", + "@jimp/plugin-crop": "^0.16.13", + "@jimp/plugin-displace": "^0.16.13", + "@jimp/plugin-dither": "^0.16.13", + "@jimp/plugin-fisheye": "^0.16.13", + "@jimp/plugin-flip": "^0.16.13", + "@jimp/plugin-gaussian": "^0.16.13", + "@jimp/plugin-invert": "^0.16.13", + "@jimp/plugin-mask": "^0.16.13", + "@jimp/plugin-normalize": "^0.16.13", + "@jimp/plugin-print": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/plugin-rotate": "^0.16.13", + "@jimp/plugin-scale": "^0.16.13", + "@jimp/plugin-shadow": "^0.16.13", + "@jimp/plugin-threshold": "^0.16.13", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/plugins/src/index.js b/node_modules/@jimp/plugins/src/index.js new file mode 100644 index 00000000..a31740cf --- /dev/null +++ b/node_modules/@jimp/plugins/src/index.js @@ -0,0 +1,62 @@ +import { mergeDeep } from "timm"; + +import blit from "@jimp/plugin-blit"; +import blur from "@jimp/plugin-blur"; +import circle from "@jimp/plugin-circle"; +import color from "@jimp/plugin-color"; +import contain from "@jimp/plugin-contain"; +import cover from "@jimp/plugin-cover"; +import crop from "@jimp/plugin-crop"; +import displace from "@jimp/plugin-displace"; +import dither from "@jimp/plugin-dither"; +import fisheye from "@jimp/plugin-fisheye"; +import flip from "@jimp/plugin-flip"; +import gaussian from "@jimp/plugin-gaussian"; +import invert from "@jimp/plugin-invert"; +import mask from "@jimp/plugin-mask"; +import normalize from "@jimp/plugin-normalize"; +import print from "@jimp/plugin-print"; +import resize from "@jimp/plugin-resize"; +import rotate from "@jimp/plugin-rotate"; +import scale from "@jimp/plugin-scale"; +import shadow from "@jimp/plugin-shadow"; +import threshold from "@jimp/plugin-threshold"; + +const plugins = [ + blit, + blur, + circle, + color, + contain, + cover, + crop, + displace, + dither, + fisheye, + flip, + gaussian, + invert, + mask, + normalize, + print, + resize, + rotate, + scale, + shadow, + threshold, +]; + +export default (jimpEvChange) => { + const initializedPlugins = plugins.map((pluginModule) => { + let plugin = pluginModule(jimpEvChange) || {}; + + if (!plugin.class && !plugin.constants) { + // Default to class function + plugin = { class: plugin }; + } + + return plugin; + }); + + return mergeDeep(...initializedPlugins); +}; diff --git a/node_modules/@jimp/png/CHANGELOG.md b/node_modules/@jimp/png/CHANGELOG.md new file mode 100644 index 00000000..cf26b5c3 --- /dev/null +++ b/node_modules/@jimp/png/CHANGELOG.md @@ -0,0 +1,36 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/png/LICENSE b/node_modules/@jimp/png/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/png/LICENSE rename to node_modules/@jimp/png/LICENSE diff --git a/project starter code/node_modules/@jimp/png/README.md b/node_modules/@jimp/png/README.md similarity index 100% rename from project starter code/node_modules/@jimp/png/README.md rename to node_modules/@jimp/png/README.md diff --git a/node_modules/@jimp/png/dist/index.js b/node_modules/@jimp/png/dist/index.js new file mode 100644 index 00000000..0c1a688e --- /dev/null +++ b/node_modules/@jimp/png/dist/index.js @@ -0,0 +1,162 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _pngjs = require("pngjs"); + +var _utils = require("@jimp/utils"); + +var MIME_TYPE = "image/png"; // PNG filter types + +var PNG_FILTER_AUTO = -1; +var PNG_FILTER_NONE = 0; +var PNG_FILTER_SUB = 1; +var PNG_FILTER_UP = 2; +var PNG_FILTER_AVERAGE = 3; +var PNG_FILTER_PATH = 4; + +var _default = function _default() { + return { + mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ["png"]), + constants: { + MIME_PNG: MIME_TYPE, + PNG_FILTER_AUTO: PNG_FILTER_AUTO, + PNG_FILTER_NONE: PNG_FILTER_NONE, + PNG_FILTER_SUB: PNG_FILTER_SUB, + PNG_FILTER_UP: PNG_FILTER_UP, + PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, + PNG_FILTER_PATH: PNG_FILTER_PATH + }, + hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), + decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), + encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { + var png = new _pngjs.PNG({ + width: data.bitmap.width, + height: data.bitmap.height + }); + png.data = data.bitmap.data; + return _pngjs.PNG.sync.write(png, { + width: data.bitmap.width, + height: data.bitmap.height, + deflateLevel: data._deflateLevel, + deflateStrategy: data._deflateStrategy, + filterType: data._filterType, + colorType: typeof data._colorType === "number" ? data._colorType : data._rgba ? 6 : 2, + inputHasAlpha: data._rgba + }); + }), + "class": { + _deflateLevel: 9, + _deflateStrategy: 3, + _filterType: PNG_FILTER_AUTO, + _colorType: null, + + /** + * Sets the deflate level used when saving as PNG format (default is 9) + * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateLevel: function deflateLevel(l, cb) { + if (typeof l !== "number") { + return _utils.throwError.call(this, "l must be a number", cb); + } + + if (l < 0 || l > 9) { + return _utils.throwError.call(this, "l must be a number 0 - 9", cb); + } + + this._deflateLevel = Math.round(l); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Sets the deflate strategy used when saving as PNG format (default is 3) + * @param {number} s Deflate strategy to use 0-3. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateStrategy: function deflateStrategy(s, cb) { + if (typeof s !== "number") { + return _utils.throwError.call(this, "s must be a number", cb); + } + + if (s < 0 || s > 3) { + return _utils.throwError.call(this, "s must be a number 0 - 3", cb); + } + + this._deflateStrategy = Math.round(s); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Sets the filter type used when saving as PNG format (default is automatic filters) + * @param {number} f The quality to use -1-4. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + filterType: function filterType(f, cb) { + if (typeof f !== "number") { + return _utils.throwError.call(this, "n must be a number", cb); + } + + if (f < -1 || f > 4) { + return _utils.throwError.call(this, "n must be -1 (auto) or a number 0 - 4", cb); + } + + this._filterType = Math.round(f); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Sets the color type used when saving as PNG format + * @param {number} s color type to use 0, 2, 4, 6. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + colorType: function colorType(s, cb) { + if (typeof s !== "number") { + return _utils.throwError.call(this, "s must be a number", cb); + } + + if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { + return _utils.throwError.call(this, "s must be a number 0, 2, 4, 6.", cb); + } + + this._colorType = Math.round(s); + + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + + return this; + } + } + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/png/dist/index.js.map b/node_modules/@jimp/png/dist/index.js.map new file mode 100644 index 00000000..a5bbc076 --- /dev/null +++ b/node_modules/@jimp/png/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB,C,CAEA;;AACA,IAAMC,eAAe,GAAG,CAAC,CAAzB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,IAAX,CAAgB,IAAhB,EAAsB,gCAAtB,EAAwDF,EAAxD,CAAP;AACD;;AAED,aAAKJ,UAAL,GAAkBO,IAAI,CAACC,KAAL,CAAWC,CAAX,CAAlB;;AAEA,YAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtGI;AAzCa,GAAP;AAAA,C","sourcesContent":["import { PNG } from \"pngjs\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/png\";\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"png\"] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH,\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE](data) {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height,\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === \"number\"\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba,\n });\n },\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== \"number\") {\n return throwError.call(this, \"l must be a number\", cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, \"l must be a number 0 - 9\", cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, \"s must be a number 0 - 3\", cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n \"n must be -1 (auto) or a number 0 - 4\",\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, \"s must be a number 0, 2, 4, 6.\", cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/png/index.d.ts b/node_modules/@jimp/png/index.d.ts new file mode 100644 index 00000000..52bcda0c --- /dev/null +++ b/node_modules/@jimp/png/index.d.ts @@ -0,0 +1,40 @@ +import { DecoderFn, EncoderFn, ImageCallback } from "@jimp/core"; + +interface PNGClass { + _deflateLevel: number; + _deflateStrategy: number; + _filterType: number; + _colorType: number; + deflateLevel(l: number, cb?: ImageCallback): this; + deflateStrategy(s: number, cb?: ImageCallback): this; + filterType(f: number, cb?: ImageCallback): this; + colorType(s: number, cb?: ImageCallback): this; +} + +interface PNG { + mime: { "image/png": string[] }; + + hasAlpha: { "image/png": true }; + + decoders: { + "image/png": DecoderFn; + }; + encoders: { + "image/png": EncoderFn; + }; + + class: PNGClass; + + constants: { + MIME_PNG: "image/png"; + // PNG filter types + PNG_FILTER_AUTO: -1; + PNG_FILTER_NONE: 0; + PNG_FILTER_SUB: 1; + PNG_FILTER_UP: 2; + PNG_FILTER_AVERAGE: 3; + PNG_FILTER_PATH: 4; + }; +} + +export default function (): PNG; diff --git a/node_modules/@jimp/png/package.json b/node_modules/@jimp/png/package.json new file mode 100644 index 00000000..eb0b0c68 --- /dev/null +++ b/node_modules/@jimp/png/package.json @@ -0,0 +1,38 @@ +{ + "name": "@jimp/png", + "version": "0.16.13", + "description": "Default Jimp png encoder/decoder.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "pngjs": "^3.3.3" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/png/src/index.js b/node_modules/@jimp/png/src/index.js new file mode 100644 index 00000000..5a337f8b --- /dev/null +++ b/node_modules/@jimp/png/src/index.js @@ -0,0 +1,159 @@ +import { PNG } from "pngjs"; +import { throwError, isNodePattern } from "@jimp/utils"; + +const MIME_TYPE = "image/png"; + +// PNG filter types +const PNG_FILTER_AUTO = -1; +const PNG_FILTER_NONE = 0; +const PNG_FILTER_SUB = 1; +const PNG_FILTER_UP = 2; +const PNG_FILTER_AVERAGE = 3; +const PNG_FILTER_PATH = 4; + +export default () => ({ + mime: { [MIME_TYPE]: ["png"] }, + + constants: { + MIME_PNG: MIME_TYPE, + PNG_FILTER_AUTO, + PNG_FILTER_NONE, + PNG_FILTER_SUB, + PNG_FILTER_UP, + PNG_FILTER_AVERAGE, + PNG_FILTER_PATH, + }, + + hasAlpha: { [MIME_TYPE]: true }, + decoders: { [MIME_TYPE]: PNG.sync.read }, + encoders: { + [MIME_TYPE](data) { + const png = new PNG({ + width: data.bitmap.width, + height: data.bitmap.height, + }); + + png.data = data.bitmap.data; + + return PNG.sync.write(png, { + width: data.bitmap.width, + height: data.bitmap.height, + deflateLevel: data._deflateLevel, + deflateStrategy: data._deflateStrategy, + filterType: data._filterType, + colorType: + typeof data._colorType === "number" + ? data._colorType + : data._rgba + ? 6 + : 2, + inputHasAlpha: data._rgba, + }); + }, + }, + + class: { + _deflateLevel: 9, + _deflateStrategy: 3, + _filterType: PNG_FILTER_AUTO, + _colorType: null, + + /** + * Sets the deflate level used when saving as PNG format (default is 9) + * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateLevel(l, cb) { + if (typeof l !== "number") { + return throwError.call(this, "l must be a number", cb); + } + + if (l < 0 || l > 9) { + return throwError.call(this, "l must be a number 0 - 9", cb); + } + + this._deflateLevel = Math.round(l); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Sets the deflate strategy used when saving as PNG format (default is 3) + * @param {number} s Deflate strategy to use 0-3. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateStrategy(s, cb) { + if (typeof s !== "number") { + return throwError.call(this, "s must be a number", cb); + } + + if (s < 0 || s > 3) { + return throwError.call(this, "s must be a number 0 - 3", cb); + } + + this._deflateStrategy = Math.round(s); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + + /** + * Sets the filter type used when saving as PNG format (default is automatic filters) + * @param {number} f The quality to use -1-4. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + filterType(f, cb) { + if (typeof f !== "number") { + return throwError.call(this, "n must be a number", cb); + } + + if (f < -1 || f > 4) { + return throwError.call( + this, + "n must be -1 (auto) or a number 0 - 4", + cb + ); + } + + this._filterType = Math.round(f); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + /** + * Sets the color type used when saving as PNG format + * @param {number} s color type to use 0, 2, 4, 6. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ colorType(s, cb) { + if (typeof s !== "number") { + return throwError.call(this, "s must be a number", cb); + } + + if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { + return throwError.call(this, "s must be a number 0, 2, 4, 6.", cb); + } + + this._colorType = Math.round(s); + + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + + return this; + }, + }, +}); diff --git a/project starter code/node_modules/@jimp/png/test/images/dice.png b/node_modules/@jimp/png/test/images/dice.png similarity index 100% rename from project starter code/node_modules/@jimp/png/test/images/dice.png rename to node_modules/@jimp/png/test/images/dice.png diff --git a/project starter code/node_modules/@jimp/png/test/images/options.png b/node_modules/@jimp/png/test/images/options.png similarity index 100% rename from project starter code/node_modules/@jimp/png/test/images/options.png rename to node_modules/@jimp/png/test/images/options.png diff --git a/node_modules/@jimp/png/test/png.test.js b/node_modules/@jimp/png/test/png.test.js new file mode 100644 index 00000000..cad4a49b --- /dev/null +++ b/node_modules/@jimp/png/test/png.test.js @@ -0,0 +1,60 @@ +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import png from "../src"; + +const jimp = configure({ types: [png] }, Jimp); + +describe("PNG", () => { + const imagesDir = getTestDir(__dirname) + "/images"; + + it("load PNG", async () => { + const image = await jimp.read(imagesDir + "/dice.png"); + + image.getPixelColor(10, 10).should.be.equal(0x00000000); + image.getPixelColor(160, 80).should.be.equal(0x1c1cd4ff); + image.getPixelColor(400, 250).should.be.equal(0x7e0c0cda); + }); + + it("export PNG", async () => { + const jgd = await jimp.read({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + const buffer = await jgd.getBufferAsync("image/png"); + + buffer.toString().should.match(/^.PNG\r\n/); + }); + + it("should use png options", async () => { + const jgd = await jimp.read({ + width: 20, + height: 20, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff, + 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff, + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff, + 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + + const image = await jgd + .deflateStrategy(0) + .colorType(0) + .getBufferAsync(Jimp.MIME_PNG); + + const expected = await jimp.read(imagesDir + "/options.png"); + const expectedBuffer = await expected + .deflateStrategy(0) + .colorType(0) + .getBufferAsync(Jimp.MIME_PNG); + + image.should.be.deepEqual(expectedBuffer); + }); +}); diff --git a/node_modules/@jimp/tiff/CHANGELOG.md b/node_modules/@jimp/tiff/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/tiff/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/tiff/LICENSE b/node_modules/@jimp/tiff/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/tiff/LICENSE rename to node_modules/@jimp/tiff/LICENSE diff --git a/project starter code/node_modules/@jimp/tiff/README.md b/node_modules/@jimp/tiff/README.md similarity index 100% rename from project starter code/node_modules/@jimp/tiff/README.md rename to node_modules/@jimp/tiff/README.md diff --git a/node_modules/@jimp/tiff/dist/index.js b/node_modules/@jimp/tiff/dist/index.js new file mode 100644 index 00000000..9eeca7e2 --- /dev/null +++ b/node_modules/@jimp/tiff/dist/index.js @@ -0,0 +1,47 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _utif = _interopRequireDefault(require("utif")); + +var MIME_TYPE = "image/tiff"; + +var _default = function _default() { + return { + mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ["tiff", "tif"]), + constants: { + MIME_TIFF: MIME_TYPE + }, + decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { + var ifds = _utif["default"].decode(data); + + var page = ifds[0]; + + _utif["default"].decodeImages(data, ifds); + + var rgba = _utif["default"].toRGBA8(page); + + return { + data: Buffer.from(rgba), + width: page.t256[0], + height: page.t257[0] + }; + }), + encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { + var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); + + return Buffer.from(tiff); + }) + }; +}; + +exports["default"] = _default; +module.exports = exports.default; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/tiff/dist/index.js.map b/node_modules/@jimp/tiff/dist/index.js.map new file mode 100644 index 00000000..743e3f19 --- /dev/null +++ b/node_modules/@jimp/tiff/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAACK,IAAD,EAAU;AACrB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAACoB,KAAD,EAAW;AACtB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from \"utif\";\n\nconst MIME_TYPE = \"image/tiff\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"tiff\", \"tif\"] },\n\n constants: {\n MIME_TIFF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0],\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (image) => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n },\n },\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/tiff/index.d.ts b/node_modules/@jimp/tiff/index.d.ts new file mode 100644 index 00000000..851d7383 --- /dev/null +++ b/node_modules/@jimp/tiff/index.d.ts @@ -0,0 +1,16 @@ +import { DecoderFn, EncoderFn } from "@jimp/core"; + +interface Tiff { + mime: { "image/tiff": string[] }; + decoders: { + "image/tiff": DecoderFn; + }; + encoders: { + "image/tiff": EncoderFn; + }; + constants: { + MIME_TIFF: "image/tiff"; + }; +} + +export default function (): Tiff; diff --git a/node_modules/@jimp/tiff/package.json b/node_modules/@jimp/tiff/package.json new file mode 100644 index 00000000..be7b1c1e --- /dev/null +++ b/node_modules/@jimp/tiff/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jimp/tiff", + "version": "0.16.13", + "description": "Default Jimp tiff encoder/decoder.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "utif": "^2.0.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@jimp/custom": "^0.16.13", + "@jimp/test-utils": "^0.16.13" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/tiff/src/index.js b/node_modules/@jimp/tiff/src/index.js new file mode 100644 index 00000000..9035f80d --- /dev/null +++ b/node_modules/@jimp/tiff/src/index.js @@ -0,0 +1,38 @@ +import UTIF from "utif"; + +const MIME_TYPE = "image/tiff"; + +export default () => ({ + mime: { [MIME_TYPE]: ["tiff", "tif"] }, + + constants: { + MIME_TIFF: MIME_TYPE, + }, + + decoders: { + [MIME_TYPE]: (data) => { + const ifds = UTIF.decode(data); + const page = ifds[0]; + UTIF.decodeImages(data, ifds); + const rgba = UTIF.toRGBA8(page); + + return { + data: Buffer.from(rgba), + width: page.t256[0], + height: page.t257[0], + }; + }, + }, + + encoders: { + [MIME_TYPE]: (image) => { + const tiff = UTIF.encodeImage( + image.bitmap.data, + image.bitmap.width, + image.bitmap.height + ); + + return Buffer.from(tiff); + }, + }, +}); diff --git a/project starter code/node_modules/@jimp/tiff/test/images/rgb.tiff b/node_modules/@jimp/tiff/test/images/rgb.tiff similarity index 100% rename from project starter code/node_modules/@jimp/tiff/test/images/rgb.tiff rename to node_modules/@jimp/tiff/test/images/rgb.tiff diff --git a/node_modules/@jimp/tiff/test/tiff.test.js b/node_modules/@jimp/tiff/test/tiff.test.js new file mode 100644 index 00000000..05211f28 --- /dev/null +++ b/node_modules/@jimp/tiff/test/tiff.test.js @@ -0,0 +1,34 @@ +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; + +import tiff from "../src"; + +const jimp = configure({ types: [tiff] }, Jimp); + +describe("TIFF", () => { + const imagesDir = getTestDir(__dirname) + "/images"; + + it("load TIFF", async () => { + const image = await jimp.read(imagesDir + "/rgb.tiff"); + + image.getPixelColor(10, 10).should.be.equal(0xa4988bff); + image.getPixelColor(220, 190).should.be.equal(0xe0d7ddff); + image.getPixelColor(350, 130).should.be.equal(0x565433ff); + }); + + const simpleJGD = { + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }; + + it("export TIFF", async () => { + const image = await jimp.read(simpleJGD); + const buffer = await image.getBufferAsync("image/tiff"); + + buffer.toString().should.match(/^MM\u0000*\u0000/); + }); +}); diff --git a/node_modules/@jimp/types/CHANGELOG.md b/node_modules/@jimp/types/CHANGELOG.md new file mode 100644 index 00000000..4eb3193f --- /dev/null +++ b/node_modules/@jimp/types/CHANGELOG.md @@ -0,0 +1,35 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/types/LICENSE b/node_modules/@jimp/types/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/types/LICENSE rename to node_modules/@jimp/types/LICENSE diff --git a/project starter code/node_modules/@jimp/types/README.md b/node_modules/@jimp/types/README.md similarity index 100% rename from project starter code/node_modules/@jimp/types/README.md rename to node_modules/@jimp/types/README.md diff --git a/project starter code/node_modules/@jimp/types/dist/index.js b/node_modules/@jimp/types/dist/index.js similarity index 100% rename from project starter code/node_modules/@jimp/types/dist/index.js rename to node_modules/@jimp/types/dist/index.js diff --git a/node_modules/@jimp/types/dist/index.js.map b/node_modules/@jimp/types/dist/index.js.map new file mode 100644 index 00000000..2017bb5d --- /dev/null +++ b/node_modules/@jimp/types/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport jpeg from \"@jimp/jpeg\";\nimport png from \"@jimp/png\";\nimport bmp from \"@jimp/bmp\";\nimport tiff from \"@jimp/tiff\";\nimport gif from \"@jimp/gif\";\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/types/index.d.ts b/node_modules/@jimp/types/index.d.ts new file mode 100644 index 00000000..98f0cceb --- /dev/null +++ b/node_modules/@jimp/types/index.d.ts @@ -0,0 +1,23 @@ +import jpeg from "@jimp/jpeg"; +import png from "@jimp/png"; +import bmp from "@jimp/bmp"; +import tiff from "@jimp/tiff"; +import gif from "@jimp/gif"; + +type JpegRet = ReturnType; +type PngRet = ReturnType; +type BmpRet = ReturnType; +type TiffRet = ReturnType; +type GifRet = ReturnType; + +/** + * This is made union and not intersection to avoid issues with + * `IllformedPlugin` and `WellFormedPlugin` when using typings with Jimp + * generic + * + * In reality, this should be an intersection but our type data isn't + * clever enough to figure out what's a class and what's not/etc + */ +type Types = JpegRet | PngRet | BmpRet | TiffRet | GifRet; + +export default function (): Types; diff --git a/node_modules/@jimp/types/package.json b/node_modules/@jimp/types/package.json new file mode 100644 index 00000000..752b6936 --- /dev/null +++ b/node_modules/@jimp/types/package.json @@ -0,0 +1,38 @@ +{ + "name": "@jimp/types", + "version": "0.16.13", + "description": "Default Jimp encoder/decoders.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/bmp": "^0.16.13", + "@jimp/gif": "^0.16.13", + "@jimp/jpeg": "^0.16.13", + "@jimp/png": "^0.16.13", + "@jimp/tiff": "^0.16.13", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + }, + "devDependencies": { + "@types/node": "^12.7.5" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/types/src/index.js b/node_modules/@jimp/types/src/index.js new file mode 100644 index 00000000..1f6eb528 --- /dev/null +++ b/node_modules/@jimp/types/src/index.js @@ -0,0 +1,9 @@ +import { mergeDeep } from "timm"; + +import jpeg from "@jimp/jpeg"; +import png from "@jimp/png"; +import bmp from "@jimp/bmp"; +import tiff from "@jimp/tiff"; +import gif from "@jimp/gif"; + +export default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif()); diff --git a/node_modules/@jimp/utils/CHANGELOG.md b/node_modules/@jimp/utils/CHANGELOG.md new file mode 100644 index 00000000..b4af2eee --- /dev/null +++ b/node_modules/@jimp/utils/CHANGELOG.md @@ -0,0 +1,46 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `master` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.10.1 (Sun Apr 05 2020) + +#### 🐛 Bug Fix + +- Update package.json [#870](https://github.com/oliver-moran/jimp/pull/870) ([@arcanis](https://github.com/arcanis)) + +#### Authors: 1 + +- Maël Nison ([@arcanis](https://github.com/arcanis)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/utils/LICENSE b/node_modules/@jimp/utils/LICENSE similarity index 100% rename from project starter code/node_modules/@jimp/utils/LICENSE rename to node_modules/@jimp/utils/LICENSE diff --git a/node_modules/@jimp/utils/README.md b/node_modules/@jimp/utils/README.md new file mode 100644 index 00000000..51a52c4d --- /dev/null +++ b/node_modules/@jimp/utils/README.md @@ -0,0 +1,70 @@ +
+ +

@jimp/utils

+

Utils for jimp extensions.

+
+ +## Available Methods + +### isNodePattern + +Determines if function was passed an node callback. + +```js +if (isNodePattern(cb)) { + cb.call(this, null, this); +} +``` + +### throwError + +Either throws the error or calls the callback with the error. + +```js +if (/* check for error */) { + return throwError.call(this, 'someError', cb); +} +``` + +### scan + +Scans through a region of the bitmap, calling a function for each pixel. + +```js +function removeRed(image) { + return scan( + image, + 0, + 0, + image.bitmap.width, + image.bitmap.height, + function (x, y, index) { + const red = this.bitmap.data[index + 0]; + const green = this.bitmap.data[index + 1]; + const blue = this.bitmap.data[index + 2]; + const alpha = this.bitmap.data[index + 3]; + + this.bitmap.data[index + 0] = 0; + this.bitmap.data[index + 1] = green; + this.bitmap.data[index + 2] = blue; + this.bitmap.data[index + 3] = alpha; + } + ); +} +``` + +### scanIterator + +It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication: + +```js +for (const { x, y, idx, image } of scanIterator( + image, + 0, + 0, + image.bitmap.width, + image.bitmap.height +)) { +} +``` diff --git a/node_modules/@jimp/utils/dist/index.js b/node_modules/@jimp/utils/dist/index.js new file mode 100644 index 00000000..dc9992b7 --- /dev/null +++ b/node_modules/@jimp/utils/dist/index.js @@ -0,0 +1,114 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isNodePattern = isNodePattern; +exports.throwError = throwError; +exports.scan = scan; +exports.scanIterator = scanIterator; + +var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); + +var _marked = +/*#__PURE__*/ +_regenerator["default"].mark(scanIterator); + +function isNodePattern(cb) { + if (typeof cb === "undefined") { + return false; + } + + if (typeof cb !== "function") { + throw new TypeError("Callback must be a function"); + } + + return true; +} + +function throwError(error, cb) { + if (typeof error === "string") { + error = new Error(error); + } + + if (typeof cb === "function") { + return cb.call(this, error); + } + + throw error; +} + +function scan(image, x, y, w, h, f) { + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + + for (var _y = y; _y < y + h; _y++) { + for (var _x = x; _x < x + w; _x++) { + var idx = image.bitmap.width * _y + _x << 2; + f.call(image, _x, _y, idx); + } + } + + return image; +} + +function scanIterator(image, x, y, w, h) { + var _y, _x, idx; + + return _regenerator["default"].wrap(function scanIterator$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + _y = y; + + case 5: + if (!(_y < y + h)) { + _context.next = 17; + break; + } + + _x = x; + + case 7: + if (!(_x < x + w)) { + _context.next = 14; + break; + } + + idx = image.bitmap.width * _y + _x << 2; + _context.next = 11; + return { + x: _x, + y: _y, + idx: idx, + image: image + }; + + case 11: + _x++; + _context.next = 7; + break; + + case 14: + _y++; + _context.next = 5; + break; + + case 17: + case "end": + return _context.stop(); + } + } + }, _marked); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/utils/dist/index.js.map b/node_modules/@jimp/utils/dist/index.js.map new file mode 100644 index 00000000..25e5db6a --- /dev/null +++ b/node_modules/@jimp/utils/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,WAAlB,EAA+B;AAC7B,WAAO,KAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,6BAAd,CAAN;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAASC,UAAT,CAAoBC,KAApB,EAA2BH,EAA3B,EAA+B;AACpC,MAAI,OAAOG,KAAP,KAAiB,QAArB,EAA+B;AAC7BA,IAAAA,KAAK,GAAG,IAAIC,KAAJ,CAAUD,KAAV,CAAR;AACD;;AAED,MAAI,OAAOH,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAcF,KAAd,CAAP;AACD;;AAED,QAAMA,KAAN;AACD;;AAEM,SAASG,IAAT,CAAcC,KAAd,EAAqBC,CAArB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAA8BC,CAA9B,EAAiCC,CAAjC,EAAoC;AACzC;AACAJ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R,CARX;;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === \"undefined\") {\n return false;\n }\n\n if (typeof cb !== \"function\") {\n throw new TypeError(\"Callback must be a function\");\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === \"string\") {\n error = new Error(error);\n }\n\n if (typeof cb === \"function\") {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/node_modules/@jimp/utils/index.d.ts b/node_modules/@jimp/utils/index.d.ts new file mode 100644 index 00000000..612e9fce --- /dev/null +++ b/node_modules/@jimp/utils/index.d.ts @@ -0,0 +1,19 @@ +import { Image, Omit } from "@jimp/core"; +import { ThrowStatement } from "typescript"; + +export function isNodePattern(cb: Function): true; +export function isNodePattern(cb: Omit): false; + +export function throwError( + error: string | Error, + cb?: (err: Error) => void +): ThrowStatement; + +export function scan( + image: Image, + x: number, + y: number, + w: number, + h: number, + f: (image: Image, _x: number, _y: number, idx: number) => void +): Image; diff --git a/node_modules/@jimp/utils/package.json b/node_modules/@jimp/utils/package.json new file mode 100644 index 00000000..a9a6418e --- /dev/null +++ b/node_modules/@jimp/utils/package.json @@ -0,0 +1,27 @@ +{ + "name": "@jimp/utils", + "version": "0.16.13", + "description": "Utils for jimp extensions.", + "main": "dist/index.js", + "module": "es/index.js", + "types": "index.d.ts", + "scripts": { + "build": "npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node" + }, + "author": "", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@babel/runtime": "^7.7.2", + "regenerator-runtime": "^0.13.3" + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/@jimp/utils/src/index.js b/node_modules/@jimp/utils/src/index.js new file mode 100644 index 00000000..723f2114 --- /dev/null +++ b/node_modules/@jimp/utils/src/index.js @@ -0,0 +1,55 @@ +export function isNodePattern(cb) { + if (typeof cb === "undefined") { + return false; + } + + if (typeof cb !== "function") { + throw new TypeError("Callback must be a function"); + } + + return true; +} + +export function throwError(error, cb) { + if (typeof error === "string") { + error = new Error(error); + } + + if (typeof cb === "function") { + return cb.call(this, error); + } + + throw error; +} + +export function scan(image, x, y, w, h, f) { + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + + for (let _y = y; _y < y + h; _y++) { + for (let _x = x; _x < x + w; _x++) { + const idx = (image.bitmap.width * _y + _x) << 2; + f.call(image, _x, _y, idx); + } + } + + return image; +} + +export function* scanIterator(image, x, y, w, h) { + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + + for (let _y = y; _y < y + h; _y++) { + for (let _x = x; _x < x + w; _x++) { + const idx = (image.bitmap.width * _y + _x) << 2; + yield { x: _x, y: _y, idx, image }; + } + } +} diff --git a/node_modules/@tokenizer/token/README.md b/node_modules/@tokenizer/token/README.md new file mode 100644 index 00000000..1c1ba324 --- /dev/null +++ b/node_modules/@tokenizer/token/README.md @@ -0,0 +1,19 @@ +[![npm version](https://badge.fury.io/js/%40tokenizer%2Ftoken.svg)](https://www.npmjs.com/package/@tokenizer/token) +[![npm downloads](http://img.shields.io/npm/dm/@tokenizer/token.svg)](https://npmcharts.com/compare/@tokenizer/token?interval=30) + +# @tokenizer/token + +TypeScript definition of an [strtok3](https://github.com/Borewit/strtok3) token. + +## Licence + +(The MIT License) + +Copyright (c) 2020 Borewit + +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. + diff --git a/node_modules/@tokenizer/token/index.d.ts b/node_modules/@tokenizer/token/index.d.ts new file mode 100644 index 00000000..d6c8122e --- /dev/null +++ b/node_modules/@tokenizer/token/index.d.ts @@ -0,0 +1,30 @@ +/** + * Read-only token + * See https://github.com/Borewit/strtok3 for more information + */ +export interface IGetToken { + + /** + * Length of encoded token in bytes + */ + len: number; + + /** + * Decode value from buffer at offset + * @param array - Uint8Array to read the decoded value from + * @param offset - Decode offset + * @return decoded value + */ + get(array: Array, offset: number): Value; +} + +export interface IToken extends IGetToken { + /** + * Encode value to buffer + * @param array - Uint8Array to write the encoded value to + * @param offset - Buffer write offset + * @param value - Value to decode of type T + * @return offset plus number of bytes written + */ + put(array: Array, offset: number, value: Value): number +} diff --git a/node_modules/@tokenizer/token/package.json b/node_modules/@tokenizer/token/package.json new file mode 100644 index 00000000..ad87e5bb --- /dev/null +++ b/node_modules/@tokenizer/token/package.json @@ -0,0 +1,33 @@ +{ + "name": "@tokenizer/token", + "version": "0.3.0", + "description": "TypeScript definition for strtok3 token", + "main": "", + "types": "index.d.ts", + "files": [ + "index.d.ts" + ], + "keywords": [ + "token", + "interface", + "tokenizer", + "TypeScript" + ], + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Borewit/tokenizer-token.git" + }, + "bugs": { + "url": "https://github.com/Borewit/tokenizer-token/issues" + }, + "typeScriptVersion": "3.0", + "dependencies": {}, + "devDependencies": { + "@types/node": "^13.1.0" + } +} diff --git a/project starter code/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE similarity index 100% rename from project starter code/node_modules/@types/node/LICENSE rename to node_modules/@types/node/LICENSE diff --git a/project starter code/node_modules/@types/node/README.md b/node_modules/@types/node/README.md similarity index 100% rename from project starter code/node_modules/@types/node/README.md rename to node_modules/@types/node/README.md diff --git a/project starter code/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/assert.d.ts rename to node_modules/@types/node/assert.d.ts diff --git a/project starter code/node_modules/@types/node/assert/strict.d.ts b/node_modules/@types/node/assert/strict.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/assert/strict.d.ts rename to node_modules/@types/node/assert/strict.d.ts diff --git a/project starter code/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/async_hooks.d.ts rename to node_modules/@types/node/async_hooks.d.ts diff --git a/project starter code/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/buffer.d.ts rename to node_modules/@types/node/buffer.d.ts diff --git a/project starter code/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/child_process.d.ts rename to node_modules/@types/node/child_process.d.ts diff --git a/project starter code/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/cluster.d.ts rename to node_modules/@types/node/cluster.d.ts diff --git a/project starter code/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/console.d.ts rename to node_modules/@types/node/console.d.ts diff --git a/project starter code/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/constants.d.ts rename to node_modules/@types/node/constants.d.ts diff --git a/project starter code/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/crypto.d.ts rename to node_modules/@types/node/crypto.d.ts diff --git a/project starter code/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/dgram.d.ts rename to node_modules/@types/node/dgram.d.ts diff --git a/project starter code/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/diagnostics_channel.d.ts rename to node_modules/@types/node/diagnostics_channel.d.ts diff --git a/project starter code/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/dns.d.ts rename to node_modules/@types/node/dns.d.ts diff --git a/project starter code/node_modules/@types/node/dns/promises.d.ts b/node_modules/@types/node/dns/promises.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/dns/promises.d.ts rename to node_modules/@types/node/dns/promises.d.ts diff --git a/project starter code/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/domain.d.ts rename to node_modules/@types/node/domain.d.ts diff --git a/project starter code/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/events.d.ts rename to node_modules/@types/node/events.d.ts diff --git a/project starter code/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/fs.d.ts rename to node_modules/@types/node/fs.d.ts diff --git a/project starter code/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/fs/promises.d.ts rename to node_modules/@types/node/fs/promises.d.ts diff --git a/project starter code/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/globals.d.ts rename to node_modules/@types/node/globals.d.ts diff --git a/project starter code/node_modules/@types/node/globals.global.d.ts b/node_modules/@types/node/globals.global.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/globals.global.d.ts rename to node_modules/@types/node/globals.global.d.ts diff --git a/project starter code/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/http.d.ts rename to node_modules/@types/node/http.d.ts diff --git a/project starter code/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/http2.d.ts rename to node_modules/@types/node/http2.d.ts diff --git a/project starter code/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/https.d.ts rename to node_modules/@types/node/https.d.ts diff --git a/project starter code/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/index.d.ts rename to node_modules/@types/node/index.d.ts diff --git a/project starter code/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/inspector.d.ts rename to node_modules/@types/node/inspector.d.ts diff --git a/project starter code/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/module.d.ts rename to node_modules/@types/node/module.d.ts diff --git a/project starter code/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/net.d.ts rename to node_modules/@types/node/net.d.ts diff --git a/project starter code/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/os.d.ts rename to node_modules/@types/node/os.d.ts diff --git a/project starter code/node_modules/@types/node/package.json b/node_modules/@types/node/package.json similarity index 100% rename from project starter code/node_modules/@types/node/package.json rename to node_modules/@types/node/package.json diff --git a/project starter code/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/path.d.ts rename to node_modules/@types/node/path.d.ts diff --git a/project starter code/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/perf_hooks.d.ts rename to node_modules/@types/node/perf_hooks.d.ts diff --git a/project starter code/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/process.d.ts rename to node_modules/@types/node/process.d.ts diff --git a/project starter code/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/punycode.d.ts rename to node_modules/@types/node/punycode.d.ts diff --git a/project starter code/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/querystring.d.ts rename to node_modules/@types/node/querystring.d.ts diff --git a/project starter code/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/readline.d.ts rename to node_modules/@types/node/readline.d.ts diff --git a/project starter code/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/repl.d.ts rename to node_modules/@types/node/repl.d.ts diff --git a/project starter code/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/stream.d.ts rename to node_modules/@types/node/stream.d.ts diff --git a/project starter code/node_modules/@types/node/stream/consumers.d.ts b/node_modules/@types/node/stream/consumers.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/stream/consumers.d.ts rename to node_modules/@types/node/stream/consumers.d.ts diff --git a/project starter code/node_modules/@types/node/stream/promises.d.ts b/node_modules/@types/node/stream/promises.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/stream/promises.d.ts rename to node_modules/@types/node/stream/promises.d.ts diff --git a/project starter code/node_modules/@types/node/stream/web.d.ts b/node_modules/@types/node/stream/web.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/stream/web.d.ts rename to node_modules/@types/node/stream/web.d.ts diff --git a/project starter code/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/string_decoder.d.ts rename to node_modules/@types/node/string_decoder.d.ts diff --git a/project starter code/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/timers.d.ts rename to node_modules/@types/node/timers.d.ts diff --git a/project starter code/node_modules/@types/node/timers/promises.d.ts b/node_modules/@types/node/timers/promises.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/timers/promises.d.ts rename to node_modules/@types/node/timers/promises.d.ts diff --git a/project starter code/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/tls.d.ts rename to node_modules/@types/node/tls.d.ts diff --git a/project starter code/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/trace_events.d.ts rename to node_modules/@types/node/trace_events.d.ts diff --git a/project starter code/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/tty.d.ts rename to node_modules/@types/node/tty.d.ts diff --git a/project starter code/node_modules/@types/node/url.d.ts b/node_modules/@types/node/url.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/url.d.ts rename to node_modules/@types/node/url.d.ts diff --git a/project starter code/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/util.d.ts rename to node_modules/@types/node/util.d.ts diff --git a/project starter code/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/v8.d.ts rename to node_modules/@types/node/v8.d.ts diff --git a/project starter code/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/vm.d.ts rename to node_modules/@types/node/vm.d.ts diff --git a/project starter code/node_modules/@types/node/wasi.d.ts b/node_modules/@types/node/wasi.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/wasi.d.ts rename to node_modules/@types/node/wasi.d.ts diff --git a/project starter code/node_modules/@types/node/worker_threads.d.ts b/node_modules/@types/node/worker_threads.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/worker_threads.d.ts rename to node_modules/@types/node/worker_threads.d.ts diff --git a/project starter code/node_modules/@types/node/zlib.d.ts b/node_modules/@types/node/zlib.d.ts similarity index 100% rename from project starter code/node_modules/@types/node/zlib.d.ts rename to node_modules/@types/node/zlib.d.ts diff --git a/project starter code/node_modules/accepts/HISTORY.md b/node_modules/accepts/HISTORY.md similarity index 100% rename from project starter code/node_modules/accepts/HISTORY.md rename to node_modules/accepts/HISTORY.md diff --git a/project starter code/node_modules/accepts/LICENSE b/node_modules/accepts/LICENSE similarity index 100% rename from project starter code/node_modules/accepts/LICENSE rename to node_modules/accepts/LICENSE diff --git a/project starter code/node_modules/accepts/README.md b/node_modules/accepts/README.md similarity index 100% rename from project starter code/node_modules/accepts/README.md rename to node_modules/accepts/README.md diff --git a/project starter code/node_modules/accepts/index.js b/node_modules/accepts/index.js similarity index 100% rename from project starter code/node_modules/accepts/index.js rename to node_modules/accepts/index.js diff --git a/project starter code/node_modules/accepts/package.json b/node_modules/accepts/package.json similarity index 100% rename from project starter code/node_modules/accepts/package.json rename to node_modules/accepts/package.json diff --git a/project starter code/node_modules/any-base/LICENSE b/node_modules/any-base/LICENSE similarity index 100% rename from project starter code/node_modules/any-base/LICENSE rename to node_modules/any-base/LICENSE diff --git a/project starter code/node_modules/any-base/README.md b/node_modules/any-base/README.md similarity index 100% rename from project starter code/node_modules/any-base/README.md rename to node_modules/any-base/README.md diff --git a/project starter code/node_modules/any-base/dist/any-base.js b/node_modules/any-base/dist/any-base.js similarity index 100% rename from project starter code/node_modules/any-base/dist/any-base.js rename to node_modules/any-base/dist/any-base.js diff --git a/project starter code/node_modules/any-base/dist/any-base.min.js b/node_modules/any-base/dist/any-base.min.js similarity index 100% rename from project starter code/node_modules/any-base/dist/any-base.min.js rename to node_modules/any-base/dist/any-base.min.js diff --git a/project starter code/node_modules/any-base/index.js b/node_modules/any-base/index.js similarity index 100% rename from project starter code/node_modules/any-base/index.js rename to node_modules/any-base/index.js diff --git a/project starter code/node_modules/any-base/package.json b/node_modules/any-base/package.json similarity index 100% rename from project starter code/node_modules/any-base/package.json rename to node_modules/any-base/package.json diff --git a/project starter code/node_modules/any-base/src/converter.js b/node_modules/any-base/src/converter.js similarity index 100% rename from project starter code/node_modules/any-base/src/converter.js rename to node_modules/any-base/src/converter.js diff --git a/project starter code/node_modules/array-flatten/LICENSE b/node_modules/array-flatten/LICENSE similarity index 100% rename from project starter code/node_modules/array-flatten/LICENSE rename to node_modules/array-flatten/LICENSE diff --git a/project starter code/node_modules/array-flatten/README.md b/node_modules/array-flatten/README.md similarity index 100% rename from project starter code/node_modules/array-flatten/README.md rename to node_modules/array-flatten/README.md diff --git a/project starter code/node_modules/array-flatten/array-flatten.js b/node_modules/array-flatten/array-flatten.js similarity index 100% rename from project starter code/node_modules/array-flatten/array-flatten.js rename to node_modules/array-flatten/array-flatten.js diff --git a/project starter code/node_modules/array-flatten/package.json b/node_modules/array-flatten/package.json similarity index 100% rename from project starter code/node_modules/array-flatten/package.json rename to node_modules/array-flatten/package.json diff --git a/node_modules/asynckit/LICENSE b/node_modules/asynckit/LICENSE new file mode 100644 index 00000000..c9eca5dd --- /dev/null +++ b/node_modules/asynckit/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Alex Indigo + +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. diff --git a/node_modules/asynckit/README.md b/node_modules/asynckit/README.md new file mode 100644 index 00000000..ddcc7e6b --- /dev/null +++ b/node_modules/asynckit/README.md @@ -0,0 +1,233 @@ +# asynckit [![NPM Module](https://img.shields.io/npm/v/asynckit.svg?style=flat)](https://www.npmjs.com/package/asynckit) + +Minimal async jobs utility library, with streams support. + +[![PhantomJS Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=browser&style=flat)](https://travis-ci.org/alexindigo/asynckit) +[![Linux Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/asynckit) +[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit) + +[![Coverage Status](https://img.shields.io/coveralls/alexindigo/asynckit/v0.4.0.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/asynckit?branch=master) +[![Dependency Status](https://img.shields.io/david/alexindigo/asynckit/v0.4.0.svg?style=flat)](https://david-dm.org/alexindigo/asynckit) +[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/asynckit/badges/score.svg)](https://www.bithound.io/github/alexindigo/asynckit) + + + +AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects. +Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method. + +It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators. + +| compression | size | +| :----------------- | -------: | +| asynckit.js | 12.34 kB | +| asynckit.min.js | 4.11 kB | +| asynckit.min.js.gz | 1.47 kB | + + +## Install + +```sh +$ npm install --save asynckit +``` + +## Examples + +### Parallel Jobs + +Runs iterator over provided array in parallel. Stores output in the `result` array, +on the matching positions. In unlikely event of an error from one of the jobs, +will terminate rest of the active jobs (if abort function is provided) +and return error along with salvaged data to the main callback function. + +#### Input Array + +```javascript +var parallel = require('asynckit').parallel + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] + , target = [] + ; + +parallel(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// async job accepts one element from the array +// and a callback function +function asyncJob(item, cb) +{ + // different delays (in ms) per item + var delay = item * 25; + + // pretend different jobs take different time to finish + // and not in consequential order + var timeoutId = setTimeout(function() { + target.push(item); + cb(null, item * 2); + }, delay); + + // allow to cancel "leftover" jobs upon error + // return function, invoking of which will abort this job + return clearTimeout.bind(null, timeoutId); +} +``` + +More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js). + +#### Input Object + +Also it supports named jobs, listed via object. + +```javascript +var parallel = require('asynckit/parallel') + , assert = require('assert') + ; + +var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } + , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } + , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] + , expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ] + , target = [] + , keys = [] + ; + +parallel(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); + assert.deepEqual(keys, expectedKeys); +}); + +// supports full value, key, callback (shortcut) interface +function asyncJob(item, key, cb) +{ + // different delays (in ms) per item + var delay = item * 25; + + // pretend different jobs take different time to finish + // and not in consequential order + var timeoutId = setTimeout(function() { + keys.push(key); + target.push(item); + cb(null, item * 2); + }, delay); + + // allow to cancel "leftover" jobs upon error + // return function, invoking of which will abort this job + return clearTimeout.bind(null, timeoutId); +} +``` + +More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js). + +### Serial Jobs + +Runs iterator over provided array sequentially. Stores output in the `result` array, +on the matching positions. In unlikely event of an error from one of the jobs, +will not proceed to the rest of the items in the list +and return error along with salvaged data to the main callback function. + +#### Input Array + +```javascript +var serial = require('asynckit/serial') + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] + , target = [] + ; + +serial(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// extended interface (item, key, callback) +// also supported for arrays +function asyncJob(item, key, cb) +{ + target.push(key); + + // it will be automatically made async + // even it iterator "returns" in the same event loop + cb(null, item * 2); +} +``` + +More examples could be found in [test/test-serial-array.js](test/test-serial-array.js). + +#### Input Object + +Also it supports named jobs, listed via object. + +```javascript +var serial = require('asynckit').serial + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] + , target = [] + ; + +var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } + , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } + , expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , target = [] + ; + + +serial(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// shortcut interface (item, callback) +// works for object as well as for the arrays +function asyncJob(item, cb) +{ + target.push(item); + + // it will be automatically made async + // even it iterator "returns" in the same event loop + cb(null, item * 2); +} +``` + +More examples could be found in [test/test-serial-object.js](test/test-serial-object.js). + +_Note: Since _object_ is an _unordered_ collection of properties, +it may produce unexpected results with sequential iterations. +Whenever order of the jobs' execution is important please use `serialOrdered` method._ + +### Ordered Serial Iterations + +TBD + +For example [compare-property](compare-property) package. + +### Streaming interface + +TBD + +## Want to Know More? + +More examples can be found in [test folder](test/). + +Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions. + +## License + +AsyncKit is licensed under the MIT license. diff --git a/node_modules/asynckit/bench.js b/node_modules/asynckit/bench.js new file mode 100644 index 00000000..c612f1a5 --- /dev/null +++ b/node_modules/asynckit/bench.js @@ -0,0 +1,76 @@ +/* eslint no-console: "off" */ + +var asynckit = require('./') + , async = require('async') + , assert = require('assert') + , expected = 0 + ; + +var Benchmark = require('benchmark'); +var suite = new Benchmark.Suite; + +var source = []; +for (var z = 1; z < 100; z++) +{ + source.push(z); + expected += z; +} + +suite +// add tests + +.add('async.map', function(deferred) +{ + var total = 0; + + async.map(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +.add('asynckit.parallel', function(deferred) +{ + var total = 0; + + asynckit.parallel(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +// add listeners +.on('cycle', function(ev) +{ + console.log(String(ev.target)); +}) +.on('complete', function() +{ + console.log('Fastest is ' + this.filter('fastest').map('name')); +}) +// run async +.run({ 'async': true }); diff --git a/node_modules/asynckit/index.js b/node_modules/asynckit/index.js new file mode 100644 index 00000000..455f9454 --- /dev/null +++ b/node_modules/asynckit/index.js @@ -0,0 +1,6 @@ +module.exports = +{ + parallel : require('./parallel.js'), + serial : require('./serial.js'), + serialOrdered : require('./serialOrdered.js') +}; diff --git a/node_modules/asynckit/lib/abort.js b/node_modules/asynckit/lib/abort.js new file mode 100644 index 00000000..114367e5 --- /dev/null +++ b/node_modules/asynckit/lib/abort.js @@ -0,0 +1,29 @@ +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} diff --git a/node_modules/asynckit/lib/async.js b/node_modules/asynckit/lib/async.js new file mode 100644 index 00000000..7f1288a4 --- /dev/null +++ b/node_modules/asynckit/lib/async.js @@ -0,0 +1,34 @@ +var defer = require('./defer.js'); + +// API +module.exports = async; + +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; + + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); + } + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); + } + }; +} diff --git a/node_modules/asynckit/lib/defer.js b/node_modules/asynckit/lib/defer.js new file mode 100644 index 00000000..b67110c7 --- /dev/null +++ b/node_modules/asynckit/lib/defer.js @@ -0,0 +1,26 @@ +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} diff --git a/node_modules/asynckit/lib/iterate.js b/node_modules/asynckit/lib/iterate.js new file mode 100644 index 00000000..5d2839a5 --- /dev/null +++ b/node_modules/asynckit/lib/iterate.js @@ -0,0 +1,75 @@ +var async = require('./async.js') + , abort = require('./abort.js') + ; + +// API +module.exports = iterate; + +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; + + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; + } + + // clean up jobs + delete state.jobs[key]; + + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } + + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} diff --git a/node_modules/asynckit/lib/readable_asynckit.js b/node_modules/asynckit/lib/readable_asynckit.js new file mode 100644 index 00000000..78ad240f --- /dev/null +++ b/node_modules/asynckit/lib/readable_asynckit.js @@ -0,0 +1,91 @@ +var streamify = require('./streamify.js') + , defer = require('./defer.js') + ; + +// API +module.exports = ReadableAsyncKit; + +/** + * Base constructor for all streams + * used to hold properties/methods + */ +function ReadableAsyncKit() +{ + ReadableAsyncKit.super_.apply(this, arguments); + + // list of active jobs + this.jobs = {}; + + // add stream methods + this.destroy = destroy; + this._start = _start; + this._read = _read; +} + +/** + * Destroys readable stream, + * by aborting outstanding jobs + * + * @returns {void} + */ +function destroy() +{ + if (this.destroyed) + { + return; + } + + this.destroyed = true; + + if (typeof this.terminator == 'function') + { + this.terminator(); + } +} + +/** + * Starts provided jobs in async manner + * + * @private + */ +function _start() +{ + // first argument – runner function + var runner = arguments[0] + // take away first argument + , args = Array.prototype.slice.call(arguments, 1) + // second argument - input data + , input = args[0] + // last argument - result callback + , endCb = streamify.callback.call(this, args[args.length - 1]) + ; + + args[args.length - 1] = endCb; + // third argument - iterator + args[1] = streamify.iterator.call(this, args[1]); + + // allow time for proper setup + defer(function() + { + if (!this.destroyed) + { + this.terminator = runner.apply(null, args); + } + else + { + endCb(null, Array.isArray(input) ? [] : {}); + } + }.bind(this)); +} + + +/** + * Implement _read to comply with Readable streams + * Doesn't really make sense for flowing object mode + * + * @private + */ +function _read() +{ + +} diff --git a/node_modules/asynckit/lib/readable_parallel.js b/node_modules/asynckit/lib/readable_parallel.js new file mode 100644 index 00000000..5d2929f7 --- /dev/null +++ b/node_modules/asynckit/lib/readable_parallel.js @@ -0,0 +1,25 @@ +var parallel = require('../parallel.js'); + +// API +module.exports = ReadableParallel; + +/** + * Streaming wrapper to `asynckit.parallel` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableParallel(list, iterator, callback) +{ + if (!(this instanceof ReadableParallel)) + { + return new ReadableParallel(list, iterator, callback); + } + + // turn on object mode + ReadableParallel.super_.call(this, {objectMode: true}); + + this._start(parallel, list, iterator, callback); +} diff --git a/node_modules/asynckit/lib/readable_serial.js b/node_modules/asynckit/lib/readable_serial.js new file mode 100644 index 00000000..78226982 --- /dev/null +++ b/node_modules/asynckit/lib/readable_serial.js @@ -0,0 +1,25 @@ +var serial = require('../serial.js'); + +// API +module.exports = ReadableSerial; + +/** + * Streaming wrapper to `asynckit.serial` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableSerial(list, iterator, callback) +{ + if (!(this instanceof ReadableSerial)) + { + return new ReadableSerial(list, iterator, callback); + } + + // turn on object mode + ReadableSerial.super_.call(this, {objectMode: true}); + + this._start(serial, list, iterator, callback); +} diff --git a/node_modules/asynckit/lib/readable_serial_ordered.js b/node_modules/asynckit/lib/readable_serial_ordered.js new file mode 100644 index 00000000..3de89c47 --- /dev/null +++ b/node_modules/asynckit/lib/readable_serial_ordered.js @@ -0,0 +1,29 @@ +var serialOrdered = require('../serialOrdered.js'); + +// API +module.exports = ReadableSerialOrdered; +// expose sort helpers +module.exports.ascending = serialOrdered.ascending; +module.exports.descending = serialOrdered.descending; + +/** + * Streaming wrapper to `asynckit.serialOrdered` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableSerialOrdered(list, iterator, sortMethod, callback) +{ + if (!(this instanceof ReadableSerialOrdered)) + { + return new ReadableSerialOrdered(list, iterator, sortMethod, callback); + } + + // turn on object mode + ReadableSerialOrdered.super_.call(this, {objectMode: true}); + + this._start(serialOrdered, list, iterator, sortMethod, callback); +} diff --git a/node_modules/asynckit/lib/state.js b/node_modules/asynckit/lib/state.js new file mode 100644 index 00000000..cbea7ad8 --- /dev/null +++ b/node_modules/asynckit/lib/state.js @@ -0,0 +1,37 @@ +// API +module.exports = state; + +/** + * Creates initial state object + * for iteration over list + * + * @param {array|object} list - list to iterate over + * @param {function|null} sortMethod - function to use for keys sort, + * or `null` to keep them as is + * @returns {object} - initial state object + */ +function state(list, sortMethod) +{ + var isNamedList = !Array.isArray(list) + , initState = + { + index : 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs : {}, + results : isNamedList ? {} : [], + size : isNamedList ? Object.keys(list).length : list.length + } + ; + + if (sortMethod) + { + // sort array keys based on it's values + // sort object's keys just on own merit + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) + { + return sortMethod(list[a], list[b]); + }); + } + + return initState; +} diff --git a/node_modules/asynckit/lib/streamify.js b/node_modules/asynckit/lib/streamify.js new file mode 100644 index 00000000..f56a1c92 --- /dev/null +++ b/node_modules/asynckit/lib/streamify.js @@ -0,0 +1,141 @@ +var async = require('./async.js'); + +// API +module.exports = { + iterator: wrapIterator, + callback: wrapCallback +}; + +/** + * Wraps iterators with long signature + * + * @this ReadableAsyncKit# + * @param {function} iterator - function to wrap + * @returns {function} - wrapped function + */ +function wrapIterator(iterator) +{ + var stream = this; + + return function(item, key, cb) + { + var aborter + , wrappedCb = async(wrapIteratorCallback.call(stream, cb, key)) + ; + + stream.jobs[key] = wrappedCb; + + // it's either shortcut (item, cb) + if (iterator.length == 2) + { + aborter = iterator(item, wrappedCb); + } + // or long format (item, key, cb) + else + { + aborter = iterator(item, key, wrappedCb); + } + + return aborter; + }; +} + +/** + * Wraps provided callback function + * allowing to execute snitch function before + * real callback + * + * @this ReadableAsyncKit# + * @param {function} callback - function to wrap + * @returns {function} - wrapped function + */ +function wrapCallback(callback) +{ + var stream = this; + + var wrapped = function(error, result) + { + return finisher.call(stream, error, result, callback); + }; + + return wrapped; +} + +/** + * Wraps provided iterator callback function + * makes sure snitch only called once, + * but passes secondary calls to the original callback + * + * @this ReadableAsyncKit# + * @param {function} callback - callback to wrap + * @param {number|string} key - iteration key + * @returns {function} wrapped callback + */ +function wrapIteratorCallback(callback, key) +{ + var stream = this; + + return function(error, output) + { + // don't repeat yourself + if (!(key in stream.jobs)) + { + callback(error, output); + return; + } + + // clean up jobs + delete stream.jobs[key]; + + return streamer.call(stream, error, {key: key, value: output}, callback); + }; +} + +/** + * Stream wrapper for iterator callback + * + * @this ReadableAsyncKit# + * @param {mixed} error - error response + * @param {mixed} output - iterator output + * @param {function} callback - callback that expects iterator results + */ +function streamer(error, output, callback) +{ + if (error && !this.error) + { + this.error = error; + this.pause(); + this.emit('error', error); + // send back value only, as expected + callback(error, output && output.value); + return; + } + + // stream stuff + this.push(output); + + // back to original track + // send back value only, as expected + callback(error, output && output.value); +} + +/** + * Stream wrapper for finishing callback + * + * @this ReadableAsyncKit# + * @param {mixed} error - error response + * @param {mixed} output - iterator output + * @param {function} callback - callback that expects final results + */ +function finisher(error, output, callback) +{ + // signal end of the stream + // only for successfully finished streams + if (!error) + { + this.push(null); + } + + // back to original track + callback(error, output); +} diff --git a/node_modules/asynckit/lib/terminator.js b/node_modules/asynckit/lib/terminator.js new file mode 100644 index 00000000..d6eb9921 --- /dev/null +++ b/node_modules/asynckit/lib/terminator.js @@ -0,0 +1,29 @@ +var abort = require('./abort.js') + , async = require('./async.js') + ; + +// API +module.exports = terminator; + +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } + + // fast forward iteration index + this.index = this.size; + + // abort jobs + abort(this); + + // send back results we have so far + async(callback)(null, this.results); +} diff --git a/node_modules/asynckit/package.json b/node_modules/asynckit/package.json new file mode 100644 index 00000000..51147d65 --- /dev/null +++ b/node_modules/asynckit/package.json @@ -0,0 +1,63 @@ +{ + "name": "asynckit", + "version": "0.4.0", + "description": "Minimal async jobs utility library, with streams support", + "main": "index.js", + "scripts": { + "clean": "rimraf coverage", + "lint": "eslint *.js lib/*.js test/*.js", + "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec", + "win-test": "tape test/test-*.js", + "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec", + "report": "istanbul report", + "size": "browserify index.js | size-table asynckit", + "debug": "tape test/test-*.js" + }, + "pre-commit": [ + "clean", + "lint", + "test", + "browser", + "report", + "size" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/alexindigo/asynckit.git" + }, + "keywords": [ + "async", + "jobs", + "parallel", + "serial", + "iterator", + "array", + "object", + "stream", + "destroy", + "terminate", + "abort" + ], + "author": "Alex Indigo ", + "license": "MIT", + "bugs": { + "url": "https://github.com/alexindigo/asynckit/issues" + }, + "homepage": "https://github.com/alexindigo/asynckit#readme", + "devDependencies": { + "browserify": "^13.0.0", + "browserify-istanbul": "^2.0.0", + "coveralls": "^2.11.9", + "eslint": "^2.9.0", + "istanbul": "^0.4.3", + "obake": "^0.1.2", + "phantomjs-prebuilt": "^2.1.7", + "pre-commit": "^1.1.3", + "reamde": "^1.1.0", + "rimraf": "^2.5.2", + "size-table": "^0.2.0", + "tap-spec": "^4.1.1", + "tape": "^4.5.1" + }, + "dependencies": {} +} diff --git a/node_modules/asynckit/parallel.js b/node_modules/asynckit/parallel.js new file mode 100644 index 00000000..3c50344d --- /dev/null +++ b/node_modules/asynckit/parallel.js @@ -0,0 +1,43 @@ +var iterate = require('./lib/iterate.js') + , initState = require('./lib/state.js') + , terminator = require('./lib/terminator.js') + ; + +// Public API +module.exports = parallel; + +/** + * Runs iterator over provided array elements in parallel + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function parallel(list, iterator, callback) +{ + var state = initState(list); + + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); + return; + } + + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; + } + }); + + state.index++; + } + + return terminator.bind(state, callback); +} diff --git a/node_modules/asynckit/serial.js b/node_modules/asynckit/serial.js new file mode 100644 index 00000000..6cd949a6 --- /dev/null +++ b/node_modules/asynckit/serial.js @@ -0,0 +1,17 @@ +var serialOrdered = require('./serialOrdered.js'); + +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} diff --git a/node_modules/asynckit/serialOrdered.js b/node_modules/asynckit/serialOrdered.js new file mode 100644 index 00000000..607eafea --- /dev/null +++ b/node_modules/asynckit/serialOrdered.js @@ -0,0 +1,75 @@ +var iterate = require('./lib/iterate.js') + , initState = require('./lib/state.js') + , terminator = require('./lib/terminator.js') + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; + +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); +} + +/* + * -- Sort methods + */ + +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} diff --git a/node_modules/asynckit/stream.js b/node_modules/asynckit/stream.js new file mode 100644 index 00000000..d43465f9 --- /dev/null +++ b/node_modules/asynckit/stream.js @@ -0,0 +1,21 @@ +var inherits = require('util').inherits + , Readable = require('stream').Readable + , ReadableAsyncKit = require('./lib/readable_asynckit.js') + , ReadableParallel = require('./lib/readable_parallel.js') + , ReadableSerial = require('./lib/readable_serial.js') + , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js') + ; + +// API +module.exports = +{ + parallel : ReadableParallel, + serial : ReadableSerial, + serialOrdered : ReadableSerialOrdered, +}; + +inherits(ReadableAsyncKit, Readable); + +inherits(ReadableParallel, ReadableAsyncKit); +inherits(ReadableSerial, ReadableAsyncKit); +inherits(ReadableSerialOrdered, ReadableAsyncKit); diff --git a/node_modules/axios/CHANGELOG.md b/node_modules/axios/CHANGELOG.md new file mode 100644 index 00000000..c9db85b5 --- /dev/null +++ b/node_modules/axios/CHANGELOG.md @@ -0,0 +1,952 @@ +# Changelog + +## [1.7.2](https://github.com/axios/axios/compare/v1.7.1...v1.7.2) (2024-05-21) + + +### Bug Fixes + +* **fetch:** enhance fetch API detection; ([#6413](https://github.com/axios/axios/issues/6413)) ([4f79aef](https://github.com/axios/axios/commit/4f79aef81b7c4644328365bfc33acf0a9ef595bc)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-3 (#6413 )") + +## [1.7.1](https://github.com/axios/axios/compare/v1.7.0...v1.7.1) (2024-05-20) + + +### Bug Fixes + +* **fetch:** fixed ReferenceError issue when TextEncoder is not available in the environment; ([#6410](https://github.com/axios/axios/issues/6410)) ([733f15f](https://github.com/axios/axios/commit/733f15fe5bd2d67e1fadaee82e7913b70d45dc5e)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+14/-9 (#6410 )") + +# [1.7.0](https://github.com/axios/axios/compare/v1.7.0-beta.2...v1.7.0) (2024-05-19) + + +### Features + +* **adapter:** add fetch adapter; ([#6371](https://github.com/axios/axios/issues/6371)) ([a3ff99b](https://github.com/axios/axios/commit/a3ff99b59d8ec2ab5dd049e68c043617a4072e42)) + +### Bug Fixes + +* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+1015/-127 (#6371 )") +- avatar [Jay](https://github.com/jasonsaayman "+30/-14 ()") +- avatar [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )") + +# [1.7.0-beta.2](https://github.com/axios/axios/compare/v1.7.0-beta.1...v1.7.0-beta.2) (2024-05-19) + + +### Bug Fixes + +* **fetch:** capitalize HTTP method names; ([#6395](https://github.com/axios/axios/issues/6395)) ([ad3174a](https://github.com/axios/axios/commit/ad3174a3515c3c2573f4bcb94818d582826f3914)) +* **fetch:** fix & optimize progress capturing for cases when the request data has a nullish value or zero data length ([#6400](https://github.com/axios/axios/issues/6400)) ([95a3e8e](https://github.com/axios/axios/commit/95a3e8e346cfd6a5548e171f2341df3235d0e26b)) +* **fetch:** fix headers getting from a stream response; ([#6401](https://github.com/axios/axios/issues/6401)) ([870e0a7](https://github.com/axios/axios/commit/870e0a76f60d0094774a6a63fa606eec52a381af)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+99/-46 (#6405 #6404 #6401 #6400 #6395 )") + +# [1.7.0-beta.1](https://github.com/axios/axios/compare/v1.7.0-beta.0...v1.7.0-beta.1) (2024-05-07) + + +### Bug Fixes + +* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9)) +* **fetch:** fix cases when ReadableStream or Response.body are not available; ([#6377](https://github.com/axios/axios/issues/6377)) ([d1d359d](https://github.com/axios/axios/commit/d1d359da347704e8b28d768e61515a3e96c5b072)) +* **fetch:** treat fetch-related TypeError as an AxiosError.ERR_NETWORK error; ([#6380](https://github.com/axios/axios/issues/6380)) ([bb5f9a5](https://github.com/axios/axios/commit/bb5f9a5ab768452de9e166dc28d0ffc234245ef1)) + +### Contributors to this release + +- avatar [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+42/-17 (#6380 #6377 )") + +# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28) + + +### Features + +* **adapter:** add fetch adapter; ([#6371](https://github.com/axios/axios/issues/6371)) ([a3ff99b](https://github.com/axios/axios/commit/a3ff99b59d8ec2ab5dd049e68c043617a4072e42)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+1015/-127 (#6371 )") +- avatar [Jay](https://github.com/jasonsaayman "+30/-14 ()") + +## [1.6.8](https://github.com/axios/axios/compare/v1.6.7...v1.6.8) (2024-03-15) + + +### Bug Fixes + +* **AxiosHeaders:** fix AxiosHeaders conversion to an object during config merging ([#6243](https://github.com/axios/axios/issues/6243)) ([2656612](https://github.com/axios/axios/commit/2656612bc10fe2757e9832b708ed773ab340b5cb)) +* **import:** use named export for EventEmitter; ([7320430](https://github.com/axios/axios/commit/7320430aef2e1ba2b89488a0eaf42681165498b1)) +* **vulnerability:** update follow-redirects to 1.15.6 ([#6300](https://github.com/axios/axios/issues/6300)) ([8786e0f](https://github.com/axios/axios/commit/8786e0ff55a8c68d4ca989801ad26df924042e27)) + +### Contributors to this release + +- avatar [Jay](https://github.com/jasonsaayman "+4572/-3446 (#6238 )") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+30/-0 (#6231 )") +- avatar [Mitchell](https://github.com/Creaous "+9/-9 (#6300 )") +- avatar [Emmanuel](https://github.com/mannoeu "+2/-2 (#6196 )") +- avatar [Lucas Keller](https://github.com/ljkeller "+3/-0 (#6194 )") +- avatar [Aditya Mogili](https://github.com/ADITYA-176 "+1/-1 ()") +- avatar [Miroslav Petrov](https://github.com/petrovmiroslav "+1/-1 (#6243 )") + +## [1.6.7](https://github.com/axios/axios/compare/v1.6.6...v1.6.7) (2024-01-25) + + +### Bug Fixes + +* capture async stack only for rejections with native error objects; ([#6203](https://github.com/axios/axios/issues/6203)) ([1a08f90](https://github.com/axios/axios/commit/1a08f90f402336e4d00e9ee82f211c6adb1640b0)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+30/-26 (#6203 )") +- avatar [zhoulixiang](https://github.com/zh-lx "+0/-3 (#6186 )") + +## [1.6.6](https://github.com/axios/axios/compare/v1.6.5...v1.6.6) (2024-01-24) + + +### Bug Fixes + +* fixed missed dispatchBeforeRedirect argument ([#5778](https://github.com/axios/axios/issues/5778)) ([a1938ff](https://github.com/axios/axios/commit/a1938ff073fcb0f89011f001dfbc1fa1dc995e39)) +* wrap errors to improve async stack trace ([#5987](https://github.com/axios/axios/issues/5987)) ([123f354](https://github.com/axios/axios/commit/123f354b920f154a209ea99f76b7b2ef3d9ebbab)) + +### Contributors to this release + +- avatar [Ilya Priven](https://github.com/ikonst "+91/-8 (#5987 )") +- avatar [Zao Soula](https://github.com/zaosoula "+6/-6 (#5778 )") + +## [1.6.5](https://github.com/axios/axios/compare/v1.6.4...v1.6.5) (2024-01-05) + + +### Bug Fixes + +* **ci:** refactor notify action as a job of publish action; ([#6176](https://github.com/axios/axios/issues/6176)) ([0736f95](https://github.com/axios/axios/commit/0736f95ce8776366dc9ca569f49ba505feb6373c)) +* **dns:** fixed lookup error handling; ([#6175](https://github.com/axios/axios/issues/6175)) ([f4f2b03](https://github.com/axios/axios/commit/f4f2b039dd38eb4829e8583caede4ed6d2dd59be)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+41/-6 (#6176 #6175 )") +- avatar [Jay](https://github.com/jasonsaayman "+6/-1 ()") + +## [1.6.4](https://github.com/axios/axios/compare/v1.6.3...v1.6.4) (2024-01-03) + + +### Bug Fixes + +* **security:** fixed formToJSON prototype pollution vulnerability; ([#6167](https://github.com/axios/axios/issues/6167)) ([3c0c11c](https://github.com/axios/axios/commit/3c0c11cade045c4412c242b5727308cff9897a0e)) +* **security:** fixed security vulnerability in follow-redirects ([#6163](https://github.com/axios/axios/issues/6163)) ([75af1cd](https://github.com/axios/axios/commit/75af1cdff5b3a6ca3766d3d3afbc3115bb0811b8)) + +### Contributors to this release + +- avatar [Jay](https://github.com/jasonsaayman "+34/-6 ()") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+34/-3 (#6172 #6167 )") +- avatar [Guy Nesher](https://github.com/gnesher "+10/-10 (#6163 )") + +## [1.6.3](https://github.com/axios/axios/compare/v1.6.2...v1.6.3) (2023-12-26) + + +### Bug Fixes + +* Regular Expression Denial of Service (ReDoS) ([#6132](https://github.com/axios/axios/issues/6132)) ([5e7ad38](https://github.com/axios/axios/commit/5e7ad38fb0f819fceb19fb2ee5d5d38f56aa837d)) + +### Contributors to this release + +- avatar [Jay](https://github.com/jasonsaayman "+15/-6 (#6145 )") +- avatar [Willian Agostini](https://github.com/WillianAgostini "+17/-2 (#6132 )") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-0 (#6084 )") + +## [1.6.2](https://github.com/axios/axios/compare/v1.6.1...v1.6.2) (2023-11-14) + + +### Features + +* **withXSRFToken:** added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ([#6046](https://github.com/axios/axios/issues/6046)) ([cff9967](https://github.com/axios/axios/commit/cff996779b272a5e94c2b52f5503ccf668bc42dc)) + +### PRs +- feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) ) +``` + +📢 This PR added 'withXSRFToken' option as a replacement for old withCredentials behaviour. +You should now use withXSRFToken along with withCredential to get the old behavior. +This functionality is considered as a fix. +``` + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+271/-146 (#6081 #6080 #6079 #6078 #6046 #6064 #6063 )") +- avatar [Ng Choon Khon (CK)](https://github.com/ckng0221 "+4/-4 (#6073 )") +- avatar [Muhammad Noman](https://github.com/mnomanmemon "+2/-2 (#6048 )") + +## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08) + + +### Bug Fixes + +* **formdata:** fixed content-type header normalization for non-standard browser environments; ([#6056](https://github.com/axios/axios/issues/6056)) ([dd465ab](https://github.com/axios/axios/commit/dd465ab22bbfa262c6567be6574bf46a057d5288)) +* **platform:** fixed emulated browser detection in node.js environment; ([#6055](https://github.com/axios/axios/issues/6055)) ([3dc8369](https://github.com/axios/axios/commit/3dc8369e505e32a4e12c22f154c55fd63ac67fbb)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+432/-65 (#6059 #6056 #6055 )") +- avatar [Fabian Meyer](https://github.com/meyfa "+5/-2 (#5835 )") + +### PRs +- feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) ) +``` + +📢 This PR added 'withXSRFToken' option as a replacement for old withCredentials behaviour. +You should now use withXSRFToken along with withCredential to get the old behavior. +This functionality is considered as a fix. +``` + +# [1.6.0](https://github.com/axios/axios/compare/v1.5.1...v1.6.0) (2023-10-26) + + +### Bug Fixes + +* **CSRF:** fixed CSRF vulnerability CVE-2023-45857 ([#6028](https://github.com/axios/axios/issues/6028)) ([96ee232](https://github.com/axios/axios/commit/96ee232bd3ee4de2e657333d4d2191cd389e14d0)) +* **dns:** fixed lookup function decorator to work properly in node v20; ([#6011](https://github.com/axios/axios/issues/6011)) ([5aaff53](https://github.com/axios/axios/commit/5aaff532a6b820bb9ab6a8cd0f77131b47e2adb8)) +* **types:** fix AxiosHeaders types; ([#5931](https://github.com/axios/axios/issues/5931)) ([a1c8ad0](https://github.com/axios/axios/commit/a1c8ad008b3c13d53e135bbd0862587fb9d3fc09)) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+449/-114 (#6032 #6021 #6011 #5932 #5931 )") +- avatar [Valentin Panov](https://github.com/valentin-panov "+4/-4 (#6028 )") +- avatar [Rinku Chaudhari](https://github.com/therealrinku "+1/-1 (#5889 )") + +## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26) + + +### Bug Fixes + +* **adapters:** improved adapters loading logic to have clear error messages; ([#5919](https://github.com/axios/axios/issues/5919)) ([e410779](https://github.com/axios/axios/commit/e4107797a7a1376f6209fbecfbbce73d3faa7859)) +* **formdata:** fixed automatic addition of the `Content-Type` header for FormData in non-browser environments; ([#5917](https://github.com/axios/axios/issues/5917)) ([bc9af51](https://github.com/axios/axios/commit/bc9af51b1886d1b3529617702f2a21a6c0ed5d92)) +* **headers:** allow `content-encoding` header to handle case-insensitive values ([#5890](https://github.com/axios/axios/issues/5890)) ([#5892](https://github.com/axios/axios/issues/5892)) ([4c89f25](https://github.com/axios/axios/commit/4c89f25196525e90a6e75eda9cb31ae0a2e18acd)) +* **types:** removed duplicated code ([9e62056](https://github.com/axios/axios/commit/9e6205630e1c9cf863adf141c0edb9e6d8d4b149)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+89/-18 (#5919 #5917 )") +- avatar [David Dallas](https://github.com/DavidJDallas "+11/-5 ()") +- avatar [Sean Sattler](https://github.com/fb-sean "+2/-8 ()") +- avatar [Mustafa Ateş Uzun](https://github.com/0o001 "+4/-4 ()") +- avatar [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki "+2/-1 (#5892 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+1/-1 ()") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26) + + +### Bug Fixes + +* **adapter:** make adapter loading error more clear by using platform-specific adapters explicitly ([#5837](https://github.com/axios/axios/issues/5837)) ([9a414bb](https://github.com/axios/axios/commit/9a414bb6c81796a95c6c7fe668637825458e8b6d)) +* **dns:** fixed `cacheable-lookup` integration; ([#5836](https://github.com/axios/axios/issues/5836)) ([b3e327d](https://github.com/axios/axios/commit/b3e327dcc9277bdce34c7ef57beedf644b00d628)) +* **headers:** added support for setting header names that overlap with class methods; ([#5831](https://github.com/axios/axios/issues/5831)) ([d8b4ca0](https://github.com/axios/axios/commit/d8b4ca0ea5f2f05efa4edfe1e7684593f9f68273)) +* **headers:** fixed common Content-Type header merging; ([#5832](https://github.com/axios/axios/issues/5832)) ([8fda276](https://github.com/axios/axios/commit/8fda2766b1e6bcb72c3fabc146223083ef13ce17)) + + +### Features + +* export getAdapter function ([#5324](https://github.com/axios/axios/issues/5324)) ([ca73eb8](https://github.com/axios/axios/commit/ca73eb878df0ae2dace81fe3a7f1fb5986231bf1)) +* **export:** export adapters without `unsafe` prefix ([#5839](https://github.com/axios/axios/issues/5839)) ([1601f4a](https://github.com/axios/axios/commit/1601f4a27a81ab47fea228f1e244b2c4e3ce28bf)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+66/-29 (#5839 #5837 #5836 #5832 #5831 )") +- avatar [夜葬](https://github.com/geekact "+42/-0 (#5324 )") +- avatar [Jonathan Budiman](https://github.com/JBudiman00 "+30/-0 (#5788 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+3/-5 (#5791 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +# [1.4.0](https://github.com/axios/axios/compare/v1.3.6...v1.4.0) (2023-04-27) + + +### Bug Fixes + +* **formdata:** add `multipart/form-data` content type for FormData payload on custom client environments; ([#5678](https://github.com/axios/axios/issues/5678)) ([bbb61e7](https://github.com/axios/axios/commit/bbb61e70cb1185adfb1cbbb86eaf6652c48d89d1)) +* **package:** export package internals with unsafe path prefix; ([#5677](https://github.com/axios/axios/issues/5677)) ([df38c94](https://github.com/axios/axios/commit/df38c949f26414d88ba29ec1e353c4d4f97eaf09)) + + +### Features + +* **dns:** added support for a custom lookup function; ([#5339](https://github.com/axios/axios/issues/5339)) ([2701911](https://github.com/axios/axios/commit/2701911260a1faa5cc5e1afe437121b330a3b7bb)) +* **types:** export `AxiosHeaderValue` type. ([#5525](https://github.com/axios/axios/issues/5525)) ([726f1c8](https://github.com/axios/axios/commit/726f1c8e00cffa0461a8813a9bdcb8f8b9d762cf)) + + +### Performance Improvements + +* **merge-config:** optimize mergeConfig performance by avoiding duplicate key visits; ([#5679](https://github.com/axios/axios/issues/5679)) ([e6f7053](https://github.com/axios/axios/commit/e6f7053bf1a3e87cf1f9da8677e12e3fe829d68e)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+151/-16 (#5684 #5339 #5679 #5678 #5677 )") +- avatar [Arthur Fiorette](https://github.com/arthurfiorette "+19/-19 (#5525 )") +- avatar [PIYUSH NEGI](https://github.com/npiyush97 "+2/-18 (#5670 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.6](https://github.com/axios/axios/compare/v1.3.5...v1.3.6) (2023-04-19) + + +### Bug Fixes + +* **types:** added transport to RawAxiosRequestConfig ([#5445](https://github.com/axios/axios/issues/5445)) ([6f360a2](https://github.com/axios/axios/commit/6f360a2531d8d70363fd9becef6a45a323f170e2)) +* **utils:** make isFormData detection logic stricter to avoid unnecessary calling of the `toString` method on the target; ([#5661](https://github.com/axios/axios/issues/5661)) ([aa372f7](https://github.com/axios/axios/commit/aa372f7306295dfd1100c1c2c77ce95c95808e76)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+48/-10 (#5665 #5661 #5663 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+2/-0 (#5445 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.5](https://github.com/axios/axios/compare/v1.3.4...v1.3.5) (2023-04-05) + + +### Bug Fixes + +* **headers:** fixed isValidHeaderName to support full list of allowed characters; ([#5584](https://github.com/axios/axios/issues/5584)) ([e7decef](https://github.com/axios/axios/commit/e7decef6a99f4627e27ed9ea5b00ce8e201c3841)) +* **params:** re-added the ability to set the function as `paramsSerializer` config; ([#5633](https://github.com/axios/axios/issues/5633)) ([a56c866](https://github.com/axios/axios/commit/a56c8661209d5ce5a645a05f294a0e08a6c1f6b3)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+28/-10 (#5633 #5584 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.4](https://github.com/axios/axios/compare/v1.3.3...v1.3.4) (2023-02-22) + + +### Bug Fixes + +* **blob:** added a check to make sure the Blob class is available in the browser's global scope; ([#5548](https://github.com/axios/axios/issues/5548)) ([3772c8f](https://github.com/axios/axios/commit/3772c8fe74112a56e3e9551f894d899bc3a9443a)) +* **http:** fixed regression bug when handling synchronous errors inside the adapter; ([#5564](https://github.com/axios/axios/issues/5564)) ([a3b246c](https://github.com/axios/axios/commit/a3b246c9de5c3bc4b5a742e15add55b375479451)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+38/-26 (#5564 )") +- avatar [lcysgsg](https://github.com/lcysgsg "+4/-0 (#5548 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+3/-0 (#5444 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.3](https://github.com/axios/axios/compare/v1.3.2...v1.3.3) (2023-02-13) + + +### Bug Fixes + +* **formdata:** added a check to make sure the FormData class is available in the browser's global scope; ([#5545](https://github.com/axios/axios/issues/5545)) ([a6dfa72](https://github.com/axios/axios/commit/a6dfa72010db5ad52db8bd13c0f98e537e8fd05d)) +* **formdata:** fixed setting NaN as Content-Length for form payload in some cases; ([#5535](https://github.com/axios/axios/issues/5535)) ([c19f7bf](https://github.com/axios/axios/commit/c19f7bf770f90ae8307f4ea3104f227056912da1)) +* **headers:** fixed the filtering logic of the clear method; ([#5542](https://github.com/axios/axios/issues/5542)) ([ea87ebf](https://github.com/axios/axios/commit/ea87ebfe6d1699af072b9e7cd40faf8f14b0ab93)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+11/-7 (#5545 #5535 #5542 )") +- avatar [陈若枫](https://github.com/ruofee "+2/-2 (#5467 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.2](https://github.com/axios/axios/compare/v1.3.1...v1.3.2) (2023-02-03) + + +### Bug Fixes + +* **http:** treat http://localhost as base URL for relative paths to avoid `ERR_INVALID_URL` error; ([#5528](https://github.com/axios/axios/issues/5528)) ([128d56f](https://github.com/axios/axios/commit/128d56f4a0fb8f5f2ed6e0dd80bc9225fee9538c)) +* **http:** use explicit import instead of TextEncoder global; ([#5530](https://github.com/axios/axios/issues/5530)) ([6b3c305](https://github.com/axios/axios/commit/6b3c305fc40c56428e0afabedc6f4d29c2830f6f)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+2/-1 (#5530 #5528 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.1](https://github.com/axios/axios/compare/v1.3.0...v1.3.1) (2023-02-01) + + +### Bug Fixes + +* **formdata:** add hotfix to use the asynchronous API to compute the content-length header value; ([#5521](https://github.com/axios/axios/issues/5521)) ([96d336f](https://github.com/axios/axios/commit/96d336f527619f21da012fe1f117eeb53e5a2120)) +* **serializer:** fixed serialization of array-like objects; ([#5518](https://github.com/axios/axios/issues/5518)) ([08104c0](https://github.com/axios/axios/commit/08104c028c0f9353897b1b6691d74c440fd0c32d)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-8 (#5521 #5518 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +# [1.3.0](https://github.com/axios/axios/compare/v1.2.6...v1.3.0) (2023-01-31) + + +### Bug Fixes + +* **headers:** fixed & optimized clear method; ([#5507](https://github.com/axios/axios/issues/5507)) ([9915635](https://github.com/axios/axios/commit/9915635c69d0ab70daca5738488421f67ca60959)) +* **http:** add zlib headers if missing ([#5497](https://github.com/axios/axios/issues/5497)) ([65e8d1e](https://github.com/axios/axios/commit/65e8d1e28ce829f47a837e45129730e541950d3c)) + + +### Features + +* **fomdata:** added support for spec-compliant FormData & Blob types; ([#5316](https://github.com/axios/axios/issues/5316)) ([6ac574e](https://github.com/axios/axios/commit/6ac574e00a06731288347acea1e8246091196953)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )") +- avatar [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.6](https://github.com/axios/axios/compare/v1.2.5...v1.2.6) (2023-01-28) + + +### Bug Fixes + +* **headers:** added missed Authorization accessor; ([#5502](https://github.com/axios/axios/issues/5502)) ([342c0ba](https://github.com/axios/axios/commit/342c0ba9a16ea50f5ed7d2366c5c1a2c877e3f26)) +* **types:** fixed `CommonRequestHeadersList` & `CommonResponseHeadersList` types to be private in commonJS; ([#5503](https://github.com/axios/axios/issues/5503)) ([5a3d0a3](https://github.com/axios/axios/commit/5a3d0a3234d77361a1bc7cedee2da1e11df08e2c)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.5](https://github.com/axios/axios/compare/v1.2.4...v1.2.5) (2023-01-26) + + +### Bug Fixes + +* **types:** fixed AxiosHeaders to handle spread syntax by making all methods non-enumerable; ([#5499](https://github.com/axios/axios/issues/5499)) ([580f1e8](https://github.com/axios/axios/commit/580f1e8033a61baa38149d59fd16019de3932c22)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+82/-54 (#5499 )") +- ![avatar](https://avatars.githubusercontent.com/u/20516159?v=4&s=16) [Elliot Ford](https://github.com/EFord36 "+1/-1 (#5462 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.4](https://github.com/axios/axios/compare/v1.2.3...v1.2.4) (2023-01-22) + + +### Bug Fixes + +* **types:** renamed `RawAxiosRequestConfig` back to `AxiosRequestConfig`; ([#5486](https://github.com/axios/axios/issues/5486)) ([2a71f49](https://github.com/axios/axios/commit/2a71f49bc6c68495fa419003a3107ed8bd703ad0)) +* **types:** fix `AxiosRequestConfig` generic; ([#5478](https://github.com/axios/axios/issues/5478)) ([9bce81b](https://github.com/axios/axios/commit/186ea062da8b7d578ae78b1a5c220986b9bce81b)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+242/-108 (#5486 #5482 )") +- ![avatar](https://avatars.githubusercontent.com/u/9430821?v=4&s=16) [Daniel Hillmann](https://github.com/hilleer "+1/-1 (#5478 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.3](https://github.com/axios/axios/compare/1.2.2...1.2.3) (2023-01-10) + + +### Bug Fixes + +* **types:** fixed AxiosRequestConfig header interface by refactoring it to RawAxiosRequestConfig; ([#5420](https://github.com/axios/axios/issues/5420)) ([0811963](https://github.com/axios/axios/commit/08119634a22f1d5b19f5c9ea0adccb6d3eebc3bc)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.2] - 2022-12-29 + +### Fixed +- fix(ci): fix release script inputs [#5392](https://github.com/axios/axios/pull/5392) +- fix(ci): prerelease scipts [#5377](https://github.com/axios/axios/pull/5377) +- fix(ci): release scripts [#5376](https://github.com/axios/axios/pull/5376) +- fix(ci): typescript tests [#5375](https://github.com/axios/axios/pull/5375) +- fix: Brotli decompression [#5353](https://github.com/axios/axios/pull/5353) +- fix: add missing HttpStatusCode [#5345](https://github.com/axios/axios/pull/5345) + +### Chores +- chore(ci): set conventional-changelog header config [#5406](https://github.com/axios/axios/pull/5406) +- chore(ci): fix automatic contributors resolving [#5403](https://github.com/axios/axios/pull/5403) +- chore(ci): improved logging for the contributors list generator [#5398](https://github.com/axios/axios/pull/5398) +- chore(ci): fix release action [#5397](https://github.com/axios/axios/pull/5397) +- chore(ci): fix version bump script by adding bump argument for target version [#5393](https://github.com/axios/axios/pull/5393) +- chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 [#5342](https://github.com/axios/axios/pull/5342) +- chore(ci): GitHub Actions Release script [#5384](https://github.com/axios/axios/pull/5384) +- chore(ci): release scripts [#5364](https://github.com/axios/axios/pull/5364) + +### Contributors to this release +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- ![avatar](https://avatars.githubusercontent.com/u/1652293?v=4&s=16) [Winnie](https://github.com/winniehell) + +## [1.2.1] - 2022-12-05 + +### Changed +- feat(exports): export mergeConfig [#5151](https://github.com/axios/axios/pull/5151) + +### Fixed +- fix(CancelledError): include config [#4922](https://github.com/axios/axios/pull/4922) +- fix(general): removing multiple/trailing/leading whitespace [#5022](https://github.com/axios/axios/pull/5022) +- fix(headers): decompression for responses without Content-Length header [#5306](https://github.com/axios/axios/pull/5306) +- fix(webWorker): exception to sending form data in web worker [#5139](https://github.com/axios/axios/pull/5139) + +### Refactors +- refactor(types): AxiosProgressEvent.event type to any [#5308](https://github.com/axios/axios/pull/5308) +- refactor(types): add missing types for static AxiosError.from method [#4956](https://github.com/axios/axios/pull/4956) + +### Chores +- chore(docs): remove README link to non-existent upgrade guide [#5307](https://github.com/axios/axios/pull/5307) +- chore(docs): typo in issue template name [#5159](https://github.com/axios/axios/pull/5159) + +### Contributors to this release + +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [Zachary Lysobey](https://github.com/zachlysobey) +- [Kevin Ennis](https://github.com/kevincennis) +- [Philipp Loose](https://github.com/phloose) +- [secondl1ght](https://github.com/secondl1ght) +- [wenzheng](https://github.com/0x30) +- [Ivan Barsukov](https://github.com/ovarn) +- [Arthur Fiorette](https://github.com/arthurfiorette) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.0] - 2022-11-10 + +### Changed + +- changed: refactored module exports [#5162](https://github.com/axios/axios/pull/5162) +- change: re-added support for loading Axios with require('axios').default [#5225](https://github.com/axios/axios/pull/5225) + +### Fixed + +- fix: improve AxiosHeaders class [#5224](https://github.com/axios/axios/pull/5224) +- fix: TypeScript type definitions for commonjs [#5196](https://github.com/axios/axios/pull/5196) +- fix: type definition of use method on AxiosInterceptorManager to match the the README [#5071](https://github.com/axios/axios/pull/5071) +- fix: __dirname is not defined in the sandbox [#5269](https://github.com/axios/axios/pull/5269) +- fix: AxiosError.toJSON method to avoid circular references [#5247](https://github.com/axios/axios/pull/5247) +- fix: Z_BUF_ERROR when content-encoding is set but the response body is empty [#5250](https://github.com/axios/axios/pull/5250) + +### Refactors +- refactor: allowing adapters to be loaded by name [#5277](https://github.com/axios/axios/pull/5277) + +### Chores + +- chore: force CI restart [#5243](https://github.com/axios/axios/pull/5243) +- chore: update ECOSYSTEM.md [#5077](https://github.com/axios/axios/pull/5077) +- chore: update get/index.html [#5116](https://github.com/axios/axios/pull/5116) +- chore: update Sandbox UI/UX [#5205](https://github.com/axios/axios/pull/5205) +- chore:(actions): remove git credentials after checkout [#5235](https://github.com/axios/axios/pull/5235) +- chore(actions): bump actions/dependency-review-action from 2 to 3 [#5266](https://github.com/axios/axios/pull/5266) +- chore(packages): bump loader-utils from 1.4.1 to 1.4.2 [#5295](https://github.com/axios/axios/pull/5295) +- chore(packages): bump engine.io from 6.2.0 to 6.2.1 [#5294](https://github.com/axios/axios/pull/5294) +- chore(packages): bump socket.io-parser from 4.0.4 to 4.0.5 [#5241](https://github.com/axios/axios/pull/5241) +- chore(packages): bump loader-utils from 1.4.0 to 1.4.1 [#5245](https://github.com/axios/axios/pull/5245) +- chore(docs): update Resources links in README [#5119](https://github.com/axios/axios/pull/5119) +- chore(docs): update the link for JSON url [#5265](https://github.com/axios/axios/pull/5265) +- chore(docs): fix broken links [#5218](https://github.com/axios/axios/pull/5218) +- chore(docs): update and rename UPGRADE_GUIDE.md to MIGRATION_GUIDE.md [#5170](https://github.com/axios/axios/pull/5170) +- chore(docs): typo fix line #856 and #920 [#5194](https://github.com/axios/axios/pull/5194) +- chore(docs): typo fix #800 [#5193](https://github.com/axios/axios/pull/5193) +- chore(docs): fix typos [#5184](https://github.com/axios/axios/pull/5184) +- chore(docs): fix punctuation in README.md [#5197](https://github.com/axios/axios/pull/5197) +- chore(docs): update readme in the Handling Errors section - issue reference #5260 [#5261](https://github.com/axios/axios/pull/5261) +- chore: remove \b from filename [#5207](https://github.com/axios/axios/pull/5207) +- chore(docs): update CHANGELOG.md [#5137](https://github.com/axios/axios/pull/5137) +- chore: add sideEffects false to package.json [#5025](https://github.com/axios/axios/pull/5025) + +### Contributors to this release + +- [Maddy Miller](https://github.com/me4502) +- [Amit Saini](https://github.com/amitsainii) +- [ecyrbe](https://github.com/ecyrbe) +- [Ikko Ashimine](https://github.com/eltociear) +- [Geeth Gunnampalli](https://github.com/thetechie7) +- [Shreem Asati](https://github.com/shreem-123) +- [Frieder Bluemle](https://github.com/friederbluemle) +- [윤세영](https://github.com/yunseyeong) +- [Claudio Busatto](https://github.com/cjcbusatto) +- [Remco Haszing](https://github.com/remcohaszing) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [Csaba Maulis](https://github.com/om4csaba) +- [MoPaMo](https://github.com/MoPaMo) +- [Daniel Fjeldstad](https://github.com/w3bdesign) +- [Adrien Brunet](https://github.com/adrien-may) +- [Frazer Smith](https://github.com/Fdawgs) +- [HaiTao](https://github.com/836334258) +- [AZM](https://github.com/aziyatali) +- [relbns](https://github.com/relbns) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.3] - 2022-10-15 + +### Added + +- Added custom params serializer support [#5113](https://github.com/axios/axios/pull/5113) + +### Fixed + +- Fixed top-level export to keep them in-line with static properties [#5109](https://github.com/axios/axios/pull/5109) +- Stopped including null values to query string. [#5108](https://github.com/axios/axios/pull/5108) +- Restored proxy config backwards compatibility with 0.x [#5097](https://github.com/axios/axios/pull/5097) +- Added back AxiosHeaders in AxiosHeaderValue [#5103](https://github.com/axios/axios/pull/5103) +- Pin CDN install instructions to a specific version [#5060](https://github.com/axios/axios/pull/5060) +- Handling of array values fixed for AxiosHeaders [#5085](https://github.com/axios/axios/pull/5085) + +### Chores + +- docs: match badge style, add link to them [#5046](https://github.com/axios/axios/pull/5046) +- chore: fixing comments typo [#5054](https://github.com/axios/axios/pull/5054) +- chore: update issue template [#5061](https://github.com/axios/axios/pull/5061) +- chore: added progress capturing section to the docs; [#5084](https://github.com/axios/axios/pull/5084) + +### Contributors to this release + +- [Jason Saayman](https://github.com/jasonsaayman) +- [scarf](https://github.com/scarf005) +- [Lenz Weber-Tronic](https://github.com/phryneas) +- [Arvindh](https://github.com/itsarvindh) +- [Félix Legrelle](https://github.com/FelixLgr) +- [Patrick Petrovic](https://github.com/ppati000) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [littledian](https://github.com/littledian) +- [ChronosMasterOfAllTime](https://github.com/ChronosMasterOfAllTime) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.2] - 2022-10-07 + +### Fixed + +- Fixed broken exports for UMD builds. + +### Contributors to this release + +- [Jason Saayman](https://github.com/jasonsaayman) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.1] - 2022-10-07 + +### Fixed + +- Fixed broken exports for common js. This fix breaks a prior fix, I will fix both issues ASAP but the commonJS use is more impactful. + +### Contributors to this release + +- [Jason Saayman](https://github.com/jasonsaayman) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.0] - 2022-10-06 + +### Fixed + +- Fixed missing exports in type definition index.d.ts [#5003](https://github.com/axios/axios/pull/5003) +- Fixed query params composing [#5018](https://github.com/axios/axios/pull/5018) +- Fixed GenericAbortSignal interface by making it more generic [#5021](https://github.com/axios/axios/pull/5021) +- Fixed adding "clear" to AxiosInterceptorManager [#5010](https://github.com/axios/axios/pull/5010) +- Fixed commonjs & umd exports [#5030](https://github.com/axios/axios/pull/5030) +- Fixed inability to access response headers when using axios 1.x with Jest [#5036](https://github.com/axios/axios/pull/5036) + +### Contributors to this release + +- [Trim21](https://github.com/trim21) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [shingo.sasaki](https://github.com/s-sasaki-0529) +- [Ivan Pepelko](https://github.com/ivanpepelko) +- [Richard Kořínek](https://github.com/risa) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.0.0] - 2022-10-04 + +### Added + +- Added stack trace to AxiosError [#4624](https://github.com/axios/axios/pull/4624) +- Add AxiosError to AxiosStatic [#4654](https://github.com/axios/axios/pull/4654) +- Replaced Rollup as our build runner [#4596](https://github.com/axios/axios/pull/4596) +- Added generic TS types for the exposed toFormData helper [#4668](https://github.com/axios/axios/pull/4668) +- Added listen callback function [#4096](https://github.com/axios/axios/pull/4096) +- Added instructions for installing using PNPM [#4207](https://github.com/axios/axios/pull/4207) +- Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill [#4229](https://github.com/axios/axios/pull/4229) +- Added axios-url-template in ECOSYSTEM.md [#4238](https://github.com/axios/axios/pull/4238) +- Added a clear() function to the request and response interceptors object so a user can ensure that all interceptors have been removed from an axios instance [#4248](https://github.com/axios/axios/pull/4248) +- Added react hook plugin [#4319](https://github.com/axios/axios/pull/4319) +- Adding HTTP status code for transformResponse [#4580](https://github.com/axios/axios/pull/4580) +- Added blob to the list of protocols supported by the browser [#4678](https://github.com/axios/axios/pull/4678) +- Resolving proxy from env on redirect [#4436](https://github.com/axios/axios/pull/4436) +- Added enhanced toFormData implementation with additional options [4704](https://github.com/axios/axios/pull/4704) +- Adding Canceler parameters config and request [#4711](https://github.com/axios/axios/pull/4711) +- Added automatic payload serialization to application/x-www-form-urlencoded [#4714](https://github.com/axios/axios/pull/4714) +- Added the ability for webpack users to overwrite built-ins [#4715](https://github.com/axios/axios/pull/4715) +- Added string[] to AxiosRequestHeaders type [#4322](https://github.com/axios/axios/pull/4322) +- Added the ability for the url-encoded-form serializer to respect the formSerializer config [#4721](https://github.com/axios/axios/pull/4721) +- Added isCancel type assert [#4293](https://github.com/axios/axios/pull/4293) +- Added data URL support for node.js [#4725](https://github.com/axios/axios/pull/4725) +- Adding types for progress event callbacks [#4675](https://github.com/axios/axios/pull/4675) +- URL params serializer [#4734](https://github.com/axios/axios/pull/4734) +- Added axios.formToJSON method [#4735](https://github.com/axios/axios/pull/4735) +- Bower platform add data protocol [#4804](https://github.com/axios/axios/pull/4804) +- Use WHATWG URL API instead of url.parse() [#4852](https://github.com/axios/axios/pull/4852) +- Add ENUM containing Http Status Codes to typings [#4903](https://github.com/axios/axios/pull/4903) +- Improve typing of timeout in index.d.ts [#4934](https://github.com/axios/axios/pull/4934) + +### Changed + +- Updated AxiosError.config to be optional in the type definition [#4665](https://github.com/axios/axios/pull/4665) +- Updated README emphasizing the URLSearchParam built-in interface over other solutions [#4590](https://github.com/axios/axios/pull/4590) +- Include request and config when creating a CanceledError instance [#4659](https://github.com/axios/axios/pull/4659) +- Changed func-names eslint rule to as-needed [#4492](https://github.com/axios/axios/pull/4492) +- Replacing deprecated substr() with slice() as substr() is deprecated [#4468](https://github.com/axios/axios/pull/4468) +- Updating HTTP links in README.md to use HTTPS [#4387](https://github.com/axios/axios/pull/4387) +- Updated to a better trim() polyfill [#4072](https://github.com/axios/axios/pull/4072) +- Updated types to allow specifying partial default headers on instance create [#4185](https://github.com/axios/axios/pull/4185) +- Expanded isAxiosError types [#4344](https://github.com/axios/axios/pull/4344) +- Updated type definition for axios instance methods [#4224](https://github.com/axios/axios/pull/4224) +- Updated eslint config [#4722](https://github.com/axios/axios/pull/4722) +- Updated Docs [#4742](https://github.com/axios/axios/pull/4742) +- Refactored Axios to use ES2017 [#4787](https://github.com/axios/axios/pull/4787) + + +### Deprecated +- There are multiple deprecations, refactors and fixes provided in this release. Please read through the full release notes to see how this may impact your project and use case. + +### Removed + +- Removed incorrect argument for NetworkError constructor [#4656](https://github.com/axios/axios/pull/4656) +- Removed Webpack [#4596](https://github.com/axios/axios/pull/4596) +- Removed function that transform arguments to array [#4544](https://github.com/axios/axios/pull/4544) + +### Fixed + +- Fixed grammar in README [#4649](https://github.com/axios/axios/pull/4649) +- Fixed code error in README [#4599](https://github.com/axios/axios/pull/4599) +- Optimized the code that checks cancellation [#4587](https://github.com/axios/axios/pull/4587) +- Fix url pointing to defaults.js in README [#4532](https://github.com/axios/axios/pull/4532) +- Use type alias instead of interface for AxiosPromise [#4505](https://github.com/axios/axios/pull/4505) +- Fix some word spelling and lint style in code comments [#4500](https://github.com/axios/axios/pull/4500) +- Edited readme with 3 updated browser icons of Chrome, FireFox and Safari [#4414](https://github.com/axios/axios/pull/4414) +- Bump follow-redirects from 1.14.9 to 1.15.0 [#4673](https://github.com/axios/axios/pull/4673) +- Fixing http tests to avoid hanging when assertions fail [#4435](https://github.com/axios/axios/pull/4435) +- Fix TS definition for AxiosRequestTransformer [#4201](https://github.com/axios/axios/pull/4201) +- Fix grammatical issues in README [#4232](https://github.com/axios/axios/pull/4232) +- Fixing instance.defaults.headers type [#4557](https://github.com/axios/axios/pull/4557) +- Fixed race condition on immediate requests cancellation [#4261](https://github.com/axios/axios/pull/4261) +- Fixing Z_BUF_ERROR when no content [#4701](https://github.com/axios/axios/pull/4701) +- Fixing proxy beforeRedirect regression [#4708](https://github.com/axios/axios/pull/4708) +- Fixed AxiosError status code type [#4717](https://github.com/axios/axios/pull/4717) +- Fixed AxiosError stack capturing [#4718](https://github.com/axios/axios/pull/4718) +- Fixing AxiosRequestHeaders typings [#4334](https://github.com/axios/axios/pull/4334) +- Fixed max body length defaults [#4731](https://github.com/axios/axios/pull/4731) +- Fixed toFormData Blob issue on node>v17 [#4728](https://github.com/axios/axios/pull/4728) +- Bump grunt from 1.5.2 to 1.5.3 [#4743](https://github.com/axios/axios/pull/4743) +- Fixing content-type header repeated [#4745](https://github.com/axios/axios/pull/4745) +- Fixed timeout error message for http [4738](https://github.com/axios/axios/pull/4738) +- Request ignores false, 0 and empty string as body values [#4785](https://github.com/axios/axios/pull/4785) +- Added back missing minified builds [#4805](https://github.com/axios/axios/pull/4805) +- Fixed a type error [#4815](https://github.com/axios/axios/pull/4815) +- Fixed a regression bug with unsubscribing from cancel token; [#4819](https://github.com/axios/axios/pull/4819) +- Remove repeated compression algorithm [#4820](https://github.com/axios/axios/pull/4820) +- The error of calling extend to pass parameters [#4857](https://github.com/axios/axios/pull/4857) +- SerializerOptions.indexes allows boolean | null | undefined [#4862](https://github.com/axios/axios/pull/4862) +- Require interceptors to return values [#4874](https://github.com/axios/axios/pull/4874) +- Removed unused imports [#4949](https://github.com/axios/axios/pull/4949) +- Allow null indexes on formSerializer and paramsSerializer [#4960](https://github.com/axios/axios/pull/4960) + +### Chores +- Set permissions for GitHub actions [#4765](https://github.com/axios/axios/pull/4765) +- Included githubactions in the dependabot config [#4770](https://github.com/axios/axios/pull/4770) +- Included dependency review [#4771](https://github.com/axios/axios/pull/4771) +- Update security.md [#4784](https://github.com/axios/axios/pull/4784) +- Remove unnecessary spaces [#4854](https://github.com/axios/axios/pull/4854) +- Simplify the import path of AxiosError [#4875](https://github.com/axios/axios/pull/4875) +- Fix Gitpod dead link [#4941](https://github.com/axios/axios/pull/4941) +- Enable syntax highlighting for a code block [#4970](https://github.com/axios/axios/pull/4970) +- Using Logo Axios in Readme.md [#4993](https://github.com/axios/axios/pull/4993) +- Fix markup for note in README [#4825](https://github.com/axios/axios/pull/4825) +- Fix typo and formatting, add colons [#4853](https://github.com/axios/axios/pull/4853) +- Fix typo in readme [#4942](https://github.com/axios/axios/pull/4942) + +### Security + +- Update SECURITY.md [#4687](https://github.com/axios/axios/pull/4687) + +### Contributors to this release + +- [Bertrand Marron](https://github.com/tusbar) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [Dan Mooney](https://github.com/danmooney) +- [Michael Li](https://github.com/xiaoyu-tamu) +- [aong](https://github.com/yxwzaxns) +- [Des Preston](https://github.com/despreston) +- [Ted Robertson](https://github.com/tredondo) +- [zhoulixiang](https://github.com/zh-lx) +- [Arthur Fiorette](https://github.com/arthurfiorette) +- [Kumar Shanu](https://github.com/Kr-Shanu) +- [JALAL](https://github.com/JLL32) +- [Jingyi Lin](https://github.com/MageeLin) +- [Philipp Loose](https://github.com/phloose) +- [Alexander Shchukin](https://github.com/sashsvamir) +- [Dave Cardwell](https://github.com/davecardwell) +- [Cat Scarlet](https://github.com/catscarlet) +- [Luca Pizzini](https://github.com/lpizzinidev) +- [Kai](https://github.com/Schweinepriester) +- [Maxime Bargiel](https://github.com/mbargiel) +- [Brian Helba](https://github.com/brianhelba) +- [reslear](https://github.com/reslear) +- [Jamie Slome](https://github.com/JamieSlome) +- [Landro3](https://github.com/Landro3) +- [rafw87](https://github.com/rafw87) +- [Afzal Sayed](https://github.com/afzalsayed96) +- [Koki Oyatsu](https://github.com/kaishuu0123) +- [Dave](https://github.com/wangcch) +- [暴走老七](https://github.com/baozouai) +- [Spencer](https://github.com/spalger) +- [Adrian Wieprzkowicz](https://github.com/Argeento) +- [Jamie Telin](https://github.com/lejahmie) +- [毛呆](https://github.com/aweikalee) +- [Kirill Shakirov](https://github.com/turisap) +- [Rraji Abdelbari](https://github.com/estarossa0) +- [Jelle Schutter](https://github.com/jelleschutter) +- [Tom Ceuppens](https://github.com/KyorCode) +- [Johann Cooper](https://github.com/JohannCooper) +- [Dimitris Halatsis](https://github.com/mitsos1os) +- [chenjigeng](https://github.com/chenjigeng) +- [João Gabriel Quaresma](https://github.com/joaoGabriel55) +- [Victor Augusto](https://github.com/VictorAugDB) +- [neilnaveen](https://github.com/neilnaveen) +- [Pavlos](https://github.com/psmoros) +- [Kiryl Valkovich](https://github.com/visortelle) +- [Naveen](https://github.com/naveensrinivasan) +- [wenzheng](https://github.com/0x30) +- [hcwhan](https://github.com/hcwhan) +- [Bassel Rachid](https://github.com/basselworkforce) +- [Grégoire Pineau](https://github.com/lyrixx) +- [felipedamin](https://github.com/felipedamin) +- [Karl Horky](https://github.com/karlhorky) +- [Yue JIN](https://github.com/kingyue737) +- [Usman Ali Siddiqui](https://github.com/usman250994) +- [WD](https://github.com/techbirds) +- [Günther Foidl](https://github.com/gfoidl) +- [Stephen Jennings](https://github.com/jennings) +- [C.T.Lin](https://github.com/chentsulin) +- [mia-z](https://github.com/mia-z) +- [Parth Banathia](https://github.com/Parth0105) +- [parth0105pluang](https://github.com/parth0105pluang) +- [Marco Weber](https://github.com/mrcwbr) +- [Luca Pizzini](https://github.com/lpizzinidev) +- [Willian Agostini](https://github.com/WillianAgostini) +- [Huyen Nguyen](https://github.com/huyenltnguyen) \ No newline at end of file diff --git a/node_modules/axios/LICENSE b/node_modules/axios/LICENSE new file mode 100644 index 00000000..05006a51 --- /dev/null +++ b/node_modules/axios/LICENSE @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present Matt Zabriskie & Collaborators + +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. diff --git a/node_modules/axios/MIGRATION_GUIDE.md b/node_modules/axios/MIGRATION_GUIDE.md new file mode 100644 index 00000000..ec3ae0da --- /dev/null +++ b/node_modules/axios/MIGRATION_GUIDE.md @@ -0,0 +1,3 @@ +# Migration Guide + +## 0.x.x -> 1.1.0 diff --git a/node_modules/axios/README.md b/node_modules/axios/README.md new file mode 100644 index 00000000..71381cb2 --- /dev/null +++ b/node_modules/axios/README.md @@ -0,0 +1,1695 @@ +

+ Platinum sponsors +
+

+ +
+ + + + + + + + +

Alloy is the integration development platform that makes it simple and
fast for SaaS companies to launch critical user-facing integrations.

+

+ Sign up free • + Documentation +

+

+
+ +

+ Gold sponsors +

+

+ + + + +
+ + + + + + + +

API-first authentication, authorization, and fraud prevention

+

+ Website • + DocumentationNode.js Backend SDK +

+
+ + + + + + + +

Drag-and-drop authentication, authorization, and identity management

+

+ Website • + DocumentationCommunity +

+
+ + +

+
+
+
+ +

Promise based HTTP client for the browser and node.js

+ +

+ Website • + Documentation +

+ +
+ +[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios) +[![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios) +[![Build status](https://img.shields.io/github/actions/workflow/status/axios/axios/ci.yml?branch=v1.x&label=CI&logo=github&style=flat-square)](https://github.com/axios/axios/actions/workflows/ci.yml) +[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/axios/axios) +[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios) +[![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=axios&query=$.install.pretty&label=install%20size&style=flat-square)](https://packagephobia.now.sh/result?p=axios) +[![npm bundle size](https://img.shields.io/bundlephobia/minzip/axios?style=flat-square)](https://bundlephobia.com/package/axios@latest) +[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://npm-stat.com/charts.html?package=axios) +[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios) +[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios) +[![Known Vulnerabilities](https://snyk.io/test/npm/axios/badge.svg)](https://snyk.io/test/npm/axios) + + + + +
+ +## Table of Contents + + - [Features](#features) + - [Browser Support](#browser-support) + - [Installing](#installing) + - [Package manager](#package-manager) + - [CDN](#cdn) + - [Example](#example) + - [Axios API](#axios-api) + - [Request method aliases](#request-method-aliases) + - [Concurrency 👎](#concurrency-deprecated) + - [Creating an instance](#creating-an-instance) + - [Instance methods](#instance-methods) + - [Request Config](#request-config) + - [Response Schema](#response-schema) + - [Config Defaults](#config-defaults) + - [Global axios defaults](#global-axios-defaults) + - [Custom instance defaults](#custom-instance-defaults) + - [Config order of precedence](#config-order-of-precedence) + - [Interceptors](#interceptors) + - [Multiple Interceptors](#multiple-interceptors) + - [Handling Errors](#handling-errors) + - [Cancellation](#cancellation) + - [AbortController](#abortcontroller) + - [CancelToken 👎](#canceltoken-deprecated) + - [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format) + - [URLSearchParams](#urlsearchparams) + - [Query string](#query-string-older-browsers) + - [🆕 Automatic serialization](#-automatic-serialization-to-urlsearchparams) + - [Using multipart/form-data format](#using-multipartform-data-format) + - [FormData](#formdata) + - [🆕 Automatic serialization](#-automatic-serialization-to-formdata) + - [Files Posting](#files-posting) + - [HTML Form Posting](#-html-form-posting-browser) + - [🆕 Progress capturing](#-progress-capturing) + - [🆕 Rate limiting](#-progress-capturing) + - [🆕 AxiosHeaders](#-axiosheaders) + - [🔥 Fetch adapter](#-fetch-adapter) + - [Semver](#semver) + - [Promises](#promises) + - [TypeScript](#typescript) + - [Resources](#resources) + - [Credits](#credits) + - [License](#license) + +## Features + +- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser +- Make [http](https://nodejs.org/api/http.html) requests from node.js +- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API +- Intercept request and response +- Transform request and response data +- Cancel requests +- Automatic transforms for [JSON](https://www.json.org/json-en.html) data +- 🆕 Automatic data object serialization to `multipart/form-data` and `x-www-form-urlencoded` body encodings +- Client side support for protecting against [XSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) + +## Browser Support + +![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | +--- | --- | --- | --- | --- | --- | +Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ | + +[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios) + +## Installing + +### Package manager + +Using npm: + +```bash +$ npm install axios +``` + +Using bower: + +```bash +$ bower install axios +``` + +Using yarn: + +```bash +$ yarn add axios +``` + +Using pnpm: + +```bash +$ pnpm add axios +``` + +Once the package is installed, you can import the library using `import` or `require` approach: + +```js +import axios, {isCancel, AxiosError} from 'axios'; +``` + +You can also use the default export, since the named export is just a re-export from the Axios factory: + +```js +import axios from 'axios'; + +console.log(axios.isCancel('something')); +```` + +If you use `require` for importing, **only default export is available**: + +```js +const axios = require('axios'); + +console.log(axios.isCancel('something')); +``` + +For cases where something went wrong when trying to import a module into a custom or legacy environment, +you can try importing the module package directly: + +```js +const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundle (ES2017) +// const axios = require('axios/dist/node/axios.cjs'); // node commonJS bundle (ES2017) +``` + +### CDN + +Using jsDelivr CDN (ES5 UMD browser module): + +```html + +``` + +Using unpkg CDN: + +```html + +``` + +## Example + +> **Note**: CommonJS usage +> In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()`, use the following approach: + +```js +import axios from 'axios'; +//const axios = require('axios'); // legacy way + +// Make a request for a user with a given ID +axios.get('/user?ID=12345') + .then(function (response) { + // handle success + console.log(response); + }) + .catch(function (error) { + // handle error + console.log(error); + }) + .finally(function () { + // always executed + }); + +// Optionally the request above could also be done as +axios.get('/user', { + params: { + ID: 12345 + } + }) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { + console.log(error); + }) + .finally(function () { + // always executed + }); + +// Want to use async/await? Add the `async` keyword to your outer function/method. +async function getUser() { + try { + const response = await axios.get('/user?ID=12345'); + console.log(response); + } catch (error) { + console.error(error); + } +} +``` + +> **Note**: `async/await` is part of ECMAScript 2017 and is not supported in Internet +> Explorer and older browsers, so use with caution. + +Performing a `POST` request + +```js +axios.post('/user', { + firstName: 'Fred', + lastName: 'Flintstone' + }) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { + console.log(error); + }); +``` + +Performing multiple concurrent requests + +```js +function getUserAccount() { + return axios.get('/user/12345'); +} + +function getUserPermissions() { + return axios.get('/user/12345/permissions'); +} + +Promise.all([getUserAccount(), getUserPermissions()]) + .then(function (results) { + const acct = results[0]; + const perm = results[1]; + }); +``` + +## axios API + +Requests can be made by passing the relevant config to `axios`. + +##### axios(config) + +```js +// Send a POST request +axios({ + method: 'post', + url: '/user/12345', + data: { + firstName: 'Fred', + lastName: 'Flintstone' + } +}); +``` + +```js +// GET request for remote image in node.js +axios({ + method: 'get', + url: 'https://bit.ly/2mTM3nY', + responseType: 'stream' +}) + .then(function (response) { + response.data.pipe(fs.createWriteStream('ada_lovelace.jpg')) + }); +``` + +##### axios(url[, config]) + +```js +// Send a GET request (default method) +axios('/user/12345'); +``` + +### Request method aliases + +For convenience, aliases have been provided for all common request methods. + +##### axios.request(config) +##### axios.get(url[, config]) +##### axios.delete(url[, config]) +##### axios.head(url[, config]) +##### axios.options(url[, config]) +##### axios.post(url[, data[, config]]) +##### axios.put(url[, data[, config]]) +##### axios.patch(url[, data[, config]]) + +###### NOTE +When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config. + +### Concurrency (Deprecated) +Please use `Promise.all` to replace the below functions. + +Helper functions for dealing with concurrent requests. + +axios.all(iterable) +axios.spread(callback) + +### Creating an instance + +You can create a new instance of axios with a custom config. + +##### axios.create([config]) + +```js +const instance = axios.create({ + baseURL: 'https://some-domain.com/api/', + timeout: 1000, + headers: {'X-Custom-Header': 'foobar'} +}); +``` + +### Instance methods + +The available instance methods are listed below. The specified config will be merged with the instance config. + +##### axios#request(config) +##### axios#get(url[, config]) +##### axios#delete(url[, config]) +##### axios#head(url[, config]) +##### axios#options(url[, config]) +##### axios#post(url[, data[, config]]) +##### axios#put(url[, data[, config]]) +##### axios#patch(url[, data[, config]]) +##### axios#getUri([config]) + +## Request Config + +These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified. + +```js +{ + // `url` is the server URL that will be used for the request + url: '/user', + + // `method` is the request method to be used when making the request + method: 'get', // default + + // `baseURL` will be prepended to `url` unless `url` is absolute. + // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs + // to methods of that instance. + baseURL: 'https://some-domain.com/api/', + + // `transformRequest` allows changes to the request data before it is sent to the server + // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE' + // The last function in the array must return a string or an instance of Buffer, ArrayBuffer, + // FormData or Stream + // You may modify the headers object. + transformRequest: [function (data, headers) { + // Do whatever you want to transform the data + + return data; + }], + + // `transformResponse` allows changes to the response data to be made before + // it is passed to then/catch + transformResponse: [function (data) { + // Do whatever you want to transform the data + + return data; + }], + + // `headers` are custom headers to be sent + headers: {'X-Requested-With': 'XMLHttpRequest'}, + + // `params` are the URL parameters to be sent with the request + // Must be a plain object or a URLSearchParams object + params: { + ID: 12345 + }, + + // `paramsSerializer` is an optional config that allows you to customize serializing `params`. + paramsSerializer: { + + //Custom encoder function which sends key/value pairs in an iterative fashion. + encode?: (param: string): string => { /* Do custom operations here and return transformed string */ }, + + // Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour. + serialize?: (params: Record, options?: ParamsSerializerOptions ), + + //Configuration for formatting array indexes in the params. + indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes). + }, + + // `data` is the data to be sent as the request body + // Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH' + // When no `transformRequest` is set, must be of one of the following types: + // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams + // - Browser only: FormData, File, Blob + // - Node only: Stream, Buffer, FormData (form-data package) + data: { + firstName: 'Fred' + }, + + // syntax alternative to send data into the body + // method post + // only the value is sent, not the key + data: 'Country=Brasil&City=Belo Horizonte', + + // `timeout` specifies the number of milliseconds before the request times out. + // If the request takes longer than `timeout`, the request will be aborted. + timeout: 1000, // default is `0` (no timeout) + + // `withCredentials` indicates whether or not cross-site Access-Control requests + // should be made using credentials + withCredentials: false, // default + + // `adapter` allows custom handling of requests which makes testing easier. + // Return a promise and supply a valid response (see lib/adapters/README.md) + adapter: function (config) { + /* ... */ + }, + // Also, you can set the name of the built-in adapter, or provide an array with their names + // to choose the first available in the environment + adapter: 'xhr' // 'fetch' | 'http' | ['xhr', 'http', 'fetch'] + + // `auth` indicates that HTTP Basic auth should be used, and supplies credentials. + // This will set an `Authorization` header, overwriting any existing + // `Authorization` custom headers you have set using `headers`. + // Please note that only HTTP Basic auth is configurable through this parameter. + // For Bearer tokens and such, use `Authorization` custom headers instead. + auth: { + username: 'janedoe', + password: 's00pers3cret' + }, + + // `responseType` indicates the type of data that the server will respond with + // options are: 'arraybuffer', 'document', 'json', 'text', 'stream' + // browser only: 'blob' + responseType: 'json', // default + + // `responseEncoding` indicates encoding to use for decoding responses (Node.js only) + // Note: Ignored for `responseType` of 'stream' or client-side requests + // options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url', + // 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8', + // 'utf8', 'UTF8', 'utf16le', 'UTF16LE' + responseEncoding: 'utf8', // default + + // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token + xsrfCookieName: 'XSRF-TOKEN', // default + + // `xsrfHeaderName` is the name of the http header that carries the xsrf token value + xsrfHeaderName: 'X-XSRF-TOKEN', // default + + // `undefined` (default) - set XSRF header only for the same origin requests + withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined), + + // `onUploadProgress` allows handling of progress events for uploads + // browser & node.js + onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) { + // Do whatever you want with the Axios progress event + }, + + // `onDownloadProgress` allows handling of progress events for downloads + // browser & node.js + onDownloadProgress: function ({loaded, total, progress, bytes, estimated, rate, download = true}) { + // Do whatever you want with the Axios progress event + }, + + // `maxContentLength` defines the max size of the http response content in bytes allowed in node.js + maxContentLength: 2000, + + // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed + maxBodyLength: 2000, + + // `validateStatus` defines whether to resolve or reject the promise for a given + // HTTP response status code. If `validateStatus` returns `true` (or is set to `null` + // or `undefined`), the promise will be resolved; otherwise, the promise will be + // rejected. + validateStatus: function (status) { + return status >= 200 && status < 300; // default + }, + + // `maxRedirects` defines the maximum number of redirects to follow in node.js. + // If set to 0, no redirects will be followed. + maxRedirects: 21, // default + + // `beforeRedirect` defines a function that will be called before redirect. + // Use this to adjust the request options upon redirecting, + // to inspect the latest response headers, + // or to cancel the request by throwing an error + // If maxRedirects is set to 0, `beforeRedirect` is not used. + beforeRedirect: (options, { headers }) => { + if (options.hostname === "example.com") { + options.auth = "user:password"; + } + }, + + // `socketPath` defines a UNIX Socket to be used in node.js. + // e.g. '/var/run/docker.sock' to send requests to the docker daemon. + // Only either `socketPath` or `proxy` can be specified. + // If both are specified, `socketPath` is used. + socketPath: null, // default + + // `transport` determines the transport method that will be used to make the request. If defined, it will be used. Otherwise, if `maxRedirects` is 0, the default `http` or `https` library will be used, depending on the protocol specified in `protocol`. Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol, which can handle redirects. + transport: undefined, // default + + // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http + // and https requests, respectively, in node.js. This allows options to be added like + // `keepAlive` that are not enabled by default. + httpAgent: new http.Agent({ keepAlive: true }), + httpsAgent: new https.Agent({ keepAlive: true }), + + // `proxy` defines the hostname, port, and protocol of the proxy server. + // You can also define your proxy using the conventional `http_proxy` and + // `https_proxy` environment variables. If you are using environment variables + // for your proxy configuration, you can also define a `no_proxy` environment + // variable as a comma-separated list of domains that should not be proxied. + // Use `false` to disable proxies, ignoring environment variables. + // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and + // supplies credentials. + // This will set an `Proxy-Authorization` header, overwriting any existing + // `Proxy-Authorization` custom headers you have set using `headers`. + // If the proxy server uses HTTPS, then you must set the protocol to `https`. + proxy: { + protocol: 'https', + host: '127.0.0.1', + // hostname: '127.0.0.1' // Takes precedence over 'host' if both are defined + port: 9000, + auth: { + username: 'mikeymike', + password: 'rapunz3l' + } + }, + + // `cancelToken` specifies a cancel token that can be used to cancel the request + // (see Cancellation section below for details) + cancelToken: new CancelToken(function (cancel) { + }), + + // an alternative way to cancel Axios requests using AbortController + signal: new AbortController().signal, + + // `decompress` indicates whether or not the response body should be decompressed + // automatically. If set to `true` will also remove the 'content-encoding' header + // from the responses objects of all decompressed responses + // - Node only (XHR cannot turn off decompression) + decompress: true, // default + + // `insecureHTTPParser` boolean. + // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers. + // This may allow interoperability with non-conformant HTTP implementations. + // Using the insecure parser should be avoided. + // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback + // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none + insecureHTTPParser: undefined, // default + + // transitional options for backward compatibility that may be removed in the newer versions + transitional: { + // silent JSON parsing mode + // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour) + // `false` - throw SyntaxError if JSON parsing failed (Note: responseType must be set to 'json') + silentJSONParsing: true, // default value for the current Axios version + + // try to parse the response string as JSON even if `responseType` is not 'json' + forcedJSONParsing: true, + + // throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts + clarifyTimeoutError: false, + }, + + env: { + // The FormData class to be used to automatically serialize the payload into a FormData object + FormData: window?.FormData || global?.FormData + }, + + formSerializer: { + visitor: (value, key, path, helpers) => {}; // custom visitor function to serialize form values + dots: boolean; // use dots instead of brackets format + metaTokens: boolean; // keep special endings like {} in parameter key + indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes + }, + + // http adapter only (node.js) + maxRate: [ + 100 * 1024, // 100KB/s upload limit, + 100 * 1024 // 100KB/s download limit + ] +} +``` + +## Response Schema + +The response for a request contains the following information. + +```js +{ + // `data` is the response that was provided by the server + data: {}, + + // `status` is the HTTP status code from the server response + status: 200, + + // `statusText` is the HTTP status message from the server response + statusText: 'OK', + + // `headers` the HTTP headers that the server responded with + // All header names are lowercase and can be accessed using the bracket notation. + // Example: `response.headers['content-type']` + headers: {}, + + // `config` is the config that was provided to `axios` for the request + config: {}, + + // `request` is the request that generated this response + // It is the last ClientRequest instance in node.js (in redirects) + // and an XMLHttpRequest instance in the browser + request: {} +} +``` + +When using `then`, you will receive the response as follows: + +```js +axios.get('/user/12345') + .then(function (response) { + console.log(response.data); + console.log(response.status); + console.log(response.statusText); + console.log(response.headers); + console.log(response.config); + }); +``` + +When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section. + +## Config Defaults + +You can specify config defaults that will be applied to every request. + +### Global axios defaults + +```js +axios.defaults.baseURL = 'https://api.example.com'; + +// Important: If axios is used with multiple domains, the AUTH_TOKEN will be sent to all of them. +// See below for an example using Custom instance defaults instead. +axios.defaults.headers.common['Authorization'] = AUTH_TOKEN; + +axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; +``` + +### Custom instance defaults + +```js +// Set config defaults when creating the instance +const instance = axios.create({ + baseURL: 'https://api.example.com' +}); + +// Alter defaults after instance has been created +instance.defaults.headers.common['Authorization'] = AUTH_TOKEN; +``` + +### Config order of precedence + +Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults/index.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example. + +```js +// Create an instance using the config defaults provided by the library +// At this point the timeout config value is `0` as is the default for the library +const instance = axios.create(); + +// Override timeout default for the library +// Now all requests using this instance will wait 2.5 seconds before timing out +instance.defaults.timeout = 2500; + +// Override timeout for this request as it's known to take a long time +instance.get('/longRequest', { + timeout: 5000 +}); +``` + +## Interceptors + +You can intercept requests or responses before they are handled by `then` or `catch`. + +```js +// Add a request interceptor +axios.interceptors.request.use(function (config) { + // Do something before request is sent + return config; + }, function (error) { + // Do something with request error + return Promise.reject(error); + }); + +// Add a response interceptor +axios.interceptors.response.use(function (response) { + // Any status code that lie within the range of 2xx cause this function to trigger + // Do something with response data + return response; + }, function (error) { + // Any status codes that falls outside the range of 2xx cause this function to trigger + // Do something with response error + return Promise.reject(error); + }); +``` + +If you need to remove an interceptor later you can. + +```js +const myInterceptor = axios.interceptors.request.use(function () {/*...*/}); +axios.interceptors.request.eject(myInterceptor); +``` + +You can also clear all interceptors for requests or responses. +```js +const instance = axios.create(); +instance.interceptors.request.use(function () {/*...*/}); +instance.interceptors.request.clear(); // Removes interceptors from requests +instance.interceptors.response.use(function () {/*...*/}); +instance.interceptors.response.clear(); // Removes interceptors from responses +``` + +You can add interceptors to a custom instance of axios. + +```js +const instance = axios.create(); +instance.interceptors.request.use(function () {/*...*/}); +``` + +When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay +in the execution of your axios request when the main thread is blocked (a promise is created under the hood for +the interceptor and your request gets put on the bottom of the call stack). If your request interceptors are synchronous you can add a flag +to the options object that will tell axios to run the code synchronously and avoid any delays in request execution. + +```js +axios.interceptors.request.use(function (config) { + config.headers.test = 'I am only a header!'; + return config; +}, null, { synchronous: true }); +``` + +If you want to execute a particular interceptor based on a runtime check, +you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return +of `runWhen` is `false`. The function will be called with the config +object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an +asynchronous request interceptor that only needs to run at certain times. + +```js +function onGetCall(config) { + return config.method === 'get'; +} +axios.interceptors.request.use(function (config) { + config.headers.test = 'special get headers'; + return config; +}, null, { runWhen: onGetCall }); +``` + +### Multiple Interceptors + +Given you add multiple response interceptors +and when the response was fulfilled +- then each interceptor is executed +- then they are executed in the order they were added +- then only the last interceptor's result is returned +- then every interceptor receives the result of its predecessor +- and when the fulfillment-interceptor throws + - then the following fulfillment-interceptor is not called + - then the following rejection-interceptor is called + - once caught, another following fulfill-interceptor is called again (just like in a promise chain). + +Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code. + +## Error Types + +There are many different axios error messages that can appear that can provide basic information about the specifics of the error and where opportunities may lie in debugging. + +The general structure of axios errors is as follows: +| Property | Definition | +| -------- | ---------- | +| message | A quick summary of the error message and the status it failed with. | +| name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. | +| stack | Provides the stack trace of the error. | +| config | An axios config object with specific instance configurations defined by the user from when the request was made | +| code | Represents an axios identified error. The table below lists out specific definitions for internal axios error. | +| status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings. + +Below is a list of potential axios identified error +| Code | Definition | +| -------- | ---------- | +| ERR_BAD_OPTION_VALUE | Invalid or unsupported value provided in axios configuration. | +| ERR_BAD_OPTION | Invalid option provided in axios configuration. | +| ECONNABORTED | Request timed out due to exceeding timeout specified in axios configuration. | +| ETIMEDOUT | Request timed out due to exceeding default axios timelimit. | +| ERR_NETWORK | Network-related issue. +| ERR_FR_TOO_MANY_REDIRECTS | Request is redirected too many times; exceeds max redirects specified in axios configuration. +| ERR_DEPRECATED | Deprecated feature or method used in axios. +| ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. +| ERR_BAD_REQUEST | Requested has unexpected format or missing required parameters. | +| ERR_CANCELED | Feature or method is canceled explicitly by the user. +| ERR_NOT_SUPPORT | Feature or method not supported in the current axios environment. +| ERR_INVALID_URL | Invalid URL provided for axios request. + +## Handling Errors + +the default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error. + +```js +axios.get('/user/12345') + .catch(function (error) { + if (error.response) { + // The request was made and the server responded with a status code + // that falls out of the range of 2xx + console.log(error.response.data); + console.log(error.response.status); + console.log(error.response.headers); + } else if (error.request) { + // The request was made but no response was received + // `error.request` is an instance of XMLHttpRequest in the browser and an instance of + // http.ClientRequest in node.js + console.log(error.request); + } else { + // Something happened in setting up the request that triggered an Error + console.log('Error', error.message); + } + console.log(error.config); + }); +``` + +Using the `validateStatus` config option, you can override the default condition (status >= 200 && status < 300) and define HTTP code(s) that should throw an error. + +```js +axios.get('/user/12345', { + validateStatus: function (status) { + return status < 500; // Resolve only if the status code is less than 500 + } +}) +``` + +Using `toJSON` you get an object with more information about the HTTP error. + +```js +axios.get('/user/12345') + .catch(function (error) { + console.log(error.toJSON()); + }); +``` + +## Cancellation + +### AbortController + +Starting from `v0.22.0` Axios supports AbortController to cancel requests in fetch API way: + +```js +const controller = new AbortController(); + +axios.get('/foo/bar', { + signal: controller.signal +}).then(function(response) { + //... +}); +// cancel the request +controller.abort() +``` + +### CancelToken `👎deprecated` + +You can also cancel a request using a *CancelToken*. + +> The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises). + +> This API is deprecated since v0.22.0 and shouldn't be used in new projects + +You can create a cancel token using the `CancelToken.source` factory as shown below: + +```js +const CancelToken = axios.CancelToken; +const source = CancelToken.source(); + +axios.get('/user/12345', { + cancelToken: source.token +}).catch(function (thrown) { + if (axios.isCancel(thrown)) { + console.log('Request canceled', thrown.message); + } else { + // handle error + } +}); + +axios.post('/user/12345', { + name: 'new name' +}, { + cancelToken: source.token +}) + +// cancel the request (the message parameter is optional) +source.cancel('Operation canceled by the user.'); +``` + +You can also create a cancel token by passing an executor function to the `CancelToken` constructor: + +```js +const CancelToken = axios.CancelToken; +let cancel; + +axios.get('/user/12345', { + cancelToken: new CancelToken(function executor(c) { + // An executor function receives a cancel function as a parameter + cancel = c; + }) +}); + +// cancel the request +cancel(); +``` + +> **Note:** you can cancel several requests with the same cancel token/abort controller. +> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make a real request. + +> During the transition period, you can use both cancellation APIs, even for the same request: + +## Using `application/x-www-form-urlencoded` format + +### URLSearchParams + +By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers,and [ Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018). + +```js +const params = new URLSearchParams({ foo: 'bar' }); +params.append('extraparam', 'value'); +axios.post('/foo', params); +``` + +### Query string (Older browsers) + +For compatibility with very old browsers, there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment). + +Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library: + +```js +const qs = require('qs'); +axios.post('/foo', qs.stringify({ 'bar': 123 })); +``` + +Or in another way (ES6), + +```js +import qs from 'qs'; +const data = { 'bar': 123 }; +const options = { + method: 'POST', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + data: qs.stringify(data), + url, +}; +axios(options); +``` + +### Older Node.js versions + +For older Node.js engines, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows: + +```js +const querystring = require('querystring'); +axios.post('https://something.com/', querystring.stringify({ foo: 'bar' })); +``` + +You can also use the [`qs`](https://github.com/ljharb/qs) library. + +> **Note**: The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case. + +### 🆕 Automatic serialization to URLSearchParams + +Axios will automatically serialize the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded". + +```js +const data = { + x: 1, + arr: [1, 2, 3], + arr2: [1, [2], 3], + users: [{name: 'Peter', surname: 'Griffin'}, {name: 'Thomas', surname: 'Anderson'}], +}; + +await axios.postForm('https://postman-echo.com/post', data, + {headers: {'content-type': 'application/x-www-form-urlencoded'}} +); +``` + +The server will handle it as: + +```js + { + x: '1', + 'arr[]': [ '1', '2', '3' ], + 'arr2[0]': '1', + 'arr2[1][0]': '2', + 'arr2[2]': '3', + 'arr3[]': [ '1', '2', '3' ], + 'users[0][name]': 'Peter', + 'users[0][surname]': 'griffin', + 'users[1][name]': 'Thomas', + 'users[1][surname]': 'Anderson' + } +```` + +If your backend body-parser (like `body-parser` of `express.js`) supports nested objects decoding, you will get the same object on the server-side automatically + +```js + var app = express(); + + app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies + + app.post('/', function (req, res, next) { + // echo body as JSON + res.send(JSON.stringify(req.body)); + }); + + server = app.listen(3000); +``` + +## Using `multipart/form-data` format + +### FormData + +To send the data as a `multipart/formdata` you need to pass a formData instance as a payload. +Setting the `Content-Type` header is not required as Axios guesses it based on the payload type. + +```js +const formData = new FormData(); +formData.append('foo', 'bar'); + +axios.post('https://httpbin.org/post', formData); +``` + +In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows: + +```js +const FormData = require('form-data'); + +const form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); + +axios.post('https://example.com', form) +``` + +### 🆕 Automatic serialization to FormData + +Starting from `v0.27.0`, Axios supports automatic object serialization to a FormData object if the request `Content-Type` +header is set to `multipart/form-data`. + +The following request will submit the data in a FormData format (Browser & Node.js): + +```js +import axios from 'axios'; + +axios.post('https://httpbin.org/post', {x: 1}, { + headers: { + 'Content-Type': 'multipart/form-data' + } +}).then(({data}) => console.log(data)); +``` + +In the `node.js` build, the ([`form-data`](https://github.com/form-data/form-data)) polyfill is used by default. + +You can overload the FormData class by setting the `env.FormData` config variable, +but you probably won't need it in most cases: + +```js +const axios = require('axios'); +var FormData = require('form-data'); + +axios.post('https://httpbin.org/post', {x: 1, buf: new Buffer(10)}, { + headers: { + 'Content-Type': 'multipart/form-data' + } +}).then(({data}) => console.log(data)); +``` + +Axios FormData serializer supports some special endings to perform the following operations: + +- `{}` - serialize the value with JSON.stringify +- `[]` - unwrap the array-like object as separate fields with the same key + +> **Note**: unwrap/expand operation will be used by default on arrays and FileList objects + +FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases: + +- `visitor: Function` - user-defined visitor function that will be called recursively to serialize the data object +to a `FormData` object by following custom rules. + +- `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects; + +- `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key. +The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON. + +- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects + + - `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`) + - `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`) + - `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`) + +Let's say we have an object like this one: + +```js +const obj = { + x: 1, + arr: [1, 2, 3], + arr2: [1, [2], 3], + users: [{name: 'Peter', surname: 'Griffin'}, {name: 'Thomas', surname: 'Anderson'}], + 'obj2{}': [{x:1}] +}; +``` + +The following steps will be executed by the Axios serializer internally: + +```js +const formData = new FormData(); +formData.append('x', '1'); +formData.append('arr[]', '1'); +formData.append('arr[]', '2'); +formData.append('arr[]', '3'); +formData.append('arr2[0]', '1'); +formData.append('arr2[1][0]', '2'); +formData.append('arr2[2]', '3'); +formData.append('users[0][name]', 'Peter'); +formData.append('users[0][surname]', 'Griffin'); +formData.append('users[1][name]', 'Thomas'); +formData.append('users[1][surname]', 'Anderson'); +formData.append('obj2{}', '[{"x":1}]'); +``` + +Axios supports the following shortcut methods: `postForm`, `putForm`, `patchForm` +which are just the corresponding http methods with the `Content-Type` header preset to `multipart/form-data`. + +## Files Posting + +You can easily submit a single file: + +```js +await axios.postForm('https://httpbin.org/post', { + 'myVar' : 'foo', + 'file': document.querySelector('#fileInput').files[0] +}); +``` + +or multiple files as `multipart/form-data`: + +```js +await axios.postForm('https://httpbin.org/post', { + 'files[]': document.querySelector('#fileInput').files +}); +``` + +`FileList` object can be passed directly: + +```js +await axios.postForm('https://httpbin.org/post', document.querySelector('#fileInput').files) +``` + +All files will be sent with the same field names: `files[]`. + +## 🆕 HTML Form Posting (browser) + +Pass HTML Form element as a payload to submit it as `multipart/form-data` content. + +```js +await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm')); +``` + +`FormData` and `HTMLForm` objects can also be posted as `JSON` by explicitly setting the `Content-Type` header to `application/json`: + +```js +await axios.post('https://httpbin.org/post', document.querySelector('#htmlForm'), { + headers: { + 'Content-Type': 'application/json' + } +}) +``` + +For example, the Form + +```html +
+ + + + + + + + + +
+``` + +will be submitted as the following JSON object: + +```js +{ + "foo": "1", + "deep": { + "prop": { + "spaced": "3" + } + }, + "baz": [ + "4", + "5" + ], + "user": { + "age": "value2" + } +} +```` + +Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported. + +## 🆕 Progress capturing + +Axios supports both browser and node environments to capture request upload/download progress. +The frequency of progress events is forced to be limited to `3` times per second. + +```js +await axios.post(url, data, { + onUploadProgress: function (axiosProgressEvent) { + /*{ + loaded: number; + total?: number; + progress?: number; // in range [0..1] + bytes: number; // how many bytes have been transferred since the last trigger (delta) + estimated?: number; // estimated time in seconds + rate?: number; // upload speed in bytes + upload: true; // upload sign + }*/ + }, + + onDownloadProgress: function (axiosProgressEvent) { + /*{ + loaded: number; + total?: number; + progress?: number; + bytes: number; + estimated?: number; + rate?: number; // download speed in bytes + download: true; // download sign + }*/ + } +}); +``` + +You can also track stream upload/download progress in node.js: + +```js +const {data} = await axios.post(SERVER_URL, readableStream, { + onUploadProgress: ({progress}) => { + console.log((progress * 100).toFixed(2)); + }, + + headers: { + 'Content-Length': contentLength + }, + + maxRedirects: 0 // avoid buffering the entire stream +}); +```` + +> **Note:** +> Capturing FormData upload progress is not currently supported in node.js environments. + +> **⚠️ Warning** +> It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment, +> as follow-redirects package will buffer the entire stream in RAM without following the "backpressure" algorithm. + + +## 🆕 Rate limiting + +Download and upload rate limits can only be set for the http adapter (node.js): + +```js +const {data} = await axios.post(LOCAL_SERVER_URL, myBuffer, { + onUploadProgress: ({progress, rate}) => { + console.log(`Upload [${(progress*100).toFixed(2)}%]: ${(rate / 1024).toFixed(2)}KB/s`) + }, + + maxRate: [100 * 1024], // 100KB/s limit +}); +``` + +## 🆕 AxiosHeaders + +Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work. +Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons +and for a workaround when servers mistakenly consider the header's case. +The old approach of directly manipulating headers object is still available, but deprecated and not recommended for future usage. + +### Working with headers + +An AxiosHeaders object instance can contain different types of internal values. that control setting and merging logic. +The final headers object with string values is obtained by Axios by calling the `toJSON` method. + +> Note: By JSON here we mean an object consisting only of string values intended to be sent over the network. + +The header value can be one of the following types: +- `string` - normal string value that will be sent to the server +- `null` - skip header when rendering to JSON +- `false` - skip header when rendering to JSON, additionally indicates that `set` method must be called with `rewrite` option set to `true` + to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`) +- `undefined` - value is not set + +> Note: The header value is considered set if it is not equal to undefined. + +The headers object is always initialized inside interceptors and transformers: + +```ts + axios.interceptors.request.use((request: InternalAxiosRequestConfig) => { + request.headers.set('My-header', 'value'); + + request.headers.set({ + "My-set-header1": "my-set-value1", + "My-set-header2": "my-set-value2" + }); + + request.headers.set('User-Agent', false); // disable subsequent setting the header by Axios + + request.headers.setContentType('text/plain'); + + request.headers['My-set-header2'] = 'newValue' // direct access is deprecated + + return request; + } + ); +```` + +You can iterate over an `AxiosHeaders` instance using a `for...of` statement: + +````js +const headers = new AxiosHeaders({ + foo: '1', + bar: '2', + baz: '3' +}); + +for(const [header, value] of headers) { + console.log(header, value); +} + +// foo 1 +// bar 2 +// baz 3 +```` + +### new AxiosHeaders(headers?) + +Constructs a new `AxiosHeaders` instance. + +``` +constructor(headers?: RawAxiosHeaders | AxiosHeaders | string); +``` + +If the headers object is a string, it will be parsed as RAW HTTP headers. + +````js +const headers = new AxiosHeaders(` +Host: www.bing.com +User-Agent: curl/7.54.0 +Accept: */*`); + +console.log(headers); + +// Object [AxiosHeaders] { +// host: 'www.bing.com', +// 'user-agent': 'curl/7.54.0', +// accept: '*/*' +// } +```` + +### AxiosHeaders#set + +```ts +set(headerName, value: Axios, rewrite?: boolean); +set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean); +set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean); +``` + +The `rewrite` argument controls the overwriting behavior: +- `false` - do not overwrite if header's value is set (is not `undefined`) +- `undefined` (default) - overwrite the header unless its value is set to `false` +- `true` - rewrite anyway + +The option can also accept a user-defined function that determines whether the value should be overwritten or not. + +Returns `this`. + +### AxiosHeaders#get(header) + +``` + get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue; + get(headerName: string, parser: RegExp): RegExpExecArray | null; +```` + +Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`, +matcher function or internal key-value parser. + +```ts +const headers = new AxiosHeaders({ + 'Content-Type': 'multipart/form-data; boundary=Asrf456BGe4h' +}); + +console.log(headers.get('Content-Type')); +// multipart/form-data; boundary=Asrf456BGe4h + +console.log(headers.get('Content-Type', true)); // parse key-value pairs from a string separated with \s,;= delimiters: +// [Object: null prototype] { +// 'multipart/form-data': undefined, +// boundary: 'Asrf456BGe4h' +// } + + +console.log(headers.get('Content-Type', (value, name, headers) => { + return String(value).replace(/a/g, 'ZZZ'); +})); +// multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h + +console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]); +// boundary=Asrf456BGe4h + +``` + +Returns the value of the header. + +### AxiosHeaders#has(header, matcher?) + +``` +has(header: string, matcher?: AxiosHeaderMatcher): boolean; +``` + +Returns `true` if the header is set (has no `undefined` value). + +### AxiosHeaders#delete(header, matcher?) + +``` +delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean; +``` + +Returns `true` if at least one header has been removed. + +### AxiosHeaders#clear(matcher?) + +``` +clear(matcher?: AxiosHeaderMatcher): boolean; +``` + +Removes all headers. +Unlike the `delete` method matcher, this optional matcher will be used to match against the header name rather than the value. + +```ts +const headers = new AxiosHeaders({ + 'foo': '1', + 'x-foo': '2', + 'x-bar': '3', +}); + +console.log(headers.clear(/^x-/)); // true + +console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' } +``` + +Returns `true` if at least one header has been cleared. + +### AxiosHeaders#normalize(format); + +If the headers object was changed directly, it can have duplicates with the same name but in different cases. +This method normalizes the headers object by combining duplicate keys into one. +Axios uses this method internally after calling each interceptor. +Set `format` to true for converting headers name to lowercase and capitalize the initial letters (`cOntEnt-type` => `Content-Type`) + +```js +const headers = new AxiosHeaders({ + 'foo': '1', +}); + +headers.Foo = '2'; +headers.FOO = '3'; + +console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' } +console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' } +console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' } +``` + +Returns `this`. + +### AxiosHeaders#concat(...targets) + +``` +concat(...targets: Array): AxiosHeaders; +``` + +Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, it will be parsed as RAW HTTP headers. + +Returns a new `AxiosHeaders` instance. + +### AxiosHeaders#toJSON(asStrings?) + +```` +toJSON(asStrings?: boolean): RawAxiosHeaders; +```` + +Resolve all internal headers values into a new null prototype object. +Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas. + +### AxiosHeaders.from(thing?) + +```` +from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders; +```` + +Returns a new `AxiosHeaders` instance created from the raw headers passed in, +or simply returns the given headers object if it's an `AxiosHeaders` instance. + +### AxiosHeaders.concat(...targets) + +```` +concat(...targets: Array): AxiosHeaders; +```` + +Returns a new `AxiosHeaders` instance created by merging the target objects. + +### Shortcuts + +The following shortcuts are available: + +- `setContentType`, `getContentType`, `hasContentType` + +- `setContentLength`, `getContentLength`, `hasContentLength` + +- `setAccept`, `getAccept`, `hasAccept` + +- `setUserAgent`, `getUserAgent`, `hasUserAgent` + +- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding` + +## 🔥 Fetch adapter + +Fetch adapter was introduced in `v1.7.0`. By default, it will be used if `xhr` and `http` adapters are not available in the build, +or not supported by the environment. +To use it by default, it must be selected explicitly: + +```js +const {data} = axios.get(url, { + adapter: 'fetch' // by default ['xhr', 'http', 'fetch'] +}) +``` + +You can create a separate instance for this: + +```js +const fetchAxios = axios.create({ + adapter: 'fetch' +}); + +const {data} = fetchAxios.get(url); +``` + +The adapter supports the same functionality as `xhr` adapter, **including upload and download progress capturing**. +Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment). + +## Semver + +Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes. + +## Promises + +axios depends on a native ES6 Promise implementation to be [supported](https://caniuse.com/promises). +If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise). + +## TypeScript + +axios includes [TypeScript](https://typescriptlang.org) definitions and a type guard for axios errors. + +```typescript +let user: User = null; +try { + const { data } = await axios.get('/user?ID=12345'); + user = data.userDetails; +} catch (error) { + if (axios.isAxiosError(error)) { + handleAxiosError(error); + } else { + handleUnexpectedError(error); + } +} +``` + +Because axios dual publishes with an ESM default export and a CJS `module.exports`, there are some caveats. +The recommended setting is to use `"moduleResolution": "node16"` (this is implied by `"module": "node16"`). Note that this requires TypeScript 4.7 or greater. +If use ESM, your settings should be fine. +If you compile TypeScript to CJS and you can’t use `"moduleResolution": "node 16"`, you have to enable `esModuleInterop`. +If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`. + +## Online one-click setup + +You can use Gitpod, an online IDE(which is free for Open Source) for contributing or running the examples online. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/main/examples/server.js) + + +## Resources + +* [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) +* [Ecosystem](https://github.com/axios/axios/blob/v1.x/ECOSYSTEM.md) +* [Contributing Guide](https://github.com/axios/axios/blob/v1.x/CONTRIBUTING.md) +* [Code of Conduct](https://github.com/axios/axios/blob/v1.x/CODE_OF_CONDUCT.md) + +## Credits + +axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS. + +## License + +[MIT](LICENSE) diff --git a/node_modules/axios/SECURITY.md b/node_modules/axios/SECURITY.md new file mode 100644 index 00000000..a5a2b7d2 --- /dev/null +++ b/node_modules/axios/SECURITY.md @@ -0,0 +1,6 @@ +# Reporting a Vulnerability + +If you discover a security vulnerability in axios please disclose it via [our huntr page](https://huntr.dev/repos/axios/axios/). Bounty eligibility, CVE assignment, response times and past reports are all there. + + +Thank you for improving the security of axios. diff --git a/node_modules/axios/dist/axios.js b/node_modules/axios/dist/axios.js new file mode 100644 index 00000000..88921735 --- /dev/null +++ b/node_modules/axios/dist/axios.js @@ -0,0 +1,4172 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory()); +})(this, (function () { 'use strict'; + + function _AsyncGenerator(e) { + var r, t; + function resume(r, t) { + try { + var n = e[r](t), + o = n.value, + u = o instanceof _OverloadYield; + Promise.resolve(u ? o.v : o).then(function (t) { + if (u) { + var i = "return" === r ? "return" : "next"; + if (!o.k || t.done) return resume(i, t); + t = e[i](t).value; + } + settle(n.done ? "return" : "normal", t); + }, function (e) { + resume("throw", e); + }); + } catch (e) { + settle("throw", e); + } + } + function settle(e, n) { + switch (e) { + case "return": + r.resolve({ + value: n, + done: !0 + }); + break; + case "throw": + r.reject(n); + break; + default: + r.resolve({ + value: n, + done: !1 + }); + } + (r = r.next) ? resume(r.key, r.arg) : t = null; + } + this._invoke = function (e, n) { + return new Promise(function (o, u) { + var i = { + key: e, + arg: n, + resolve: o, + reject: u, + next: null + }; + t ? t = t.next = i : (r = t = i, resume(e, n)); + }); + }, "function" != typeof e.return && (this.return = void 0); + } + _AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { + return this; + }, _AsyncGenerator.prototype.next = function (e) { + return this._invoke("next", e); + }, _AsyncGenerator.prototype.throw = function (e) { + return this._invoke("throw", e); + }, _AsyncGenerator.prototype.return = function (e) { + return this._invoke("return", e); + }; + function _OverloadYield(t, e) { + this.v = t, this.k = e; + } + function _asyncGeneratorDelegate(t) { + var e = {}, + n = !1; + function pump(e, r) { + return n = !0, r = new Promise(function (n) { + n(t[e](r)); + }), { + done: !1, + value: new _OverloadYield(r, 1) + }; + } + return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { + return this; + }, e.next = function (t) { + return n ? (n = !1, t) : pump("next", t); + }, "function" == typeof t.throw && (e.throw = function (t) { + if (n) throw n = !1, t; + return pump("throw", t); + }), "function" == typeof t.return && (e.return = function (t) { + return n ? (n = !1, t) : pump("return", t); + }), e; + } + function _asyncIterator(r) { + var n, + t, + o, + e = 2; + for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { + if (t && null != (n = r[t])) return n.call(r); + if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); + t = "@@asyncIterator", o = "@@iterator"; + } + throw new TypeError("Object is not async iterable"); + } + function AsyncFromSyncIterator(r) { + function AsyncFromSyncIteratorContinuation(r) { + if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); + var n = r.done; + return Promise.resolve(r.value).then(function (r) { + return { + value: r, + done: n + }; + }); + } + return AsyncFromSyncIterator = function (r) { + this.s = r, this.n = r.next; + }, AsyncFromSyncIterator.prototype = { + s: null, + n: null, + next: function () { + return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); + }, + return: function (r) { + var n = this.s.return; + return void 0 === n ? Promise.resolve({ + value: r, + done: !0 + }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + }, + throw: function (r) { + var n = this.s.return; + return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + } + }, new AsyncFromSyncIterator(r); + } + function _awaitAsyncGenerator(e) { + return new _OverloadYield(e, 0); + } + function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } + } + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; + } + function _regeneratorRuntime() { + _regeneratorRuntime = function () { + return e; + }; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = Object.defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof Symbol ? Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function (t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = Object.create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = Object.getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + ["next", "throw", "return"].forEach(function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function (t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw new Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(typeof e + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) r.push(n); + return r.reverse(), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function (e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function () { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function (e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw new Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function (t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function (t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function (t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + catch: function (t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function (e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : String(i); + } + function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); + } + function _wrapAsyncGenerator(fn) { + return function () { + return new _AsyncGenerator(fn.apply(this, arguments)); + }; + } + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } + } + function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(undefined); + }); + }; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _toArray(arr) { + return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); + } + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _createForOfIteratorHelper(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (!it) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + var F = function () {}; + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = it.call(o); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + + function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; + } + + // utils is a library of generic helper functions non-specific to axios + + var toString = Object.prototype.toString; + var getPrototypeOf = Object.getPrototypeOf; + var kindOf = function (cache) { + return function (thing) { + var str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); + }; + }(Object.create(null)); + var kindOfTest = function kindOfTest(type) { + type = type.toLowerCase(); + return function (thing) { + return kindOf(thing) === type; + }; + }; + var typeOfTest = function typeOfTest(type) { + return function (thing) { + return _typeof(thing) === type; + }; + }; + + /** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ + var isArray = Array.isArray; + + /** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ + var isUndefined = typeOfTest('undefined'); + + /** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ + function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); + } + + /** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ + var isArrayBuffer = kindOfTest('ArrayBuffer'); + + /** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ + function isArrayBufferView(val) { + var result; + if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { + result = ArrayBuffer.isView(val); + } else { + result = val && val.buffer && isArrayBuffer(val.buffer); + } + return result; + } + + /** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ + var isString = typeOfTest('string'); + + /** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ + var isFunction = typeOfTest('function'); + + /** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ + var isNumber = typeOfTest('number'); + + /** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ + var isObject = function isObject(thing) { + return thing !== null && _typeof(thing) === 'object'; + }; + + /** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ + var isBoolean = function isBoolean(thing) { + return thing === true || thing === false; + }; + + /** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ + var isPlainObject = function isPlainObject(val) { + if (kindOf(val) !== 'object') { + return false; + } + var prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); + }; + + /** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ + var isDate = kindOfTest('Date'); + + /** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ + var isFile = kindOfTest('File'); + + /** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ + var isBlob = kindOfTest('Blob'); + + /** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ + var isFileList = kindOfTest('FileList'); + + /** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ + var isStream = function isStream(val) { + return isObject(val) && isFunction(val.pipe); + }; + + /** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ + var isFormData = function isFormData(thing) { + var kind; + return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')); + }; + + /** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ + var isURLSearchParams = kindOfTest('URLSearchParams'); + var _map = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest), + _map2 = _slicedToArray(_map, 4), + isReadableStream = _map2[0], + isRequest = _map2[1], + isResponse = _map2[2], + isHeaders = _map2[3]; + + /** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ + var trim = function trim(str) { + return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + }; + + /** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ + function forEach(obj, fn) { + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + _ref$allOwnKeys = _ref.allOwnKeys, + allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys; + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + var i; + var l; + + // Force an array if not already something iterable + if (_typeof(obj) !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + var len = keys.length; + var key; + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } + } + function findKey(obj, key) { + key = key.toLowerCase(); + var keys = Object.keys(obj); + var i = keys.length; + var _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; + } + var _global = function () { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global; + }(); + var isContextDefined = function isContextDefined(context) { + return !isUndefined(context) && context !== _global; + }; + + /** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ + function merge( /* obj1, obj2, obj3, ... */ + ) { + var _ref2 = isContextDefined(this) && this || {}, + caseless = _ref2.caseless; + var result = {}; + var assignValue = function assignValue(val, key) { + var targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + for (var i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; + } + + /** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ + var extend = function extend(a, b, thisArg) { + var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, + allOwnKeys = _ref3.allOwnKeys; + forEach(b, function (val, key) { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, { + allOwnKeys: allOwnKeys + }); + return a; + }; + + /** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ + var stripBOM = function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; + }; + + /** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ + var inherits = function inherits(constructor, superConstructor, props, descriptors) { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); + }; + + /** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ + var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) { + var props; + var i; + var prop; + var merged = {}; + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + return destObj; + }; + + /** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ + var endsWith = function endsWith(str, searchString, position) { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + var lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }; + + /** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ + var toArray = function toArray(thing) { + if (!thing) return null; + if (isArray(thing)) return thing; + var i = thing.length; + if (!isNumber(i)) return null; + var arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; + }; + + /** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ + // eslint-disable-next-line func-names + var isTypedArray = function (TypedArray) { + // eslint-disable-next-line func-names + return function (thing) { + return TypedArray && thing instanceof TypedArray; + }; + }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + + /** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ + var forEachEntry = function forEachEntry(obj, fn) { + var generator = obj && obj[Symbol.iterator]; + var iterator = generator.call(obj); + var result; + while ((result = iterator.next()) && !result.done) { + var pair = result.value; + fn.call(obj, pair[0], pair[1]); + } + }; + + /** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ + var matchAll = function matchAll(regExp, str) { + var matches; + var arr = []; + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + return arr; + }; + + /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ + var isHTMLForm = kindOfTest('HTMLFormElement'); + var toCamelCase = function toCamelCase(str) { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + }); + }; + + /* Creating a function that will check if an object has a property. */ + var hasOwnProperty = function (_ref4) { + var hasOwnProperty = _ref4.hasOwnProperty; + return function (obj, prop) { + return hasOwnProperty.call(obj, prop); + }; + }(Object.prototype); + + /** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ + var isRegExp = kindOfTest('RegExp'); + var reduceDescriptors = function reduceDescriptors(obj, reducer) { + var descriptors = Object.getOwnPropertyDescriptors(obj); + var reducedDescriptors = {}; + forEach(descriptors, function (descriptor, name) { + var ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + Object.defineProperties(obj, reducedDescriptors); + }; + + /** + * Makes all methods read-only + * @param {Object} obj + */ + + var freezeMethods = function freezeMethods(obj) { + reduceDescriptors(obj, function (descriptor, name) { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + var value = obj[name]; + if (!isFunction(value)) return; + descriptor.enumerable = false; + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + if (!descriptor.set) { + descriptor.set = function () { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); + }; + var toObjectSet = function toObjectSet(arrayOrString, delimiter) { + var obj = {}; + var define = function define(arr) { + arr.forEach(function (value) { + obj[value] = true; + }); + }; + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + return obj; + }; + var noop = function noop() {}; + var toFiniteNumber = function toFiniteNumber(value, defaultValue) { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; + }; + var ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + var DIGIT = '0123456789'; + var ALPHABET = { + DIGIT: DIGIT, + ALPHA: ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT + }; + var generateString = function generateString() { + var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16; + var alphabet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALPHABET.ALPHA_DIGIT; + var str = ''; + var length = alphabet.length; + while (size--) { + str += alphabet[Math.random() * length | 0]; + } + return str; + }; + + /** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ + function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); + } + var toJSONObject = function toJSONObject(obj) { + var stack = new Array(10); + var visit = function visit(source, i) { + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + if (!('toJSON' in source)) { + stack[i] = source; + var target = isArray(source) ? [] : {}; + forEach(source, function (value, key) { + var reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + stack[i] = undefined; + return target; + } + } + return source; + }; + return visit(obj, 0); + }; + var isAsyncFn = kindOfTest('AsyncFunction'); + var isThenable = function isThenable(thing) { + return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]); + }; + var utils$1 = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isBoolean: isBoolean, + isObject: isObject, + isPlainObject: isPlainObject, + isReadableStream: isReadableStream, + isRequest: isRequest, + isResponse: isResponse, + isHeaders: isHeaders, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isRegExp: isRegExp, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isTypedArray: isTypedArray, + isFileList: isFileList, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM, + inherits: inherits, + toFlatObject: toFlatObject, + kindOf: kindOf, + kindOfTest: kindOfTest, + endsWith: endsWith, + toArray: toArray, + forEachEntry: forEachEntry, + matchAll: matchAll, + isHTMLForm: isHTMLForm, + hasOwnProperty: hasOwnProperty, + hasOwnProp: hasOwnProperty, + // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors: reduceDescriptors, + freezeMethods: freezeMethods, + toObjectSet: toObjectSet, + toCamelCase: toCamelCase, + noop: noop, + toFiniteNumber: toFiniteNumber, + findKey: findKey, + global: _global, + isContextDefined: isContextDefined, + ALPHABET: ALPHABET, + generateString: generateString, + isSpecCompliantForm: isSpecCompliantForm, + toJSONObject: toJSONObject, + isAsyncFn: isAsyncFn, + isThenable: isThenable + }; + + /** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ + function AxiosError(message, code, config, request, response) { + Error.call(this); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = new Error().stack; + } + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); + } + utils$1.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } + }); + var prototype$1 = AxiosError.prototype; + var descriptors = {}; + ['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL' + // eslint-disable-next-line func-names + ].forEach(function (code) { + descriptors[code] = { + value: code + }; + }); + Object.defineProperties(AxiosError, descriptors); + Object.defineProperty(prototype$1, 'isAxiosError', { + value: true + }); + + // eslint-disable-next-line func-names + AxiosError.from = function (error, code, config, request, response, customProps) { + var axiosError = Object.create(prototype$1); + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, function (prop) { + return prop !== 'isAxiosError'; + }); + AxiosError.call(axiosError, error.message, code, config, request, response); + axiosError.cause = error; + axiosError.name = error.name; + customProps && Object.assign(axiosError, customProps); + return axiosError; + }; + + // eslint-disable-next-line strict + var httpAdapter = null; + + /** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ + function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); + } + + /** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ + function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; + } + + /** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ + function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); + } + + /** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ + function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); + } + var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); + }); + + /** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + + /** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ + function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + var metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + var visitor = options.visitor || defaultVisitor; + var dots = options.dots; + var indexes = options.indexes; + var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + var useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + function convertValue(value) { + if (value === null) return ''; + if (utils$1.isDate(value)) { + return value.toISOString(); + } + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + var arr = value; + if (value && !path && _typeof(value) === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el)); + }); + return false; + } + } + if (isVisitable(value)) { + return true; + } + formData.append(renderKey(path, key, dots), convertValue(value)); + return false; + } + var stack = []; + var exposedHelpers = Object.assign(predicates, { + defaultVisitor: defaultVisitor, + convertValue: convertValue, + isVisitable: isVisitable + }); + function build(value, path) { + if (utils$1.isUndefined(value)) return; + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + stack.push(value); + utils$1.forEach(value, function each(el, key) { + var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers); + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + stack.pop(); + } + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + build(obj); + return formData; + } + + /** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ + function encode$1(str) { + var charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); + } + + /** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ + function AxiosURLSearchParams(params, options) { + this._pairs = []; + params && toFormData(params, this, options); + } + var prototype = AxiosURLSearchParams.prototype; + prototype.append = function append(name, value) { + this._pairs.push([name, value]); + }; + prototype.toString = function toString(encoder) { + var _encode = encoder ? function (value) { + return encoder.call(this, value, encode$1); + } : encode$1; + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); + }; + + /** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ + function encode(val) { + return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']'); + } + + /** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ + function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + var _encode = options && options.encode || encode; + var serializeFn = options && options.serialize; + var serializedParams; + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode); + } + if (serializedParams) { + var hashmarkIndex = url.indexOf("#"); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + return url; + } + + var InterceptorManager = /*#__PURE__*/function () { + function InterceptorManager() { + _classCallCheck(this, InterceptorManager); + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + _createClass(InterceptorManager, [{ + key: "use", + value: function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + }, { + key: "eject", + value: function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + }, { + key: "clear", + value: function clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + }, { + key: "forEach", + value: function forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } + }]); + return InterceptorManager; + }(); + var InterceptorManager$1 = InterceptorManager; + + var transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }; + + var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; + + var FormData$1 = typeof FormData !== 'undefined' ? FormData : null; + + var Blob$1 = typeof Blob !== 'undefined' ? Blob : null; + + var platform$1 = { + isBrowser: true, + classes: { + URLSearchParams: URLSearchParams$1, + FormData: FormData$1, + Blob: Blob$1 + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] + }; + + var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + + /** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ + var hasStandardBrowserEnv = function (product) { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0; + }(typeof navigator !== 'undefined' && navigator.product); + + /** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ + var hasStandardBrowserWebWorkerEnv = function () { + return typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && typeof self.importScripts === 'function'; + }(); + var origin = hasBrowserEnv && window.location.href || 'http://localhost'; + + var utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin + }); + + var platform = _objectSpread2(_objectSpread2({}, utils), platform$1); + + function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function visitor(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); + } + + /** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ + function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); + } + + /** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ + function arrayToObject(arr) { + var obj = {}; + var keys = Object.keys(arr); + var i; + var len = keys.length; + var key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; + } + + /** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ + function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + var name = path[index++]; + if (name === '__proto__') return true; + var isNumericKey = Number.isFinite(+name); + var isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + return !isNumericKey; + } + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + var result = buildPath(path, value, target[name], index); + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + return !isNumericKey; + } + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + var obj = {}; + utils$1.forEachEntry(formData, function (name, value) { + buildPath(parsePropPath(name), value, obj, 0); + }); + return obj; + } + return null; + } + + /** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ + function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + return (encoder || JSON.stringify)(rawValue); + } + var defaults = { + transitional: transitionalDefaults, + adapter: ['xhr', 'http', 'fetch'], + transformRequest: [function transformRequest(data, headers) { + var contentType = headers.getContentType() || ''; + var hasJSONContentType = contentType.indexOf('application/json') > -1; + var isObjectPayload = utils$1.isObject(data); + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + var isFormData = utils$1.isFormData(data); + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + var isFileList; + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + var _FormData = this.env && this.env.FormData; + return toFormData(isFileList ? { + 'files[]': data + } : data, _FormData && new _FormData(), this.formSerializer); + } + } + if (isObjectPayload || hasJSONContentType) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + return data; + }], + transformResponse: [function transformResponse(data) { + var transitional = this.transitional || defaults.transitional; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var JSONRequested = this.responseType === 'json'; + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) { + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var strictJSONParsing = !silentJSONParsing && JSONRequested; + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + return data; + }], + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + maxContentLength: -1, + maxBodyLength: -1, + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } + }; + utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) { + defaults.headers[method] = {}; + }); + var defaults$1 = defaults; + + // RawAxiosHeaders whose duplicates are ignored by node + // c.f. https://nodejs.org/api/http.html#http_message_headers + var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']); + + /** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ + var parseHeaders = (function (rawHeaders) { + var parsed = {}; + var key; + var val; + var i; + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + if (!key || parsed[key] && ignoreDuplicateOf[key]) { + return; + } + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + return parsed; + }); + + var $internals = Symbol('internals'); + function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); + } + function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); + } + function parseTokens(str) { + var tokens = Object.create(null); + var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + var match; + while (match = tokensRE.exec(str)) { + tokens[match[1]] = match[2]; + } + return tokens; + } + var isValidHeaderName = function isValidHeaderName(str) { + return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + }; + function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + if (isHeaderNameFilter) { + value = header; + } + if (!utils$1.isString(value)) return; + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } + } + function formatHeader(header) { + return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) { + return _char.toUpperCase() + str; + }); + } + function buildAccessors(obj, header) { + var accessorName = utils$1.toCamelCase(' ' + header); + ['get', 'set', 'has'].forEach(function (methodName) { + Object.defineProperty(obj, methodName + accessorName, { + value: function value(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); + } + var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) { + function AxiosHeaders(headers) { + _classCallCheck(this, AxiosHeaders); + headers && this.set(headers); + } + _createClass(AxiosHeaders, [{ + key: "set", + value: function set(header, valueOrRewrite, rewrite) { + var self = this; + function setHeader(_value, _header, _rewrite) { + var lHeader = normalizeHeader(_header); + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + var key = utils$1.findKey(self, lHeader); + if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) { + self[key || _header] = normalizeValue(_value); + } + } + var setHeaders = function setHeaders(headers, _rewrite) { + return utils$1.forEach(headers, function (_value, _header) { + return setHeader(_value, _header, _rewrite); + }); + }; + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + var _iterator = _createForOfIteratorHelper(header.entries()), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + key = _step$value[0], + value = _step$value[1]; + setHeader(value, key, rewrite); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + return this; + } + }, { + key: "get", + value: function get(header, parser) { + header = normalizeHeader(header); + if (header) { + var key = utils$1.findKey(this, header); + if (key) { + var value = this[key]; + if (!parser) { + return value; + } + if (parser === true) { + return parseTokens(value); + } + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + }, { + key: "has", + value: function has(header, matcher) { + header = normalizeHeader(header); + if (header) { + var key = utils$1.findKey(this, header); + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + return false; + } + }, { + key: "delete", + value: function _delete(header, matcher) { + var self = this; + var deleted = false; + function deleteHeader(_header) { + _header = normalizeHeader(_header); + if (_header) { + var key = utils$1.findKey(self, _header); + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + deleted = true; + } + } + } + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + return deleted; + } + }, { + key: "clear", + value: function clear(matcher) { + var keys = Object.keys(this); + var i = keys.length; + var deleted = false; + while (i--) { + var key = keys[i]; + if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + return deleted; + } + }, { + key: "normalize", + value: function normalize(format) { + var self = this; + var headers = {}; + utils$1.forEach(this, function (value, header) { + var key = utils$1.findKey(headers, header); + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + var normalized = format ? formatHeader(header) : String(header).trim(); + if (normalized !== header) { + delete self[header]; + } + self[normalized] = normalizeValue(value); + headers[normalized] = true; + }); + return this; + } + }, { + key: "concat", + value: function concat() { + var _this$constructor; + for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) { + targets[_key] = arguments[_key]; + } + return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets)); + } + }, { + key: "toJSON", + value: function toJSON(asStrings) { + var obj = Object.create(null); + utils$1.forEach(this, function (value, header) { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + return obj; + } + }, { + key: _Symbol$iterator, + value: function value() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + }, { + key: "toString", + value: function toString() { + return Object.entries(this.toJSON()).map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + header = _ref2[0], + value = _ref2[1]; + return header + ': ' + value; + }).join('\n'); + } + }, { + key: _Symbol$toStringTag, + get: function get() { + return 'AxiosHeaders'; + } + }], [{ + key: "from", + value: function from(thing) { + return thing instanceof this ? thing : new this(thing); + } + }, { + key: "concat", + value: function concat(first) { + var computed = new this(first); + for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + targets[_key2 - 1] = arguments[_key2]; + } + targets.forEach(function (target) { + return computed.set(target); + }); + return computed; + } + }, { + key: "accessor", + value: function accessor(header) { + var internals = this[$internals] = this[$internals] = { + accessors: {} + }; + var accessors = internals.accessors; + var prototype = this.prototype; + function defineAccessor(_header) { + var lHeader = normalizeHeader(_header); + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + return this; + } + }]); + return AxiosHeaders; + }(Symbol.iterator, Symbol.toStringTag); + AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + + // reserved names hotfix + utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) { + var value = _ref3.value; + var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: function get() { + return value; + }, + set: function set(headerValue) { + this[mapped] = headerValue; + } + }; + }); + utils$1.freezeMethods(AxiosHeaders); + var AxiosHeaders$1 = AxiosHeaders; + + /** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ + function transformData(fns, response) { + var config = this || defaults$1; + var context = response || config; + var headers = AxiosHeaders$1.from(context.headers); + var data = context.data; + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + headers.normalize(); + return data; + } + + function isCancel(value) { + return !!(value && value.__CANCEL__); + } + + /** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ + function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; + } + utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true + }); + + /** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ + function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response)); + } + } + + function parseProtocol(url) { + var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; + } + + /** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ + function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + var bytes = new Array(samplesCount); + var timestamps = new Array(samplesCount); + var head = 0; + var tail = 0; + var firstSampleTS; + min = min !== undefined ? min : 1000; + return function push(chunkLength) { + var now = Date.now(); + var startedAt = timestamps[tail]; + if (!firstSampleTS) { + firstSampleTS = now; + } + bytes[head] = chunkLength; + timestamps[head] = now; + var i = tail; + var bytesCount = 0; + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + head = (head + 1) % samplesCount; + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + if (now - firstSampleTS < min) { + return; + } + var passed = startedAt && now - startedAt; + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; + } + + /** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ + function throttle(fn, freq) { + var timestamp = 0; + var threshold = 1000 / freq; + var timer = null; + return function throttled() { + var _arguments = arguments; + var force = this === true; + var now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(function () { + timer = null; + timestamp = Date.now(); + return fn.apply(null, _arguments); + }, threshold - (now - timestamp)); + } + }; + } + + var progressEventReducer = (function (listener, isDownloadStream) { + var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3; + var bytesNotified = 0; + var _speedometer = speedometer(50, 250); + return throttle(function (e) { + var loaded = e.loaded; + var total = e.lengthComputable ? e.total : undefined; + var progressBytes = loaded - bytesNotified; + var rate = _speedometer(progressBytes); + var inRange = loaded <= total; + bytesNotified = loaded; + var data = { + loaded: loaded, + total: total, + progress: total ? loaded / total : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + data[isDownloadStream ? 'download' : 'upload'] = true; + listener(data); + }, freq); + }); + + var isURLSameOrigin = platform.hasStandardBrowserEnv ? + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname + }; + } + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL; + return parsed.protocol === originURL.protocol && parsed.host === originURL.host; + }; + }() : + // Non standard browser envs (web workers, react-native) lack needed support. + function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + }(); + + var cookies = platform.hasStandardBrowserEnv ? + // Standard browser envs support document.cookie + { + write: function write(name, value, expires, path, domain, secure) { + var cookie = [name + '=' + encodeURIComponent(value)]; + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + utils$1.isString(path) && cookie.push('path=' + path); + utils$1.isString(domain) && cookie.push('domain=' + domain); + secure === true && cookie.push('secure'); + document.cookie = cookie.join('; '); + }, + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return match ? decodeURIComponent(match[3]) : null; + }, + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } : + // Non-standard browser env (web workers, react-native) lack needed support. + { + write: function write() {}, + read: function read() { + return null; + }, + remove: function remove() {} + }; + + /** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ + function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); + } + + /** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ + function combineURLs(baseURL, relativeURL) { + return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL; + } + + /** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ + function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; + } + + var headersToObject = function headersToObject(thing) { + return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing; + }; + + /** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ + function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({ + caseless: caseless + }, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + var mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: function headers(a, b) { + return mergeDeepProperties(headersToObject(a), headersToObject(b), true); + } + }; + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + var merge = mergeMap[prop] || mergeDeepProperties; + var configValue = merge(config1[prop], config2[prop], prop); + utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue); + }); + return config; + } + + var resolveConfig = (function (config) { + var newConfig = mergeConfig({}, config); + var data = newConfig.data, + withXSRFToken = newConfig.withXSRFToken, + xsrfHeaderName = newConfig.xsrfHeaderName, + xsrfCookieName = newConfig.xsrfCookieName, + headers = newConfig.headers, + auth = newConfig.auth; + newConfig.headers = headers = AxiosHeaders$1.from(headers); + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))); + } + var contentType; + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + var _ref = contentType ? contentType.split(';').map(function (token) { + return token.trim(); + }).filter(Boolean) : [], + _ref2 = _toArray(_ref), + type = _ref2[0], + tokens = _ref2.slice(1); + headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) { + // Add xsrf header + var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + return newConfig; + }); + + var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + var xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var _config = resolveConfig(config); + var requestData = _config.data; + var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + var responseType = _config.responseType; + var onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + var request = new XMLHttpRequest(); + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + function onloadend() { + if (!request) { + return; + } + // Prepare the response + var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders()); + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + var transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = function onCanceled(cancel) { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + var protocol = parseProtocol(_config.url); + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + // Send the request + request.send(requestData || null); + }); + }; + + var composeSignals = function composeSignals(signals, timeout) { + var controller = new AbortController(); + var aborted; + var onabort = function onabort(cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + var err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }; + var timer = timeout && setTimeout(function () { + onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT)); + }, timeout); + var unsubscribe = function unsubscribe() { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(function (signal) { + signal && (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + signals.forEach(function (signal) { + return signal && signal.addEventListener && signal.addEventListener('abort', onabort); + }); + var signal = controller.signal; + signal.unsubscribe = unsubscribe; + return [signal, function () { + timer && clearTimeout(timer); + timer = null; + }]; + }; + var composeSignals$1 = composeSignals; + + var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) { + var len, pos, end; + return _regeneratorRuntime().wrap(function streamChunk$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + len = chunk.byteLength; + if (!(!chunkSize || len < chunkSize)) { + _context.next = 5; + break; + } + _context.next = 4; + return chunk; + case 4: + return _context.abrupt("return"); + case 5: + pos = 0; + case 6: + if (!(pos < len)) { + _context.next = 13; + break; + } + end = pos + chunkSize; + _context.next = 10; + return chunk.slice(pos, end); + case 10: + pos = end; + _context.next = 6; + break; + case 13: + case "end": + return _context.stop(); + } + }, streamChunk); + }); + var readBytes = /*#__PURE__*/function () { + var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize, encode) { + var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk; + return _regeneratorRuntime().wrap(function _callee$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + _iteratorAbruptCompletion = false; + _didIteratorError = false; + _context2.prev = 2; + _iterator = _asyncIterator(iterable); + case 4: + _context2.next = 6; + return _awaitAsyncGenerator(_iterator.next()); + case 6: + if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) { + _context2.next = 27; + break; + } + chunk = _step.value; + _context2.t0 = _asyncGeneratorDelegate; + _context2.t1 = _asyncIterator; + _context2.t2 = streamChunk; + if (!ArrayBuffer.isView(chunk)) { + _context2.next = 15; + break; + } + _context2.t3 = chunk; + _context2.next = 18; + break; + case 15: + _context2.next = 17; + return _awaitAsyncGenerator(encode(String(chunk))); + case 17: + _context2.t3 = _context2.sent; + case 18: + _context2.t4 = _context2.t3; + _context2.t5 = chunkSize; + _context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5); + _context2.t7 = (0, _context2.t1)(_context2.t6); + _context2.t8 = _awaitAsyncGenerator; + return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24); + case 24: + _iteratorAbruptCompletion = false; + _context2.next = 4; + break; + case 27: + _context2.next = 33; + break; + case 29: + _context2.prev = 29; + _context2.t10 = _context2["catch"](2); + _didIteratorError = true; + _iteratorError = _context2.t10; + case 33: + _context2.prev = 33; + _context2.prev = 34; + if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) { + _context2.next = 38; + break; + } + _context2.next = 38; + return _awaitAsyncGenerator(_iterator["return"]()); + case 38: + _context2.prev = 38; + if (!_didIteratorError) { + _context2.next = 41; + break; + } + throw _iteratorError; + case 41: + return _context2.finish(38); + case 42: + return _context2.finish(33); + case 43: + case "end": + return _context2.stop(); + } + }, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]); + })); + return function readBytes(_x, _x2, _x3) { + return _ref.apply(this, arguments); + }; + }(); + var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish, encode) { + var iterator = readBytes(stream, chunkSize, encode); + var bytes = 0; + return new ReadableStream({ + type: 'bytes', + pull: function pull(controller) { + return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { + var _yield$iterator$next, done, value, len; + return _regeneratorRuntime().wrap(function _callee2$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return iterator.next(); + case 2: + _yield$iterator$next = _context3.sent; + done = _yield$iterator$next.done; + value = _yield$iterator$next.value; + if (!done) { + _context3.next = 9; + break; + } + controller.close(); + onFinish(); + return _context3.abrupt("return"); + case 9: + len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + case 12: + case "end": + return _context3.stop(); + } + }, _callee2); + }))(); + }, + cancel: function cancel(reason) { + onFinish(reason); + return iterator["return"](); + } + }, { + highWaterMark: 2 + }); + }; + + var fetchProgressDecorator = function fetchProgressDecorator(total, fn) { + var lengthComputable = total != null; + return function (loaded) { + return setTimeout(function () { + return fn({ + lengthComputable: lengthComputable, + total: total, + loaded: loaded + }); + }); + }; + }; + var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; + var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + + // used only inside the fetch adapter + var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) { + return function (str) { + return encoder.encode(str); + }; + }(new TextEncoder()) : ( /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.t0 = Uint8Array; + _context.next = 3; + return new Response(str).arrayBuffer(); + case 3: + _context.t1 = _context.sent; + return _context.abrupt("return", new _context.t0(_context.t1)); + case 5: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function (_x) { + return _ref.apply(this, arguments); + }; + }())); + var supportsRequestStream = isReadableStreamSupported && function () { + var duplexAccessed = false; + var hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + } + }).headers.has('Content-Type'); + return duplexAccessed && !hasContentType; + }(); + var DEFAULT_CHUNK_SIZE = 64 * 1024; + var supportsResponseStream = isReadableStreamSupported && !!function () { + try { + return utils$1.isReadableStream(new Response('').body); + } catch (err) { + // return undefined + } + }(); + var resolvers = { + stream: supportsResponseStream && function (res) { + return res.body; + } + }; + isFetchSupported && function (res) { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) { + return res[type](); + } : function (_, config) { + throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config); + }); + }); + }(new Response()); + var getBodyLength = /*#__PURE__*/function () { + var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + if (!(body == null)) { + _context2.next = 2; + break; + } + return _context2.abrupt("return", 0); + case 2: + if (!utils$1.isBlob(body)) { + _context2.next = 4; + break; + } + return _context2.abrupt("return", body.size); + case 4: + if (!utils$1.isSpecCompliantForm(body)) { + _context2.next = 8; + break; + } + _context2.next = 7; + return new Request(body).arrayBuffer(); + case 7: + return _context2.abrupt("return", _context2.sent.byteLength); + case 8: + if (!utils$1.isArrayBufferView(body)) { + _context2.next = 10; + break; + } + return _context2.abrupt("return", body.byteLength); + case 10: + if (utils$1.isURLSearchParams(body)) { + body = body + ''; + } + if (!utils$1.isString(body)) { + _context2.next = 15; + break; + } + _context2.next = 14; + return encodeText(body); + case 14: + return _context2.abrupt("return", _context2.sent.byteLength); + case 15: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + return function getBodyLength(_x2) { + return _ref2.apply(this, arguments); + }; + }(); + var resolveBodyLength = /*#__PURE__*/function () { + var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) { + var length; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + length = utils$1.toFiniteNumber(headers.getContentLength()); + return _context3.abrupt("return", length == null ? getBodyLength(body) : length); + case 2: + case "end": + return _context3.stop(); + } + }, _callee3); + })); + return function resolveBodyLength(_x3, _x4) { + return _ref3.apply(this, arguments); + }; + }(); + var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () { + var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) { + var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, response, isStreamResponse, options, responseContentLength, responseData; + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions; + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + _ref5 = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [], _ref6 = _slicedToArray(_ref5, 2), composedSignal = _ref6[0], stopTimeout = _ref6[1]; + onFinish = function onFinish() { + !finished && setTimeout(function () { + composedSignal && composedSignal.unsubscribe(); + }); + finished = true; + }; + _context4.prev = 4; + _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head'; + if (!_context4.t0) { + _context4.next = 11; + break; + } + _context4.next = 9; + return resolveBodyLength(headers, data); + case 9: + _context4.t1 = requestContentLength = _context4.sent; + _context4.t0 = _context4.t1 !== 0; + case 11: + if (!_context4.t0) { + _context4.next = 15; + break; + } + _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(requestContentLength, progressEventReducer(onUploadProgress)), null, encodeText); + } + case 15: + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, { + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials: withCredentials + })); + _context4.next = 19; + return fetch(request); + case 19: + response = _context4.sent; + isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + options = {}; + ['status', 'statusText', 'headers'].forEach(function (prop) { + options[prop] = response[prop]; + }); + responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(responseContentLength, progressEventReducer(onDownloadProgress, true)), isStreamResponse && onFinish, encodeText), options); + } + responseType = responseType || 'text'; + _context4.next = 25; + return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + case 25: + responseData = _context4.sent; + !isStreamResponse && onFinish(); + stopTimeout && stopTimeout(); + _context4.next = 30; + return new Promise(function (resolve, reject) { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config: config, + request: request + }); + }); + case 30: + return _context4.abrupt("return", _context4.sent); + case 33: + _context4.prev = 33; + _context4.t2 = _context4["catch"](4); + onFinish(); + if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) { + _context4.next = 38; + break; + } + throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), { + cause: _context4.t2.cause || _context4.t2 + }); + case 38: + throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request); + case 39: + case "end": + return _context4.stop(); + } + }, _callee4, null, [[4, 33]]); + })); + return function (_x5) { + return _ref4.apply(this, arguments); + }; + }()); + + var knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter + }; + utils$1.forEach(knownAdapters, function (fn, value) { + if (fn) { + try { + Object.defineProperty(fn, 'name', { + value: value + }); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', { + value: value + }); + } + }); + var renderReason = function renderReason(reason) { + return "- ".concat(reason); + }; + var isResolvedHandle = function isResolvedHandle(adapter) { + return utils$1.isFunction(adapter) || adapter === null || adapter === false; + }; + var adapters = { + getAdapter: function getAdapter(adapters) { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + var _adapters = adapters, + length = _adapters.length; + var nameOrAdapter; + var adapter; + var rejectedReasons = {}; + for (var i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + var id = void 0; + adapter = nameOrAdapter; + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + if (adapter === undefined) { + throw new AxiosError("Unknown adapter '".concat(id, "'")); + } + } + if (adapter) { + break; + } + rejectedReasons[id || '#' + i] = adapter; + } + if (!adapter) { + var reasons = Object.entries(rejectedReasons).map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + id = _ref2[0], + state = _ref2[1]; + return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build'); + }); + var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified'; + throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT'); + } + return adapter; + }, + adapters: knownAdapters + }; + + /** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ + function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } + } + + /** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ + function dispatchRequest(config) { + throwIfCancellationRequested(config); + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call(config, config.transformRequest); + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call(config, config.transformResponse, response); + response.headers = AxiosHeaders$1.from(response.headers); + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call(config, config.transformResponse, reason.response); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + return Promise.reject(reason); + }); + } + + var VERSION = "1.7.2"; + + var validators$1 = {}; + + // eslint-disable-next-line func-names + ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) { + validators$1[type] = function validator(thing) { + return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; + }); + var deprecatedWarnings = {}; + + /** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ + validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return function (value, opt, opts) { + if (validator === false) { + throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED); + } + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future')); + } + return validator ? validator(value, opt, opts) : true; + }; + }; + + /** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + + function assertOptions(options, schema, allowUnknown) { + if (_typeof(options) !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } + } + var validator = { + assertOptions: assertOptions, + validators: validators$1 + }; + + var validators = validator.validators; + + /** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ + var Axios = /*#__PURE__*/function () { + function Axios(instanceConfig) { + _classCallCheck(this, Axios); + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + _createClass(Axios, [{ + key: "request", + value: (function () { + var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) { + var dummy, stack; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + _context.next = 3; + return this._request(configOrUrl, config); + case 3: + return _context.abrupt("return", _context.sent); + case 6: + _context.prev = 6; + _context.t0 = _context["catch"](0); + if (_context.t0 instanceof Error) { + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error(); + + // slice off the Error: ... line + stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!_context.t0.stack) { + _context.t0.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + _context.t0.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + throw _context.t0; + case 10: + case "end": + return _context.stop(); + } + }, _callee, this, [[0, 6]]); + })); + function request(_x, _x2) { + return _request2.apply(this, arguments); + } + return request; + }()) + }, { + key: "_request", + value: function _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + config = mergeConfig(this.defaults, config); + var _config = config, + transitional = _config.transitional, + paramsSerializer = _config.paramsSerializer, + headers = _config.headers; + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators["boolean"]), + forcedJSONParsing: validators.transitional(validators["boolean"]), + clarifyTimeoutError: validators.transitional(validators["boolean"]) + }, false); + } + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators["function"], + serialize: validators["function"] + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]); + headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) { + delete headers[method]; + }); + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + var promise; + var i = 0; + var len; + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + promise = Promise.resolve(config); + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + return promise; + } + len = requestInterceptorChain.length; + var newConfig = config; + i = 0; + while (i < len) { + var onFulfilled = requestInterceptorChain[i++]; + var onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + i = 0; + len = responseInterceptorChain.length; + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + return promise; + } + }, { + key: "getUri", + value: function getUri(config) { + config = mergeConfig(this.defaults, config); + var fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } + }]); + return Axios; + }(); // Provide aliases for supported request methods + utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function (url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; + }); + utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url: url, + data: data + })); + }; + } + Axios.prototype[method] = generateHTTPMethod(); + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); + }); + var Axios$1 = Axios; + + /** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ + var CancelToken = /*#__PURE__*/function () { + function CancelToken(executor) { + _classCallCheck(this, CancelToken); + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + var token = this; + + // eslint-disable-next-line func-names + this.promise.then(function (cancel) { + if (!token._listeners) return; + var i = token._listeners.length; + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = function (onfulfilled) { + var _resolve; + // eslint-disable-next-line func-names + var promise = new Promise(function (resolve) { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + return promise; + }; + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + _createClass(CancelToken, [{ + key: "throwIfRequested", + value: function throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + }, { + key: "subscribe", + value: function subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + }, { + key: "unsubscribe", + value: function unsubscribe(listener) { + if (!this._listeners) { + return; + } + var index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + }], [{ + key: "source", + value: function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; + } + }]); + return CancelToken; + }(); + var CancelToken$1 = CancelToken; + + /** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ + function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; + } + + /** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ + function isAxiosError(payload) { + return utils$1.isObject(payload) && payload.isAxiosError === true; + } + + var HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511 + }; + Object.entries(HttpStatusCode).forEach(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + key = _ref2[0], + value = _ref2[1]; + HttpStatusCode[value] = key; + }); + var HttpStatusCode$1 = HttpStatusCode; + + /** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ + function createInstance(defaultConfig) { + var context = new Axios$1(defaultConfig); + var instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$1.prototype, context, { + allOwnKeys: true + }); + + // Copy context to instance + utils$1.extend(instance, context, null, { + allOwnKeys: true + }); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + return instance; + } + + // Create the default instance to be exported + var axios = createInstance(defaults$1); + + // Expose Axios class to allow class inheritance + axios.Axios = Axios$1; + + // Expose Cancel & CancelToken + axios.CanceledError = CanceledError; + axios.CancelToken = CancelToken$1; + axios.isCancel = isCancel; + axios.VERSION = VERSION; + axios.toFormData = toFormData; + + // Expose AxiosError class + axios.AxiosError = AxiosError; + + // alias for CanceledError for backward compatibility + axios.Cancel = axios.CanceledError; + + // Expose all/spread + axios.all = function all(promises) { + return Promise.all(promises); + }; + axios.spread = spread; + + // Expose isAxiosError + axios.isAxiosError = isAxiosError; + + // Expose mergeConfig + axios.mergeConfig = mergeConfig; + axios.AxiosHeaders = AxiosHeaders$1; + axios.formToJSON = function (thing) { + return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + }; + axios.getAdapter = adapters.getAdapter; + axios.HttpStatusCode = HttpStatusCode$1; + axios["default"] = axios; + + return axios; + +})); +//# sourceMappingURL=axios.js.map diff --git a/node_modules/axios/dist/axios.js.map b/node_modules/axios/dist/axios.js.map new file mode 100644 index 00000000..5e2fa06e --- /dev/null +++ b/node_modules/axios/dist/axios.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.js","sources":["../lib/helpers/bind.js","../lib/utils.js","../lib/core/AxiosError.js","../lib/helpers/null.js","../lib/helpers/toFormData.js","../lib/helpers/AxiosURLSearchParams.js","../lib/helpers/buildURL.js","../lib/core/InterceptorManager.js","../lib/defaults/transitional.js","../lib/platform/browser/classes/URLSearchParams.js","../lib/platform/browser/classes/FormData.js","../lib/platform/browser/classes/Blob.js","../lib/platform/browser/index.js","../lib/platform/common/utils.js","../lib/platform/index.js","../lib/helpers/toURLEncodedForm.js","../lib/helpers/formDataToJSON.js","../lib/defaults/index.js","../lib/helpers/parseHeaders.js","../lib/core/AxiosHeaders.js","../lib/core/transformData.js","../lib/cancel/isCancel.js","../lib/cancel/CanceledError.js","../lib/core/settle.js","../lib/helpers/parseProtocol.js","../lib/helpers/speedometer.js","../lib/helpers/throttle.js","../lib/helpers/progressEventReducer.js","../lib/helpers/isURLSameOrigin.js","../lib/helpers/cookies.js","../lib/helpers/isAbsoluteURL.js","../lib/helpers/combineURLs.js","../lib/core/buildFullPath.js","../lib/core/mergeConfig.js","../lib/helpers/resolveConfig.js","../lib/adapters/xhr.js","../lib/helpers/composeSignals.js","../lib/helpers/trackStream.js","../lib/adapters/fetch.js","../lib/adapters/adapters.js","../lib/core/dispatchRequest.js","../lib/env/data.js","../lib/helpers/validator.js","../lib/core/Axios.js","../lib/cancel/CancelToken.js","../lib/helpers/spread.js","../lib/helpers/isAxiosError.js","../lib/helpers/HttpStatusCode.js","../lib/axios.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n"],"names":["bind","fn","thisArg","wrap","apply","arguments","toString","Object","prototype","getPrototypeOf","kindOf","cache","thing","str","call","slice","toLowerCase","create","kindOfTest","type","typeOfTest","_typeof","isArray","Array","isUndefined","isBuffer","val","constructor","isFunction","isArrayBuffer","isArrayBufferView","result","ArrayBuffer","isView","buffer","isString","isNumber","isObject","isBoolean","isPlainObject","Symbol","toStringTag","iterator","isDate","isFile","isBlob","isFileList","isStream","pipe","isFormData","kind","FormData","append","isURLSearchParams","_map","map","_map2","_slicedToArray","isReadableStream","isRequest","isResponse","isHeaders","trim","replace","forEach","obj","_ref","length","undefined","_ref$allOwnKeys","allOwnKeys","i","l","keys","getOwnPropertyNames","len","key","findKey","_key","_global","globalThis","self","window","global","isContextDefined","context","merge","_ref2","caseless","assignValue","targetKey","extend","a","b","_ref3","stripBOM","content","charCodeAt","inherits","superConstructor","props","descriptors","defineProperty","value","assign","toFlatObject","sourceObj","destObj","filter","propFilter","prop","merged","endsWith","searchString","position","String","lastIndex","indexOf","toArray","arr","isTypedArray","TypedArray","Uint8Array","forEachEntry","generator","next","done","pair","matchAll","regExp","matches","exec","push","isHTMLForm","toCamelCase","replacer","m","p1","p2","toUpperCase","hasOwnProperty","_ref4","isRegExp","reduceDescriptors","reducer","getOwnPropertyDescriptors","reducedDescriptors","descriptor","name","ret","defineProperties","freezeMethods","enumerable","writable","set","Error","toObjectSet","arrayOrString","delimiter","define","split","noop","toFiniteNumber","defaultValue","Number","isFinite","ALPHA","DIGIT","ALPHABET","ALPHA_DIGIT","generateString","size","alphabet","Math","random","isSpecCompliantForm","toJSONObject","stack","visit","source","target","reducedValue","isAsyncFn","isThenable","then","hasOwnProp","AxiosError","message","code","config","request","response","captureStackTrace","utils","toJSON","description","number","fileName","lineNumber","columnNumber","status","from","error","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","path","dots","concat","each","token","join","isFlatArray","some","predicates","test","toFormData","formData","options","TypeError","metaTokens","indexes","defined","option","visitor","defaultVisitor","_Blob","Blob","useBlob","convertValue","toISOString","Buffer","JSON","stringify","el","index","exposedHelpers","build","pop","encode","charMap","encodeURIComponent","match","AxiosURLSearchParams","params","_pairs","encoder","_encode","buildURL","url","serializeFn","serialize","serializedParams","hashmarkIndex","InterceptorManager","_classCallCheck","handlers","_createClass","use","fulfilled","rejected","synchronous","runWhen","eject","id","clear","forEachHandler","h","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","URLSearchParams","isBrowser","classes","protocols","hasBrowserEnv","document","hasStandardBrowserEnv","product","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","origin","location","href","_objectSpread","platform","toURLEncodedForm","data","helpers","isNode","parsePropPath","arrayToObject","formDataToJSON","buildPath","isNumericKey","isLast","entries","stringifySafely","rawValue","parser","parse","e","defaults","transitional","transitionalDefaults","adapter","transformRequest","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","setContentType","formSerializer","_FormData","env","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","method","ignoreDuplicateOf","rawHeaders","parsed","line","substring","$internals","normalizeHeader","header","normalizeValue","parseTokens","tokens","tokensRE","isValidHeaderName","matchHeaderValue","isHeaderNameFilter","formatHeader","w","char","buildAccessors","accessorName","methodName","arg1","arg2","arg3","configurable","AxiosHeaders","_Symbol$iterator","_Symbol$toStringTag","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","parseHeaders","_iterator","_createForOfIteratorHelper","_step","s","n","_step$value","err","f","get","has","matcher","_delete","deleted","deleteHeader","normalize","format","normalized","_this$constructor","_len","targets","asStrings","first","computed","_len2","_key2","accessor","internals","accessors","defineAccessor","mapped","headerValue","transformData","fns","transform","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","settle","resolve","reject","ERR_BAD_REQUEST","floor","parseProtocol","speedometer","samplesCount","min","bytes","timestamps","head","tail","firstSampleTS","chunkLength","now","Date","startedAt","bytesCount","passed","round","throttle","freq","timestamp","threshold","timer","throttled","_arguments","force","clearTimeout","setTimeout","listener","isDownloadStream","bytesNotified","_speedometer","loaded","total","lengthComputable","progressBytes","rate","inRange","progress","estimated","event","standardBrowserEnv","msie","userAgent","urlParsingNode","createElement","originURL","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","isURLSameOrigin","requestURL","nonStandardBrowserEnv","write","expires","domain","secure","cookie","toGMTString","read","RegExp","decodeURIComponent","remove","isAbsoluteURL","combineURLs","baseURL","relativeURL","buildFullPath","requestedURL","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","paramsSerializer","timeoutMessage","withCredentials","withXSRFToken","onUploadProgress","onDownloadProgress","decompress","beforeRedirect","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding","computeConfigValue","configValue","newConfig","auth","btoa","username","password","unescape","Boolean","_toArray","_toConsumableArray","xsrfValue","cookies","isXHRAdapterSupported","XMLHttpRequest","Promise","dispatchXhrRequest","_config","resolveConfig","requestData","requestHeaders","onCanceled","unsubscribe","signal","removeEventListener","open","onloadend","responseHeaders","getAllResponseHeaders","responseData","responseText","statusText","_resolve","_reject","onreadystatechange","handleLoad","readyState","responseURL","onabort","handleAbort","ECONNABORTED","onerror","handleError","ERR_NETWORK","ontimeout","handleTimeout","timeoutErrorMessage","ETIMEDOUT","setRequestHeader","addEventListener","progressEventReducer","upload","cancel","abort","subscribe","aborted","send","composeSignals","signals","controller","AbortController","reason","streamChunk","_regeneratorRuntime","mark","chunk","chunkSize","pos","end","streamChunk$","_context","prev","byteLength","abrupt","stop","readBytes","_wrapAsyncGenerator","_callee","iterable","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_callee$","_context2","_asyncIterator","_awaitAsyncGenerator","sent","t0","_asyncGeneratorDelegate","t1","t2","t3","t4","t5","t6","t7","t8","delegateYield","t10","finish","_x","_x2","_x3","trackStream","stream","onProgress","onFinish","ReadableStream","pull","_asyncToGenerator","_callee2","_yield$iterator$next","_callee2$","_context3","close","enqueue","highWaterMark","fetchProgressDecorator","isFetchSupported","fetch","Request","Response","isReadableStreamSupported","encodeText","TextEncoder","arrayBuffer","supportsRequestStream","duplexAccessed","hasContentType","body","duplex","DEFAULT_CHUNK_SIZE","supportsResponseStream","resolvers","res","_","ERR_NOT_SUPPORT","getBodyLength","resolveBodyLength","_callee3","_callee3$","getContentLength","_x4","_callee4","_resolveConfig","_resolveConfig$withCr","fetchOptions","_ref5","_ref6","composedSignal","stopTimeout","finished","requestContentLength","_request","contentTypeHeader","isStreamResponse","responseContentLength","_callee4$","_context4","_x5","knownAdapters","http","httpAdapter","xhr","xhrAdapter","fetchAdapter","renderReason","isResolvedHandle","getAdapter","adapters","_adapters","nameOrAdapter","rejectedReasons","reasons","state","throwIfCancellationRequested","throwIfRequested","dispatchRequest","onAdapterResolution","onAdapterRejection","VERSION","validators","validator","deprecatedWarnings","version","formatMessage","opt","desc","opts","ERR_DEPRECATED","console","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","_request2","configOrUrl","dummy","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","unshiftRequestInterceptors","interceptor","unshift","responseInterceptorChain","pushResponseInterceptors","promise","chain","onFulfilled","onRejected","getUri","fullPath","forEachMethodNoData","forEachMethodWithData","generateHTTPMethod","isForm","httpMethod","CancelToken","executor","resolvePromise","promiseExecutor","_listeners","onfulfilled","splice","c","spread","callback","isAxiosError","payload","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthentic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AAK,CAACxG,KAAK,GAAGA,OAAK,CAAA;;EAEnB;EACAwG,KAAK,CAACtZ,aAAa,GAAGA,aAAa,CAAA;EACnCsZ,KAAK,CAAC/E,WAAW,GAAGA,aAAW,CAAA;EAC/B+E,KAAK,CAACxZ,QAAQ,GAAGA,QAAQ,CAAA;EACzBwZ,KAAK,CAACzH,OAAO,GAAGA,OAAO,CAAA;EACvByH,KAAK,CAACllB,UAAU,GAAGA,UAAU,CAAA;;EAE7B;EACAklB,KAAK,CAACnnB,UAAU,GAAGA,UAAU,CAAA;;EAE7B;EACAmnB,KAAK,CAACC,MAAM,GAAGD,KAAK,CAACtZ,aAAa,CAAA;;EAElC;EACAsZ,KAAK,CAACE,GAAG,GAAG,SAASA,GAAGA,CAACC,QAAQ,EAAE;EACjC,EAAA,OAAOjS,OAAO,CAACgS,GAAG,CAACC,QAAQ,CAAC,CAAA;EAC9B,CAAC,CAAA;EAEDH,KAAK,CAACvE,MAAM,GAAGA,MAAM,CAAA;;EAErB;EACAuE,KAAK,CAACrE,YAAY,GAAGA,YAAY,CAAA;;EAEjC;EACAqE,KAAK,CAACpU,WAAW,GAAGA,WAAW,CAAA;EAE/BoU,KAAK,CAACtc,YAAY,GAAGA,cAAY,CAAA;EAEjCsc,KAAK,CAACI,UAAU,GAAG,UAAAryB,KAAK,EAAA;EAAA,EAAA,OAAI6R,cAAc,CAACxG,OAAK,CAAC5D,UAAU,CAACzH,KAAK,CAAC,GAAG,IAAIuC,QAAQ,CAACvC,KAAK,CAAC,GAAGA,KAAK,CAAC,CAAA;EAAA,CAAA,CAAA;EAEjGiyB,KAAK,CAACrI,UAAU,GAAGC,QAAQ,CAACD,UAAU,CAAA;EAEtCqI,KAAK,CAACnE,cAAc,GAAGA,gBAAc,CAAA;EAErCmE,KAAK,CAAA,SAAA,CAAQ,GAAGA,KAAK;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/axios/dist/axios.min.js b/node_modules/axios/dist/axios.min.js new file mode 100644 index 00000000..8da3e5f2 --- /dev/null +++ b/node_modules/axios/dist/axios.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,(function(){"use strict";function e(e){var r,n;function o(r,n){try{var a=e[r](n),s=a.value,u=s instanceof t;Promise.resolve(u?s.v:s).then((function(t){if(u){var n="return"===r?"return":"next";if(!s.k||t.done)return o(n,t);t=e[n](t).value}i(a.done?"return":"normal",t)}),(function(e){o("throw",e)}))}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?o(r.key,r.arg):n=null}this._invoke=function(e,t){return new Promise((function(i,a){var s={key:e,arg:t,resolve:i,reject:a,next:null};n?n=n.next=s:(r=n=s,o(e,t))}))},"function"!=typeof e.return&&(this.return=void 0)}function t(e,t){this.v=e,this.k=t}function r(e){var r={},n=!1;function o(r,o){return n=!0,o=new Promise((function(t){t(e[r](o))})),{done:!1,value:new t(o,1)}}return r["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},r.next=function(e){return n?(n=!1,e):o("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return o("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return n?(n=!1,e):o("return",e)}),r}function n(e){var t,r,n,i=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new o(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function o(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return o=function(e){this.s=e,this.n=e.next},o.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new o(e)}function i(e){return new t(e,0)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function l(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){l(i,n,o,a,s,"next",e)}function s(e){l(i,n,o,a,s,"throw",e)}a(void 0)}))}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:{},i=o.allOwnKeys,a=void 0!==i&&i;if(null!=e)if("object"!==f(e)&&(e=[e]),L(e))for(r=0,n=e.length;r0;)if(t===(r=n[o]).toLowerCase())return r;return null}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Q=function(e){return!N(e)&&e!==Y};var Z,ee=(Z="undefined"!=typeof Uint8Array&&j(Uint8Array),function(e){return Z&&e instanceof Z}),te=A("HTMLFormElement"),re=function(e){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),ne=A("RegExp"),oe=function(e,t){var r=Object.getOwnPropertyDescriptors(e),n={};X(r,(function(r,o){var i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)},ie="abcdefghijklmnopqrstuvwxyz",ae="0123456789",se={DIGIT:ae,ALPHA:ie,ALPHA_DIGIT:ie+ie.toUpperCase()+ae};var ue=A("AsyncFunction"),ce={isArray:L,isArrayBuffer:_,isBuffer:function(e){return null!==e&&!N(e)&&null!==e.constructor&&!N(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||F(e.append)&&("formdata"===(t=k(e))||"object"===t&&F(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_(e.buffer)},isString:C,isNumber:U,isBoolean:function(e){return!0===e||!1===e},isObject:D,isPlainObject:B,isReadableStream:W,isRequest:G,isResponse:K,isHeaders:V,isUndefined:N,isDate:I,isFile:q,isBlob:z,isRegExp:ne,isFunction:F,isStream:function(e){return D(e)&&F(e.pipe)},isURLSearchParams:H,isTypedArray:ee,isFileList:M,forEach:X,merge:function e(){for(var t=Q(this)&&this||{},r=t.caseless,n={},o=function(t,o){var i=r&&$(n,o)||o;B(n[i])&&B(t)?n[i]=e(n[i],t):B(t)?n[i]=e({},t):L(t)?n[i]=t.slice():n[i]=t},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{},o=n.allOwnKeys;return X(t,(function(t,n){r&&F(t)?e[n]=x(t,r):e[n]=t}),{allOwnKeys:o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,a,s={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&j(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:k,kindOfTest:A,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(L(e))return e;var t=e.length;if(!U(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},forEachEntry:function(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:te,hasOwnProperty:re,hasOwnProp:re,reduceDescriptors:oe,freezeMethods:function(e){oe(e,(function(t,r){if(F(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;var n=e[r];F(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:function(e,t){var r={},n=function(e){e.forEach((function(e){r[e]=!0}))};return L(e)?n(e):n(String(e).split(t)),r},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:$,global:Y,isContextDefined:Q,ALPHABET:se,generateString:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:se.ALPHA_DIGIT,r="",n=t.length;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&F(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:function(e){var t=new Array(10);return function e(r,n){if(D(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[n]=r;var o=L(r)?[]:{};return X(r,(function(t,r){var i=e(t,n+1);!N(i)&&(o[r]=i)})),t[n]=void 0,o}}return r}(e,0)},isAsyncFn:ue,isThenable:function(e){return e&&(D(e)||F(e))&&F(e.then)&&F(e.catch)}};function fe(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}ce.inherits(fe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ce.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var le=fe.prototype,he={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){he[e]={value:e}})),Object.defineProperties(fe,he),Object.defineProperty(le,"isAxiosError",{value:!0}),fe.from=function(e,t,r,n,o,i){var a=Object.create(le);return ce.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(function(e){return"isAxiosError"!==e})),fe.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};function pe(e){return ce.isPlainObject(e)||ce.isArray(e)}function de(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,r){return e?e.concat(t).map((function(e,t){return e=de(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var ve=ce.toFlatObject(ce,{},null,(function(e){return/^is[A-Z]/.test(e)}));function me(e,t,r){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var n=(r=ce.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ce.isUndefined(t[e])}))).metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(ce.isDate(e))return e.toISOString();if(!s&&ce.isBlob(e))throw new fe("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(e)||ce.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,o){var s=e;if(e&&!o&&"object"===f(e))if(ce.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ce.isArray(e)&&function(e){return ce.isArray(e)&&!e.some(pe)}(e)||(ce.isFileList(e)||ce.endsWith(r,"[]"))&&(s=ce.toArray(e)))return r=de(r),s.forEach((function(e,n){!ce.isUndefined(e)&&null!==e&&t.append(!0===a?ye([r],n,i):null===a?r:r+"[]",u(e))})),!1;return!!pe(e)||(t.append(ye(o,r,i),u(e)),!1)}var l=[],h=Object.assign(ve,{defaultVisitor:c,convertValue:u,isVisitable:pe});if(!ce.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ce.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),ce.forEach(r,(function(r,i){!0===(!(ce.isUndefined(r)||null===r)&&o.call(t,r,ce.isString(i)?i.trim():i,n,h))&&e(r,n?n.concat(i):[i])})),l.pop()}}(e),t}function be(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ge(e,t){this._pairs=[],e&&me(e,this,t)}var we=ge.prototype;function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oe(e,t,r){if(!t)return e;var n,o=r&&r.encode||Ee,i=r&&r.serialize;if(n=i?i(t,r):ce.isURLSearchParams(t)?t.toString():new ge(t,r).toString(o)){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}we.append=function(e,t){this._pairs.push([e,t])},we.toString=function(e){var t=e?function(t){return e.call(this,t,be)}:be;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Se,xe=function(){function e(){p(this,e),this.handlers=[]}return y(e,[{key:"use",value:function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){ce.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}]),e}(),Re={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ge,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},je="undefined"!=typeof window&&"undefined"!=typeof document,ke=(Se="undefined"!=typeof navigator&&navigator.product,je&&["ReactNative","NativeScript","NS"].indexOf(Se)<0),Ae="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Pe=je&&window.location.href||"http://localhost",Le=s(s({},Object.freeze({__proto__:null,hasBrowserEnv:je,hasStandardBrowserWebWorkerEnv:Ae,hasStandardBrowserEnv:ke,origin:Pe})),Te);function Ne(e){function t(e,r,n,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),s=o>=e.length;return i=!i&&ce.isArray(n)?n.length:i,s?(ce.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&ce.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&ce.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t-1,i=ce.isObject(e);if(i&&ce.isHTMLForm(e)&&(e=new FormData(e)),ce.isFormData(e))return o?JSON.stringify(Ne(e)):e;if(ce.isArrayBuffer(e)||ce.isBuffer(e)||ce.isStream(e)||ce.isFile(e)||ce.isBlob(e)||ce.isReadableStream(e))return e;if(ce.isArrayBufferView(e))return e.buffer;if(ce.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return me(e,new Le.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Le.isNode&&ce.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=ce.isFileList(e))||n.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return me(r?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,r){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||_e.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ce.isResponse(e)||ce.isReadableStream(e))return e;if(e&&ce.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw fe.from(e,fe.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Le.classes.FormData,Blob:Le.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],(function(e){_e.headers[e]={}}));var Ce=_e,Fe=ce.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ue=Symbol("internals");function De(e){return e&&String(e).trim().toLowerCase()}function Be(e){return!1===e||null==e?e:ce.isArray(e)?e.map(Be):String(e)}function Ie(e,t,r,n,o){return ce.isFunction(n)?n.call(this,t,r):(o&&(t=r),ce.isString(t)?ce.isString(n)?-1!==t.indexOf(n):ce.isRegExp(n)?n.test(t):void 0:void 0)}var qe=function(e,t){function r(e){p(this,r),e&&this.set(e)}return y(r,[{key:"set",value:function(e,t,r){var n=this;function o(e,t,r){var o=De(t);if(!o)throw new Error("header name must be a non-empty string");var i=ce.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Be(e))}var i=function(e,t){return ce.forEach(e,(function(e,r){return o(e,r,t)}))};if(ce.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ce.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(function(e){var t,r,n,o={};return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),t=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!t||o[t]&&Fe[t]||("set-cookie"===t?o[t]?o[t].push(r):o[t]=[r]:o[t]=o[t]?o[t]+", "+r:r)})),o}(e),t);else if(ce.isHeaders(e)){var a,s=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=E(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e.entries());try{for(s.s();!(a=s.n()).done;){var u=m(a.value,2),c=u[0];o(u[1],c,r)}}catch(e){s.e(e)}finally{s.f()}}else null!=e&&o(t,e,r);return this}},{key:"get",value:function(e,t){if(e=De(e)){var r=ce.findKey(this,e);if(r){var n=this[r];if(!t)return n;if(!0===t)return function(e){for(var t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=n.exec(e);)r[t[1]]=t[2];return r}(n);if(ce.isFunction(t))return t.call(this,n,r);if(ce.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=De(e)){var r=ce.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ie(0,this[r],r,t))}return!1}},{key:"delete",value:function(e,t){var r=this,n=!1;function o(e){if(e=De(e)){var o=ce.findKey(r,e);!o||t&&!Ie(0,r[o],o,t)||(delete r[o],n=!0)}}return ce.isArray(e)?e.forEach(o):o(e),n}},{key:"clear",value:function(e){for(var t=Object.keys(this),r=t.length,n=!1;r--;){var o=t[r];e&&!Ie(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}},{key:"normalize",value:function(e){var t=this,r={};return ce.forEach(this,(function(n,o){var i=ce.findKey(r,o);if(i)return t[i]=Be(n),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}(o):String(o).trim();a!==o&&delete t[o],t[a]=Be(n),r[a]=!0})),this}},{key:"concat",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n1?r-1:0),o=1;on)return o&&(clearTimeout(o),o=null),r=a,e.apply(null,arguments);o||(o=setTimeout((function(){return o=null,r=Date.now(),e.apply(null,t)}),n-(a-r)))}}ce.inherits(Je,fe,{__CANCEL__:!0});var Ve=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=0,o=Ge(50,250);return Ke((function(r){var i=r.loaded,a=r.lengthComputable?r.total:void 0,s=i-n,u=o(s);n=i;var c={loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:u||void 0,estimated:u&&a&&i<=a?(a-i)/u:void 0,event:r,lengthComputable:null!=a};c[t?"download":"upload"]=!0,e(c)}),r)},Xe=Le.hasStandardBrowserEnv?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=ce.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},$e=Le.hasStandardBrowserEnv?{write:function(e,t,r,n,o,i){var a=[e+"="+encodeURIComponent(t)];ce.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),ce.isString(n)&&a.push("path="+n),ce.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Ye(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Qe=function(e){return e instanceof ze?s({},e):e};function Ze(e,t){t=t||{};var r={};function n(e,t,r){return ce.isPlainObject(e)&&ce.isPlainObject(t)?ce.merge.call({caseless:r},e,t):ce.isPlainObject(t)?ce.merge({},t):ce.isArray(t)?t.slice():t}function o(e,t,r){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!ce.isUndefined(t))return n(void 0,t)}function a(e,t){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,o,i){return i in t?n(r,o):i in e?n(void 0,r):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:function(e,t){return o(Qe(e),Qe(t),!0)}};return ce.forEach(Object.keys(Object.assign({},e,t)),(function(n){var i=u[n]||o,a=i(e[n],t[n],n);ce.isUndefined(a)&&i!==s||(r[n]=a)})),r}var et,tt,rt,nt,ot=function(e){var t,r,n=Ze({},e),o=n.data,i=n.withXSRFToken,a=n.xsrfHeaderName,s=n.xsrfCookieName,u=n.headers,c=n.auth;if(n.headers=u=ze.from(u),n.url=Oe(Ye(n.baseURL,n.url),e.params,e.paramsSerializer),c&&u.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ce.isFormData(o))if(Le.hasStandardBrowserEnv||Le.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(!1!==(t=u.getContentType())){var f=t?t.split(";").map((function(e){return e.trim()})).filter(Boolean):[],l=g(r=f)||w(r)||E(r)||S(),h=l[0],p=l.slice(1);u.setContentType([h||"multipart/form-data"].concat(b(p)).join("; "))}if(Le.hasStandardBrowserEnv&&(i&&ce.isFunction(i)&&(i=i(n)),i||!1!==i&&Xe(n.url))){var d=a&&s&&$e.read(s);d&&u.set(a,d)}return n},it="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){var n,o=ot(e),i=o.data,a=ze.from(o.headers).normalize(),s=o.responseType;function u(){o.cancelToken&&o.cancelToken.unsubscribe(n),o.signal&&o.signal.removeEventListener("abort",n)}var c=new XMLHttpRequest;function f(){if(c){var n=ze.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());We((function(e){t(e),u()}),(function(e){r(e),u()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}}c.open(o.method.toUpperCase(),o.url,!0),c.timeout=o.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new fe("Request aborted",fe.ECONNABORTED,o,c)),c=null)},c.onerror=function(){r(new fe("Network Error",fe.ERR_NETWORK,o,c)),c=null},c.ontimeout=function(){var e=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",t=o.transitional||Re;o.timeoutErrorMessage&&(e=o.timeoutErrorMessage),r(new fe(e,t.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,o,c)),c=null},void 0===i&&a.setContentType(null),"setRequestHeader"in c&&ce.forEach(a.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),ce.isUndefined(o.withCredentials)||(c.withCredentials=!!o.withCredentials),s&&"json"!==s&&(c.responseType=o.responseType),"function"==typeof o.onDownloadProgress&&c.addEventListener("progress",Ve(o.onDownloadProgress,!0)),"function"==typeof o.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Ve(o.onUploadProgress)),(o.cancelToken||o.signal)&&(n=function(t){c&&(r(!t||t.type?new Je(null,e,c):t),c.abort(),c=null)},o.cancelToken&&o.cancelToken.subscribe(n),o.signal&&(o.signal.aborted?n():o.signal.addEventListener("abort",n)));var l,h,p=(l=o.url,(h=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l))&&h[1]||"");p&&-1===Le.protocols.indexOf(p)?r(new fe("Unsupported protocol "+p+":",fe.ERR_BAD_REQUEST,e)):c.send(i||null)}))},at=function(e,t){var r,n=new AbortController,o=function(e){if(!r){r=!0,a();var t=e instanceof Error?e:this.reason;n.abort(t instanceof fe?t:new Je(t instanceof Error?t.message:t))}},i=t&&setTimeout((function(){o(new fe("timeout ".concat(t," of ms exceeded"),fe.ETIMEDOUT))}),t),a=function(){e&&(i&&clearTimeout(i),i=null,e.forEach((function(e){e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))})),e=null)};e.forEach((function(e){return e&&e.addEventListener&&e.addEventListener("abort",o)}));var s=n.signal;return s.unsubscribe=a,[s,function(){i&&clearTimeout(i),i=null}]},st=u().mark((function e(t,r){var n,o,i;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.byteLength,r&&!(n1?"since :\n"+s.map(Et).join("\n"):" "+Et(s[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function xt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Je(null,e)}function Rt(e){return xt(e),e.headers=ze.from(e.headers),e.data=Me.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),St(e.adapter||Ce.adapter)(e).then((function(t){return xt(e),t.data=Me.call(e,e.transformResponse,t),t.headers=ze.from(t.headers),t}),(function(t){return He(t)||(xt(e),t&&t.response&&(t.response.data=Me.call(e,e.transformResponse,t.response),t.response.headers=ze.from(t.response.headers))),Promise.reject(t)}))}var Tt="1.7.2",jt={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){jt[e]=function(r){return f(r)===e||"a"+(t<1?"n ":" ")+e}}));var kt={};jt.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.2] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new fe(n(o," has been removed"+(t?" in "+t:"")),fe.ERR_DEPRECATED);return t&&!kt[o]&&(kt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var At={assertOptions:function(e,t,r){if("object"!==f(e))throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new fe("option "+i+" must be "+u,fe.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new fe("Unknown option "+i,fe.ERR_BAD_OPTION)}},validators:jt},Pt=At.validators,Lt=function(){function e(t){p(this,e),this.defaults=t,this.interceptors={request:new xe,response:new xe}}var t;return y(e,[{key:"request",value:(t=h(u().mark((function e(t,r){var n,o;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._request(t,r);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),e.t0 instanceof Error){Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error,o=n.stack?n.stack.replace(/^.+\n/,""):"";try{e.t0.stack?o&&!String(e.t0.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(e.t0.stack+="\n"+o):e.t0.stack=o}catch(e){}}throw e.t0;case 10:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(e,r){return t.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var r=t=Ze(this.defaults,t),n=r.transitional,o=r.paramsSerializer,i=r.headers;void 0!==n&&At.assertOptions(n,{silentJSONParsing:Pt.transitional(Pt.boolean),forcedJSONParsing:Pt.transitional(Pt.boolean),clarifyTimeoutError:Pt.transitional(Pt.boolean)},!1),null!=o&&(ce.isFunction(o)?t.paramsSerializer={serialize:o}:At.assertOptions(o,{encode:Pt.function,serialize:Pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&ce.merge(i.common,i[t.method]);i&&ce.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]})),t.headers=ze.concat(a,i);var s=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));var c,f=[];this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));var l,h=0;if(!u){var p=[Rt.bind(this),void 0];for(p.unshift.apply(p,s),p.push.apply(p,f),l=p.length,c=Promise.resolve(t);h0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(e,t,o){n.reason||(n.reason=new Je(e,t,o),r(n.reason))}))}return y(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}}],[{key:"source",value:function(){var t;return{token:new e((function(e){t=e})),cancel:t}}}]),e}();var Ct={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ct).forEach((function(e){var t=m(e,2),r=t[0],n=t[1];Ct[n]=r}));var Ft=Ct;var Ut=function e(t){var r=new Nt(t),n=x(Nt.prototype.request,r);return ce.extend(n,Nt.prototype,r,{allOwnKeys:!0}),ce.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Ze(t,r))},n}(Ce);return Ut.Axios=Nt,Ut.CanceledError=Je,Ut.CancelToken=_t,Ut.isCancel=He,Ut.VERSION=Tt,Ut.toFormData=me,Ut.AxiosError=fe,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return ce.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=Ze,Ut.AxiosHeaders=ze,Ut.formToJSON=function(e){return Ne(ce.isHTMLForm(e)?new FormData(e):e)},Ut.getAdapter=St,Ut.HttpStatusCode=Ft,Ut.default=Ut,Ut})); +//# sourceMappingURL=axios.min.js.map diff --git a/node_modules/axios/dist/axios.min.js.map b/node_modules/axios/dist/axios.min.js.map new file mode 100644 index 00000000..870e70f5 --- /dev/null +++ b/node_modules/axios/dist/axios.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.min.js","sources":["../lib/helpers/bind.js","../lib/utils.js","../lib/core/AxiosError.js","../lib/helpers/toFormData.js","../lib/helpers/AxiosURLSearchParams.js","../lib/helpers/buildURL.js","../lib/core/InterceptorManager.js","../lib/platform/common/utils.js","../lib/defaults/transitional.js","../lib/platform/browser/index.js","../lib/platform/browser/classes/URLSearchParams.js","../lib/platform/browser/classes/FormData.js","../lib/platform/browser/classes/Blob.js","../lib/platform/index.js","../lib/helpers/formDataToJSON.js","../lib/defaults/index.js","../lib/helpers/toURLEncodedForm.js","../lib/helpers/parseHeaders.js","../lib/core/AxiosHeaders.js","../lib/core/transformData.js","../lib/cancel/isCancel.js","../lib/cancel/CanceledError.js","../lib/core/settle.js","../lib/helpers/speedometer.js","../lib/helpers/throttle.js","../lib/helpers/progressEventReducer.js","../lib/helpers/isURLSameOrigin.js","../lib/helpers/cookies.js","../lib/core/buildFullPath.js","../lib/helpers/isAbsoluteURL.js","../lib/helpers/combineURLs.js","../lib/core/mergeConfig.js","../lib/helpers/resolveConfig.js","../lib/adapters/fetch.js","../lib/adapters/xhr.js","../lib/helpers/parseProtocol.js","../lib/helpers/composeSignals.js","../lib/helpers/trackStream.js","../lib/adapters/adapters.js","../lib/helpers/null.js","../lib/core/dispatchRequest.js","../lib/env/data.js","../lib/helpers/validator.js","../lib/core/Axios.js","../lib/cancel/CancelToken.js","../lib/helpers/HttpStatusCode.js","../lib/axios.js","../lib/helpers/spread.js","../lib/helpers/isAxiosError.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n"],"names":["bind","fn","thisArg","apply","arguments","cache","toString","Object","prototype","getPrototypeOf","kindOf","create","thing","str","call","slice","toLowerCase","kindOfTest","type","typeOfTest","_typeof","isArray","Array","isUndefined","isArrayBuffer","isString","isFunction","isNumber","isObject","isPlainObject","val","Symbol","toStringTag","iterator","isDate","isFile","isBlob","isFileList","isURLSearchParams","_map2","_slicedToArray","map","isReadableStream","isRequest","isResponse","isHeaders","forEach","obj","i","l","_ref","length","undefined","_ref$allOwnKeys","allOwnKeys","key","keys","getOwnPropertyNames","len","findKey","_key","_global","globalThis","self","window","global","isContextDefined","context","TypedArray","isTypedArray","Uint8Array","isHTMLForm","hasOwnProperty","_ref4","prop","isRegExp","reduceDescriptors","reducer","descriptors","getOwnPropertyDescriptors","reducedDescriptors","descriptor","name","ret","defineProperties","ALPHA","DIGIT","ALPHABET","ALPHA_DIGIT","toUpperCase","isAsyncFn","utils$1","isBuffer","constructor","isFormData","kind","FormData","append","isArrayBufferView","ArrayBuffer","isView","buffer","isBoolean","isStream","pipe","merge","_ref2","this","caseless","result","assignValue","targetKey","extend","a","b","_ref3","trim","replace","stripBOM","content","charCodeAt","inherits","superConstructor","props","defineProperty","value","assign","toFlatObject","sourceObj","destObj","filter","propFilter","merged","endsWith","searchString","position","String","lastIndex","indexOf","toArray","arr","forEachEntry","next","done","pair","matchAll","regExp","matches","exec","push","hasOwnProp","freezeMethods","enumerable","writable","set","Error","toObjectSet","arrayOrString","delimiter","define","split","toCamelCase","m","p1","p2","noop","toFiniteNumber","defaultValue","Number","isFinite","generateString","size","alphabet","Math","random","isSpecCompliantForm","toJSONObject","stack","visit","source","target","reducedValue","isThenable","then","AxiosError","message","code","config","request","response","captureStackTrace","utils","toJSON","description","number","fileName","lineNumber","columnNumber","status","from","error","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","path","dots","concat","token","join","predicates","test","toFormData","formData","options","TypeError","metaTokens","indexes","option","visitor","defaultVisitor","useBlob","Blob","convertValue","toISOString","Buffer","JSON","stringify","some","isFlatArray","el","index","exposedHelpers","build","pop","encode","charMap","encodeURIComponent","match","AxiosURLSearchParams","params","_pairs","buildURL","url","serializedParams","_encode","serializeFn","serialize","hashmarkIndex","encoder","product","InterceptorManager$1","InterceptorManager","_classCallCheck","handlers","_createClass","fulfilled","rejected","synchronous","runWhen","id","h","transitionalDefaults","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","platform$1","isBrowser","classes","URLSearchParams","protocols","hasBrowserEnv","document","hasStandardBrowserEnv","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","origin","location","href","_objectSpread","platform","formDataToJSON","buildPath","isNumericKey","isLast","arrayToObject","entries","parsePropPath","defaults","transitional","adapter","transformRequest","data","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","setContentType","helpers","isNode","toURLEncodedForm","formSerializer","_FormData","env","rawValue","parser","parse","e","stringifySafely","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","Accept","method","defaults$1","ignoreDuplicateOf","$internals","normalizeHeader","header","normalizeValue","matchHeaderValue","isHeaderNameFilter","AxiosHeaders","_Symbol$iterator","_Symbol$toStringTag","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","rawHeaders","parsed","line","substring","parseHeaders","_step","_iterator","_createForOfIteratorHelper","s","n","_step$value","err","f","tokens","tokensRE","parseTokens","matcher","deleted","deleteHeader","format","normalized","w","char","formatHeader","_this$constructor","_len","targets","asStrings","get","first","computed","_len2","_key2","accessors","defineAccessor","accessorName","methodName","arg1","arg2","arg3","configurable","buildAccessors","accessor","mapped","headerValue","AxiosHeaders$1","transformData","fns","normalize","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","settle","resolve","reject","ERR_BAD_REQUEST","floor","speedometer","samplesCount","min","firstSampleTS","bytes","timestamps","head","tail","chunkLength","now","Date","startedAt","bytesCount","passed","round","throttle","freq","timestamp","threshold","timer","_arguments","force","clearTimeout","setTimeout","progressEventReducer","listener","isDownloadStream","bytesNotified","_speedometer","loaded","total","lengthComputable","progressBytes","rate","progress","estimated","event","originURL","msie","userAgent","urlParsingNode","createElement","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","requestURL","write","expires","domain","secure","cookie","toGMTString","read","RegExp","decodeURIComponent","remove","buildFullPath","baseURL","requestedURL","relativeURL","combineURLs","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","paramsSerializer","timeoutMessage","withCredentials","withXSRFToken","onUploadProgress","onDownloadProgress","decompress","beforeRedirect","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding","configValue","duplexAccessed","hasContentType","res","resolveConfig","newConfig","auth","btoa","username","password","unescape","Boolean","_toConsumableArray","isURLSameOrigin","xsrfValue","cookies","xhrAdapter","XMLHttpRequest","Promise","onCanceled","_config","requestData","requestHeaders","unsubscribe","signal","removeEventListener","onloadend","responseHeaders","getAllResponseHeaders","responseText","statusText","open","onreadystatechange","readyState","responseURL","onabort","ECONNABORTED","onerror","ERR_NETWORK","ontimeout","timeoutErrorMessage","ETIMEDOUT","setRequestHeader","addEventListener","upload","cancel","abort","subscribe","aborted","send","composeSignals$1","signals","controller","AbortController","reason","streamChunk","_regeneratorRuntime","mark","chunk","chunkSize","pos","end","wrap","_context","prev","byteLength","abrupt","stop","readBytes","_callee","iterable","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_context2","_asyncIterator","_awaitAsyncGenerator","sent","t0","_asyncGeneratorDelegate","t1","t2","t3","t4","t5","t6","t7","t8","delegateYield","t10","finish","_x","_x2","_x3","trackStream","stream","onProgress","onFinish","ReadableStream","pull","_asyncToGenerator","_callee2","_yield$iterator$next","_context3","close","enqueue","highWaterMark","fetchProgressDecorator","isFetchSupported","fetch","Request","Response","isReadableStreamSupported","encodeText","TextEncoder","arrayBuffer","supportsRequestStream","body","duplex","has","supportsResponseStream","resolvers","_","ERR_NOT_SUPPORT","getBodyLength","resolveBodyLength","_callee3","getContentLength","_x4","_callee4","_resolveConfig","_resolveConfig$withCr","fetchOptions","_ref5","_ref6","composedSignal","stopTimeout","finished","requestContentLength","_request","contentTypeHeader","isStreamResponse","responseContentLength","responseData","_context4","composeSignals","_x5","knownAdapters","http","xhr","fetchAdapter","renderReason","isResolvedHandle","adapters","nameOrAdapter","rejectedReasons","reasons","state","throwIfCancellationRequested","throwIfRequested","dispatchRequest","VERSION","validators","deprecatedWarnings","validators$1","validator","version","formatMessage","opt","desc","opts","ERR_DEPRECATED","console","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","_request2","configOrUrl","dummy","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","unshift","promise","responseInterceptorChain","chain","onFulfilled","onRejected","generateHTTPMethod","isForm","Axios$1","CancelToken$1","CancelToken","executor","resolvePromise","_listeners","onfulfilled","_resolve","splice","c","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","HttpStatusCode$1","axios","createInstance","defaultConfig","instance","Cancel","all","promises","spread","callback","isAxiosError","payload","formToJSON","getAdapter"],"mappings":"i1XAEe,SAASA,EAAKC,EAAIC,GAC/B,OAAO,WACL,OAAOD,EAAGE,MAAMD,EAASE,WAE7B,mSCAA,IAGgBC,EAHTC,EAAYC,OAAOC,UAAnBF,SACAG,EAAkBF,OAAlBE,eAEDC,GAAUL,EAGbE,OAAOI,OAAO,MAHQ,SAAAC,GACrB,IAAMC,EAAMP,EAASQ,KAAKF,GAC1B,OAAOP,EAAMQ,KAASR,EAAMQ,GAAOA,EAAIE,MAAM,GAAI,GAAGC,iBAGlDC,EAAa,SAACC,GAElB,OADAA,EAAOA,EAAKF,cACL,SAACJ,GAAK,OAAKF,EAAOE,KAAWM,CAAI,CAC1C,EAEMC,EAAa,SAAAD,GAAI,OAAI,SAAAN,GAAK,OAAIQ,EAAOR,KAAUM,CAAI,CAAA,EASlDG,EAAWC,MAAXD,QASDE,EAAcJ,EAAW,aAqB/B,IAAMK,EAAgBP,EAAW,eA2BjC,IAAMQ,EAAWN,EAAW,UAQtBO,EAAaP,EAAW,YASxBQ,EAAWR,EAAW,UAStBS,EAAW,SAAChB,GAAK,OAAe,OAAVA,GAAmC,WAAjBQ,EAAOR,EAAkB,EAiBjEiB,EAAgB,SAACC,GACr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BK,EAAGmD,EAAA,GAAEmB,EAAKnB,EAAA,GACjDslB,GAAenkB,GAAStE,CAC1B,IAEA,IAAAysB,GAAehE,GCxBf,IAAMiE,GAnBN,SAASC,EAAeC,GACtB,IAAMhsB,EAAU,IAAIimB,GAAM+F,GACpBC,EAAWpwB,EAAKoqB,GAAM5pB,UAAUoL,QAASzH,GAa/C,OAVA4H,GAAM/E,OAAOopB,EAAUhG,GAAM5pB,UAAW2D,EAAS,CAACb,YAAY,IAG9DyI,GAAM/E,OAAOopB,EAAUjsB,EAAS,KAAM,CAACb,YAAY,IAGnD8sB,EAASzvB,OAAS,SAAgB0pB,GAChC,OAAO6F,EAAexS,GAAYyS,EAAe9F,KAG5C+F,CACT,CAGcF,CAAe9d,WAG7B6d,GAAM7F,MAAQA,GAGd6F,GAAMnX,cAAgBA,GACtBmX,GAAMzE,YAAcA,GACpByE,GAAMrX,SAAWA,GACjBqX,GAAM/G,QAAUA,GAChB+G,GAAM3iB,WAAaA,GAGnB2iB,GAAMzkB,WAAaA,GAGnBykB,GAAMI,OAASJ,GAAMnX,cAGrBmX,GAAMK,IAAM,SAAaC,GACvB,OAAOpQ,QAAQmQ,IAAIC,EACrB,EAEAN,GAAMO,OC9CS,SAAgBC,GAC7B,OAAO,SAAc7nB,GACnB,OAAO6nB,EAAStwB,MAAM,KAAMyI,GAEhC,ED6CAqnB,GAAMS,aE7DS,SAAsBC,GACnC,OAAO5kB,GAAMnK,SAAS+uB,KAAsC,IAAzBA,EAAQD,YAC7C,EF8DAT,GAAMvS,YAAcA,GAEpBuS,GAAMjb,aAAeA,GAErBib,GAAMW,WAAa,SAAAhwB,GAAK,OAAIiR,GAAe9F,GAAMxH,WAAW3D,GAAS,IAAIoF,SAASpF,GAASA,EAAM,EAEjGqvB,GAAMY,WAAanI,GAEnBuH,GAAMjE,eAAiBA,GAEvBiE,GAAK,QAAWA"} \ No newline at end of file diff --git a/node_modules/axios/dist/browser/axios.cjs b/node_modules/axios/dist/browser/axios.cjs new file mode 100644 index 00000000..6936d242 --- /dev/null +++ b/node_modules/axios/dist/browser/axios.cjs @@ -0,0 +1,3638 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +'use strict'; + +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +var utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils$1.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +// eslint-disable-next-line strict +var httpAdapter = null; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils$1.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils$1.isArray(value) && isFlatArray(value)) || + ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils$1.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils$1.forEach(value, function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +var InterceptorManager$1 = InterceptorManager; + +var transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; + +var FormData$1 = typeof FormData !== 'undefined' ? FormData : null; + +var Blob$1 = typeof Blob !== 'undefined' ? Blob : null; + +var platform$1 = { + isBrowser: true, + classes: { + URLSearchParams: URLSearchParams$1, + FormData: FormData$1, + Blob: Blob$1 + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}; + +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +var utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin +}); + +var platform = { + ...utils, + ...platform$1 +}; + +function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils$1.isObject(data); + + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils$1.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils$1.isArrayBuffer(data) || + utils$1.isBuffer(data) || + utils$1.isStream(data) || + utils$1.isFile(data) || + utils$1.isBlob(data) || + utils$1.isReadableStream(data) + ) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + + if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +var defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils$1.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +var parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils$1.isString(value)) return; + + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils$1.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils$1.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils$1.freezeMethods(AxiosHeaders); + +var AxiosHeaders$1 = AxiosHeaders; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$1.from(context.headers); + let data = context.data; + + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +var progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +}; + +var isURLSameOrigin = platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +var cookies = platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils$1.isString(path) && cookie.push('path=' + path); + + utils$1.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({caseless}, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +var resolveConfig = (config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders$1.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +var xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$1.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }; + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); + }, timeout); + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +}; + +var composeSignals$1 = composeSignals; + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +}; + +const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +}; + +const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +}; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +}; + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils$1.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }); + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils$1.isBlob(body)) { + return body.size; + } + + if(utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils$1.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } +}; + +const resolveBodyLength = async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +}; + +var fetchAdapter = isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals$1([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + }; + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError.from(err, err && err.code, config, request); + } +}); + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +}; + +utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; + +var adapters = { + getAdapter: (adapters) => { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$1.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const VERSION = "1.7.2"; + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +var validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + + headers && utils$1.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +var Axios$1 = Axios; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +var CancelToken$1 = CancelToken; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError(payload) { + return utils$1.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +var HttpStatusCode$1 = HttpStatusCode; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$1(defaultConfig); + const instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils$1.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$1; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken$1; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders$1; + +axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode$1; + +axios.default = axios; + +module.exports = axios; +//# sourceMappingURL=axios.cjs.map diff --git a/node_modules/axios/dist/browser/axios.cjs.map b/node_modules/axios/dist/browser/axios.cjs.map new file mode 100644 index 00000000..b27fbf23 --- /dev/null +++ b/node_modules/axios/dist/browser/axios.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.cjs","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/null.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/browser/classes/URLSearchParams.js","../../lib/platform/browser/classes/FormData.js","../../lib/platform/browser/classes/Blob.js","../../lib/platform/browser/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/env/data.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n"],"names":["utils","prototype","encode","URLSearchParams","FormData","Blob","platform","defaults","AxiosHeaders","composeSignals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CAAC;AAChC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC1B,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;AACxB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B;AACA;AACA,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B;AACA;AACA,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;AACnC;AACA;AACA,KAAK,CAAC,GAAG,GAAG,SAAS,GAAG,CAAC,QAAQ,EAAE;AACnC,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACA,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB;AACA;AACA,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;AAClC;AACA;AACA,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;AAChC;AACA,KAAK,CAAC,YAAY,GAAGL,cAAY,CAAC;AAClC;AACA,KAAK,CAAC,UAAU,GAAG,KAAK,IAAI,cAAc,CAACR,OAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAClG;AACA,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACvC;AACA,KAAK,CAAC,cAAc,GAAGc,gBAAc,CAAC;AACtC;AACA,KAAK,CAAC,OAAO,GAAG,KAAK;;;;"} \ No newline at end of file diff --git a/node_modules/axios/dist/esm/axios.js b/node_modules/axios/dist/esm/axios.js new file mode 100644 index 00000000..c29e4a71 --- /dev/null +++ b/node_modules/axios/dist/esm/axios.js @@ -0,0 +1,3661 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +const utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError$1(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils$1.inherits(AxiosError$1, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError$1.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError$1, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError$1.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError$1.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +// eslint-disable-next-line strict +const httpAdapter = null; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData$1(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils$1.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError$1('Blob is not supported. Use a Buffer instead.'); + } + + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils$1.isArray(value) && isFlatArray(value)) || + ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils$1.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils$1.forEach(value, function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData$1(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +const InterceptorManager$1 = InterceptorManager; + +const transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; + +const FormData$1 = typeof FormData !== 'undefined' ? FormData : null; + +const Blob$1 = typeof Blob !== 'undefined' ? Blob : null; + +const platform$1 = { + isBrowser: true, + classes: { + URLSearchParams: URLSearchParams$1, + FormData: FormData$1, + Blob: Blob$1 + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}; + +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +const utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin +}); + +const platform = { + ...utils, + ...platform$1 +}; + +function toURLEncodedForm(data, options) { + return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils$1.isObject(data); + + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils$1.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils$1.isArrayBuffer(data) || + utils$1.isBuffer(data) || + utils$1.isStream(data) || + utils$1.isFile(data) || + utils$1.isBlob(data) || + utils$1.isReadableStream(data) + ) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData$1( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + + if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +const defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils$1.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +const parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils$1.isString(value)) return; + + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders$1 { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils$1.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils$1.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils$1.freezeMethods(AxiosHeaders$1); + +const AxiosHeaders$2 = AxiosHeaders$1; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$2.from(context.headers); + let data = context.data; + + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel$1(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError$1(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils$1.inherits(CanceledError$1, AxiosError$1, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError$1( + 'Request failed with status code ' + response.status, + [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +const progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +}; + +const isURLSameOrigin = platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +const cookies = platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils$1.isString(path) && cookie.push('path=' + path); + + utils$1.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig$1(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({caseless}, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +const resolveConfig = (config) => { + const newConfig = mergeConfig$1({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders$2.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +const xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$2.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$2.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError$1( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)); + } + }; + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT)); + }, timeout); + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +}; + +const composeSignals$1 = composeSignals; + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +}; + +const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +}; + +const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +}; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +}; + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils$1.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config); + }); + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils$1.isBlob(body)) { + return body.size; + } + + if(utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils$1.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } +}; + +const resolveBodyLength = async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +}; + +const fetchAdapter = isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals$1([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + }; + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$2.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError$1.from(err, err && err.code, config, request); + } +}); + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +}; + +utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; + +const adapters = { + getAdapter: (adapters) => { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError$1(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError$1( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError$1(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$2.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$2.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel$1(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$2.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const VERSION$1 = "1.7.2"; + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError$1( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError$1.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION); + } + } +} + +const validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios$1 { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig$1(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + + headers && utils$1.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$2.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig$1(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios$1.prototype[method] = function(url, config) { + return this.request(mergeConfig$1(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig$1(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios$1.prototype[method] = generateHTTPMethod(); + + Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +const Axios$2 = Axios$1; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken$1 { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError$1(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken$1(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +const CancelToken$2 = CancelToken$1; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread$1(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError$1(payload) { + return utils$1.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode$1 = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode$1).forEach(([key, value]) => { + HttpStatusCode$1[value] = key; +}); + +const HttpStatusCode$2 = HttpStatusCode$1; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$2(defaultConfig); + const instance = bind(Axios$2.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$2.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils$1.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig$1(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$2; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError$1; +axios.CancelToken = CancelToken$2; +axios.isCancel = isCancel$1; +axios.VERSION = VERSION$1; +axios.toFormData = toFormData$1; + +// Expose AxiosError class +axios.AxiosError = AxiosError$1; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread$1; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError$1; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig$1; + +axios.AxiosHeaders = AxiosHeaders$2; + +axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode$2; + +axios.default = axios; + +// this module should only have a default export +const axios$1 = axios; + +// This module is intended to unwrap Axios default export as named. +// Keep top-level export same with static properties +// so that it can keep same with es module or cjs +const { + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData, + AxiosHeaders, + HttpStatusCode, + formToJSON, + getAdapter, + mergeConfig +} = axios$1; + +export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, axios$1 as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData }; +//# sourceMappingURL=axios.js.map diff --git a/node_modules/axios/dist/esm/axios.js.map b/node_modules/axios/dist/esm/axios.js.map new file mode 100644 index 00000000..ea2ab215 --- /dev/null +++ b/node_modules/axios/dist/esm/axios.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.js","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/null.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/browser/classes/URLSearchParams.js","../../lib/platform/browser/classes/FormData.js","../../lib/platform/browser/classes/Blob.js","../../lib/platform/browser/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/env/data.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js","../../index.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n","import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n} = axios;\n\nexport {\n axios as default,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n}\n"],"names":["AxiosError","utils","prototype","toFormData","encode","URLSearchParams","FormData","Blob","platform","AxiosHeaders","defaults","isCancel","CanceledError","mergeConfig","composeSignals","VERSION","validators","Axios","InterceptorManager","CancelToken","spread","isAxiosError","HttpStatusCode","axios"],"mappings":";AAEe,SAAS,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE;AAC1C,EAAE,OAAO,SAAS,IAAI,GAAG;AACzB,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACxC,GAAG,CAAC;AACJ;;ACFA;AACA;AACA,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;AACpC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC;AAChC;AACA,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,KAAK,IAAI;AAClC,IAAI,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC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CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACA,KAAK,CAAC,MAAM,GAAGoB,QAAM,CAAC;AACtB;AACA;AACA,KAAK,CAAC,YAAY,GAAGC,cAAY,CAAC;AAClC;AACA;AACA,KAAK,CAAC,WAAW,GAAGR,aAAW,CAAC;AAChC;AACA,KAAK,CAAC,YAAY,GAAGJ,cAAY,CAAC;AAClC;AACA,KAAK,CAAC,UAAU,GAAG,KAAK,IAAI,cAAc,CAACR,OAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAClG;AACA,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACvC;AACA,KAAK,CAAC,cAAc,GAAGqB,gBAAc,CAAC;AACtC;AACA,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;AACtB;AACA;AACA,gBAAe;;ACtFf;AACA;AACA;AACK,MAAC;AACN,EAAE,KAAK;AACP,EAAE,UAAU;AACZ,EAAE,aAAa;AACf,EAAE,QAAQ;AACV,EAAE,WAAW;AACb,EAAE,OAAO;AACT,EAAE,GAAG;AACL,EAAE,MAAM;AACR,EAAE,YAAY;AACd,EAAE,MAAM;AACR,EAAE,UAAU;AACZ,EAAE,YAAY;AACd,EAAE,cAAc;AAChB,EAAE,UAAU;AACZ,EAAE,UAAU;AACZ,EAAE,WAAW;AACb,CAAC,GAAGC;;;;"} \ No newline at end of file diff --git a/node_modules/axios/dist/esm/axios.min.js b/node_modules/axios/dist/esm/axios.min.js new file mode 100644 index 00000000..6373f437 --- /dev/null +++ b/node_modules/axios/dist/esm/axios.min.js @@ -0,0 +1,2 @@ +function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,r=(o=Object.create(null),e=>{const n=t.call(e);return o[n]||(o[n]=n.slice(8,-1).toLowerCase())});var o;const s=e=>(e=e.toLowerCase(),t=>r(t)===e),i=e=>t=>typeof t===e,{isArray:a}=Array,c=i("undefined");const u=s("ArrayBuffer");const l=i("string"),f=i("function"),d=i("number"),h=e=>null!==e&&"object"==typeof e,p=e=>{if("object"!==r(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},m=s("Date"),y=s("File"),b=s("Blob"),g=s("FileList"),w=s("URLSearchParams"),[E,O,R,S]=["ReadableStream","Request","Response","Headers"].map(s);function T(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),a(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,C=e=>!c(e)&&e!==v;const x=(N="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>N&&e instanceof N);var N;const j=s("HTMLFormElement"),P=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),_=s("RegExp"),F=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};T(n,((n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)})),Object.defineProperties(e,r)},L="abcdefghijklmnopqrstuvwxyz",U={DIGIT:"0123456789",ALPHA:L,ALPHA_DIGIT:L+L.toUpperCase()+"0123456789"};const B=s("AsyncFunction"),D={isArray:a,isArrayBuffer:u,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=r(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&u(e.buffer),t},isString:l,isNumber:d,isBoolean:e=>!0===e||!1===e,isObject:h,isPlainObject:p,isReadableStream:E,isRequest:O,isResponse:R,isHeaders:S,isUndefined:c,isDate:m,isFile:y,isBlob:b,isRegExp:_,isFunction:f,isStream:e=>h(e)&&f(e.pipe),isURLSearchParams:w,isTypedArray:x,isFileList:g,forEach:T,merge:function e(){const{caseless:t}=C(this)&&this||{},n={},r=(r,o)=>{const s=t&&A(n,o)||o;p(n[s])&&p(r)?n[s]=e(n[s],r):p(r)?n[s]=e({},r):a(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e(T(n,((n,o)=>{r&&f(n)?t[o]=e(n,r):t[o]=n}),{allOwnKeys:o}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,o)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:r,kindOfTest:s,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(a(e))return e;let t=e.length;if(!d(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:P,hasOwnProp:P,reduceDescriptors:F,freezeMethods:e=>{F(e,((t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];f(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return a(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:A,global:v,isContextDefined:C,ALPHABET:U,generateString:(e=16,t=U.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(h(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=a(e)?[]:{};return T(e,((e,t)=>{const s=n(e,r+1);!c(s)&&(o[t]=s)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:B,isThenable:e=>e&&(h(e)||f(e))&&f(e.then)&&f(e.catch)};function k(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}D.inherits(k,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const q=k.prototype,I={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{I[e]={value:e}})),Object.defineProperties(k,I),Object.defineProperty(q,"isAxiosError",{value:!0}),k.from=(e,t,n,r,o,s)=>{const i=Object.create(q);return D.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),k.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function z(e){return D.isPlainObject(e)||D.isArray(e)}function M(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function H(e,t,n){return e?e.concat(t).map((function(e,t){return e=M(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const J=D.toFlatObject(D,{},null,(function(e){return/^is[A-Z]/.test(e)}));function W(e,t,n){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=D.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!D.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&D.isSpecCompliantForm(t);if(!D.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(D.isDate(e))return e.toISOString();if(!a&&D.isBlob(e))throw new k("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(e)||D.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(D.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(D.isArray(e)&&function(e){return D.isArray(e)&&!e.some(z)}(e)||(D.isFileList(e)||D.endsWith(n,"[]"))&&(a=D.toArray(e)))return n=M(n),a.forEach((function(e,r){!D.isUndefined(e)&&null!==e&&t.append(!0===i?H([n],r,s):null===i?n:n+"[]",c(e))})),!1;return!!z(e)||(t.append(H(o,n,s),c(e)),!1)}const l=[],f=Object.assign(J,{defaultVisitor:u,convertValue:c,isVisitable:z});if(!D.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!D.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),D.forEach(n,(function(n,s){!0===(!(D.isUndefined(n)||null===n)&&o.call(t,n,D.isString(s)?s.trim():s,r,f))&&e(n,r?r.concat(s):[s])})),l.pop()}}(e),t}function V(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function K(e,t){this._pairs=[],e&&W(e,this,t)}const $=K.prototype;function G(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function X(e,t,n){if(!t)return e;const r=n&&n.encode||G,o=n&&n.serialize;let s;if(s=o?o(t,n):D.isURLSearchParams(t)?t.toString():new K(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,V)}:V;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const Q=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){D.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:K,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ee="undefined"!=typeof window&&"undefined"!=typeof document,te=(ne="undefined"!=typeof navigator&&navigator.product,ee&&["ReactNative","NativeScript","NS"].indexOf(ne)<0);var ne;const re="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oe=ee&&window.location.href||"http://localhost",se={...Object.freeze({__proto__:null,hasBrowserEnv:ee,hasStandardBrowserWebWorkerEnv:re,hasStandardBrowserEnv:te,origin:oe}),...Y};function ie(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&D.isArray(r)?r.length:s,a)return D.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&D.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&D.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r{t(function(e){return D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const ae={transitional:Z,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=D.isObject(e);o&&D.isHTMLForm(e)&&(e=new FormData(e));if(D.isFormData(e))return r?JSON.stringify(ie(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e)||D.isReadableStream(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return W(e,new se.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return se.isNode&&D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=D.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return W(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ae.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(D.isResponse(e)||D.isReadableStream(e))return e;if(e&&D.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw k.from(e,k.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:se.classes.FormData,Blob:se.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch"],(e=>{ae.headers[e]={}}));const ce=ae,ue=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),le=Symbol("internals");function fe(e){return e&&String(e).trim().toLowerCase()}function de(e){return!1===e||null==e?e:D.isArray(e)?e.map(de):String(e)}function he(e,t,n,r,o){return D.isFunction(r)?r.call(this,t,n):(o&&(t=n),D.isString(t)?D.isString(r)?-1!==t.indexOf(r):D.isRegExp(r)?r.test(t):void 0:void 0)}class pe{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=fe(t);if(!o)throw new Error("header name must be a non-empty string");const s=D.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=de(e))}const s=(e,t)=>D.forEach(e,((e,n)=>o(e,n,t)));if(D.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ue[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(D.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=fe(e)){const n=D.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(D.isFunction(t))return t.call(this,e,n);if(D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fe(e)){const n=D.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=fe(e)){const o=D.findKey(n,e);!o||t&&!he(0,n[o],o,t)||(delete n[o],r=!0)}}return D.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!he(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return D.forEach(this,((r,o)=>{const s=D.findKey(n,o);if(s)return t[s]=de(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();i!==o&&delete t[o],t[i]=de(r),n[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return D.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&D.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[le]=this[le]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=fe(e);t[r]||(!function(e,t){const n=D.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return D.isArray(e)?e.forEach(r):r(e),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(pe.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),D.freezeMethods(pe);const me=pe;function ye(e,t){const n=this||ce,r=t||n,o=me.from(r.headers);let s=r.data;return D.forEach(e,(function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function be(e){return!(!e||!e.__CANCEL__)}function ge(e,t,n){k.call(this,null==e?"canceled":e,k.ERR_CANCELED,t,n),this.name="CanceledError"}function we(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new k("Request failed with status code "+n.status,[k.ERR_BAD_REQUEST,k.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}D.inherits(ge,k,{__CANCEL__:!0});const Ee=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,f=0;for(;l!==s;)f+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-or)return o&&(clearTimeout(o),o=null),n=s,e.apply(null,arguments);o||(o=setTimeout((()=>(o=null,n=Date.now(),e.apply(null,arguments))),r-(s-n)))}}((n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;const u={loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i};u[t?"download":"upload"]=!0,e(u)}),n)},Oe=se.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=D.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},Re=se.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];D.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),D.isString(r)&&i.push("path="+r),D.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Se(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Te=e=>e instanceof me?{...e}:e;function Ae(e,t){t=t||{};const n={};function r(e,t,n){return D.isPlainObject(e)&&D.isPlainObject(t)?D.merge.call({caseless:n},e,t):D.isPlainObject(t)?D.merge({},t):D.isArray(t)?t.slice():t}function o(e,t,n){return D.isUndefined(t)?D.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function s(e,t){if(!D.isUndefined(t))return r(void 0,t)}function i(e,t){return D.isUndefined(t)?D.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>o(Te(e),Te(t),!0)};return D.forEach(Object.keys(Object.assign({},e,t)),(function(r){const s=c[r]||o,i=s(e[r],t[r],r);D.isUndefined(i)&&s!==a||(n[r]=i)})),n}const ve=e=>{const t=Ae({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=me.from(a),t.url=X(Se(t.baseURL,t.url),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),D.isFormData(r))if(se.hasStandardBrowserEnv||se.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(se.hasStandardBrowserEnv&&(o&&D.isFunction(o)&&(o=o(t)),o||!1!==o&&Oe(t.url))){const e=s&&i&&Re.read(i);e&&a.set(s,e)}return t},Ce="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=ve(e);let o=r.data;const s=me.from(r.headers).normalize();let i,{responseType:a}=r;function c(){r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let u=new XMLHttpRequest;function l(){if(!u)return;const r=me.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());we((function(e){t(e),c()}),(function(e){n(e),c()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:e,request:u}),u=null}u.open(r.method.toUpperCase(),r.url,!0),u.timeout=r.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(n(new k("Request aborted",k.ECONNABORTED,r,u)),u=null)},u.onerror=function(){n(new k("Network Error",k.ERR_NETWORK,r,u)),u=null},u.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const t=r.transitional||Z;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new k(e,t.clarifyTimeoutError?k.ETIMEDOUT:k.ECONNABORTED,r,u)),u=null},void 0===o&&s.setContentType(null),"setRequestHeader"in u&&D.forEach(s.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),D.isUndefined(r.withCredentials)||(u.withCredentials=!!r.withCredentials),a&&"json"!==a&&(u.responseType=r.responseType),"function"==typeof r.onDownloadProgress&&u.addEventListener("progress",Ee(r.onDownloadProgress,!0)),"function"==typeof r.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Ee(r.onUploadProgress)),(r.cancelToken||r.signal)&&(i=t=>{u&&(n(!t||t.type?new ge(null,e,u):t),u.abort(),u=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);f&&-1===se.protocols.indexOf(f)?n(new k("Unsupported protocol "+f+":",k.ERR_BAD_REQUEST,e)):u.send(o||null)}))},xe=(e,t)=>{let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof k?t:new ge(t instanceof Error?t.message:t))}};let s=t&&setTimeout((()=>{o(new k(`timeout ${t} of ms exceeded`,k.ETIMEDOUT))}),t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach((e=>{e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))})),e=null)};e.forEach((e=>e&&e.addEventListener&&e.addEventListener("abort",o)));const{signal:a}=r;return a.unsubscribe=i,[a,()=>{s&&clearTimeout(s),s=null}]},Ne=function*(e,t){let n=e.byteLength;if(!t||n{const s=async function*(e,t,n){for await(const r of e)yield*Ne(ArrayBuffer.isView(r)?r:await n(String(r)),t)}(e,t,o);let i=0;return new ReadableStream({type:"bytes",async pull(e){const{done:t,value:o}=await s.next();if(t)return e.close(),void r();let a=o.byteLength;n&&n(i+=a),e.enqueue(new Uint8Array(o))},cancel:e=>(r(e),s.return())},{highWaterMark:2})},Pe=(e,t)=>{const n=null!=e;return r=>setTimeout((()=>t({lengthComputable:n,total:e,loaded:r})))},_e="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Fe=_e&&"function"==typeof ReadableStream,Le=_e&&("function"==typeof TextEncoder?(Ue=new TextEncoder,e=>Ue.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ue;const Be=Fe&&(()=>{let e=!1;const t=new Request(se.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),De=Fe&&!!(()=>{try{return D.isReadableStream(new Response("").body)}catch(e){}})(),ke={stream:De&&(e=>e.body)};var qe;_e&&(qe=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!ke[e]&&(ke[e]=D.isFunction(qe[e])?t=>t[e]():(t,n)=>{throw new k(`Response type '${e}' is not supported`,k.ERR_NOT_SUPPORT,n)})})));const Ie=async(e,t)=>{const n=D.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:D.isBlob(e)?e.size:D.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:D.isArrayBufferView(e)?e.byteLength:(D.isURLSearchParams(e)&&(e+=""),D.isString(e)?(await Le(e)).byteLength:void 0))(t):n},ze={http:null,xhr:Ce,fetch:_e&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:d}=ve(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,y]=o||s||i?xe([o,s],i):[];const b=()=>{!h&&setTimeout((()=>{m&&m.unsubscribe()})),h=!0};let g;try{if(c&&Be&&"get"!==n&&"head"!==n&&0!==(g=await Ie(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});D.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body&&(r=je(n.body,65536,Pe(g,Ee(c)),null,Le))}D.isString(f)||(f=f?"cors":"omit"),p=new Request(t,{...d,signal:m,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",withCredentials:f});let o=await fetch(p);const s=De&&("stream"===u||"response"===u);if(De&&(a||s)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=D.toFiniteNumber(o.headers.get("content-length"));o=new Response(je(o.body,65536,a&&Pe(t,Ee(a,!0)),s&&b,Le),e)}u=u||"text";let i=await ke[D.findKey(ke,u)||"text"](o,e);return!s&&b(),y&&y(),await new Promise(((t,n)=>{we(t,n,{data:i,headers:me.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})}))}catch(t){if(b(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new k("Network Error",k.ERR_NETWORK,e,p),{cause:t.cause||t});throw k.from(t,t&&t.code,e,p)}})};D.forEach(ze,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Me=e=>`- ${e}`,He=e=>D.isFunction(e)||null===e||!1===e,Je=e=>{e=D.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new k("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Me).join("\n"):" "+Me(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function We(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ge(null,e)}function Ve(e){We(e),e.headers=me.from(e.headers),e.data=ye.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Je(e.adapter||ce.adapter)(e).then((function(t){return We(e),t.data=ye.call(e,e.transformResponse,t),t.headers=me.from(t.headers),t}),(function(t){return be(t)||(We(e),t&&t.response&&(t.response.data=ye.call(e,e.transformResponse,t.response),t.response.headers=me.from(t.response.headers))),Promise.reject(t)}))}const Ke={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ke[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const $e={};Ke.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.2] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new k(r(o," has been removed"+(t?" in "+t:"")),k.ERR_DEPRECATED);return t&&!$e[o]&&($e[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}};const Ge={assertOptions:function(e,t,n){if("object"!=typeof e)throw new k("options must be an object",k.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new k("option "+s+" must be "+n,k.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new k("Unknown option "+s,k.ERR_BAD_OPTION)}},validators:Ke},Xe=Ge.validators;class Qe{constructor(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ae(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ge.assertOptions(n,{silentJSONParsing:Xe.transitional(Xe.boolean),forcedJSONParsing:Xe.transitional(Xe.boolean),clarifyTimeoutError:Xe.transitional(Xe.boolean)},!1),null!=r&&(D.isFunction(r)?t.paramsSerializer={serialize:r}:Ge.assertOptions(r,{encode:Xe.function,serialize:Xe.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&D.merge(o.common,o[t.method]);o&&D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=me.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,f=0;if(!a){const e=[Ve.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);f{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new ge(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Ye((function(t){e=t})),cancel:e}}}const et=Ye;const tt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(tt).forEach((([e,t])=>{tt[t]=e}));const nt=tt;const rt=function t(n){const r=new Ze(n),o=e(Ze.prototype.request,r);return D.extend(o,Ze.prototype,r,{allOwnKeys:!0}),D.extend(o,r,null,{allOwnKeys:!0}),o.create=function(e){return t(Ae(n,e))},o}(ce);rt.Axios=Ze,rt.CanceledError=ge,rt.CancelToken=et,rt.isCancel=be,rt.VERSION="1.7.2",rt.toFormData=W,rt.AxiosError=k,rt.Cancel=rt.CanceledError,rt.all=function(e){return Promise.all(e)},rt.spread=function(e){return function(t){return e.apply(null,t)}},rt.isAxiosError=function(e){return D.isObject(e)&&!0===e.isAxiosError},rt.mergeConfig=Ae,rt.AxiosHeaders=me,rt.formToJSON=e=>ie(D.isHTMLForm(e)?new FormData(e):e),rt.getAdapter=Je,rt.HttpStatusCode=nt,rt.default=rt;const ot=rt,{Axios:st,AxiosError:it,CanceledError:at,isCancel:ct,CancelToken:ut,VERSION:lt,all:ft,Cancel:dt,isAxiosError:ht,spread:pt,toFormData:mt,AxiosHeaders:yt,HttpStatusCode:bt,formToJSON:gt,getAdapter:wt,mergeConfig:Et}=ot;export{st as Axios,it as AxiosError,yt as AxiosHeaders,dt as Cancel,ut as CancelToken,at as CanceledError,bt as HttpStatusCode,lt as VERSION,ft as all,ot as default,gt as formToJSON,wt as getAdapter,ht as isAxiosError,ct as isCancel,Et as mergeConfig,pt as spread,mt as toFormData}; +//# sourceMappingURL=axios.min.js.map diff --git a/node_modules/axios/dist/esm/axios.min.js.map b/node_modules/axios/dist/esm/axios.min.js.map new file mode 100644 index 00000000..0901b22d --- /dev/null +++ b/node_modules/axios/dist/esm/axios.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.min.js","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/browser/index.js","../../lib/platform/browser/classes/URLSearchParams.js","../../lib/platform/browser/classes/FormData.js","../../lib/platform/browser/classes/Blob.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/core/buildFullPath.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/helpers/null.js","../../lib/core/dispatchRequest.js","../../lib/env/data.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../index.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n} = axios;\n\nexport {\n axios as default,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n}\n"],"names":["bind","fn","thisArg","apply","arguments","toString","Object","prototype","getPrototypeOf","kindOf","cache","create","thing","str","call","slice","toLowerCase","kindOfTest","type","typeOfTest","isArray","Array","isUndefined","isArrayBuffer","isString","isFunction","isNumber","isObject","isPlainObject","val","Symbol","toStringTag","iterator","isDate","isFile","isBlob","isFileList","isURLSearchParams","isReadableStream","isRequest","isResponse","isHeaders","map","forEach","obj","allOwnKeys","i","l","length","keys","getOwnPropertyNames","len","key","findKey","_key","_global","globalThis","self","window","global","isContextDefined","context","isTypedArray","TypedArray","Uint8Array","isHTMLForm","hasOwnProperty","prop","isRegExp","reduceDescriptors","reducer","descriptors","getOwnPropertyDescriptors","reducedDescriptors","descriptor","name","ret","defineProperties","ALPHA","ALPHABET","DIGIT","ALPHA_DIGIT","toUpperCase","isAsyncFn","utils$1","isBuffer","constructor","isFormData","kind","FormData","append","isArrayBufferView","result","ArrayBuffer","isView","buffer","isBoolean","isStream","pipe","merge","caseless","this","assignValue","targetKey","extend","a","b","trim","replace","stripBOM","content","charCodeAt","inherits","superConstructor","props","defineProperty","value","assign","toFlatObject","sourceObj","destObj","filter","propFilter","merged","endsWith","searchString","position","String","undefined","lastIndex","indexOf","toArray","arr","forEachEntry","next","done","pair","matchAll","regExp","matches","exec","push","hasOwnProp","freezeMethods","enumerable","writable","set","Error","toObjectSet","arrayOrString","delimiter","define","split","toCamelCase","m","p1","p2","noop","toFiniteNumber","defaultValue","Number","isFinite","generateString","size","alphabet","Math","random","isSpecCompliantForm","toJSONObject","stack","visit","source","target","reducedValue","isThenable","then","catch","AxiosError","message","code","config","request","response","captureStackTrace","utils","toJSON","description","number","fileName","lineNumber","columnNumber","status","from","error","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","path","dots","concat","token","join","predicates","test","toFormData","formData","options","TypeError","metaTokens","indexes","option","visitor","defaultVisitor","useBlob","Blob","convertValue","toISOString","Buffer","JSON","stringify","some","isFlatArray","el","index","exposedHelpers","build","pop","encode","charMap","encodeURIComponent","match","AxiosURLSearchParams","params","_pairs","buildURL","url","_encode","serializeFn","serialize","serializedParams","hashmarkIndex","encoder","InterceptorManager$1","handlers","use","fulfilled","rejected","synchronous","runWhen","eject","id","clear","h","transitionalDefaults","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","platform$1","isBrowser","classes","URLSearchParams","protocols","hasBrowserEnv","document","hasStandardBrowserEnv","product","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","origin","location","href","platform","formDataToJSON","buildPath","isNumericKey","isLast","arrayToObject","entries","parsePropPath","defaults","transitional","adapter","transformRequest","data","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","setContentType","helpers","isNode","toURLEncodedForm","formSerializer","_FormData","env","rawValue","parser","parse","e","stringifySafely","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","Accept","method","defaults$1","ignoreDuplicateOf","$internals","normalizeHeader","header","normalizeValue","matchHeaderValue","isHeaderNameFilter","AxiosHeaders","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","rawHeaders","parsed","line","substring","parseHeaders","get","tokens","tokensRE","parseTokens","has","matcher","delete","deleted","deleteHeader","normalize","format","normalized","w","char","formatHeader","targets","asStrings","static","first","computed","accessors","defineAccessor","accessorName","methodName","arg1","arg2","arg3","configurable","buildAccessors","accessor","mapped","headerValue","AxiosHeaders$2","transformData","fns","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","settle","resolve","reject","ERR_BAD_REQUEST","floor","progressEventReducer","listener","isDownloadStream","freq","bytesNotified","_speedometer","samplesCount","min","bytes","timestamps","firstSampleTS","head","tail","chunkLength","now","Date","startedAt","bytesCount","passed","round","speedometer","timestamp","threshold","timer","force","clearTimeout","setTimeout","throttle","loaded","total","lengthComputable","progressBytes","rate","progress","estimated","event","isURLSameOrigin","msie","userAgent","urlParsingNode","createElement","originURL","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","requestURL","cookies","write","expires","domain","secure","cookie","toGMTString","read","RegExp","decodeURIComponent","remove","buildFullPath","baseURL","requestedURL","relativeURL","combineURLs","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","paramsSerializer","timeoutMessage","withCredentials","withXSRFToken","onUploadProgress","onDownloadProgress","decompress","beforeRedirect","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding","configValue","resolveConfig","newConfig","auth","btoa","username","password","unescape","Boolean","xsrfValue","xhrAdapter","XMLHttpRequest","Promise","_config","requestData","requestHeaders","onCanceled","unsubscribe","signal","removeEventListener","onloadend","responseHeaders","getAllResponseHeaders","err","responseText","statusText","open","onreadystatechange","readyState","responseURL","onabort","ECONNABORTED","onerror","ERR_NETWORK","ontimeout","timeoutErrorMessage","ETIMEDOUT","setRequestHeader","addEventListener","upload","cancel","abort","subscribe","aborted","parseProtocol","send","composeSignals$1","signals","controller","AbortController","reason","streamChunk","chunk","chunkSize","byteLength","end","pos","trackStream","stream","onProgress","onFinish","async","iterable","readBytes","ReadableStream","close","enqueue","return","highWaterMark","fetchProgressDecorator","isFetchSupported","fetch","Request","Response","isReadableStreamSupported","encodeText","TextEncoder","arrayBuffer","supportsRequestStream","duplexAccessed","hasContentType","body","duplex","supportsResponseStream","resolvers","res","_","ERR_NOT_SUPPORT","resolveBodyLength","getContentLength","getBodyLength","knownAdapters","http","xhr","fetchOptions","finished","composedSignal","stopTimeout","composeSignals","requestContentLength","contentTypeHeader","_request","isStreamResponse","responseContentLength","responseData","renderReason","isResolvedHandle","adapters","nameOrAdapter","rejectedReasons","reasons","state","throwIfCancellationRequested","throwIfRequested","dispatchRequest","validators","deprecatedWarnings","validator","version","formatMessage","opt","desc","opts","ERR_DEPRECATED","console","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","InterceptorManager","configOrUrl","dummy","boolean","function","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","unshift","responseInterceptorChain","promise","chain","onFulfilled","onRejected","getUri","generateHTTPMethod","isForm","Axios$2","CancelToken","executor","resolvePromise","_listeners","onfulfilled","_resolve","splice","c","CancelToken$2","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","HttpStatusCode$2","axios","createInstance","defaultConfig","instance","VERSION","Cancel","all","promises","spread","callback","isAxiosError","payload","formToJSON","getAdapter","default","axios$1"],"mappings":"AAEe,SAASA,EAAKC,EAAIC,GAC/B,OAAO,WACL,OAAOD,EAAGE,MAAMD,EAASE,UAC7B,CACA,CCAA,MAAMC,SAACA,GAAYC,OAAOC,WACpBC,eAACA,GAAkBF,OAEnBG,GAAUC,EAGbJ,OAAOK,OAAO,MAHQC,IACrB,MAAMC,EAAMR,EAASS,KAAKF,GAC1B,OAAOF,EAAMG,KAASH,EAAMG,GAAOA,EAAIE,MAAM,GAAI,GAAGC,cAAc,GAFvD,IAACN,EAKhB,MAAMO,EAAcC,IAClBA,EAAOA,EAAKF,cACJJ,GAAUH,EAAOG,KAAWM,GAGhCC,EAAaD,GAAQN,UAAgBA,IAAUM,GAS/CE,QAACA,GAAWC,MASZC,EAAcH,EAAW,aAqB/B,M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AS,KAAM,CAAChB,YAAY,IAGnDwpB,EAAS1rB,OAAS,SAAgBwlB,GAChC,OAAOgG,EAAe3P,GAAY4P,EAAejG,GACrD,EAESkG,CACT,CAGcF,CAAeva,IAG7Bsa,GAAMhG,MAAQA,GAGdgG,GAAMvU,cAAgBA,GACtBuU,GAAM1E,YAAcA,GACpB0E,GAAMzU,SAAWA,GACjByU,GAAMI,QLvDiB,QKwDvBJ,GAAMnf,WAAaA,EAGnBmf,GAAMjhB,WAAaA,EAGnBihB,GAAMK,OAASL,GAAMvU,cAGrBuU,GAAMM,IAAM,SAAaC,GACvB,OAAO9N,QAAQ6N,IAAIC,EACrB,EAEAP,GAAMQ,OC9CS,SAAgBC,GAC7B,OAAO,SAAcvkB,GACnB,OAAOukB,EAASxsB,MAAM,KAAMiI,EAChC,CACA,ED6CA8jB,GAAMU,aE7DS,SAAsBC,GACnC,OAAOrhB,EAAM7J,SAASkrB,KAAsC,IAAzBA,EAAQD,YAC7C,EF8DAV,GAAM1P,YAAcA,GAEpB0P,GAAM1X,aAAeA,GAErB0X,GAAMY,WAAalsB,GAASyQ,GAAe7F,EAAMvH,WAAWrD,GAAS,IAAI6E,SAAS7E,GAASA,GAE3FsrB,GAAMa,WAAarI,GAEnBwH,GAAMjE,eAAiBA,GAEvBiE,GAAMc,QAAUd,GAGhB,MAAee,GAAAf,IGnFThG,MACJA,GAAKjb,WACLA,GAAU0M,cACVA,GAAaF,SACbA,GAAQ+P,YACRA,GAAW8E,QACXA,GAAOE,IACPA,GAAGD,OACHA,GAAMK,aACNA,GAAYF,OACZA,GAAM3f,WACNA,GAAUyH,aACVA,GAAYyT,eACZA,GAAc6E,WACdA,GAAUC,WACVA,GAAUvQ,YACVA,IACE0P"} \ No newline at end of file diff --git a/node_modules/axios/dist/node/axios.cjs b/node_modules/axios/dist/node/axios.cjs new file mode 100644 index 00000000..a2edf8c2 --- /dev/null +++ b/node_modules/axios/dist/node/axios.cjs @@ -0,0 +1,4705 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +'use strict'; + +const FormData$1 = require('form-data'); +const url = require('url'); +const proxyFromEnv = require('proxy-from-env'); +const http = require('http'); +const https = require('https'); +const util = require('util'); +const followRedirects = require('follow-redirects'); +const zlib = require('zlib'); +const stream = require('stream'); +const events = require('events'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1); +const url__default = /*#__PURE__*/_interopDefaultLegacy(url); +const http__default = /*#__PURE__*/_interopDefaultLegacy(http); +const https__default = /*#__PURE__*/_interopDefaultLegacy(https); +const util__default = /*#__PURE__*/_interopDefaultLegacy(util); +const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects); +const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib); +const stream__default = /*#__PURE__*/_interopDefaultLegacy(stream); + +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +const utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils$1.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData__default["default"] || FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils$1.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils$1.isArray(value) && isFlatArray(value)) || + ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils$1.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils$1.forEach(value, function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +const InterceptorManager$1 = InterceptorManager; + +const transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +const URLSearchParams = url__default["default"].URLSearchParams; + +const platform$1 = { + isNode: true, + classes: { + URLSearchParams, + FormData: FormData__default["default"], + Blob: typeof Blob !== 'undefined' && Blob || null + }, + protocols: [ 'http', 'https', 'file', 'data' ] +}; + +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +const utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin +}); + +const platform = { + ...utils, + ...platform$1 +}; + +function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils$1.isObject(data); + + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils$1.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils$1.isArrayBuffer(data) || + utils$1.isBuffer(data) || + utils$1.isStream(data) || + utils$1.isFile(data) || + utils$1.isBlob(data) || + utils$1.isReadableStream(data) + ) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + + if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +const defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils$1.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +const parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils$1.isString(value)) return; + + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils$1.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils$1.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils$1.freezeMethods(AxiosHeaders); + +const AxiosHeaders$1 = AxiosHeaders; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$1.from(context.headers); + let data = context.data; + + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const VERSION = "1.7.2"; + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/; + +/** + * Parse data uri to a Buffer or Blob + * + * @param {String} uri + * @param {?Boolean} asBlob + * @param {?Object} options + * @param {?Function} options.Blob + * + * @returns {Buffer|Blob} + */ +function fromDataURI(uri, asBlob, options) { + const _Blob = options && options.Blob || platform.classes.Blob; + const protocol = parseProtocol(uri); + + if (asBlob === undefined && _Blob) { + asBlob = true; + } + + if (protocol === 'data') { + uri = protocol.length ? uri.slice(protocol.length + 1) : uri; + + const match = DATA_URL_PATTERN.exec(uri); + + if (!match) { + throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL); + } + + const mime = match[1]; + const isBase64 = match[2]; + const body = match[3]; + const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8'); + + if (asBlob) { + if (!_Blob) { + throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT); + } + + return new _Blob([buffer], {type: mime}); + } + + return buffer; + } + + throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT); +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +const kInternals = Symbol('internals'); + +class AxiosTransformStream extends stream__default["default"].Transform{ + constructor(options) { + options = utils$1.toFlatObject(options, { + maxRate: 0, + chunkSize: 64 * 1024, + minChunkSize: 100, + timeWindow: 500, + ticksRate: 2, + samplesCount: 15 + }, null, (prop, source) => { + return !utils$1.isUndefined(source[prop]); + }); + + super({ + readableHighWaterMark: options.chunkSize + }); + + const self = this; + + const internals = this[kInternals] = { + length: options.length, + timeWindow: options.timeWindow, + ticksRate: options.ticksRate, + chunkSize: options.chunkSize, + maxRate: options.maxRate, + minChunkSize: options.minChunkSize, + bytesSeen: 0, + isCaptured: false, + notifiedBytesLoaded: 0, + ts: Date.now(), + bytes: 0, + onReadCallback: null + }; + + const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow); + + this.on('newListener', event => { + if (event === 'progress') { + if (!internals.isCaptured) { + internals.isCaptured = true; + } + } + }); + + let bytesNotified = 0; + + internals.updateProgress = throttle(function throttledHandler() { + const totalBytes = internals.length; + const bytesTransferred = internals.bytesSeen; + const progressBytes = bytesTransferred - bytesNotified; + if (!progressBytes || self.destroyed) return; + + const rate = _speedometer(progressBytes); + + bytesNotified = bytesTransferred; + + process.nextTick(() => { + self.emit('progress', { + loaded: bytesTransferred, + total: totalBytes, + progress: totalBytes ? (bytesTransferred / totalBytes) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && totalBytes && bytesTransferred <= totalBytes ? + (totalBytes - bytesTransferred) / rate : undefined, + lengthComputable: totalBytes != null + }); + }); + }, internals.ticksRate); + + const onFinish = () => { + internals.updateProgress.call(true); + }; + + this.once('end', onFinish); + this.once('error', onFinish); + } + + _read(size) { + const internals = this[kInternals]; + + if (internals.onReadCallback) { + internals.onReadCallback(); + } + + return super._read(size); + } + + _transform(chunk, encoding, callback) { + const self = this; + const internals = this[kInternals]; + const maxRate = internals.maxRate; + + const readableHighWaterMark = this.readableHighWaterMark; + + const timeWindow = internals.timeWindow; + + const divider = 1000 / timeWindow; + const bytesThreshold = (maxRate / divider); + const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0; + + function pushChunk(_chunk, _callback) { + const bytes = Buffer.byteLength(_chunk); + internals.bytesSeen += bytes; + internals.bytes += bytes; + + if (internals.isCaptured) { + internals.updateProgress(); + } + + if (self.push(_chunk)) { + process.nextTick(_callback); + } else { + internals.onReadCallback = () => { + internals.onReadCallback = null; + process.nextTick(_callback); + }; + } + } + + const transformChunk = (_chunk, _callback) => { + const chunkSize = Buffer.byteLength(_chunk); + let chunkRemainder = null; + let maxChunkSize = readableHighWaterMark; + let bytesLeft; + let passed = 0; + + if (maxRate) { + const now = Date.now(); + + if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) { + internals.ts = now; + bytesLeft = bytesThreshold - internals.bytes; + internals.bytes = bytesLeft < 0 ? -bytesLeft : 0; + passed = 0; + } + + bytesLeft = bytesThreshold - internals.bytes; + } + + if (maxRate) { + if (bytesLeft <= 0) { + // next time window + return setTimeout(() => { + _callback(null, _chunk); + }, timeWindow - passed); + } + + if (bytesLeft < maxChunkSize) { + maxChunkSize = bytesLeft; + } + } + + if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) { + chunkRemainder = _chunk.subarray(maxChunkSize); + _chunk = _chunk.subarray(0, maxChunkSize); + } + + pushChunk(_chunk, chunkRemainder ? () => { + process.nextTick(_callback, null, chunkRemainder); + } : _callback); + }; + + transformChunk(chunk, function transformNextChunk(err, _chunk) { + if (err) { + return callback(err); + } + + if (_chunk) { + transformChunk(_chunk, transformNextChunk); + } else { + callback(null); + } + }); + } + + setLength(length) { + this[kInternals].length = +length; + return this; + } +} + +const AxiosTransformStream$1 = AxiosTransformStream; + +const {asyncIterator} = Symbol; + +const readBlob = async function* (blob) { + if (blob.stream) { + yield* blob.stream(); + } else if (blob.arrayBuffer) { + yield await blob.arrayBuffer(); + } else if (blob[asyncIterator]) { + yield* blob[asyncIterator](); + } else { + yield blob; + } +}; + +const readBlob$1 = readBlob; + +const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_'; + +const textEncoder = new util.TextEncoder(); + +const CRLF = '\r\n'; +const CRLF_BYTES = textEncoder.encode(CRLF); +const CRLF_BYTES_COUNT = 2; + +class FormDataPart { + constructor(name, value) { + const {escapeName} = this.constructor; + const isStringValue = utils$1.isString(value); + + let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${ + !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : '' + }${CRLF}`; + + if (isStringValue) { + value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF)); + } else { + headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`; + } + + this.headers = textEncoder.encode(headers + CRLF); + + this.contentLength = isStringValue ? value.byteLength : value.size; + + this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT; + + this.name = name; + this.value = value; + } + + async *encode(){ + yield this.headers; + + const {value} = this; + + if(utils$1.isTypedArray(value)) { + yield value; + } else { + yield* readBlob$1(value); + } + + yield CRLF_BYTES; + } + + static escapeName(name) { + return String(name).replace(/[\r\n"]/g, (match) => ({ + '\r' : '%0D', + '\n' : '%0A', + '"' : '%22', + }[match])); + } +} + +const formDataToStream = (form, headersHandler, options) => { + const { + tag = 'form-data-boundary', + size = 25, + boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET) + } = options || {}; + + if(!utils$1.isFormData(form)) { + throw TypeError('FormData instance required'); + } + + if (boundary.length < 1 || boundary.length > 70) { + throw Error('boundary must be 10-70 characters long') + } + + const boundaryBytes = textEncoder.encode('--' + boundary + CRLF); + const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF); + let contentLength = footerBytes.byteLength; + + const parts = Array.from(form.entries()).map(([name, value]) => { + const part = new FormDataPart(name, value); + contentLength += part.size; + return part; + }); + + contentLength += boundaryBytes.byteLength * parts.length; + + contentLength = utils$1.toFiniteNumber(contentLength); + + const computedHeaders = { + 'Content-Type': `multipart/form-data; boundary=${boundary}` + }; + + if (Number.isFinite(contentLength)) { + computedHeaders['Content-Length'] = contentLength; + } + + headersHandler && headersHandler(computedHeaders); + + return stream.Readable.from((async function *() { + for(const part of parts) { + yield boundaryBytes; + yield* part.encode(); + } + + yield footerBytes; + })()); +}; + +const formDataToStream$1 = formDataToStream; + +class ZlibHeaderTransformStream extends stream__default["default"].Transform { + __transform(chunk, encoding, callback) { + this.push(chunk); + callback(); + } + + _transform(chunk, encoding, callback) { + if (chunk.length !== 0) { + this._transform = this.__transform; + + // Add Default Compression headers if no zlib headers are present + if (chunk[0] !== 120) { // Hex: 78 + const header = Buffer.alloc(2); + header[0] = 120; // Hex: 78 + header[1] = 156; // Hex: 9C + this.push(header, encoding); + } + } + + this.__transform(chunk, encoding, callback); + } +} + +const ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream; + +const callbackify = (fn, reducer) => { + return utils$1.isAsyncFn(fn) ? function (...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; +}; + +const callbackify$1 = callbackify; + +const zlibOptions = { + flush: zlib__default["default"].constants.Z_SYNC_FLUSH, + finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH +}; + +const brotliOptions = { + flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH, + finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH +}; + +const isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress); + +const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"]; + +const isHttps = /https:?/; + +const supportedProtocols = platform.protocols.map(protocol => { + return protocol + ':'; +}); + +/** + * If the proxy or config beforeRedirects functions are defined, call them with the options + * object. + * + * @param {Object} options - The options object that was passed to the request. + * + * @returns {Object} + */ +function dispatchBeforeRedirect(options, responseDetails) { + if (options.beforeRedirects.proxy) { + options.beforeRedirects.proxy(options); + } + if (options.beforeRedirects.config) { + options.beforeRedirects.config(options, responseDetails); + } +} + +/** + * If the proxy or config afterRedirects functions are defined, call them with the options + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} configProxy configuration from Axios options object + * @param {string} location + * + * @returns {http.ClientRequestArgs} + */ +function setProxy(options, configProxy, location) { + let proxy = configProxy; + if (!proxy && proxy !== false) { + const proxyUrl = proxyFromEnv.getProxyForUrl(location); + if (proxyUrl) { + proxy = new URL(proxyUrl); + } + } + if (proxy) { + // Basic proxy authorization + if (proxy.username) { + proxy.auth = (proxy.username || '') + ':' + (proxy.password || ''); + } + + if (proxy.auth) { + // Support proxy auth object form + if (proxy.auth.username || proxy.auth.password) { + proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || ''); + } + const base64 = Buffer + .from(proxy.auth, 'utf8') + .toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } + + options.headers.host = options.hostname + (options.port ? ':' + options.port : ''); + const proxyHost = proxy.hostname || proxy.host; + options.hostname = proxyHost; + // Replace 'host' since options is not a URL object + options.host = proxyHost; + options.port = proxy.port; + options.path = location; + if (proxy.protocol) { + options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`; + } + } + + options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) { + // Configure proxy for redirected request, passing the original config proxy to apply + // the exact same logic as if the redirected request was performed by axios directly. + setProxy(redirectOptions, configProxy, redirectOptions.href); + }; +} + +const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process'; + +// temporary hotfix + +const wrapAsync = (asyncExecutor) => { + return new Promise((resolve, reject) => { + let onDone; + let isDone; + + const done = (value, isRejected) => { + if (isDone) return; + isDone = true; + onDone && onDone(value, isRejected); + }; + + const _resolve = (value) => { + done(value); + resolve(value); + }; + + const _reject = (reason) => { + done(reason, true); + reject(reason); + }; + + asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject); + }) +}; + +const resolveFamily = ({address, family}) => { + if (!utils$1.isString(address)) { + throw TypeError('address must be a string'); + } + return ({ + address, + family: family || (address.indexOf('.') < 0 ? 6 : 4) + }); +}; + +const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family}); + +/*eslint consistent-return:0*/ +const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { + return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { + let {data, lookup, family} = config; + const {responseType, responseEncoding} = config; + const method = config.method.toUpperCase(); + let isDone; + let rejected = false; + let req; + + if (lookup) { + const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]); + // hotfix to support opt.all option which is required for node 20.x + lookup = (hostname, opt, cb) => { + _lookup(hostname, opt, (err, arg0, arg1) => { + if (err) { + return cb(err); + } + + const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)]; + + opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family); + }); + }; + } + + // temporary internal emitter until the AxiosRequest class will be implemented + const emitter = new events.EventEmitter(); + + const onFinished = () => { + if (config.cancelToken) { + config.cancelToken.unsubscribe(abort); + } + + if (config.signal) { + config.signal.removeEventListener('abort', abort); + } + + emitter.removeAllListeners(); + }; + + onDone((value, isRejected) => { + isDone = true; + if (isRejected) { + rejected = true; + onFinished(); + } + }); + + function abort(reason) { + emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason); + } + + emitter.once('abort', reject); + + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); + } + } + + // Parse url + const fullPath = buildFullPath(config.baseURL, config.url); + const parsed = new URL(fullPath, 'http://localhost'); + const protocol = parsed.protocol || supportedProtocols[0]; + + if (protocol === 'data:') { + let convertedData; + + if (method !== 'GET') { + return settle(resolve, reject, { + status: 405, + statusText: 'method not allowed', + headers: {}, + config + }); + } + + try { + convertedData = fromDataURI(config.url, responseType === 'blob', { + Blob: config.env && config.env.Blob + }); + } catch (err) { + throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config); + } + + if (responseType === 'text') { + convertedData = convertedData.toString(responseEncoding); + + if (!responseEncoding || responseEncoding === 'utf8') { + convertedData = utils$1.stripBOM(convertedData); + } + } else if (responseType === 'stream') { + convertedData = stream__default["default"].Readable.from(convertedData); + } + + return settle(resolve, reject, { + data: convertedData, + status: 200, + statusText: 'OK', + headers: new AxiosHeaders$1(), + config + }); + } + + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + 'Unsupported protocol ' + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + const headers = AxiosHeaders$1.from(config.headers).normalize(); + + // Set User-Agent (required by some servers) + // See https://github.com/axios/axios/issues/69 + // User-Agent is specified; handle case where no UA header is desired + // Only set header if it hasn't been set in config + headers.set('User-Agent', 'axios/' + VERSION, false); + + const onDownloadProgress = config.onDownloadProgress; + const onUploadProgress = config.onUploadProgress; + const maxRate = config.maxRate; + let maxUploadRate = undefined; + let maxDownloadRate = undefined; + + // support for spec compliant FormData objects + if (utils$1.isSpecCompliantForm(data)) { + const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i); + + data = formDataToStream$1(data, (formHeaders) => { + headers.set(formHeaders); + }, { + tag: `axios-${VERSION}-boundary`, + boundary: userBoundary && userBoundary[1] || undefined + }); + // support for https://www.npmjs.com/package/form-data api + } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) { + headers.set(data.getHeaders()); + + if (!headers.hasContentLength()) { + try { + const knownLength = await util__default["default"].promisify(data.getLength).call(data); + Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength); + /*eslint no-empty:0*/ + } catch (e) { + } + } + } else if (utils$1.isBlob(data)) { + data.size && headers.setContentType(data.type || 'application/octet-stream'); + headers.setContentLength(data.size || 0); + data = stream__default["default"].Readable.from(readBlob$1(data)); + } else if (data && !utils$1.isStream(data)) { + if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils$1.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(new AxiosError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + // Add Content-Length header if data exists + headers.setContentLength(data.length, false); + + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + 'Request body larger than maxBodyLength limit', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + } + + const contentLength = utils$1.toFiniteNumber(headers.getContentLength()); + + if (utils$1.isArray(maxRate)) { + maxUploadRate = maxRate[0]; + maxDownloadRate = maxRate[1]; + } else { + maxUploadRate = maxDownloadRate = maxRate; + } + + if (data && (onUploadProgress || maxUploadRate)) { + if (!utils$1.isStream(data)) { + data = stream__default["default"].Readable.from(data, {objectMode: false}); + } + + data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({ + length: contentLength, + maxRate: utils$1.toFiniteNumber(maxUploadRate) + })], utils$1.noop); + + onUploadProgress && data.on('progress', progress => { + onUploadProgress(Object.assign(progress, { + upload: true + })); + }); + } + + // HTTP basic authentication + let auth = undefined; + if (config.auth) { + const username = config.auth.username || ''; + const password = config.auth.password || ''; + auth = username + ':' + password; + } + + if (!auth && parsed.username) { + const urlUsername = parsed.username; + const urlPassword = parsed.password; + auth = urlUsername + ':' + urlPassword; + } + + auth && headers.delete('authorization'); + + let path; + + try { + path = buildURL( + parsed.pathname + parsed.search, + config.params, + config.paramsSerializer + ).replace(/^\?/, ''); + } catch (err) { + const customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + return reject(customErr); + } + + headers.set( + 'Accept-Encoding', + 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false + ); + + const options = { + path, + method: method, + headers: headers.toJSON(), + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth, + protocol, + family, + beforeRedirect: dispatchBeforeRedirect, + beforeRedirects: {} + }; + + // cacheable-lookup integration hotfix + !utils$1.isUndefined(lookup) && (options.lookup = lookup); + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } + + let transport; + const isHttpsRequest = isHttps.test(options.protocol); + options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? https__default["default"] : http__default["default"]; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; + } + + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } else { + // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited + options.maxBodyLength = Infinity; + } + + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + + // Create the request + req = transport.request(options, function handleResponse(res) { + if (req.destroyed) return; + + const streams = [res]; + + const responseLength = +res.headers['content-length']; + + if (onDownloadProgress) { + const transformStream = new AxiosTransformStream$1({ + length: utils$1.toFiniteNumber(responseLength), + maxRate: utils$1.toFiniteNumber(maxDownloadRate) + }); + + onDownloadProgress && transformStream.on('progress', progress => { + onDownloadProgress(Object.assign(progress, { + download: true + })); + }); + + streams.push(transformStream); + } + + // decompress the response body transparently if required + let responseStream = res; + + // return the last request in case of redirects + const lastRequest = res.req || req; + + // if decompress disabled we should not decompress + if (config.decompress !== false && res.headers['content-encoding']) { + // if no content, but headers still say that it is encoded, + // remove the header not confuse downstream operations + if (method === 'HEAD' || res.statusCode === 204) { + delete res.headers['content-encoding']; + } + + switch ((res.headers['content-encoding'] || '').toLowerCase()) { + /*eslint default-case:0*/ + case 'gzip': + case 'x-gzip': + case 'compress': + case 'x-compress': + // add the unzipper to the body stream processing pipeline + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'deflate': + streams.push(new ZlibHeaderTransformStream$1()); + + // add the unzipper to the body stream processing pipeline + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'br': + if (isBrotliSupported) { + streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions)); + delete res.headers['content-encoding']; + } + } + } + + responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0]; + + const offListeners = stream__default["default"].finished(responseStream, () => { + offListeners(); + onFinished(); + }); + + const response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: new AxiosHeaders$1(res.headers), + config, + request: lastRequest + }; + + if (responseType === 'stream') { + response.data = responseStream; + settle(resolve, reject, response); + } else { + const responseBuffer = []; + let totalResponseBytes = 0; + + responseStream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; + + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + // stream.destroy() emit aborted event before calling reject() on Node.js v16 + rejected = true; + responseStream.destroy(); + reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); + } + }); + + responseStream.on('aborted', function handlerStreamAborted() { + if (rejected) { + return; + } + + const err = new AxiosError( + 'maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + ); + responseStream.destroy(err); + reject(err); + }); + + responseStream.on('error', function handleStreamError(err) { + if (req.destroyed) return; + reject(AxiosError.from(err, null, config, lastRequest)); + }); + + responseStream.on('end', function handleStreamEnd() { + try { + let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (responseType !== 'arraybuffer') { + responseData = responseData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === 'utf8') { + responseData = utils$1.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + return reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }); + } + + emitter.once('abort', err => { + if (!responseStream.destroyed) { + responseStream.emit('error', err); + responseStream.destroy(); + } + }); + }); + + emitter.once('abort', err => { + reject(err); + req.destroy(err); + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + // @todo remove + // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; + reject(AxiosError.from(err, null, config, req)); + }); + + // set tcp keep alive to prevent drop connection by peer + req.on('socket', function handleRequestSocket(socket) { + // default interval of sending ack packet is 1 minute + socket.setKeepAlive(true, 1000 * 60); + }); + + // Handle request timeout + if (config.timeout) { + // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. + const timeout = parseInt(config.timeout, 10); + + if (Number.isNaN(timeout)) { + reject(new AxiosError( + 'error trying to parse `config.timeout` to int', + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); + + return; + } + + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devouring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(timeout, function handleRequestTimeout() { + if (isDone) return; + let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + abort(); + }); + } + + + // Send the request + if (utils$1.isStream(data)) { + let ended = false; + let errored = false; + + data.on('end', () => { + ended = true; + }); + + data.once('error', err => { + errored = true; + req.destroy(err); + }); + + data.on('close', () => { + if (!ended && !errored) { + abort(new CanceledError('Request stream has been aborted', config, req)); + } + }); + + data.pipe(req); + } else { + req.end(data); + } + }); +}; + +const progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +}; + +const isURLSameOrigin = platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +const cookies = platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils$1.isString(path) && cookie.push('path=' + path); + + utils$1.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + +const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({caseless}, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +const resolveConfig = (config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders$1.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +const xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$1.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }; + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); + }, timeout); + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +}; + +const composeSignals$1 = composeSignals; + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +}; + +const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +}; + +const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +}; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +}; + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils$1.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }); + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils$1.isBlob(body)) { + return body.size; + } + + if(utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils$1.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } +}; + +const resolveBodyLength = async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +}; + +const fetchAdapter = isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals$1([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + }; + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError.from(err, err && err.code, config, request); + } +}); + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +}; + +utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; + +const adapters = { + getAdapter: (adapters) => { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$1.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +const validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + + headers && utils$1.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +const Axios$1 = Axios; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +const CancelToken$1 = CancelToken; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError(payload) { + return utils$1.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +const HttpStatusCode$1 = HttpStatusCode; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$1(defaultConfig); + const instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils$1.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$1; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken$1; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders$1; + +axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode$1; + +axios.default = axios; + +module.exports = axios; +//# sourceMappingURL=axios.cjs.map diff --git a/node_modules/axios/dist/node/axios.cjs.map b/node_modules/axios/dist/node/axios.cjs.map new file mode 100644 index 00000000..825edd67 --- /dev/null +++ b/node_modules/axios/dist/node/axios.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.cjs","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/node/classes/URLSearchParams.js","../../lib/platform/node/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/env/data.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/fromDataURI.js","../../lib/helpers/throttle.js","../../lib/helpers/speedometer.js","../../lib/helpers/AxiosTransformStream.js","../../lib/helpers/readBlob.js","../../lib/helpers/formDataToStream.js","../../lib/helpers/ZlibHeaderTransformStream.js","../../lib/helpers/callbackify.js","../../lib/adapters/http.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport url from 'url';\nexport default url.URLSearchParams;\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\n\nexport default {\n isNode: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob: typeof Blob !== 'undefined' && Blob || null\n },\n protocols: [ 'http', 'https', 'file', 'data' ]\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport parseProtocol from './parseProtocol.js';\nimport platform from '../platform/index.js';\n\nconst DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\\s\\S]*)$/;\n\n/**\n * Parse data uri to a Buffer or Blob\n *\n * @param {String} uri\n * @param {?Boolean} asBlob\n * @param {?Object} options\n * @param {?Function} options.Blob\n *\n * @returns {Buffer|Blob}\n */\nexport default function fromDataURI(uri, asBlob, options) {\n const _Blob = options && options.Blob || platform.classes.Blob;\n const protocol = parseProtocol(uri);\n\n if (asBlob === undefined && _Blob) {\n asBlob = true;\n }\n\n if (protocol === 'data') {\n uri = protocol.length ? uri.slice(protocol.length + 1) : uri;\n\n const match = DATA_URL_PATTERN.exec(uri);\n\n if (!match) {\n throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);\n }\n\n const mime = match[1];\n const isBase64 = match[2];\n const body = match[3];\n const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');\n\n if (asBlob) {\n if (!_Blob) {\n throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);\n }\n\n return new _Blob([buffer], {type: mime});\n }\n\n return buffer;\n }\n\n throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);\n}\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\nimport stream from 'stream';\nimport utils from '../utils.js';\nimport throttle from './throttle.js';\nimport speedometer from './speedometer.js';\n\nconst kInternals = Symbol('internals');\n\nclass AxiosTransformStream extends stream.Transform{\n constructor(options) {\n options = utils.toFlatObject(options, {\n maxRate: 0,\n chunkSize: 64 * 1024,\n minChunkSize: 100,\n timeWindow: 500,\n ticksRate: 2,\n samplesCount: 15\n }, null, (prop, source) => {\n return !utils.isUndefined(source[prop]);\n });\n\n super({\n readableHighWaterMark: options.chunkSize\n });\n\n const self = this;\n\n const internals = this[kInternals] = {\n length: options.length,\n timeWindow: options.timeWindow,\n ticksRate: options.ticksRate,\n chunkSize: options.chunkSize,\n maxRate: options.maxRate,\n minChunkSize: options.minChunkSize,\n bytesSeen: 0,\n isCaptured: false,\n notifiedBytesLoaded: 0,\n ts: Date.now(),\n bytes: 0,\n onReadCallback: null\n };\n\n const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);\n\n this.on('newListener', event => {\n if (event === 'progress') {\n if (!internals.isCaptured) {\n internals.isCaptured = true;\n }\n }\n });\n\n let bytesNotified = 0;\n\n internals.updateProgress = throttle(function throttledHandler() {\n const totalBytes = internals.length;\n const bytesTransferred = internals.bytesSeen;\n const progressBytes = bytesTransferred - bytesNotified;\n if (!progressBytes || self.destroyed) return;\n\n const rate = _speedometer(progressBytes);\n\n bytesNotified = bytesTransferred;\n\n process.nextTick(() => {\n self.emit('progress', {\n loaded: bytesTransferred,\n total: totalBytes,\n progress: totalBytes ? (bytesTransferred / totalBytes) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && totalBytes && bytesTransferred <= totalBytes ?\n (totalBytes - bytesTransferred) / rate : undefined,\n lengthComputable: totalBytes != null\n });\n });\n }, internals.ticksRate);\n\n const onFinish = () => {\n internals.updateProgress.call(true);\n };\n\n this.once('end', onFinish);\n this.once('error', onFinish);\n }\n\n _read(size) {\n const internals = this[kInternals];\n\n if (internals.onReadCallback) {\n internals.onReadCallback();\n }\n\n return super._read(size);\n }\n\n _transform(chunk, encoding, callback) {\n const self = this;\n const internals = this[kInternals];\n const maxRate = internals.maxRate;\n\n const readableHighWaterMark = this.readableHighWaterMark;\n\n const timeWindow = internals.timeWindow;\n\n const divider = 1000 / timeWindow;\n const bytesThreshold = (maxRate / divider);\n const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;\n\n function pushChunk(_chunk, _callback) {\n const bytes = Buffer.byteLength(_chunk);\n internals.bytesSeen += bytes;\n internals.bytes += bytes;\n\n if (internals.isCaptured) {\n internals.updateProgress();\n }\n\n if (self.push(_chunk)) {\n process.nextTick(_callback);\n } else {\n internals.onReadCallback = () => {\n internals.onReadCallback = null;\n process.nextTick(_callback);\n };\n }\n }\n\n const transformChunk = (_chunk, _callback) => {\n const chunkSize = Buffer.byteLength(_chunk);\n let chunkRemainder = null;\n let maxChunkSize = readableHighWaterMark;\n let bytesLeft;\n let passed = 0;\n\n if (maxRate) {\n const now = Date.now();\n\n if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {\n internals.ts = now;\n bytesLeft = bytesThreshold - internals.bytes;\n internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;\n passed = 0;\n }\n\n bytesLeft = bytesThreshold - internals.bytes;\n }\n\n if (maxRate) {\n if (bytesLeft <= 0) {\n // next time window\n return setTimeout(() => {\n _callback(null, _chunk);\n }, timeWindow - passed);\n }\n\n if (bytesLeft < maxChunkSize) {\n maxChunkSize = bytesLeft;\n }\n }\n\n if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {\n chunkRemainder = _chunk.subarray(maxChunkSize);\n _chunk = _chunk.subarray(0, maxChunkSize);\n }\n\n pushChunk(_chunk, chunkRemainder ? () => {\n process.nextTick(_callback, null, chunkRemainder);\n } : _callback);\n };\n\n transformChunk(chunk, function transformNextChunk(err, _chunk) {\n if (err) {\n return callback(err);\n }\n\n if (_chunk) {\n transformChunk(_chunk, transformNextChunk);\n } else {\n callback(null);\n }\n });\n }\n\n setLength(length) {\n this[kInternals].length = +length;\n return this;\n }\n}\n\nexport default AxiosTransformStream;\n","const {asyncIterator} = Symbol;\n\nconst readBlob = async function* (blob) {\n if (blob.stream) {\n yield* blob.stream()\n } else if (blob.arrayBuffer) {\n yield await blob.arrayBuffer()\n } else if (blob[asyncIterator]) {\n yield* blob[asyncIterator]();\n } else {\n yield blob;\n }\n}\n\nexport default readBlob;\n","import {TextEncoder} from 'util';\nimport {Readable} from 'stream';\nimport utils from \"../utils.js\";\nimport readBlob from \"./readBlob.js\";\n\nconst BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';\n\nconst textEncoder = new TextEncoder();\n\nconst CRLF = '\\r\\n';\nconst CRLF_BYTES = textEncoder.encode(CRLF);\nconst CRLF_BYTES_COUNT = 2;\n\nclass FormDataPart {\n constructor(name, value) {\n const {escapeName} = this.constructor;\n const isStringValue = utils.isString(value);\n\n let headers = `Content-Disposition: form-data; name=\"${escapeName(name)}\"${\n !isStringValue && value.name ? `; filename=\"${escapeName(value.name)}\"` : ''\n }${CRLF}`;\n\n if (isStringValue) {\n value = textEncoder.encode(String(value).replace(/\\r?\\n|\\r\\n?/g, CRLF));\n } else {\n headers += `Content-Type: ${value.type || \"application/octet-stream\"}${CRLF}`\n }\n\n this.headers = textEncoder.encode(headers + CRLF);\n\n this.contentLength = isStringValue ? value.byteLength : value.size;\n\n this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;\n\n this.name = name;\n this.value = value;\n }\n\n async *encode(){\n yield this.headers;\n\n const {value} = this;\n\n if(utils.isTypedArray(value)) {\n yield value;\n } else {\n yield* readBlob(value);\n }\n\n yield CRLF_BYTES;\n }\n\n static escapeName(name) {\n return String(name).replace(/[\\r\\n\"]/g, (match) => ({\n '\\r' : '%0D',\n '\\n' : '%0A',\n '\"' : '%22',\n }[match]));\n }\n}\n\nconst formDataToStream = (form, headersHandler, options) => {\n const {\n tag = 'form-data-boundary',\n size = 25,\n boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)\n } = options || {};\n\n if(!utils.isFormData(form)) {\n throw TypeError('FormData instance required');\n }\n\n if (boundary.length < 1 || boundary.length > 70) {\n throw Error('boundary must be 10-70 characters long')\n }\n\n const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);\n const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);\n let contentLength = footerBytes.byteLength;\n\n const parts = Array.from(form.entries()).map(([name, value]) => {\n const part = new FormDataPart(name, value);\n contentLength += part.size;\n return part;\n });\n\n contentLength += boundaryBytes.byteLength * parts.length;\n\n contentLength = utils.toFiniteNumber(contentLength);\n\n const computedHeaders = {\n 'Content-Type': `multipart/form-data; boundary=${boundary}`\n }\n\n if (Number.isFinite(contentLength)) {\n computedHeaders['Content-Length'] = contentLength;\n }\n\n headersHandler && headersHandler(computedHeaders);\n\n return Readable.from((async function *() {\n for(const part of parts) {\n yield boundaryBytes;\n yield* part.encode();\n }\n\n yield footerBytes;\n })());\n};\n\nexport default formDataToStream;\n","\"use strict\";\n\nimport stream from \"stream\";\n\nclass ZlibHeaderTransformStream extends stream.Transform {\n __transform(chunk, encoding, callback) {\n this.push(chunk);\n callback();\n }\n\n _transform(chunk, encoding, callback) {\n if (chunk.length !== 0) {\n this._transform = this.__transform;\n\n // Add Default Compression headers if no zlib headers are present\n if (chunk[0] !== 120) { // Hex: 78\n const header = Buffer.alloc(2);\n header[0] = 120; // Hex: 78\n header[1] = 156; // Hex: 9C \n this.push(header, encoding);\n }\n }\n\n this.__transform(chunk, encoding, callback);\n }\n}\n\nexport default ZlibHeaderTransformStream;\n","import utils from \"../utils.js\";\n\nconst callbackify = (fn, reducer) => {\n return utils.isAsyncFn(fn) ? function (...args) {\n const cb = args.pop();\n fn.apply(this, args).then((value) => {\n try {\n reducer ? cb(null, ...reducer(value)) : cb(null, value);\n } catch (err) {\n cb(err);\n }\n }, cb);\n } : fn;\n}\n\nexport default callbackify;\n","'use strict';\n\nimport utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport buildFullPath from '../core/buildFullPath.js';\nimport buildURL from './../helpers/buildURL.js';\nimport {getProxyForUrl} from 'proxy-from-env';\nimport http from 'http';\nimport https from 'https';\nimport util from 'util';\nimport followRedirects from 'follow-redirects';\nimport zlib from 'zlib';\nimport {VERSION} from '../env/data.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport platform from '../platform/index.js';\nimport fromDataURI from '../helpers/fromDataURI.js';\nimport stream from 'stream';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport AxiosTransformStream from '../helpers/AxiosTransformStream.js';\nimport {EventEmitter} from 'events';\nimport formDataToStream from \"../helpers/formDataToStream.js\";\nimport readBlob from \"../helpers/readBlob.js\";\nimport ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';\nimport callbackify from \"../helpers/callbackify.js\";\n\nconst zlibOptions = {\n flush: zlib.constants.Z_SYNC_FLUSH,\n finishFlush: zlib.constants.Z_SYNC_FLUSH\n};\n\nconst brotliOptions = {\n flush: zlib.constants.BROTLI_OPERATION_FLUSH,\n finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH\n}\n\nconst isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);\n\nconst {http: httpFollow, https: httpsFollow} = followRedirects;\n\nconst isHttps = /https:?/;\n\nconst supportedProtocols = platform.protocols.map(protocol => {\n return protocol + ':';\n});\n\n/**\n * If the proxy or config beforeRedirects functions are defined, call them with the options\n * object.\n *\n * @param {Object} options - The options object that was passed to the request.\n *\n * @returns {Object}\n */\nfunction dispatchBeforeRedirect(options, responseDetails) {\n if (options.beforeRedirects.proxy) {\n options.beforeRedirects.proxy(options);\n }\n if (options.beforeRedirects.config) {\n options.beforeRedirects.config(options, responseDetails);\n }\n}\n\n/**\n * If the proxy or config afterRedirects functions are defined, call them with the options\n *\n * @param {http.ClientRequestArgs} options\n * @param {AxiosProxyConfig} configProxy configuration from Axios options object\n * @param {string} location\n *\n * @returns {http.ClientRequestArgs}\n */\nfunction setProxy(options, configProxy, location) {\n let proxy = configProxy;\n if (!proxy && proxy !== false) {\n const proxyUrl = getProxyForUrl(location);\n if (proxyUrl) {\n proxy = new URL(proxyUrl);\n }\n }\n if (proxy) {\n // Basic proxy authorization\n if (proxy.username) {\n proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');\n }\n\n if (proxy.auth) {\n // Support proxy auth object form\n if (proxy.auth.username || proxy.auth.password) {\n proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');\n }\n const base64 = Buffer\n .from(proxy.auth, 'utf8')\n .toString('base64');\n options.headers['Proxy-Authorization'] = 'Basic ' + base64;\n }\n\n options.headers.host = options.hostname + (options.port ? ':' + options.port : '');\n const proxyHost = proxy.hostname || proxy.host;\n options.hostname = proxyHost;\n // Replace 'host' since options is not a URL object\n options.host = proxyHost;\n options.port = proxy.port;\n options.path = location;\n if (proxy.protocol) {\n options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;\n }\n }\n\n options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {\n // Configure proxy for redirected request, passing the original config proxy to apply\n // the exact same logic as if the redirected request was performed by axios directly.\n setProxy(redirectOptions, configProxy, redirectOptions.href);\n };\n}\n\nconst isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';\n\n// temporary hotfix\n\nconst wrapAsync = (asyncExecutor) => {\n return new Promise((resolve, reject) => {\n let onDone;\n let isDone;\n\n const done = (value, isRejected) => {\n if (isDone) return;\n isDone = true;\n onDone && onDone(value, isRejected);\n }\n\n const _resolve = (value) => {\n done(value);\n resolve(value);\n };\n\n const _reject = (reason) => {\n done(reason, true);\n reject(reason);\n }\n\n asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);\n })\n};\n\nconst resolveFamily = ({address, family}) => {\n if (!utils.isString(address)) {\n throw TypeError('address must be a string');\n }\n return ({\n address,\n family: family || (address.indexOf('.') < 0 ? 6 : 4)\n });\n}\n\nconst buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});\n\n/*eslint consistent-return:0*/\nexport default isHttpAdapterSupported && function httpAdapter(config) {\n return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {\n let {data, lookup, family} = config;\n const {responseType, responseEncoding} = config;\n const method = config.method.toUpperCase();\n let isDone;\n let rejected = false;\n let req;\n\n if (lookup) {\n const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);\n // hotfix to support opt.all option which is required for node 20.x\n lookup = (hostname, opt, cb) => {\n _lookup(hostname, opt, (err, arg0, arg1) => {\n if (err) {\n return cb(err);\n }\n\n const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];\n\n opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);\n });\n }\n }\n\n // temporary internal emitter until the AxiosRequest class will be implemented\n const emitter = new EventEmitter();\n\n const onFinished = () => {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(abort);\n }\n\n if (config.signal) {\n config.signal.removeEventListener('abort', abort);\n }\n\n emitter.removeAllListeners();\n }\n\n onDone((value, isRejected) => {\n isDone = true;\n if (isRejected) {\n rejected = true;\n onFinished();\n }\n });\n\n function abort(reason) {\n emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);\n }\n\n emitter.once('abort', reject);\n\n if (config.cancelToken || config.signal) {\n config.cancelToken && config.cancelToken.subscribe(abort);\n if (config.signal) {\n config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);\n }\n }\n\n // Parse url\n const fullPath = buildFullPath(config.baseURL, config.url);\n const parsed = new URL(fullPath, 'http://localhost');\n const protocol = parsed.protocol || supportedProtocols[0];\n\n if (protocol === 'data:') {\n let convertedData;\n\n if (method !== 'GET') {\n return settle(resolve, reject, {\n status: 405,\n statusText: 'method not allowed',\n headers: {},\n config\n });\n }\n\n try {\n convertedData = fromDataURI(config.url, responseType === 'blob', {\n Blob: config.env && config.env.Blob\n });\n } catch (err) {\n throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);\n }\n\n if (responseType === 'text') {\n convertedData = convertedData.toString(responseEncoding);\n\n if (!responseEncoding || responseEncoding === 'utf8') {\n convertedData = utils.stripBOM(convertedData);\n }\n } else if (responseType === 'stream') {\n convertedData = stream.Readable.from(convertedData);\n }\n\n return settle(resolve, reject, {\n data: convertedData,\n status: 200,\n statusText: 'OK',\n headers: new AxiosHeaders(),\n config\n });\n }\n\n if (supportedProtocols.indexOf(protocol) === -1) {\n return reject(new AxiosError(\n 'Unsupported protocol ' + protocol,\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n\n const headers = AxiosHeaders.from(config.headers).normalize();\n\n // Set User-Agent (required by some servers)\n // See https://github.com/axios/axios/issues/69\n // User-Agent is specified; handle case where no UA header is desired\n // Only set header if it hasn't been set in config\n headers.set('User-Agent', 'axios/' + VERSION, false);\n\n const onDownloadProgress = config.onDownloadProgress;\n const onUploadProgress = config.onUploadProgress;\n const maxRate = config.maxRate;\n let maxUploadRate = undefined;\n let maxDownloadRate = undefined;\n\n // support for spec compliant FormData objects\n if (utils.isSpecCompliantForm(data)) {\n const userBoundary = headers.getContentType(/boundary=([-_\\w\\d]{10,70})/i);\n\n data = formDataToStream(data, (formHeaders) => {\n headers.set(formHeaders);\n }, {\n tag: `axios-${VERSION}-boundary`,\n boundary: userBoundary && userBoundary[1] || undefined\n });\n // support for https://www.npmjs.com/package/form-data api\n } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {\n headers.set(data.getHeaders());\n\n if (!headers.hasContentLength()) {\n try {\n const knownLength = await util.promisify(data.getLength).call(data);\n Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);\n /*eslint no-empty:0*/\n } catch (e) {\n }\n }\n } else if (utils.isBlob(data)) {\n data.size && headers.setContentType(data.type || 'application/octet-stream');\n headers.setContentLength(data.size || 0);\n data = stream.Readable.from(readBlob(data));\n } else if (data && !utils.isStream(data)) {\n if (Buffer.isBuffer(data)) {\n // Nothing to do...\n } else if (utils.isArrayBuffer(data)) {\n data = Buffer.from(new Uint8Array(data));\n } else if (utils.isString(data)) {\n data = Buffer.from(data, 'utf-8');\n } else {\n return reject(new AxiosError(\n 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n\n // Add Content-Length header if data exists\n headers.setContentLength(data.length, false);\n\n if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {\n return reject(new AxiosError(\n 'Request body larger than maxBodyLength limit',\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n }\n\n const contentLength = utils.toFiniteNumber(headers.getContentLength());\n\n if (utils.isArray(maxRate)) {\n maxUploadRate = maxRate[0];\n maxDownloadRate = maxRate[1];\n } else {\n maxUploadRate = maxDownloadRate = maxRate;\n }\n\n if (data && (onUploadProgress || maxUploadRate)) {\n if (!utils.isStream(data)) {\n data = stream.Readable.from(data, {objectMode: false});\n }\n\n data = stream.pipeline([data, new AxiosTransformStream({\n length: contentLength,\n maxRate: utils.toFiniteNumber(maxUploadRate)\n })], utils.noop);\n\n onUploadProgress && data.on('progress', progress => {\n onUploadProgress(Object.assign(progress, {\n upload: true\n }));\n });\n }\n\n // HTTP basic authentication\n let auth = undefined;\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password || '';\n auth = username + ':' + password;\n }\n\n if (!auth && parsed.username) {\n const urlUsername = parsed.username;\n const urlPassword = parsed.password;\n auth = urlUsername + ':' + urlPassword;\n }\n\n auth && headers.delete('authorization');\n\n let path;\n\n try {\n path = buildURL(\n parsed.pathname + parsed.search,\n config.params,\n config.paramsSerializer\n ).replace(/^\\?/, '');\n } catch (err) {\n const customErr = new Error(err.message);\n customErr.config = config;\n customErr.url = config.url;\n customErr.exists = true;\n return reject(customErr);\n }\n\n headers.set(\n 'Accept-Encoding',\n 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false\n );\n\n const options = {\n path,\n method: method,\n headers: headers.toJSON(),\n agents: { http: config.httpAgent, https: config.httpsAgent },\n auth,\n protocol,\n family,\n beforeRedirect: dispatchBeforeRedirect,\n beforeRedirects: {}\n };\n\n // cacheable-lookup integration hotfix\n !utils.isUndefined(lookup) && (options.lookup = lookup);\n\n if (config.socketPath) {\n options.socketPath = config.socketPath;\n } else {\n options.hostname = parsed.hostname;\n options.port = parsed.port;\n setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);\n }\n\n let transport;\n const isHttpsRequest = isHttps.test(options.protocol);\n options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;\n if (config.transport) {\n transport = config.transport;\n } else if (config.maxRedirects === 0) {\n transport = isHttpsRequest ? https : http;\n } else {\n if (config.maxRedirects) {\n options.maxRedirects = config.maxRedirects;\n }\n if (config.beforeRedirect) {\n options.beforeRedirects.config = config.beforeRedirect;\n }\n transport = isHttpsRequest ? httpsFollow : httpFollow;\n }\n\n if (config.maxBodyLength > -1) {\n options.maxBodyLength = config.maxBodyLength;\n } else {\n // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited\n options.maxBodyLength = Infinity;\n }\n\n if (config.insecureHTTPParser) {\n options.insecureHTTPParser = config.insecureHTTPParser;\n }\n\n // Create the request\n req = transport.request(options, function handleResponse(res) {\n if (req.destroyed) return;\n\n const streams = [res];\n\n const responseLength = +res.headers['content-length'];\n\n if (onDownloadProgress) {\n const transformStream = new AxiosTransformStream({\n length: utils.toFiniteNumber(responseLength),\n maxRate: utils.toFiniteNumber(maxDownloadRate)\n });\n\n onDownloadProgress && transformStream.on('progress', progress => {\n onDownloadProgress(Object.assign(progress, {\n download: true\n }));\n });\n\n streams.push(transformStream);\n }\n\n // decompress the response body transparently if required\n let responseStream = res;\n\n // return the last request in case of redirects\n const lastRequest = res.req || req;\n\n // if decompress disabled we should not decompress\n if (config.decompress !== false && res.headers['content-encoding']) {\n // if no content, but headers still say that it is encoded,\n // remove the header not confuse downstream operations\n if (method === 'HEAD' || res.statusCode === 204) {\n delete res.headers['content-encoding'];\n }\n\n switch ((res.headers['content-encoding'] || '').toLowerCase()) {\n /*eslint default-case:0*/\n case 'gzip':\n case 'x-gzip':\n case 'compress':\n case 'x-compress':\n // add the unzipper to the body stream processing pipeline\n streams.push(zlib.createUnzip(zlibOptions));\n\n // remove the content-encoding in order to not confuse downstream operations\n delete res.headers['content-encoding'];\n break;\n case 'deflate':\n streams.push(new ZlibHeaderTransformStream());\n\n // add the unzipper to the body stream processing pipeline\n streams.push(zlib.createUnzip(zlibOptions));\n\n // remove the content-encoding in order to not confuse downstream operations\n delete res.headers['content-encoding'];\n break;\n case 'br':\n if (isBrotliSupported) {\n streams.push(zlib.createBrotliDecompress(brotliOptions));\n delete res.headers['content-encoding'];\n }\n }\n }\n\n responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];\n\n const offListeners = stream.finished(responseStream, () => {\n offListeners();\n onFinished();\n });\n\n const response = {\n status: res.statusCode,\n statusText: res.statusMessage,\n headers: new AxiosHeaders(res.headers),\n config,\n request: lastRequest\n };\n\n if (responseType === 'stream') {\n response.data = responseStream;\n settle(resolve, reject, response);\n } else {\n const responseBuffer = [];\n let totalResponseBytes = 0;\n\n responseStream.on('data', function handleStreamData(chunk) {\n responseBuffer.push(chunk);\n totalResponseBytes += chunk.length;\n\n // make sure the content length is not over the maxContentLength if specified\n if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {\n // stream.destroy() emit aborted event before calling reject() on Node.js v16\n rejected = true;\n responseStream.destroy();\n reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE, config, lastRequest));\n }\n });\n\n responseStream.on('aborted', function handlerStreamAborted() {\n if (rejected) {\n return;\n }\n\n const err = new AxiosError(\n 'maxContentLength size of ' + config.maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n lastRequest\n );\n responseStream.destroy(err);\n reject(err);\n });\n\n responseStream.on('error', function handleStreamError(err) {\n if (req.destroyed) return;\n reject(AxiosError.from(err, null, config, lastRequest));\n });\n\n responseStream.on('end', function handleStreamEnd() {\n try {\n let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);\n if (responseType !== 'arraybuffer') {\n responseData = responseData.toString(responseEncoding);\n if (!responseEncoding || responseEncoding === 'utf8') {\n responseData = utils.stripBOM(responseData);\n }\n }\n response.data = responseData;\n } catch (err) {\n return reject(AxiosError.from(err, null, config, response.request, response));\n }\n settle(resolve, reject, response);\n });\n }\n\n emitter.once('abort', err => {\n if (!responseStream.destroyed) {\n responseStream.emit('error', err);\n responseStream.destroy();\n }\n });\n });\n\n emitter.once('abort', err => {\n reject(err);\n req.destroy(err);\n });\n\n // Handle errors\n req.on('error', function handleRequestError(err) {\n // @todo remove\n // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;\n reject(AxiosError.from(err, null, config, req));\n });\n\n // set tcp keep alive to prevent drop connection by peer\n req.on('socket', function handleRequestSocket(socket) {\n // default interval of sending ack packet is 1 minute\n socket.setKeepAlive(true, 1000 * 60);\n });\n\n // Handle request timeout\n if (config.timeout) {\n // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.\n const timeout = parseInt(config.timeout, 10);\n\n if (Number.isNaN(timeout)) {\n reject(new AxiosError(\n 'error trying to parse `config.timeout` to int',\n AxiosError.ERR_BAD_OPTION_VALUE,\n config,\n req\n ));\n\n return;\n }\n\n // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.\n // And timer callback will be fired, and abort() will be invoked before connection, then get \"socket hang up\" and code ECONNRESET.\n // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.\n // And then these socket which be hang up will devouring CPU little by little.\n // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.\n req.setTimeout(timeout, function handleRequestTimeout() {\n if (isDone) return;\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n req\n ));\n abort();\n });\n }\n\n\n // Send the request\n if (utils.isStream(data)) {\n let ended = false;\n let errored = false;\n\n data.on('end', () => {\n ended = true;\n });\n\n data.once('error', err => {\n errored = true;\n req.destroy(err);\n });\n\n data.on('close', () => {\n if (!ended && !errored) {\n abort(new CanceledError('Request stream has been aborted', config, req));\n }\n });\n\n data.pipe(req);\n } else {\n req.end(data);\n }\n });\n}\n\nexport const __setProxy = setProxy;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n"],"names":["utils","prototype","PlatformFormData","encode","url","FormData","platform","defaults","AxiosHeaders","stream","TextEncoder","readBlob","Readable","zlib","followRedirects","getProxyForUrl","callbackify","EventEmitter","formDataToStream","util","AxiosTransformStream","https","http","ZlibHeaderTransformStream","composeSignals","validators","InterceptorManager","Axios","CancelToken","HttpStatusCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEe,SAAS,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE;AAC1C,EAAE,OAAO,SAAS,IAAI,GAAG;AACzB,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACxC,GAAG,CAAC;AACJ;;ACFA;AACA;AACA,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;AACpC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC;AAChC;AACA,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,KAAK,IAAI;AAClC,IAAI,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACxB;AACA,MAAM,UAAU,GAAG,CAAC,IAAI,KAAK;AAC7B,EAAE,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,EAAE,OAAO,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI;AAC1C,EAAC;AACD;AACA,MAAM,UAAU,GAAG,IAAI,IAAI,KAAK,IAAI,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AO,CAAC;AACxB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B;AACA;AACA,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;AAC9B;AACA;AACA,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;AACnC;AACA;AACA,KAAK,CAAC,GAAG,GAAG,SAAS,GAAG,CAAC,QAAQ,EAAE;AACnC,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACA,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB;AACA;AACA,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;AAClC;AACA;AACA,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;AAChC;AACA,KAAK,CAAC,YAAY,GAAGpB,cAAY,CAAC;AAClC;AACA,KAAK,CAAC,UAAU,GAAG,KAAK,IAAI,cAAc,CAACR,OAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAClG;AACA,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACvC;AACA,KAAK,CAAC,cAAc,GAAG6B,gBAAc,CAAC;AACtC;AACA,KAAK,CAAC,OAAO,GAAG,KAAK;;;;"} \ No newline at end of file diff --git a/node_modules/axios/index.d.cts b/node_modules/axios/index.d.cts new file mode 100644 index 00000000..7d12dd32 --- /dev/null +++ b/node_modules/axios/index.d.cts @@ -0,0 +1,545 @@ +interface RawAxiosHeaders { + [key: string]: axios.AxiosHeaderValue; +} + +type MethodsHeaders = Partial<{ + [Key in axios.Method as Lowercase]: AxiosHeaders; +} & {common: AxiosHeaders}>; + +type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean; + +type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any; + +type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization'; + +type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream'; + +type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding'; + +declare class AxiosHeaders { + constructor( + headers?: RawAxiosHeaders | AxiosHeaders | string + ); + + [key: string]: any; + + set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; + + get(headerName: string, parser: RegExp): RegExpExecArray | null; + get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue; + + has(header: string, matcher?: AxiosHeaderMatcher): boolean; + + delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean; + + clear(matcher?: AxiosHeaderMatcher): boolean; + + normalize(format: boolean): AxiosHeaders; + + concat(...targets: Array): AxiosHeaders; + + toJSON(asStrings?: boolean): RawAxiosHeaders; + + static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders; + + static accessor(header: string | string[]): AxiosHeaders; + + static concat(...targets: Array): AxiosHeaders; + + setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentType(parser?: RegExp): RegExpExecArray | null; + getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasContentType(matcher?: AxiosHeaderMatcher): boolean; + + setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentLength(parser?: RegExp): RegExpExecArray | null; + getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasContentLength(matcher?: AxiosHeaderMatcher): boolean; + + setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAccept(parser?: RegExp): RegExpExecArray | null; + getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasAccept(matcher?: AxiosHeaderMatcher): boolean; + + setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getUserAgent(parser?: RegExp): RegExpExecArray | null; + getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasUserAgent(matcher?: AxiosHeaderMatcher): boolean; + + setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentEncoding(parser?: RegExp): RegExpExecArray | null; + getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean; + + setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAuthorization(parser?: RegExp): RegExpExecArray | null; + getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasAuthorization(matcher?: AxiosHeaderMatcher): boolean; + + [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>; +} + +declare class AxiosError extends Error { + constructor( + message?: string, + code?: string, + config?: axios.InternalAxiosRequestConfig, + request?: any, + response?: axios.AxiosResponse + ); + + config?: axios.InternalAxiosRequestConfig; + code?: string; + request?: any; + response?: axios.AxiosResponse; + isAxiosError: boolean; + status?: number; + toJSON: () => object; + cause?: Error; + static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS"; + static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE"; + static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION"; + static readonly ERR_NETWORK = "ERR_NETWORK"; + static readonly ERR_DEPRECATED = "ERR_DEPRECATED"; + static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE"; + static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST"; + static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT"; + static readonly ERR_INVALID_URL = "ERR_INVALID_URL"; + static readonly ERR_CANCELED = "ERR_CANCELED"; + static readonly ECONNABORTED = "ECONNABORTED"; + static readonly ETIMEDOUT = "ETIMEDOUT"; +} + +declare class CanceledError extends AxiosError { +} + +declare class Axios { + constructor(config?: axios.AxiosRequestConfig); + defaults: axios.AxiosDefaults; + interceptors: { + request: axios.AxiosInterceptorManager; + response: axios.AxiosInterceptorManager; + }; + getUri(config?: axios.AxiosRequestConfig): string; + request, D = any>(config: axios.AxiosRequestConfig): Promise; + get, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + delete, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + head, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + options, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + post, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + put, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + patch, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + postForm, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + putForm, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + patchForm, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; +} + +declare enum HttpStatusCode { + Continue = 100, + SwitchingProtocols = 101, + Processing = 102, + EarlyHints = 103, + Ok = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + MultiStatus = 207, + AlreadyReported = 208, + ImUsed = 226, + MultipleChoices = 300, + MovedPermanently = 301, + Found = 302, + SeeOther = 303, + NotModified = 304, + UseProxy = 305, + Unused = 306, + TemporaryRedirect = 307, + PermanentRedirect = 308, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + PayloadTooLarge = 413, + UriTooLong = 414, + UnsupportedMediaType = 415, + RangeNotSatisfiable = 416, + ExpectationFailed = 417, + ImATeapot = 418, + MisdirectedRequest = 421, + UnprocessableEntity = 422, + Locked = 423, + FailedDependency = 424, + TooEarly = 425, + UpgradeRequired = 426, + PreconditionRequired = 428, + TooManyRequests = 429, + RequestHeaderFieldsTooLarge = 431, + UnavailableForLegalReasons = 451, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505, + VariantAlsoNegotiates = 506, + InsufficientStorage = 507, + LoopDetected = 508, + NotExtended = 510, + NetworkAuthenticationRequired = 511, +} + +type InternalAxiosError = AxiosError; + +declare namespace axios { + type AxiosError = InternalAxiosError; + + type RawAxiosRequestHeaders = Partial; + + type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders; + + type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null; + + type RawCommonResponseHeaders = { + [Key in CommonResponseHeadersList]: AxiosHeaderValue; + } & { + "set-cookie": string[]; + }; + + type RawAxiosResponseHeaders = Partial; + + type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders; + + interface AxiosRequestTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any; + } + + interface AxiosResponseTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any; + } + + interface AxiosAdapter { + (config: InternalAxiosRequestConfig): AxiosPromise; + } + + interface AxiosBasicCredentials { + username: string; + password: string; + } + + interface AxiosProxyConfig { + host: string; + port: number; + auth?: AxiosBasicCredentials; + protocol?: string; + } + + type Method = + | 'get' | 'GET' + | 'delete' | 'DELETE' + | 'head' | 'HEAD' + | 'options' | 'OPTIONS' + | 'post' | 'POST' + | 'put' | 'PUT' + | 'patch' | 'PATCH' + | 'purge' | 'PURGE' + | 'link' | 'LINK' + | 'unlink' | 'UNLINK'; + + type ResponseType = + | 'arraybuffer' + | 'blob' + | 'document' + | 'json' + | 'text' + | 'stream' + | 'formdata'; + + type responseEncoding = + | 'ascii' | 'ASCII' + | 'ansi' | 'ANSI' + | 'binary' | 'BINARY' + | 'base64' | 'BASE64' + | 'base64url' | 'BASE64URL' + | 'hex' | 'HEX' + | 'latin1' | 'LATIN1' + | 'ucs-2' | 'UCS-2' + | 'ucs2' | 'UCS2' + | 'utf-8' | 'UTF-8' + | 'utf8' | 'UTF8' + | 'utf16le' | 'UTF16LE'; + + interface TransitionalOptions { + silentJSONParsing?: boolean; + forcedJSONParsing?: boolean; + clarifyTimeoutError?: boolean; + } + + interface GenericAbortSignal { + readonly aborted: boolean; + onabort?: ((...args: any) => any) | null; + addEventListener?: (...args: any) => any; + removeEventListener?: (...args: any) => any; + } + + interface FormDataVisitorHelpers { + defaultVisitor: SerializerVisitor; + convertValue: (value: any) => any; + isVisitable: (value: any) => boolean; + } + + interface SerializerVisitor { + ( + this: GenericFormData, + value: any, + key: string | number, + path: null | Array, + helpers: FormDataVisitorHelpers + ): boolean; + } + + interface SerializerOptions { + visitor?: SerializerVisitor; + dots?: boolean; + metaTokens?: boolean; + indexes?: boolean | null; + } + + // tslint:disable-next-line + interface FormSerializerOptions extends SerializerOptions { + } + + interface ParamEncoder { + (value: any, defaultEncoder: (value: any) => any): any; + } + + interface CustomParamsSerializer { + (params: Record, options?: ParamsSerializerOptions): string; + } + + interface ParamsSerializerOptions extends SerializerOptions { + encode?: ParamEncoder; + serialize?: CustomParamsSerializer; + } + + type MaxUploadRate = number; + + type MaxDownloadRate = number; + + type BrowserProgressEvent = any; + + interface AxiosProgressEvent { + loaded: number; + total?: number; + progress?: number; + bytes: number; + rate?: number; + estimated?: number; + upload?: boolean; + download?: boolean; + event?: BrowserProgressEvent; + lengthComputable: boolean; + } + + type Milliseconds = number; + + type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string; + + type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName; + + type AddressFamily = 4 | 6 | undefined; + + interface LookupAddressEntry { + address: string; + family?: AddressFamily; + } + + type LookupAddress = string | LookupAddressEntry; + + interface AxiosRequestConfig { + url?: string; + method?: Method | string; + baseURL?: string; + transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[]; + transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[]; + headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders; + params?: any; + paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer; + data?: D; + timeout?: Milliseconds; + timeoutErrorMessage?: string; + withCredentials?: boolean; + adapter?: AxiosAdapterConfig | AxiosAdapterConfig[]; + auth?: AxiosBasicCredentials; + responseType?: ResponseType; + responseEncoding?: responseEncoding | string; + xsrfCookieName?: string; + xsrfHeaderName?: string; + onUploadProgress?: (progressEvent: AxiosProgressEvent) => void; + onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void; + maxContentLength?: number; + validateStatus?: ((status: number) => boolean) | null; + maxBodyLength?: number; + maxRedirects?: number; + maxRate?: number | [MaxUploadRate, MaxDownloadRate]; + beforeRedirect?: (options: Record, responseDetails: {headers: Record, statusCode: HttpStatusCode}) => void; + socketPath?: string | null; + transport?: any; + httpAgent?: any; + httpsAgent?: any; + proxy?: AxiosProxyConfig | false; + cancelToken?: CancelToken; + decompress?: boolean; + transitional?: TransitionalOptions; + signal?: GenericAbortSignal; + insecureHTTPParser?: boolean; + env?: { + FormData?: new (...args: any[]) => object; + }; + formSerializer?: FormSerializerOptions; + family?: AddressFamily; + lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) | + ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); + withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); + fetchOptions?: Record; + } + + // Alias + type RawAxiosRequestConfig = AxiosRequestConfig; + + interface InternalAxiosRequestConfig extends AxiosRequestConfig { + headers: AxiosRequestHeaders; + } + + interface HeadersDefaults { + common: RawAxiosRequestHeaders; + delete: RawAxiosRequestHeaders; + get: RawAxiosRequestHeaders; + head: RawAxiosRequestHeaders; + post: RawAxiosRequestHeaders; + put: RawAxiosRequestHeaders; + patch: RawAxiosRequestHeaders; + options?: RawAxiosRequestHeaders; + purge?: RawAxiosRequestHeaders; + link?: RawAxiosRequestHeaders; + unlink?: RawAxiosRequestHeaders; + } + + interface AxiosDefaults extends Omit, 'headers'> { + headers: HeadersDefaults; + } + + interface CreateAxiosDefaults extends Omit, 'headers'> { + headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial; + } + + interface AxiosResponse { + data: T; + status: number; + statusText: string; + headers: RawAxiosResponseHeaders | AxiosResponseHeaders; + config: InternalAxiosRequestConfig; + request?: any; + } + + type AxiosPromise = Promise>; + + interface CancelStatic { + new (message?: string): Cancel; + } + + interface Cancel { + message: string | undefined; + } + + interface Canceler { + (message?: string, config?: AxiosRequestConfig, request?: any): void; + } + + interface CancelTokenStatic { + new (executor: (cancel: Canceler) => void): CancelToken; + source(): CancelTokenSource; + } + + interface CancelToken { + promise: Promise; + reason?: Cancel; + throwIfRequested(): void; + } + + interface CancelTokenSource { + token: CancelToken; + cancel: Canceler; + } + + interface AxiosInterceptorOptions { + synchronous?: boolean; + runWhen?: (config: InternalAxiosRequestConfig) => boolean; + } + + interface AxiosInterceptorManager { + use(onFulfilled?: (value: V) => V | Promise, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number; + eject(id: number): void; + clear(): void; + } + + interface AxiosInstance extends Axios { + , D = any>(config: AxiosRequestConfig): Promise; + , D = any>(url: string, config?: AxiosRequestConfig): Promise; + + defaults: Omit & { + headers: HeadersDefaults & { + [key: string]: AxiosHeaderValue + } + }; + } + + interface GenericFormData { + append(name: string, value: any, options?: any): any; + } + + interface GenericHTMLFormElement { + name: string; + method: string; + submit(): void; + } + + interface AxiosStatic extends AxiosInstance { + create(config?: CreateAxiosDefaults): AxiosInstance; + Cancel: CancelStatic; + CancelToken: CancelTokenStatic; + Axios: typeof Axios; + AxiosError: typeof AxiosError; + CanceledError: typeof CanceledError; + HttpStatusCode: typeof HttpStatusCode; + readonly VERSION: string; + isCancel(value: any): value is Cancel; + all(values: Array>): Promise; + spread(callback: (...args: T[]) => R): (array: T[]) => R; + isAxiosError(payload: any): payload is AxiosError; + toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData; + formToJSON(form: GenericFormData|GenericHTMLFormElement): object; + getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter; + AxiosHeaders: typeof AxiosHeaders; + } +} + +declare const axios: axios.AxiosStatic; + +export = axios; diff --git a/node_modules/axios/index.d.ts b/node_modules/axios/index.d.ts new file mode 100644 index 00000000..dbb7dca3 --- /dev/null +++ b/node_modules/axios/index.d.ts @@ -0,0 +1,562 @@ +// TypeScript Version: 4.7 +export type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null; + +interface RawAxiosHeaders { + [key: string]: AxiosHeaderValue; +} + +type MethodsHeaders = Partial<{ + [Key in Method as Lowercase]: AxiosHeaders; +} & {common: AxiosHeaders}>; + +type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean); + +type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any; + +export class AxiosHeaders { + constructor( + headers?: RawAxiosHeaders | AxiosHeaders | string + ); + + [key: string]: any; + + set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; + + get(headerName: string, parser: RegExp): RegExpExecArray | null; + get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue; + + has(header: string, matcher?: AxiosHeaderMatcher): boolean; + + delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean; + + clear(matcher?: AxiosHeaderMatcher): boolean; + + normalize(format: boolean): AxiosHeaders; + + concat(...targets: Array): AxiosHeaders; + + toJSON(asStrings?: boolean): RawAxiosHeaders; + + static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders; + + static accessor(header: string | string[]): AxiosHeaders; + + static concat(...targets: Array): AxiosHeaders; + + setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentType(parser?: RegExp): RegExpExecArray | null; + getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasContentType(matcher?: AxiosHeaderMatcher): boolean; + + setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentLength(parser?: RegExp): RegExpExecArray | null; + getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasContentLength(matcher?: AxiosHeaderMatcher): boolean; + + setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAccept(parser?: RegExp): RegExpExecArray | null; + getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasAccept(matcher?: AxiosHeaderMatcher): boolean; + + setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getUserAgent(parser?: RegExp): RegExpExecArray | null; + getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasUserAgent(matcher?: AxiosHeaderMatcher): boolean; + + setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentEncoding(parser?: RegExp): RegExpExecArray | null; + getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean; + + setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAuthorization(parser?: RegExp): RegExpExecArray | null; + getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasAuthorization(matcher?: AxiosHeaderMatcher): boolean; + + [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>; +} + +type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization'; + +type ContentType = AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream'; + +export type RawAxiosRequestHeaders = Partial; + +export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders; + +type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding'; + +type RawCommonResponseHeaders = { + [Key in CommonResponseHeadersList]: AxiosHeaderValue; +} & { + "set-cookie": string[]; +}; + +export type RawAxiosResponseHeaders = Partial; + +export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders; + +export interface AxiosRequestTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any; +} + +export interface AxiosResponseTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any; +} + +export interface AxiosAdapter { + (config: InternalAxiosRequestConfig): AxiosPromise; +} + +export interface AxiosBasicCredentials { + username: string; + password: string; +} + +export interface AxiosProxyConfig { + host: string; + port: number; + auth?: AxiosBasicCredentials; + protocol?: string; +} + +export enum HttpStatusCode { + Continue = 100, + SwitchingProtocols = 101, + Processing = 102, + EarlyHints = 103, + Ok = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + MultiStatus = 207, + AlreadyReported = 208, + ImUsed = 226, + MultipleChoices = 300, + MovedPermanently = 301, + Found = 302, + SeeOther = 303, + NotModified = 304, + UseProxy = 305, + Unused = 306, + TemporaryRedirect = 307, + PermanentRedirect = 308, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + PayloadTooLarge = 413, + UriTooLong = 414, + UnsupportedMediaType = 415, + RangeNotSatisfiable = 416, + ExpectationFailed = 417, + ImATeapot = 418, + MisdirectedRequest = 421, + UnprocessableEntity = 422, + Locked = 423, + FailedDependency = 424, + TooEarly = 425, + UpgradeRequired = 426, + PreconditionRequired = 428, + TooManyRequests = 429, + RequestHeaderFieldsTooLarge = 431, + UnavailableForLegalReasons = 451, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505, + VariantAlsoNegotiates = 506, + InsufficientStorage = 507, + LoopDetected = 508, + NotExtended = 510, + NetworkAuthenticationRequired = 511, +} + +export type Method = + | 'get' | 'GET' + | 'delete' | 'DELETE' + | 'head' | 'HEAD' + | 'options' | 'OPTIONS' + | 'post' | 'POST' + | 'put' | 'PUT' + | 'patch' | 'PATCH' + | 'purge' | 'PURGE' + | 'link' | 'LINK' + | 'unlink' | 'UNLINK'; + +export type ResponseType = + | 'arraybuffer' + | 'blob' + | 'document' + | 'json' + | 'text' + | 'stream' + | 'formdata'; + +export type responseEncoding = + | 'ascii' | 'ASCII' + | 'ansi' | 'ANSI' + | 'binary' | 'BINARY' + | 'base64' | 'BASE64' + | 'base64url' | 'BASE64URL' + | 'hex' | 'HEX' + | 'latin1' | 'LATIN1' + | 'ucs-2' | 'UCS-2' + | 'ucs2' | 'UCS2' + | 'utf-8' | 'UTF-8' + | 'utf8' | 'UTF8' + | 'utf16le' | 'UTF16LE'; + +export interface TransitionalOptions { + silentJSONParsing?: boolean; + forcedJSONParsing?: boolean; + clarifyTimeoutError?: boolean; +} + +export interface GenericAbortSignal { + readonly aborted: boolean; + onabort?: ((...args: any) => any) | null; + addEventListener?: (...args: any) => any; + removeEventListener?: (...args: any) => any; +} + +export interface FormDataVisitorHelpers { + defaultVisitor: SerializerVisitor; + convertValue: (value: any) => any; + isVisitable: (value: any) => boolean; +} + +export interface SerializerVisitor { + ( + this: GenericFormData, + value: any, + key: string | number, + path: null | Array, + helpers: FormDataVisitorHelpers + ): boolean; +} + +export interface SerializerOptions { + visitor?: SerializerVisitor; + dots?: boolean; + metaTokens?: boolean; + indexes?: boolean | null; +} + +// tslint:disable-next-line +export interface FormSerializerOptions extends SerializerOptions { +} + +export interface ParamEncoder { + (value: any, defaultEncoder: (value: any) => any): any; +} + +export interface CustomParamsSerializer { + (params: Record, options?: ParamsSerializerOptions): string; +} + +export interface ParamsSerializerOptions extends SerializerOptions { + encode?: ParamEncoder; + serialize?: CustomParamsSerializer; +} + +type MaxUploadRate = number; + +type MaxDownloadRate = number; + +type BrowserProgressEvent = any; + +export interface AxiosProgressEvent { + loaded: number; + total?: number; + progress?: number; + bytes: number; + rate?: number; + estimated?: number; + upload?: boolean; + download?: boolean; + event?: BrowserProgressEvent; + lengthComputable: boolean; +} + +type Milliseconds = number; + +type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string; + +type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName; + +export type AddressFamily = 4 | 6 | undefined; + +export interface LookupAddressEntry { + address: string; + family?: AddressFamily; +} + +export type LookupAddress = string | LookupAddressEntry; + +export interface AxiosRequestConfig { + url?: string; + method?: Method | string; + baseURL?: string; + transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[]; + transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[]; + headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders; + params?: any; + paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer; + data?: D; + timeout?: Milliseconds; + timeoutErrorMessage?: string; + withCredentials?: boolean; + adapter?: AxiosAdapterConfig | AxiosAdapterConfig[]; + auth?: AxiosBasicCredentials; + responseType?: ResponseType; + responseEncoding?: responseEncoding | string; + xsrfCookieName?: string; + xsrfHeaderName?: string; + onUploadProgress?: (progressEvent: AxiosProgressEvent) => void; + onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void; + maxContentLength?: number; + validateStatus?: ((status: number) => boolean) | null; + maxBodyLength?: number; + maxRedirects?: number; + maxRate?: number | [MaxUploadRate, MaxDownloadRate]; + beforeRedirect?: (options: Record, responseDetails: {headers: Record, statusCode: HttpStatusCode}) => void; + socketPath?: string | null; + transport?: any; + httpAgent?: any; + httpsAgent?: any; + proxy?: AxiosProxyConfig | false; + cancelToken?: CancelToken; + decompress?: boolean; + transitional?: TransitionalOptions; + signal?: GenericAbortSignal; + insecureHTTPParser?: boolean; + env?: { + FormData?: new (...args: any[]) => object; + }; + formSerializer?: FormSerializerOptions; + family?: AddressFamily; + lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) | + ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); + withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); + fetchOptions?: Record; +} + +// Alias +export type RawAxiosRequestConfig = AxiosRequestConfig; + +export interface InternalAxiosRequestConfig extends AxiosRequestConfig { + headers: AxiosRequestHeaders; +} + +export interface HeadersDefaults { + common: RawAxiosRequestHeaders; + delete: RawAxiosRequestHeaders; + get: RawAxiosRequestHeaders; + head: RawAxiosRequestHeaders; + post: RawAxiosRequestHeaders; + put: RawAxiosRequestHeaders; + patch: RawAxiosRequestHeaders; + options?: RawAxiosRequestHeaders; + purge?: RawAxiosRequestHeaders; + link?: RawAxiosRequestHeaders; + unlink?: RawAxiosRequestHeaders; +} + +export interface AxiosDefaults extends Omit, 'headers'> { + headers: HeadersDefaults; +} + +export interface CreateAxiosDefaults extends Omit, 'headers'> { + headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial; +} + +export interface AxiosResponse { + data: T; + status: number; + statusText: string; + headers: RawAxiosResponseHeaders | AxiosResponseHeaders; + config: InternalAxiosRequestConfig; + request?: any; +} + +export class AxiosError extends Error { + constructor( + message?: string, + code?: string, + config?: InternalAxiosRequestConfig, + request?: any, + response?: AxiosResponse + ); + + config?: InternalAxiosRequestConfig; + code?: string; + request?: any; + response?: AxiosResponse; + isAxiosError: boolean; + status?: number; + toJSON: () => object; + cause?: Error; + static from( + error: Error | unknown, + code?: string, + config?: InternalAxiosRequestConfig, + request?: any, + response?: AxiosResponse, + customProps?: object, +): AxiosError; + static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS"; + static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE"; + static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION"; + static readonly ERR_NETWORK = "ERR_NETWORK"; + static readonly ERR_DEPRECATED = "ERR_DEPRECATED"; + static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE"; + static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST"; + static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT"; + static readonly ERR_INVALID_URL = "ERR_INVALID_URL"; + static readonly ERR_CANCELED = "ERR_CANCELED"; + static readonly ECONNABORTED = "ECONNABORTED"; + static readonly ETIMEDOUT = "ETIMEDOUT"; +} + +export class CanceledError extends AxiosError { +} + +export type AxiosPromise = Promise>; + +export interface CancelStatic { + new (message?: string): Cancel; +} + +export interface Cancel { + message: string | undefined; +} + +export interface Canceler { + (message?: string, config?: AxiosRequestConfig, request?: any): void; +} + +export interface CancelTokenStatic { + new (executor: (cancel: Canceler) => void): CancelToken; + source(): CancelTokenSource; +} + +export interface CancelToken { + promise: Promise; + reason?: Cancel; + throwIfRequested(): void; +} + +export interface CancelTokenSource { + token: CancelToken; + cancel: Canceler; +} + +export interface AxiosInterceptorOptions { + synchronous?: boolean; + runWhen?: (config: InternalAxiosRequestConfig) => boolean; +} + +export interface AxiosInterceptorManager { + use(onFulfilled?: ((value: V) => V | Promise) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): number; + eject(id: number): void; + clear(): void; +} + +export class Axios { + constructor(config?: AxiosRequestConfig); + defaults: AxiosDefaults; + interceptors: { + request: AxiosInterceptorManager; + response: AxiosInterceptorManager; + }; + getUri(config?: AxiosRequestConfig): string; + request, D = any>(config: AxiosRequestConfig): Promise; + get, D = any>(url: string, config?: AxiosRequestConfig): Promise; + delete, D = any>(url: string, config?: AxiosRequestConfig): Promise; + head, D = any>(url: string, config?: AxiosRequestConfig): Promise; + options, D = any>(url: string, config?: AxiosRequestConfig): Promise; + post, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + put, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + patch, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + postForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + putForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + patchForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; +} + +export interface AxiosInstance extends Axios { + , D = any>(config: AxiosRequestConfig): Promise; + , D = any>(url: string, config?: AxiosRequestConfig): Promise; + + defaults: Omit & { + headers: HeadersDefaults & { + [key: string]: AxiosHeaderValue + } + }; +} + +export interface GenericFormData { + append(name: string, value: any, options?: any): any; +} + +export interface GenericHTMLFormElement { + name: string; + method: string; + submit(): void; +} + +export function getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter; + +export function toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData; + +export function formToJSON(form: GenericFormData|GenericHTMLFormElement): object; + +export function isAxiosError(payload: any): payload is AxiosError; + +export function spread(callback: (...args: T[]) => R): (array: T[]) => R; + +export function isCancel(value: any): value is Cancel; + +export function all(values: Array>): Promise; + +export interface AxiosStatic extends AxiosInstance { + create(config?: CreateAxiosDefaults): AxiosInstance; + Cancel: CancelStatic; + CancelToken: CancelTokenStatic; + Axios: typeof Axios; + AxiosError: typeof AxiosError; + HttpStatusCode: typeof HttpStatusCode; + readonly VERSION: string; + isCancel: typeof isCancel; + all: typeof all; + spread: typeof spread; + isAxiosError: typeof isAxiosError; + toFormData: typeof toFormData; + formToJSON: typeof formToJSON; + getAdapter: typeof getAdapter; + CanceledError: typeof CanceledError; + AxiosHeaders: typeof AxiosHeaders; +} + +declare const axios: AxiosStatic; + +export default axios; diff --git a/node_modules/axios/index.js b/node_modules/axios/index.js new file mode 100644 index 00000000..fba3990d --- /dev/null +++ b/node_modules/axios/index.js @@ -0,0 +1,43 @@ +import axios from './lib/axios.js'; + +// This module is intended to unwrap Axios default export as named. +// Keep top-level export same with static properties +// so that it can keep same with es module or cjs +const { + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData, + AxiosHeaders, + HttpStatusCode, + formToJSON, + getAdapter, + mergeConfig +} = axios; + +export { + axios as default, + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData, + AxiosHeaders, + HttpStatusCode, + formToJSON, + getAdapter, + mergeConfig +} diff --git a/node_modules/axios/lib/adapters/README.md b/node_modules/axios/lib/adapters/README.md new file mode 100644 index 00000000..68f11189 --- /dev/null +++ b/node_modules/axios/lib/adapters/README.md @@ -0,0 +1,37 @@ +# axios // adapters + +The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received. + +## Example + +```js +var settle = require('./../core/settle'); + +module.exports = function myAdapter(config) { + // At this point: + // - config has been merged with defaults + // - request transformers have already run + // - request interceptors have already run + + // Make the request using config provided + // Upon response settle the Promise + + return new Promise(function(resolve, reject) { + + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(resolve, reject, response); + + // From here: + // - response transformers will run + // - response interceptors will run + }); +} +``` diff --git a/node_modules/axios/lib/adapters/adapters.js b/node_modules/axios/lib/adapters/adapters.js new file mode 100644 index 00000000..b466dd51 --- /dev/null +++ b/node_modules/axios/lib/adapters/adapters.js @@ -0,0 +1,79 @@ +import utils from '../utils.js'; +import httpAdapter from './http.js'; +import xhrAdapter from './xhr.js'; +import fetchAdapter from './fetch.js'; +import AxiosError from "../core/AxiosError.js"; + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +} + +utils.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; + +export default { + getAdapter: (adapters) => { + adapters = utils.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +} diff --git a/node_modules/axios/lib/adapters/fetch.js b/node_modules/axios/lib/adapters/fetch.js new file mode 100644 index 00000000..11045535 --- /dev/null +++ b/node_modules/axios/lib/adapters/fetch.js @@ -0,0 +1,227 @@ +import platform from "../platform/index.js"; +import utils from "../utils.js"; +import AxiosError from "../core/AxiosError.js"; +import composeSignals from "../helpers/composeSignals.js"; +import {trackStream} from "../helpers/trackStream.js"; +import AxiosHeaders from "../core/AxiosHeaders.js"; +import progressEventReducer from "../helpers/progressEventReducer.js"; +import resolveConfig from "../helpers/resolveConfig.js"; +import settle from "../core/settle.js"; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +} + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }) + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils.isBlob(body)) { + return body.size; + } + + if(utils.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils.isString(body)) { + return (await encodeText(body)).byteLength; + } +} + +const resolveBodyLength = async (headers, body) => { + const length = utils.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +} + +export default isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + } + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader) + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }) + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError.from(err, err && err.code, config, request); + } +}); + + diff --git a/node_modules/axios/lib/adapters/http.js b/node_modules/axios/lib/adapters/http.js new file mode 100644 index 00000000..768e4a5d --- /dev/null +++ b/node_modules/axios/lib/adapters/http.js @@ -0,0 +1,685 @@ +'use strict'; + +import utils from './../utils.js'; +import settle from './../core/settle.js'; +import buildFullPath from '../core/buildFullPath.js'; +import buildURL from './../helpers/buildURL.js'; +import {getProxyForUrl} from 'proxy-from-env'; +import http from 'http'; +import https from 'https'; +import util from 'util'; +import followRedirects from 'follow-redirects'; +import zlib from 'zlib'; +import {VERSION} from '../env/data.js'; +import transitionalDefaults from '../defaults/transitional.js'; +import AxiosError from '../core/AxiosError.js'; +import CanceledError from '../cancel/CanceledError.js'; +import platform from '../platform/index.js'; +import fromDataURI from '../helpers/fromDataURI.js'; +import stream from 'stream'; +import AxiosHeaders from '../core/AxiosHeaders.js'; +import AxiosTransformStream from '../helpers/AxiosTransformStream.js'; +import {EventEmitter} from 'events'; +import formDataToStream from "../helpers/formDataToStream.js"; +import readBlob from "../helpers/readBlob.js"; +import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js'; +import callbackify from "../helpers/callbackify.js"; + +const zlibOptions = { + flush: zlib.constants.Z_SYNC_FLUSH, + finishFlush: zlib.constants.Z_SYNC_FLUSH +}; + +const brotliOptions = { + flush: zlib.constants.BROTLI_OPERATION_FLUSH, + finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH +} + +const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress); + +const {http: httpFollow, https: httpsFollow} = followRedirects; + +const isHttps = /https:?/; + +const supportedProtocols = platform.protocols.map(protocol => { + return protocol + ':'; +}); + +/** + * If the proxy or config beforeRedirects functions are defined, call them with the options + * object. + * + * @param {Object} options - The options object that was passed to the request. + * + * @returns {Object} + */ +function dispatchBeforeRedirect(options, responseDetails) { + if (options.beforeRedirects.proxy) { + options.beforeRedirects.proxy(options); + } + if (options.beforeRedirects.config) { + options.beforeRedirects.config(options, responseDetails); + } +} + +/** + * If the proxy or config afterRedirects functions are defined, call them with the options + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} configProxy configuration from Axios options object + * @param {string} location + * + * @returns {http.ClientRequestArgs} + */ +function setProxy(options, configProxy, location) { + let proxy = configProxy; + if (!proxy && proxy !== false) { + const proxyUrl = getProxyForUrl(location); + if (proxyUrl) { + proxy = new URL(proxyUrl); + } + } + if (proxy) { + // Basic proxy authorization + if (proxy.username) { + proxy.auth = (proxy.username || '') + ':' + (proxy.password || ''); + } + + if (proxy.auth) { + // Support proxy auth object form + if (proxy.auth.username || proxy.auth.password) { + proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || ''); + } + const base64 = Buffer + .from(proxy.auth, 'utf8') + .toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } + + options.headers.host = options.hostname + (options.port ? ':' + options.port : ''); + const proxyHost = proxy.hostname || proxy.host; + options.hostname = proxyHost; + // Replace 'host' since options is not a URL object + options.host = proxyHost; + options.port = proxy.port; + options.path = location; + if (proxy.protocol) { + options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`; + } + } + + options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) { + // Configure proxy for redirected request, passing the original config proxy to apply + // the exact same logic as if the redirected request was performed by axios directly. + setProxy(redirectOptions, configProxy, redirectOptions.href); + }; +} + +const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process'; + +// temporary hotfix + +const wrapAsync = (asyncExecutor) => { + return new Promise((resolve, reject) => { + let onDone; + let isDone; + + const done = (value, isRejected) => { + if (isDone) return; + isDone = true; + onDone && onDone(value, isRejected); + } + + const _resolve = (value) => { + done(value); + resolve(value); + }; + + const _reject = (reason) => { + done(reason, true); + reject(reason); + } + + asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject); + }) +}; + +const resolveFamily = ({address, family}) => { + if (!utils.isString(address)) { + throw TypeError('address must be a string'); + } + return ({ + address, + family: family || (address.indexOf('.') < 0 ? 6 : 4) + }); +} + +const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family}); + +/*eslint consistent-return:0*/ +export default isHttpAdapterSupported && function httpAdapter(config) { + return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { + let {data, lookup, family} = config; + const {responseType, responseEncoding} = config; + const method = config.method.toUpperCase(); + let isDone; + let rejected = false; + let req; + + if (lookup) { + const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]); + // hotfix to support opt.all option which is required for node 20.x + lookup = (hostname, opt, cb) => { + _lookup(hostname, opt, (err, arg0, arg1) => { + if (err) { + return cb(err); + } + + const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)]; + + opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family); + }); + } + } + + // temporary internal emitter until the AxiosRequest class will be implemented + const emitter = new EventEmitter(); + + const onFinished = () => { + if (config.cancelToken) { + config.cancelToken.unsubscribe(abort); + } + + if (config.signal) { + config.signal.removeEventListener('abort', abort); + } + + emitter.removeAllListeners(); + } + + onDone((value, isRejected) => { + isDone = true; + if (isRejected) { + rejected = true; + onFinished(); + } + }); + + function abort(reason) { + emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason); + } + + emitter.once('abort', reject); + + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); + } + } + + // Parse url + const fullPath = buildFullPath(config.baseURL, config.url); + const parsed = new URL(fullPath, 'http://localhost'); + const protocol = parsed.protocol || supportedProtocols[0]; + + if (protocol === 'data:') { + let convertedData; + + if (method !== 'GET') { + return settle(resolve, reject, { + status: 405, + statusText: 'method not allowed', + headers: {}, + config + }); + } + + try { + convertedData = fromDataURI(config.url, responseType === 'blob', { + Blob: config.env && config.env.Blob + }); + } catch (err) { + throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config); + } + + if (responseType === 'text') { + convertedData = convertedData.toString(responseEncoding); + + if (!responseEncoding || responseEncoding === 'utf8') { + convertedData = utils.stripBOM(convertedData); + } + } else if (responseType === 'stream') { + convertedData = stream.Readable.from(convertedData); + } + + return settle(resolve, reject, { + data: convertedData, + status: 200, + statusText: 'OK', + headers: new AxiosHeaders(), + config + }); + } + + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + 'Unsupported protocol ' + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + const headers = AxiosHeaders.from(config.headers).normalize(); + + // Set User-Agent (required by some servers) + // See https://github.com/axios/axios/issues/69 + // User-Agent is specified; handle case where no UA header is desired + // Only set header if it hasn't been set in config + headers.set('User-Agent', 'axios/' + VERSION, false); + + const onDownloadProgress = config.onDownloadProgress; + const onUploadProgress = config.onUploadProgress; + const maxRate = config.maxRate; + let maxUploadRate = undefined; + let maxDownloadRate = undefined; + + // support for spec compliant FormData objects + if (utils.isSpecCompliantForm(data)) { + const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i); + + data = formDataToStream(data, (formHeaders) => { + headers.set(formHeaders); + }, { + tag: `axios-${VERSION}-boundary`, + boundary: userBoundary && userBoundary[1] || undefined + }); + // support for https://www.npmjs.com/package/form-data api + } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) { + headers.set(data.getHeaders()); + + if (!headers.hasContentLength()) { + try { + const knownLength = await util.promisify(data.getLength).call(data); + Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength); + /*eslint no-empty:0*/ + } catch (e) { + } + } + } else if (utils.isBlob(data)) { + data.size && headers.setContentType(data.type || 'application/octet-stream'); + headers.setContentLength(data.size || 0); + data = stream.Readable.from(readBlob(data)); + } else if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) { + // Nothing to do... + } else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(new AxiosError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + // Add Content-Length header if data exists + headers.setContentLength(data.length, false); + + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + 'Request body larger than maxBodyLength limit', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + } + + const contentLength = utils.toFiniteNumber(headers.getContentLength()); + + if (utils.isArray(maxRate)) { + maxUploadRate = maxRate[0]; + maxDownloadRate = maxRate[1]; + } else { + maxUploadRate = maxDownloadRate = maxRate; + } + + if (data && (onUploadProgress || maxUploadRate)) { + if (!utils.isStream(data)) { + data = stream.Readable.from(data, {objectMode: false}); + } + + data = stream.pipeline([data, new AxiosTransformStream({ + length: contentLength, + maxRate: utils.toFiniteNumber(maxUploadRate) + })], utils.noop); + + onUploadProgress && data.on('progress', progress => { + onUploadProgress(Object.assign(progress, { + upload: true + })); + }); + } + + // HTTP basic authentication + let auth = undefined; + if (config.auth) { + const username = config.auth.username || ''; + const password = config.auth.password || ''; + auth = username + ':' + password; + } + + if (!auth && parsed.username) { + const urlUsername = parsed.username; + const urlPassword = parsed.password; + auth = urlUsername + ':' + urlPassword; + } + + auth && headers.delete('authorization'); + + let path; + + try { + path = buildURL( + parsed.pathname + parsed.search, + config.params, + config.paramsSerializer + ).replace(/^\?/, ''); + } catch (err) { + const customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + return reject(customErr); + } + + headers.set( + 'Accept-Encoding', + 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false + ); + + const options = { + path, + method: method, + headers: headers.toJSON(), + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth, + protocol, + family, + beforeRedirect: dispatchBeforeRedirect, + beforeRedirects: {} + }; + + // cacheable-lookup integration hotfix + !utils.isUndefined(lookup) && (options.lookup = lookup); + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } + + let transport; + const isHttpsRequest = isHttps.test(options.protocol); + options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? https : http; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; + } + + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } else { + // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited + options.maxBodyLength = Infinity; + } + + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + + // Create the request + req = transport.request(options, function handleResponse(res) { + if (req.destroyed) return; + + const streams = [res]; + + const responseLength = +res.headers['content-length']; + + if (onDownloadProgress) { + const transformStream = new AxiosTransformStream({ + length: utils.toFiniteNumber(responseLength), + maxRate: utils.toFiniteNumber(maxDownloadRate) + }); + + onDownloadProgress && transformStream.on('progress', progress => { + onDownloadProgress(Object.assign(progress, { + download: true + })); + }); + + streams.push(transformStream); + } + + // decompress the response body transparently if required + let responseStream = res; + + // return the last request in case of redirects + const lastRequest = res.req || req; + + // if decompress disabled we should not decompress + if (config.decompress !== false && res.headers['content-encoding']) { + // if no content, but headers still say that it is encoded, + // remove the header not confuse downstream operations + if (method === 'HEAD' || res.statusCode === 204) { + delete res.headers['content-encoding']; + } + + switch ((res.headers['content-encoding'] || '').toLowerCase()) { + /*eslint default-case:0*/ + case 'gzip': + case 'x-gzip': + case 'compress': + case 'x-compress': + // add the unzipper to the body stream processing pipeline + streams.push(zlib.createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'deflate': + streams.push(new ZlibHeaderTransformStream()); + + // add the unzipper to the body stream processing pipeline + streams.push(zlib.createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'br': + if (isBrotliSupported) { + streams.push(zlib.createBrotliDecompress(brotliOptions)); + delete res.headers['content-encoding']; + } + } + } + + responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0]; + + const offListeners = stream.finished(responseStream, () => { + offListeners(); + onFinished(); + }); + + const response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: new AxiosHeaders(res.headers), + config, + request: lastRequest + }; + + if (responseType === 'stream') { + response.data = responseStream; + settle(resolve, reject, response); + } else { + const responseBuffer = []; + let totalResponseBytes = 0; + + responseStream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; + + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + // stream.destroy() emit aborted event before calling reject() on Node.js v16 + rejected = true; + responseStream.destroy(); + reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); + } + }); + + responseStream.on('aborted', function handlerStreamAborted() { + if (rejected) { + return; + } + + const err = new AxiosError( + 'maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + ); + responseStream.destroy(err); + reject(err); + }); + + responseStream.on('error', function handleStreamError(err) { + if (req.destroyed) return; + reject(AxiosError.from(err, null, config, lastRequest)); + }); + + responseStream.on('end', function handleStreamEnd() { + try { + let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (responseType !== 'arraybuffer') { + responseData = responseData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + return reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }); + } + + emitter.once('abort', err => { + if (!responseStream.destroyed) { + responseStream.emit('error', err); + responseStream.destroy(); + } + }); + }); + + emitter.once('abort', err => { + reject(err); + req.destroy(err); + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + // @todo remove + // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; + reject(AxiosError.from(err, null, config, req)); + }); + + // set tcp keep alive to prevent drop connection by peer + req.on('socket', function handleRequestSocket(socket) { + // default interval of sending ack packet is 1 minute + socket.setKeepAlive(true, 1000 * 60); + }); + + // Handle request timeout + if (config.timeout) { + // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. + const timeout = parseInt(config.timeout, 10); + + if (Number.isNaN(timeout)) { + reject(new AxiosError( + 'error trying to parse `config.timeout` to int', + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); + + return; + } + + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devouring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(timeout, function handleRequestTimeout() { + if (isDone) return; + let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + abort(); + }); + } + + + // Send the request + if (utils.isStream(data)) { + let ended = false; + let errored = false; + + data.on('end', () => { + ended = true; + }); + + data.once('error', err => { + errored = true; + req.destroy(err); + }); + + data.on('close', () => { + if (!ended && !errored) { + abort(new CanceledError('Request stream has been aborted', config, req)); + } + }); + + data.pipe(req); + } else { + req.end(data); + } + }); +} + +export const __setProxy = setProxy; diff --git a/node_modules/axios/lib/adapters/xhr.js b/node_modules/axios/lib/adapters/xhr.js new file mode 100644 index 00000000..e9b8e805 --- /dev/null +++ b/node_modules/axios/lib/adapters/xhr.js @@ -0,0 +1,190 @@ +import utils from './../utils.js'; +import settle from './../core/settle.js'; +import transitionalDefaults from '../defaults/transitional.js'; +import AxiosError from '../core/AxiosError.js'; +import CanceledError from '../cancel/CanceledError.js'; +import parseProtocol from '../helpers/parseProtocol.js'; +import platform from '../platform/index.js'; +import AxiosHeaders from '../core/AxiosHeaders.js'; +import progressEventReducer from '../helpers/progressEventReducer.js'; +import resolveConfig from "../helpers/resolveConfig.js"; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +export default isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +} diff --git a/node_modules/axios/lib/axios.js b/node_modules/axios/lib/axios.js new file mode 100644 index 00000000..873f246d --- /dev/null +++ b/node_modules/axios/lib/axios.js @@ -0,0 +1,89 @@ +'use strict'; + +import utils from './utils.js'; +import bind from './helpers/bind.js'; +import Axios from './core/Axios.js'; +import mergeConfig from './core/mergeConfig.js'; +import defaults from './defaults/index.js'; +import formDataToJSON from './helpers/formDataToJSON.js'; +import CanceledError from './cancel/CanceledError.js'; +import CancelToken from './cancel/CancelToken.js'; +import isCancel from './cancel/isCancel.js'; +import {VERSION} from './env/data.js'; +import toFormData from './helpers/toFormData.js'; +import AxiosError from './core/AxiosError.js'; +import spread from './helpers/spread.js'; +import isAxiosError from './helpers/isAxiosError.js'; +import AxiosHeaders from "./core/AxiosHeaders.js"; +import adapters from './adapters/adapters.js'; +import HttpStatusCode from './helpers/HttpStatusCode.js'; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios(defaultConfig); + const instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders; + +axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode; + +axios.default = axios; + +// this module should only have a default export +export default axios diff --git a/node_modules/axios/lib/cancel/CancelToken.js b/node_modules/axios/lib/cancel/CancelToken.js new file mode 100644 index 00000000..20d8f68a --- /dev/null +++ b/node_modules/axios/lib/cancel/CancelToken.js @@ -0,0 +1,121 @@ +'use strict'; + +import CanceledError from './CanceledError.js'; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +export default CancelToken; diff --git a/node_modules/axios/lib/cancel/CanceledError.js b/node_modules/axios/lib/cancel/CanceledError.js new file mode 100644 index 00000000..880066ed --- /dev/null +++ b/node_modules/axios/lib/cancel/CanceledError.js @@ -0,0 +1,25 @@ +'use strict'; + +import AxiosError from '../core/AxiosError.js'; +import utils from '../utils.js'; + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +export default CanceledError; diff --git a/node_modules/axios/lib/cancel/isCancel.js b/node_modules/axios/lib/cancel/isCancel.js new file mode 100644 index 00000000..a444a129 --- /dev/null +++ b/node_modules/axios/lib/cancel/isCancel.js @@ -0,0 +1,5 @@ +'use strict'; + +export default function isCancel(value) { + return !!(value && value.__CANCEL__); +} diff --git a/node_modules/axios/lib/core/Axios.js b/node_modules/axios/lib/core/Axios.js new file mode 100644 index 00000000..2765bbbd --- /dev/null +++ b/node_modules/axios/lib/core/Axios.js @@ -0,0 +1,228 @@ +'use strict'; + +import utils from './../utils.js'; +import buildURL from '../helpers/buildURL.js'; +import InterceptorManager from './InterceptorManager.js'; +import dispatchRequest from './dispatchRequest.js'; +import mergeConfig from './mergeConfig.js'; +import buildFullPath from './buildFullPath.js'; +import validator from '../helpers/validator.js'; +import AxiosHeaders from './AxiosHeaders.js'; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + } + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils.merge( + headers.common, + headers[config.method] + ); + + headers && utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +export default Axios; diff --git a/node_modules/axios/lib/core/AxiosError.js b/node_modules/axios/lib/core/AxiosError.js new file mode 100644 index 00000000..7141a8cd --- /dev/null +++ b/node_modules/axios/lib/core/AxiosError.js @@ -0,0 +1,100 @@ +'use strict'; + +import utils from '../utils.js'; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype); + + utils.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +export default AxiosError; diff --git a/node_modules/axios/lib/core/AxiosHeaders.js b/node_modules/axios/lib/core/AxiosHeaders.js new file mode 100644 index 00000000..7b576e9e --- /dev/null +++ b/node_modules/axios/lib/core/AxiosHeaders.js @@ -0,0 +1,302 @@ +'use strict'; + +import utils from '../utils.js'; +import parseHeaders from '../helpers/parseHeaders.js'; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils.isString(value)) return; + + if (utils.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite) + } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils.forEach(this, (value, header) => { + const key = utils.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils.freezeMethods(AxiosHeaders); + +export default AxiosHeaders; diff --git a/node_modules/axios/lib/core/InterceptorManager.js b/node_modules/axios/lib/core/InterceptorManager.js new file mode 100644 index 00000000..6657a9d2 --- /dev/null +++ b/node_modules/axios/lib/core/InterceptorManager.js @@ -0,0 +1,71 @@ +'use strict'; + +import utils from './../utils.js'; + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +export default InterceptorManager; diff --git a/node_modules/axios/lib/core/README.md b/node_modules/axios/lib/core/README.md new file mode 100644 index 00000000..84559ce7 --- /dev/null +++ b/node_modules/axios/lib/core/README.md @@ -0,0 +1,8 @@ +# axios // core + +The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are: + +- Dispatching requests + - Requests sent via `adapters/` (see lib/adapters/README.md) +- Managing interceptors +- Handling config diff --git a/node_modules/axios/lib/core/buildFullPath.js b/node_modules/axios/lib/core/buildFullPath.js new file mode 100644 index 00000000..b60927c0 --- /dev/null +++ b/node_modules/axios/lib/core/buildFullPath.js @@ -0,0 +1,21 @@ +'use strict'; + +import isAbsoluteURL from '../helpers/isAbsoluteURL.js'; +import combineURLs from '../helpers/combineURLs.js'; + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +export default function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} diff --git a/node_modules/axios/lib/core/dispatchRequest.js b/node_modules/axios/lib/core/dispatchRequest.js new file mode 100644 index 00000000..9e306aac --- /dev/null +++ b/node_modules/axios/lib/core/dispatchRequest.js @@ -0,0 +1,81 @@ +'use strict'; + +import transformData from './transformData.js'; +import isCancel from '../cancel/isCancel.js'; +import defaults from '../defaults/index.js'; +import CanceledError from '../cancel/CanceledError.js'; +import AxiosHeaders from '../core/AxiosHeaders.js'; +import adapters from "../adapters/adapters.js"; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +export default function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} diff --git a/node_modules/axios/lib/core/mergeConfig.js b/node_modules/axios/lib/core/mergeConfig.js new file mode 100644 index 00000000..e4600e57 --- /dev/null +++ b/node_modules/axios/lib/core/mergeConfig.js @@ -0,0 +1,106 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosHeaders from "./AxiosHeaders.js"; + +const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +export default function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge.call({caseless}, target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} diff --git a/node_modules/axios/lib/core/settle.js b/node_modules/axios/lib/core/settle.js new file mode 100644 index 00000000..ac905c43 --- /dev/null +++ b/node_modules/axios/lib/core/settle.js @@ -0,0 +1,27 @@ +'use strict'; + +import AxiosError from './AxiosError.js'; + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +export default function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} diff --git a/node_modules/axios/lib/core/transformData.js b/node_modules/axios/lib/core/transformData.js new file mode 100644 index 00000000..eeb5a8a1 --- /dev/null +++ b/node_modules/axios/lib/core/transformData.js @@ -0,0 +1,28 @@ +'use strict'; + +import utils from './../utils.js'; +import defaults from '../defaults/index.js'; +import AxiosHeaders from '../core/AxiosHeaders.js'; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +export default function transformData(fns, response) { + const config = this || defaults; + const context = response || config; + const headers = AxiosHeaders.from(context.headers); + let data = context.data; + + utils.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} diff --git a/node_modules/axios/lib/defaults/index.js b/node_modules/axios/lib/defaults/index.js new file mode 100644 index 00000000..e543fea2 --- /dev/null +++ b/node_modules/axios/lib/defaults/index.js @@ -0,0 +1,161 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosError from '../core/AxiosError.js'; +import transitionalDefaults from './transitional.js'; +import toFormData from '../helpers/toFormData.js'; +import toURLEncodedForm from '../helpers/toURLEncodedForm.js'; +import platform from '../platform/index.js'; +import formDataToJSON from '../helpers/formDataToJSON.js'; + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils.isObject(data); + + if (isObjectPayload && utils.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) || + utils.isReadableStream(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils.isResponse(data) || utils.isReadableStream(data)) { + return data; + } + + if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +export default defaults; diff --git a/node_modules/axios/lib/defaults/transitional.js b/node_modules/axios/lib/defaults/transitional.js new file mode 100644 index 00000000..f8913319 --- /dev/null +++ b/node_modules/axios/lib/defaults/transitional.js @@ -0,0 +1,7 @@ +'use strict'; + +export default { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; diff --git a/node_modules/axios/lib/env/README.md b/node_modules/axios/lib/env/README.md new file mode 100644 index 00000000..b41baff3 --- /dev/null +++ b/node_modules/axios/lib/env/README.md @@ -0,0 +1,3 @@ +# axios // env + +The `data.js` file is updated automatically when the package version is upgrading. Please do not edit it manually. diff --git a/node_modules/axios/lib/env/classes/FormData.js b/node_modules/axios/lib/env/classes/FormData.js new file mode 100644 index 00000000..862adb93 --- /dev/null +++ b/node_modules/axios/lib/env/classes/FormData.js @@ -0,0 +1,2 @@ +import _FormData from 'form-data'; +export default typeof FormData !== 'undefined' ? FormData : _FormData; diff --git a/node_modules/axios/lib/env/data.js b/node_modules/axios/lib/env/data.js new file mode 100644 index 00000000..487d829f --- /dev/null +++ b/node_modules/axios/lib/env/data.js @@ -0,0 +1 @@ +export const VERSION = "1.7.2"; \ No newline at end of file diff --git a/node_modules/axios/lib/helpers/AxiosTransformStream.js b/node_modules/axios/lib/helpers/AxiosTransformStream.js new file mode 100644 index 00000000..92ba8833 --- /dev/null +++ b/node_modules/axios/lib/helpers/AxiosTransformStream.js @@ -0,0 +1,192 @@ +'use strict'; + +import stream from 'stream'; +import utils from '../utils.js'; +import throttle from './throttle.js'; +import speedometer from './speedometer.js'; + +const kInternals = Symbol('internals'); + +class AxiosTransformStream extends stream.Transform{ + constructor(options) { + options = utils.toFlatObject(options, { + maxRate: 0, + chunkSize: 64 * 1024, + minChunkSize: 100, + timeWindow: 500, + ticksRate: 2, + samplesCount: 15 + }, null, (prop, source) => { + return !utils.isUndefined(source[prop]); + }); + + super({ + readableHighWaterMark: options.chunkSize + }); + + const self = this; + + const internals = this[kInternals] = { + length: options.length, + timeWindow: options.timeWindow, + ticksRate: options.ticksRate, + chunkSize: options.chunkSize, + maxRate: options.maxRate, + minChunkSize: options.minChunkSize, + bytesSeen: 0, + isCaptured: false, + notifiedBytesLoaded: 0, + ts: Date.now(), + bytes: 0, + onReadCallback: null + }; + + const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow); + + this.on('newListener', event => { + if (event === 'progress') { + if (!internals.isCaptured) { + internals.isCaptured = true; + } + } + }); + + let bytesNotified = 0; + + internals.updateProgress = throttle(function throttledHandler() { + const totalBytes = internals.length; + const bytesTransferred = internals.bytesSeen; + const progressBytes = bytesTransferred - bytesNotified; + if (!progressBytes || self.destroyed) return; + + const rate = _speedometer(progressBytes); + + bytesNotified = bytesTransferred; + + process.nextTick(() => { + self.emit('progress', { + loaded: bytesTransferred, + total: totalBytes, + progress: totalBytes ? (bytesTransferred / totalBytes) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && totalBytes && bytesTransferred <= totalBytes ? + (totalBytes - bytesTransferred) / rate : undefined, + lengthComputable: totalBytes != null + }); + }); + }, internals.ticksRate); + + const onFinish = () => { + internals.updateProgress.call(true); + }; + + this.once('end', onFinish); + this.once('error', onFinish); + } + + _read(size) { + const internals = this[kInternals]; + + if (internals.onReadCallback) { + internals.onReadCallback(); + } + + return super._read(size); + } + + _transform(chunk, encoding, callback) { + const self = this; + const internals = this[kInternals]; + const maxRate = internals.maxRate; + + const readableHighWaterMark = this.readableHighWaterMark; + + const timeWindow = internals.timeWindow; + + const divider = 1000 / timeWindow; + const bytesThreshold = (maxRate / divider); + const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0; + + function pushChunk(_chunk, _callback) { + const bytes = Buffer.byteLength(_chunk); + internals.bytesSeen += bytes; + internals.bytes += bytes; + + if (internals.isCaptured) { + internals.updateProgress(); + } + + if (self.push(_chunk)) { + process.nextTick(_callback); + } else { + internals.onReadCallback = () => { + internals.onReadCallback = null; + process.nextTick(_callback); + }; + } + } + + const transformChunk = (_chunk, _callback) => { + const chunkSize = Buffer.byteLength(_chunk); + let chunkRemainder = null; + let maxChunkSize = readableHighWaterMark; + let bytesLeft; + let passed = 0; + + if (maxRate) { + const now = Date.now(); + + if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) { + internals.ts = now; + bytesLeft = bytesThreshold - internals.bytes; + internals.bytes = bytesLeft < 0 ? -bytesLeft : 0; + passed = 0; + } + + bytesLeft = bytesThreshold - internals.bytes; + } + + if (maxRate) { + if (bytesLeft <= 0) { + // next time window + return setTimeout(() => { + _callback(null, _chunk); + }, timeWindow - passed); + } + + if (bytesLeft < maxChunkSize) { + maxChunkSize = bytesLeft; + } + } + + if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) { + chunkRemainder = _chunk.subarray(maxChunkSize); + _chunk = _chunk.subarray(0, maxChunkSize); + } + + pushChunk(_chunk, chunkRemainder ? () => { + process.nextTick(_callback, null, chunkRemainder); + } : _callback); + }; + + transformChunk(chunk, function transformNextChunk(err, _chunk) { + if (err) { + return callback(err); + } + + if (_chunk) { + transformChunk(_chunk, transformNextChunk); + } else { + callback(null); + } + }); + } + + setLength(length) { + this[kInternals].length = +length; + return this; + } +} + +export default AxiosTransformStream; diff --git a/node_modules/axios/lib/helpers/AxiosURLSearchParams.js b/node_modules/axios/lib/helpers/AxiosURLSearchParams.js new file mode 100644 index 00000000..b9aa9f02 --- /dev/null +++ b/node_modules/axios/lib/helpers/AxiosURLSearchParams.js @@ -0,0 +1,58 @@ +'use strict'; + +import toFormData from './toFormData.js'; + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode); + } : encode; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +export default AxiosURLSearchParams; diff --git a/node_modules/axios/lib/helpers/HttpStatusCode.js b/node_modules/axios/lib/helpers/HttpStatusCode.js new file mode 100644 index 00000000..b3e7adca --- /dev/null +++ b/node_modules/axios/lib/helpers/HttpStatusCode.js @@ -0,0 +1,71 @@ +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +export default HttpStatusCode; diff --git a/node_modules/axios/lib/helpers/README.md b/node_modules/axios/lib/helpers/README.md new file mode 100644 index 00000000..4ae34193 --- /dev/null +++ b/node_modules/axios/lib/helpers/README.md @@ -0,0 +1,7 @@ +# axios // helpers + +The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like: + +- Browser polyfills +- Managing cookies +- Parsing HTTP headers diff --git a/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js b/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js new file mode 100644 index 00000000..d1791f0b --- /dev/null +++ b/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js @@ -0,0 +1,28 @@ +"use strict"; + +import stream from "stream"; + +class ZlibHeaderTransformStream extends stream.Transform { + __transform(chunk, encoding, callback) { + this.push(chunk); + callback(); + } + + _transform(chunk, encoding, callback) { + if (chunk.length !== 0) { + this._transform = this.__transform; + + // Add Default Compression headers if no zlib headers are present + if (chunk[0] !== 120) { // Hex: 78 + const header = Buffer.alloc(2); + header[0] = 120; // Hex: 78 + header[1] = 156; // Hex: 9C + this.push(header, encoding); + } + } + + this.__transform(chunk, encoding, callback); + } +} + +export default ZlibHeaderTransformStream; diff --git a/node_modules/axios/lib/helpers/bind.js b/node_modules/axios/lib/helpers/bind.js new file mode 100644 index 00000000..b3aa83b7 --- /dev/null +++ b/node_modules/axios/lib/helpers/bind.js @@ -0,0 +1,7 @@ +'use strict'; + +export default function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} diff --git a/node_modules/axios/lib/helpers/buildURL.js b/node_modules/axios/lib/helpers/buildURL.js new file mode 100644 index 00000000..d769fdf4 --- /dev/null +++ b/node_modules/axios/lib/helpers/buildURL.js @@ -0,0 +1,63 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js'; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +export default function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} diff --git a/node_modules/axios/lib/helpers/callbackify.js b/node_modules/axios/lib/helpers/callbackify.js new file mode 100644 index 00000000..4603badc --- /dev/null +++ b/node_modules/axios/lib/helpers/callbackify.js @@ -0,0 +1,16 @@ +import utils from "../utils.js"; + +const callbackify = (fn, reducer) => { + return utils.isAsyncFn(fn) ? function (...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; +} + +export default callbackify; diff --git a/node_modules/axios/lib/helpers/combineURLs.js b/node_modules/axios/lib/helpers/combineURLs.js new file mode 100644 index 00000000..9f04f020 --- /dev/null +++ b/node_modules/axios/lib/helpers/combineURLs.js @@ -0,0 +1,15 @@ +'use strict'; + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +export default function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} diff --git a/node_modules/axios/lib/helpers/composeSignals.js b/node_modules/axios/lib/helpers/composeSignals.js new file mode 100644 index 00000000..3f6f2035 --- /dev/null +++ b/node_modules/axios/lib/helpers/composeSignals.js @@ -0,0 +1,46 @@ +import CanceledError from "../cancel/CanceledError.js"; +import AxiosError from "../core/AxiosError.js"; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + } + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)) + }, timeout) + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + } + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +} + +export default composeSignals; diff --git a/node_modules/axios/lib/helpers/cookies.js b/node_modules/axios/lib/helpers/cookies.js new file mode 100644 index 00000000..d039ac4f --- /dev/null +++ b/node_modules/axios/lib/helpers/cookies.js @@ -0,0 +1,42 @@ +import utils from './../utils.js'; +import platform from '../platform/index.js'; + +export default platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils.isString(path) && cookie.push('path=' + path); + + utils.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + diff --git a/node_modules/axios/lib/helpers/deprecatedMethod.js b/node_modules/axios/lib/helpers/deprecatedMethod.js new file mode 100644 index 00000000..9e8fae6b --- /dev/null +++ b/node_modules/axios/lib/helpers/deprecatedMethod.js @@ -0,0 +1,26 @@ +'use strict'; + +/*eslint no-console:0*/ + +/** + * Supply a warning to the developer that a method they are using + * has been deprecated. + * + * @param {string} method The name of the deprecated method + * @param {string} [instead] The alternate method to use if applicable + * @param {string} [docs] The documentation URL to get further details + * + * @returns {void} + */ +export default function deprecatedMethod(method, instead, docs) { + try { + console.warn( + 'DEPRECATED method `' + method + '`.' + + (instead ? ' Use `' + instead + '` instead.' : '') + + ' This method will be removed in a future release.'); + + if (docs) { + console.warn('For more information about usage see ' + docs); + } + } catch (e) { /* Ignore */ } +} diff --git a/node_modules/axios/lib/helpers/formDataToJSON.js b/node_modules/axios/lib/helpers/formDataToJSON.js new file mode 100644 index 00000000..906ce602 --- /dev/null +++ b/node_modules/axios/lib/helpers/formDataToJSON.js @@ -0,0 +1,95 @@ +'use strict'; + +import utils from '../utils.js'; + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils.isArray(target) ? target.length : name; + + if (isLast) { + if (utils.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils.isFormData(formData) && utils.isFunction(formData.entries)) { + const obj = {}; + + utils.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +export default formDataToJSON; diff --git a/node_modules/axios/lib/helpers/formDataToStream.js b/node_modules/axios/lib/helpers/formDataToStream.js new file mode 100644 index 00000000..9187e73e --- /dev/null +++ b/node_modules/axios/lib/helpers/formDataToStream.js @@ -0,0 +1,111 @@ +import {TextEncoder} from 'util'; +import {Readable} from 'stream'; +import utils from "../utils.js"; +import readBlob from "./readBlob.js"; + +const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_'; + +const textEncoder = new TextEncoder(); + +const CRLF = '\r\n'; +const CRLF_BYTES = textEncoder.encode(CRLF); +const CRLF_BYTES_COUNT = 2; + +class FormDataPart { + constructor(name, value) { + const {escapeName} = this.constructor; + const isStringValue = utils.isString(value); + + let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${ + !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : '' + }${CRLF}`; + + if (isStringValue) { + value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF)); + } else { + headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}` + } + + this.headers = textEncoder.encode(headers + CRLF); + + this.contentLength = isStringValue ? value.byteLength : value.size; + + this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT; + + this.name = name; + this.value = value; + } + + async *encode(){ + yield this.headers; + + const {value} = this; + + if(utils.isTypedArray(value)) { + yield value; + } else { + yield* readBlob(value); + } + + yield CRLF_BYTES; + } + + static escapeName(name) { + return String(name).replace(/[\r\n"]/g, (match) => ({ + '\r' : '%0D', + '\n' : '%0A', + '"' : '%22', + }[match])); + } +} + +const formDataToStream = (form, headersHandler, options) => { + const { + tag = 'form-data-boundary', + size = 25, + boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET) + } = options || {}; + + if(!utils.isFormData(form)) { + throw TypeError('FormData instance required'); + } + + if (boundary.length < 1 || boundary.length > 70) { + throw Error('boundary must be 10-70 characters long') + } + + const boundaryBytes = textEncoder.encode('--' + boundary + CRLF); + const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF); + let contentLength = footerBytes.byteLength; + + const parts = Array.from(form.entries()).map(([name, value]) => { + const part = new FormDataPart(name, value); + contentLength += part.size; + return part; + }); + + contentLength += boundaryBytes.byteLength * parts.length; + + contentLength = utils.toFiniteNumber(contentLength); + + const computedHeaders = { + 'Content-Type': `multipart/form-data; boundary=${boundary}` + } + + if (Number.isFinite(contentLength)) { + computedHeaders['Content-Length'] = contentLength; + } + + headersHandler && headersHandler(computedHeaders); + + return Readable.from((async function *() { + for(const part of parts) { + yield boundaryBytes; + yield* part.encode(); + } + + yield footerBytes; + })()); +}; + +export default formDataToStream; diff --git a/node_modules/axios/lib/helpers/fromDataURI.js b/node_modules/axios/lib/helpers/fromDataURI.js new file mode 100644 index 00000000..eb71d3f3 --- /dev/null +++ b/node_modules/axios/lib/helpers/fromDataURI.js @@ -0,0 +1,53 @@ +'use strict'; + +import AxiosError from '../core/AxiosError.js'; +import parseProtocol from './parseProtocol.js'; +import platform from '../platform/index.js'; + +const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/; + +/** + * Parse data uri to a Buffer or Blob + * + * @param {String} uri + * @param {?Boolean} asBlob + * @param {?Object} options + * @param {?Function} options.Blob + * + * @returns {Buffer|Blob} + */ +export default function fromDataURI(uri, asBlob, options) { + const _Blob = options && options.Blob || platform.classes.Blob; + const protocol = parseProtocol(uri); + + if (asBlob === undefined && _Blob) { + asBlob = true; + } + + if (protocol === 'data') { + uri = protocol.length ? uri.slice(protocol.length + 1) : uri; + + const match = DATA_URL_PATTERN.exec(uri); + + if (!match) { + throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL); + } + + const mime = match[1]; + const isBase64 = match[2]; + const body = match[3]; + const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8'); + + if (asBlob) { + if (!_Blob) { + throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT); + } + + return new _Blob([buffer], {type: mime}); + } + + return buffer; + } + + throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT); +} diff --git a/node_modules/axios/lib/helpers/isAbsoluteURL.js b/node_modules/axios/lib/helpers/isAbsoluteURL.js new file mode 100644 index 00000000..4747a457 --- /dev/null +++ b/node_modules/axios/lib/helpers/isAbsoluteURL.js @@ -0,0 +1,15 @@ +'use strict'; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +export default function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} diff --git a/node_modules/axios/lib/helpers/isAxiosError.js b/node_modules/axios/lib/helpers/isAxiosError.js new file mode 100644 index 00000000..da6cd63f --- /dev/null +++ b/node_modules/axios/lib/helpers/isAxiosError.js @@ -0,0 +1,14 @@ +'use strict'; + +import utils from './../utils.js'; + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +export default function isAxiosError(payload) { + return utils.isObject(payload) && (payload.isAxiosError === true); +} diff --git a/node_modules/axios/lib/helpers/isURLSameOrigin.js b/node_modules/axios/lib/helpers/isURLSameOrigin.js new file mode 100644 index 00000000..a8678a4e --- /dev/null +++ b/node_modules/axios/lib/helpers/isURLSameOrigin.js @@ -0,0 +1,67 @@ +'use strict'; + +import utils from './../utils.js'; +import platform from '../platform/index.js'; + +export default platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); diff --git a/node_modules/axios/lib/helpers/null.js b/node_modules/axios/lib/helpers/null.js new file mode 100644 index 00000000..b9f82c46 --- /dev/null +++ b/node_modules/axios/lib/helpers/null.js @@ -0,0 +1,2 @@ +// eslint-disable-next-line strict +export default null; diff --git a/node_modules/axios/lib/helpers/parseHeaders.js b/node_modules/axios/lib/helpers/parseHeaders.js new file mode 100644 index 00000000..50af9480 --- /dev/null +++ b/node_modules/axios/lib/helpers/parseHeaders.js @@ -0,0 +1,55 @@ +'use strict'; + +import utils from './../utils.js'; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +export default rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; diff --git a/node_modules/axios/lib/helpers/parseProtocol.js b/node_modules/axios/lib/helpers/parseProtocol.js new file mode 100644 index 00000000..586ec964 --- /dev/null +++ b/node_modules/axios/lib/helpers/parseProtocol.js @@ -0,0 +1,6 @@ +'use strict'; + +export default function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} diff --git a/node_modules/axios/lib/helpers/progressEventReducer.js b/node_modules/axios/lib/helpers/progressEventReducer.js new file mode 100644 index 00000000..7829be34 --- /dev/null +++ b/node_modules/axios/lib/helpers/progressEventReducer.js @@ -0,0 +1,32 @@ +import speedometer from "./speedometer.js"; +import throttle from "./throttle.js"; + +export default (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +} diff --git a/node_modules/axios/lib/helpers/readBlob.js b/node_modules/axios/lib/helpers/readBlob.js new file mode 100644 index 00000000..6de748e8 --- /dev/null +++ b/node_modules/axios/lib/helpers/readBlob.js @@ -0,0 +1,15 @@ +const {asyncIterator} = Symbol; + +const readBlob = async function* (blob) { + if (blob.stream) { + yield* blob.stream() + } else if (blob.arrayBuffer) { + yield await blob.arrayBuffer() + } else if (blob[asyncIterator]) { + yield* blob[asyncIterator](); + } else { + yield blob; + } +} + +export default readBlob; diff --git a/node_modules/axios/lib/helpers/resolveConfig.js b/node_modules/axios/lib/helpers/resolveConfig.js new file mode 100644 index 00000000..5e84c5cc --- /dev/null +++ b/node_modules/axios/lib/helpers/resolveConfig.js @@ -0,0 +1,57 @@ +import platform from "../platform/index.js"; +import utils from "../utils.js"; +import isURLSameOrigin from "./isURLSameOrigin.js"; +import cookies from "./cookies.js"; +import buildFullPath from "../core/buildFullPath.js"; +import mergeConfig from "../core/mergeConfig.js"; +import AxiosHeaders from "../core/AxiosHeaders.js"; +import buildURL from "./buildURL.js"; + +export default (config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +} + diff --git a/node_modules/axios/lib/helpers/speedometer.js b/node_modules/axios/lib/helpers/speedometer.js new file mode 100644 index 00000000..3b3c6662 --- /dev/null +++ b/node_modules/axios/lib/helpers/speedometer.js @@ -0,0 +1,55 @@ +'use strict'; + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +export default speedometer; diff --git a/node_modules/axios/lib/helpers/spread.js b/node_modules/axios/lib/helpers/spread.js new file mode 100644 index 00000000..13479cb2 --- /dev/null +++ b/node_modules/axios/lib/helpers/spread.js @@ -0,0 +1,28 @@ +'use strict'; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +export default function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} diff --git a/node_modules/axios/lib/helpers/throttle.js b/node_modules/axios/lib/helpers/throttle.js new file mode 100644 index 00000000..a3204fde --- /dev/null +++ b/node_modules/axios/lib/helpers/throttle.js @@ -0,0 +1,35 @@ +'use strict'; + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +export default throttle; diff --git a/node_modules/axios/lib/helpers/toFormData.js b/node_modules/axios/lib/helpers/toFormData.js new file mode 100644 index 00000000..a41e966c --- /dev/null +++ b/node_modules/axios/lib/helpers/toFormData.js @@ -0,0 +1,219 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosError from '../core/AxiosError.js'; +// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored +import PlatformFormData from '../platform/node/classes/FormData.js'; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils.isPlainObject(thing) || utils.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (PlatformFormData || FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils.isSpecCompliantForm(formData); + + if (!utils.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils.isArray(value) && isFlatArray(value)) || + ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils.forEach(value, function each(el, key) { + const result = !(utils.isUndefined(el) || el === null) && visitor.call( + formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +export default toFormData; diff --git a/node_modules/axios/lib/helpers/toURLEncodedForm.js b/node_modules/axios/lib/helpers/toURLEncodedForm.js new file mode 100644 index 00000000..988a38a1 --- /dev/null +++ b/node_modules/axios/lib/helpers/toURLEncodedForm.js @@ -0,0 +1,18 @@ +'use strict'; + +import utils from '../utils.js'; +import toFormData from './toFormData.js'; +import platform from '../platform/index.js'; + +export default function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} diff --git a/node_modules/axios/lib/helpers/trackStream.js b/node_modules/axios/lib/helpers/trackStream.js new file mode 100644 index 00000000..6241d06f --- /dev/null +++ b/node_modules/axios/lib/helpers/trackStream.js @@ -0,0 +1,55 @@ + + +export const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +} + +export const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +} + +export const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +} diff --git a/node_modules/axios/lib/helpers/validator.js b/node_modules/axios/lib/helpers/validator.js new file mode 100644 index 00000000..14b46960 --- /dev/null +++ b/node_modules/axios/lib/helpers/validator.js @@ -0,0 +1,91 @@ +'use strict'; + +import {VERSION} from '../env/data.js'; +import AxiosError from '../core/AxiosError.js'; + +const validators = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +export default { + assertOptions, + validators +}; diff --git a/node_modules/axios/lib/platform/browser/classes/Blob.js b/node_modules/axios/lib/platform/browser/classes/Blob.js new file mode 100644 index 00000000..6c506c48 --- /dev/null +++ b/node_modules/axios/lib/platform/browser/classes/Blob.js @@ -0,0 +1,3 @@ +'use strict' + +export default typeof Blob !== 'undefined' ? Blob : null diff --git a/node_modules/axios/lib/platform/browser/classes/FormData.js b/node_modules/axios/lib/platform/browser/classes/FormData.js new file mode 100644 index 00000000..f36d31b2 --- /dev/null +++ b/node_modules/axios/lib/platform/browser/classes/FormData.js @@ -0,0 +1,3 @@ +'use strict'; + +export default typeof FormData !== 'undefined' ? FormData : null; diff --git a/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js b/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js new file mode 100644 index 00000000..b7dae953 --- /dev/null +++ b/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js @@ -0,0 +1,4 @@ +'use strict'; + +import AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js'; +export default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; diff --git a/node_modules/axios/lib/platform/browser/index.js b/node_modules/axios/lib/platform/browser/index.js new file mode 100644 index 00000000..08c206f3 --- /dev/null +++ b/node_modules/axios/lib/platform/browser/index.js @@ -0,0 +1,13 @@ +import URLSearchParams from './classes/URLSearchParams.js' +import FormData from './classes/FormData.js' +import Blob from './classes/Blob.js' + +export default { + isBrowser: true, + classes: { + URLSearchParams, + FormData, + Blob + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}; diff --git a/node_modules/axios/lib/platform/common/utils.js b/node_modules/axios/lib/platform/common/utils.js new file mode 100644 index 00000000..d60921b0 --- /dev/null +++ b/node_modules/axios/lib/platform/common/utils.js @@ -0,0 +1,50 @@ +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +export { + hasBrowserEnv, + hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv, + origin +} diff --git a/node_modules/axios/lib/platform/index.js b/node_modules/axios/lib/platform/index.js new file mode 100644 index 00000000..860ba21a --- /dev/null +++ b/node_modules/axios/lib/platform/index.js @@ -0,0 +1,7 @@ +import platform from './node/index.js'; +import * as utils from './common/utils.js'; + +export default { + ...utils, + ...platform +} diff --git a/node_modules/axios/lib/platform/node/classes/FormData.js b/node_modules/axios/lib/platform/node/classes/FormData.js new file mode 100644 index 00000000..b07f9476 --- /dev/null +++ b/node_modules/axios/lib/platform/node/classes/FormData.js @@ -0,0 +1,3 @@ +import FormData from 'form-data'; + +export default FormData; diff --git a/node_modules/axios/lib/platform/node/classes/URLSearchParams.js b/node_modules/axios/lib/platform/node/classes/URLSearchParams.js new file mode 100644 index 00000000..fba58428 --- /dev/null +++ b/node_modules/axios/lib/platform/node/classes/URLSearchParams.js @@ -0,0 +1,4 @@ +'use strict'; + +import url from 'url'; +export default url.URLSearchParams; diff --git a/node_modules/axios/lib/platform/node/index.js b/node_modules/axios/lib/platform/node/index.js new file mode 100644 index 00000000..aef514aa --- /dev/null +++ b/node_modules/axios/lib/platform/node/index.js @@ -0,0 +1,12 @@ +import URLSearchParams from './classes/URLSearchParams.js' +import FormData from './classes/FormData.js' + +export default { + isNode: true, + classes: { + URLSearchParams, + FormData, + Blob: typeof Blob !== 'undefined' && Blob || null + }, + protocols: [ 'http', 'https', 'file', 'data' ] +}; diff --git a/node_modules/axios/lib/utils.js b/node_modules/axios/lib/utils.js new file mode 100644 index 00000000..72b9f1da --- /dev/null +++ b/node_modules/axios/lib/utils.js @@ -0,0 +1,728 @@ +'use strict'; + +import bind from './helpers/bind.js'; + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +} + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +} + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +} + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + } + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +} + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +} + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +} + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +} + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +} + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +} + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +} + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +} + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +} + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + } + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +} + +const noop = () => {} + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +} + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz' + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +} + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0] + } + + return str; +} + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + } + + return visit(obj, 0); +} + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +export default { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; diff --git a/node_modules/axios/package.json b/node_modules/axios/package.json new file mode 100644 index 00000000..860d6140 --- /dev/null +++ b/node_modules/axios/package.json @@ -0,0 +1,219 @@ +{ + "name": "axios", + "version": "1.7.2", + "description": "Promise based HTTP client for the browser and node.js", + "main": "index.js", + "exports": { + ".": { + "types": { + "require": "./index.d.cts", + "default": "./index.d.ts" + }, + "browser": { + "require": "./dist/browser/axios.cjs", + "default": "./index.js" + }, + "default": { + "require": "./dist/node/axios.cjs", + "default": "./index.js" + } + }, + "./lib/adapters/http.js": "./lib/adapters/http.js", + "./lib/adapters/xhr.js": "./lib/adapters/xhr.js", + "./unsafe/*": "./lib/*", + "./unsafe/core/settle.js": "./lib/core/settle.js", + "./unsafe/core/buildFullPath.js": "./lib/core/buildFullPath.js", + "./unsafe/helpers/isAbsoluteURL.js": "./lib/helpers/isAbsoluteURL.js", + "./unsafe/helpers/buildURL.js": "./lib/helpers/buildURL.js", + "./unsafe/helpers/combineURLs.js": "./lib/helpers/combineURLs.js", + "./unsafe/adapters/http.js": "./lib/adapters/http.js", + "./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js", + "./unsafe/utils.js": "./lib/utils.js", + "./package.json": "./package.json" + }, + "type": "module", + "types": "index.d.ts", + "scripts": { + "test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports", + "test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js", + "test:dtslint": "dtslint --localTs node_modules/typescript/lib", + "test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit", + "test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit", + "test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run", + "test:karma:firefox": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: Browsers=Firefox karma start karma.conf.cjs --single-run", + "test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs", + "test:build:version": "node ./bin/check-build-version.js", + "start": "node ./sandbox/server.js", + "preversion": "gulp version", + "version": "npm run build && git add dist && git add package.json", + "prepublishOnly": "npm run test:build:version", + "postpublish": "git push && git push --tags", + "build": "gulp clear && cross-env NODE_ENV=production rollup -c -m", + "examples": "node ./examples/server.js", + "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", + "fix": "eslint --fix lib/**/*.js", + "prepare": "husky install && npm run prepare:hooks", + "prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"", + "release:dry": "release-it --dry-run --no-npm", + "release:info": "release-it --release-version", + "release:beta:no-npm": "release-it --preRelease=beta --no-npm", + "release:beta": "release-it --preRelease=beta", + "release:no-npm": "release-it --no-npm", + "release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md", + "release": "release-it" + }, + "repository": { + "type": "git", + "url": "https://github.com/axios/axios.git" + }, + "keywords": [ + "xhr", + "http", + "ajax", + "promise", + "node" + ], + "author": "Matt Zabriskie", + "license": "MIT", + "bugs": { + "url": "https://github.com/axios/axios/issues" + }, + "homepage": "https://axios-http.com", + "devDependencies": { + "@babel/core": "^7.23.9", + "@babel/preset-env": "^7.23.9", + "@commitlint/cli": "^17.8.1", + "@commitlint/config-conventional": "^17.8.1", + "@release-it/conventional-changelog": "^5.1.1", + "@rollup/plugin-babel": "^5.3.1", + "@rollup/plugin-commonjs": "^15.1.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^9.0.0", + "abortcontroller-polyfill": "^1.7.5", + "auto-changelog": "^2.4.0", + "body-parser": "^1.20.2", + "chalk": "^5.3.0", + "coveralls": "^3.1.1", + "cross-env": "^7.0.3", + "dev-null": "^0.1.1", + "dtslint": "^4.2.1", + "es6-promise": "^4.2.8", + "eslint": "^8.56.0", + "express": "^4.18.2", + "formdata-node": "^5.0.1", + "formidable": "^2.1.2", + "fs-extra": "^10.1.0", + "get-stream": "^3.0.0", + "gulp": "^4.0.2", + "gzip-size": "^7.0.0", + "handlebars": "^4.7.8", + "husky": "^8.0.3", + "istanbul-instrumenter-loader": "^3.0.1", + "jasmine-core": "^2.99.1", + "karma": "^6.3.17", + "karma-chrome-launcher": "^3.2.0", + "karma-firefox-launcher": "^2.1.2", + "karma-jasmine": "^1.1.2", + "karma-jasmine-ajax": "^0.1.13", + "karma-rollup-preprocessor": "^7.0.8", + "karma-safari-launcher": "^1.0.0", + "karma-sauce-launcher": "^4.3.6", + "karma-sinon": "^1.0.5", + "karma-sourcemap-loader": "^0.3.8", + "memoizee": "^0.4.15", + "minimist": "^1.2.8", + "mocha": "^10.3.0", + "multer": "^1.4.4", + "pretty-bytes": "^6.1.1", + "release-it": "^15.11.0", + "rollup": "^2.79.1", + "rollup-plugin-auto-external": "^2.0.0", + "rollup-plugin-bundle-size": "^1.0.3", + "rollup-plugin-terser": "^7.0.2", + "sinon": "^4.5.0", + "stream-throttle": "^0.1.3", + "string-replace-async": "^3.0.2", + "terser-webpack-plugin": "^4.2.3", + "typescript": "^4.9.5", + "@rollup/plugin-alias": "^5.1.0" + }, + "browser": { + "./lib/adapters/http.js": "./lib/helpers/null.js", + "./lib/platform/node/index.js": "./lib/platform/browser/index.js", + "./lib/platform/node/classes/FormData.js": "./lib/helpers/null.js" + }, + "jsdelivr": "dist/axios.min.js", + "unpkg": "dist/axios.min.js", + "typings": "./index.d.ts", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + }, + "bundlesize": [ + { + "path": "./dist/axios.min.js", + "threshold": "5kB" + } + ], + "contributors": [ + "Matt Zabriskie (https://github.com/mzabriskie)", + "Nick Uraltsev (https://github.com/nickuraltsev)", + "Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)", + "Jay (https://github.com/jasonsaayman)", + "Emily Morehouse (https://github.com/emilyemorehouse)", + "Rubén Norte (https://github.com/rubennorte)", + "Justin Beckwith (https://github.com/JustinBeckwith)", + "Martti Laine (https://github.com/codeclown)", + "Xianming Zhong (https://github.com/chinesedfan)", + "Rikki Gibson (https://github.com/RikkiGibson)", + "Remco Haszing (https://github.com/remcohaszing)", + "Yasu Flores (https://github.com/yasuf)", + "Ben Carp (https://github.com/carpben)" + ], + "sideEffects": false, + "release-it": { + "git": { + "commitMessage": "chore(release): v${version}", + "push": true, + "commit": true, + "tag": true, + "requireCommits": false, + "requireCleanWorkingDir": false + }, + "github": { + "release": true, + "draft": true + }, + "npm": { + "publish": false, + "ignoreVersion": false + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": "angular", + "infile": "CHANGELOG.md", + "header": "# Changelog" + } + }, + "hooks": { + "before:init": "npm test", + "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist && git add ./package-lock.json", + "before:release": "npm run release:changelog:fix", + "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}." + } + }, + "commitlint": { + "rules": { + "header-max-length": [ + 2, + "always", + 130 + ] + }, + "extends": [ + "@commitlint/config-conventional" + ] + } +} \ No newline at end of file diff --git a/project starter code/node_modules/base64-js/LICENSE b/node_modules/base64-js/LICENSE similarity index 100% rename from project starter code/node_modules/base64-js/LICENSE rename to node_modules/base64-js/LICENSE diff --git a/project starter code/node_modules/base64-js/README.md b/node_modules/base64-js/README.md similarity index 100% rename from project starter code/node_modules/base64-js/README.md rename to node_modules/base64-js/README.md diff --git a/project starter code/node_modules/base64-js/base64js.min.js b/node_modules/base64-js/base64js.min.js similarity index 100% rename from project starter code/node_modules/base64-js/base64js.min.js rename to node_modules/base64-js/base64js.min.js diff --git a/project starter code/node_modules/base64-js/index.d.ts b/node_modules/base64-js/index.d.ts similarity index 100% rename from project starter code/node_modules/base64-js/index.d.ts rename to node_modules/base64-js/index.d.ts diff --git a/project starter code/node_modules/base64-js/index.js b/node_modules/base64-js/index.js similarity index 100% rename from project starter code/node_modules/base64-js/index.js rename to node_modules/base64-js/index.js diff --git a/project starter code/node_modules/base64-js/package.json b/node_modules/base64-js/package.json similarity index 100% rename from project starter code/node_modules/base64-js/package.json rename to node_modules/base64-js/package.json diff --git a/project starter code/node_modules/bmp-js/.npmignore b/node_modules/bmp-js/.npmignore similarity index 100% rename from project starter code/node_modules/bmp-js/.npmignore rename to node_modules/bmp-js/.npmignore diff --git a/project starter code/node_modules/bmp-js/LICENSE b/node_modules/bmp-js/LICENSE similarity index 100% rename from project starter code/node_modules/bmp-js/LICENSE rename to node_modules/bmp-js/LICENSE diff --git a/project starter code/node_modules/bmp-js/README.md b/node_modules/bmp-js/README.md similarity index 100% rename from project starter code/node_modules/bmp-js/README.md rename to node_modules/bmp-js/README.md diff --git a/project starter code/node_modules/bmp-js/bmp-js.iml b/node_modules/bmp-js/bmp-js.iml similarity index 100% rename from project starter code/node_modules/bmp-js/bmp-js.iml rename to node_modules/bmp-js/bmp-js.iml diff --git a/project starter code/node_modules/bmp-js/index.js b/node_modules/bmp-js/index.js similarity index 100% rename from project starter code/node_modules/bmp-js/index.js rename to node_modules/bmp-js/index.js diff --git a/project starter code/node_modules/bmp-js/lib/decoder.js b/node_modules/bmp-js/lib/decoder.js similarity index 100% rename from project starter code/node_modules/bmp-js/lib/decoder.js rename to node_modules/bmp-js/lib/decoder.js diff --git a/project starter code/node_modules/bmp-js/lib/encoder.js b/node_modules/bmp-js/lib/encoder.js similarity index 100% rename from project starter code/node_modules/bmp-js/lib/encoder.js rename to node_modules/bmp-js/lib/encoder.js diff --git a/project starter code/node_modules/bmp-js/package.json b/node_modules/bmp-js/package.json similarity index 100% rename from project starter code/node_modules/bmp-js/package.json rename to node_modules/bmp-js/package.json diff --git a/project starter code/node_modules/bmp-js/test/bit1.bmp b/node_modules/bmp-js/test/bit1.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit1.bmp rename to node_modules/bmp-js/test/bit1.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_565.bmp b/node_modules/bmp-js/test/bit16_565.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_565.bmp rename to node_modules/bmp-js/test/bit16_565.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_565_out.bmp b/node_modules/bmp-js/test/bit16_565_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_565_out.bmp rename to node_modules/bmp-js/test/bit16_565_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_a444.bmp b/node_modules/bmp-js/test/bit16_a444.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_a444.bmp rename to node_modules/bmp-js/test/bit16_a444.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_a444_out.bmp b/node_modules/bmp-js/test/bit16_a444_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_a444_out.bmp rename to node_modules/bmp-js/test/bit16_a444_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_a555.bmp b/node_modules/bmp-js/test/bit16_a555.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_a555.bmp rename to node_modules/bmp-js/test/bit16_a555.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_a555_out.bmp b/node_modules/bmp-js/test/bit16_a555_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_a555_out.bmp rename to node_modules/bmp-js/test/bit16_a555_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_x444.bmp b/node_modules/bmp-js/test/bit16_x444.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_x444.bmp rename to node_modules/bmp-js/test/bit16_x444.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_x444_out.bmp b/node_modules/bmp-js/test/bit16_x444_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_x444_out.bmp rename to node_modules/bmp-js/test/bit16_x444_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_x555.bmp b/node_modules/bmp-js/test/bit16_x555.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_x555.bmp rename to node_modules/bmp-js/test/bit16_x555.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit16_x555_out.bmp b/node_modules/bmp-js/test/bit16_x555_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit16_x555_out.bmp rename to node_modules/bmp-js/test/bit16_x555_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit1_out.bmp b/node_modules/bmp-js/test/bit1_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit1_out.bmp rename to node_modules/bmp-js/test/bit1_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit24.bmp b/node_modules/bmp-js/test/bit24.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit24.bmp rename to node_modules/bmp-js/test/bit24.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit24_out.bmp b/node_modules/bmp-js/test/bit24_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit24_out.bmp rename to node_modules/bmp-js/test/bit24_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit32.bmp b/node_modules/bmp-js/test/bit32.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit32.bmp rename to node_modules/bmp-js/test/bit32.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit32_alpha.bmp b/node_modules/bmp-js/test/bit32_alpha.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit32_alpha.bmp rename to node_modules/bmp-js/test/bit32_alpha.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit32_alpha_out.bmp b/node_modules/bmp-js/test/bit32_alpha_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit32_alpha_out.bmp rename to node_modules/bmp-js/test/bit32_alpha_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit32_out.bmp b/node_modules/bmp-js/test/bit32_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit32_out.bmp rename to node_modules/bmp-js/test/bit32_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit4.bmp b/node_modules/bmp-js/test/bit4.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit4.bmp rename to node_modules/bmp-js/test/bit4.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit4_RLE.bmp b/node_modules/bmp-js/test/bit4_RLE.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit4_RLE.bmp rename to node_modules/bmp-js/test/bit4_RLE.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit4_RLE_out.bmp b/node_modules/bmp-js/test/bit4_RLE_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit4_RLE_out.bmp rename to node_modules/bmp-js/test/bit4_RLE_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit4_out.bmp b/node_modules/bmp-js/test/bit4_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit4_out.bmp rename to node_modules/bmp-js/test/bit4_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit8.bmp b/node_modules/bmp-js/test/bit8.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit8.bmp rename to node_modules/bmp-js/test/bit8.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit8_RLE.bmp b/node_modules/bmp-js/test/bit8_RLE.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit8_RLE.bmp rename to node_modules/bmp-js/test/bit8_RLE.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit8_RLE_out.bmp b/node_modules/bmp-js/test/bit8_RLE_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit8_RLE_out.bmp rename to node_modules/bmp-js/test/bit8_RLE_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/bit8_out.bmp b/node_modules/bmp-js/test/bit8_out.bmp similarity index 100% rename from project starter code/node_modules/bmp-js/test/bit8_out.bmp rename to node_modules/bmp-js/test/bit8_out.bmp diff --git a/project starter code/node_modules/bmp-js/test/test.js b/node_modules/bmp-js/test/test.js similarity index 100% rename from project starter code/node_modules/bmp-js/test/test.js rename to node_modules/bmp-js/test/test.js diff --git a/node_modules/body-parser/HISTORY.md b/node_modules/body-parser/HISTORY.md new file mode 100644 index 00000000..b8924919 --- /dev/null +++ b/node_modules/body-parser/HISTORY.md @@ -0,0 +1,665 @@ +1.20.2 / 2023-02-21 +=================== + + * Fix strict json error message on Node.js 19+ + * deps: content-type@~1.0.5 + - perf: skip value escaping when unnecessary + * deps: raw-body@2.5.2 + +1.20.1 / 2022-10-06 +=================== + + * deps: qs@6.11.0 + * perf: remove unnecessary object clone + +1.20.0 / 2022-04-02 +=================== + + * Fix error message for json parse whitespace in `strict` + * Fix internal error when inflated body exceeds limit + * Prevent loss of async hooks context + * Prevent hanging when request already read + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: http-errors@2.0.0 + - deps: depd@2.0.0 + - deps: statuses@2.0.1 + * deps: on-finished@2.4.1 + * deps: qs@6.10.3 + * deps: raw-body@2.5.1 + - deps: http-errors@2.0.0 + +1.19.2 / 2022-02-15 +=================== + + * deps: bytes@3.1.2 + * deps: qs@6.9.7 + * Fix handling of `__proto__` keys + * deps: raw-body@2.4.3 + - deps: bytes@3.1.2 + +1.19.1 / 2021-12-10 +=================== + + * deps: bytes@3.1.1 + * deps: http-errors@1.8.1 + - deps: inherits@2.0.4 + - deps: toidentifier@1.0.1 + - deps: setprototypeof@1.2.0 + * deps: qs@6.9.6 + * deps: raw-body@2.4.2 + - deps: bytes@3.1.1 + - deps: http-errors@1.8.1 + * deps: safe-buffer@5.2.1 + * deps: type-is@~1.6.18 + +1.19.0 / 2019-04-25 +=================== + + * deps: bytes@3.1.0 + - Add petabyte (`pb`) support + * deps: http-errors@1.7.2 + - Set constructor name when possible + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: iconv-lite@0.4.24 + - Added encoding MIK + * deps: qs@6.7.0 + - Fix parsing array brackets after index + * deps: raw-body@2.4.0 + - deps: bytes@3.1.0 + - deps: http-errors@1.7.2 + - deps: iconv-lite@0.4.24 + * deps: type-is@~1.6.17 + - deps: mime-types@~2.1.24 + - perf: prevent internal `throw` on invalid type + +1.18.3 / 2018-05-14 +=================== + + * Fix stack trace for strict json parse error + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: http-errors@~1.6.3 + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.0 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.23 + - Fix loading encoding with year appended + - Fix deprecation warnings on Node.js 10+ + * deps: qs@6.5.2 + * deps: raw-body@2.3.3 + - deps: http-errors@1.6.3 + - deps: iconv-lite@0.4.23 + * deps: type-is@~1.6.16 + - deps: mime-types@~2.1.18 + +1.18.2 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: remove argument reassignment + +1.18.1 / 2017-09-12 +=================== + + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: raw-body@2.3.2 + - deps: iconv-lite@0.4.19 + +1.18.0 / 2017-09-08 +=================== + + * Fix JSON strict violation error to match native parse error + * Include the `body` property on verify errors + * Include the `type` property on all generated errors + * Use `http-errors` to set status code on errors + * deps: bytes@3.0.0 + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + * deps: qs@6.5.0 + * deps: raw-body@2.3.1 + - Use `http-errors` for standard emitted errors + - deps: bytes@3.0.0 + - deps: iconv-lite@0.4.18 + - perf: skip buffer decoding on overage chunk + * perf: prevent internal `throw` when missing charset + +1.17.2 / 2017-05-17 +=================== + + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + +1.17.1 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +1.17.0 / 2017-03-01 +=================== + + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + * deps: qs@6.3.1 + - Fix compacting nested arrays + +1.16.1 / 2017-02-10 +=================== + + * deps: debug@2.6.1 + - Fix deprecation messages in WebStorm and other editors + - Undeprecate `DEBUG_FD` set to `1` or `2` + +1.16.0 / 2017-01-17 +=================== + + * deps: debug@2.6.0 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + * deps: qs@6.2.1 + - Fix array parsing from skipping empty values + * deps: raw-body@~2.2.0 + - deps: iconv-lite@0.4.15 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +1.15.2 / 2016-06-19 +=================== + + * deps: bytes@2.4.0 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: http-errors@~1.5.0 + - Use `setprototypeof` module to replace `__proto__` setting + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: qs@6.2.0 + * deps: raw-body@~2.1.7 + - deps: bytes@2.4.0 + - perf: remove double-cleanup on happy path + * deps: type-is@~1.6.13 + - deps: mime-types@~2.1.11 + +1.15.1 / 2016-05-05 +=================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + * deps: raw-body@~2.1.6 + - deps: bytes@2.3.0 + * deps: type-is@~1.6.12 + - deps: mime-types@~2.1.10 + +1.15.0 / 2016-02-10 +=================== + + * deps: http-errors@~1.4.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.2.1 < 2' + * deps: qs@6.1.0 + * deps: type-is@~1.6.11 + - deps: mime-types@~2.1.9 + +1.14.2 / 2015-12-16 +=================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + * deps: qs@5.2.0 + * deps: raw-body@~2.1.5 + - deps: bytes@2.2.0 + - deps: iconv-lite@0.4.13 + * deps: type-is@~1.6.10 + - deps: mime-types@~2.1.8 + +1.14.1 / 2015-09-27 +=================== + + * Fix issue where invalid charset results in 400 when `verify` used + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + * deps: raw-body@~2.1.4 + - Fix masking critical errors from `iconv-lite` + - deps: iconv-lite@0.4.12 + * deps: type-is@~1.6.9 + - deps: mime-types@~2.1.7 + +1.14.0 / 2015-09-16 +=================== + + * Fix JSON strict parse error to match syntax errors + * Provide static `require` analysis in `urlencoded` parser + * deps: depd@~1.1.0 + - Support web browser loading + * deps: qs@5.1.0 + * deps: raw-body@~2.1.3 + - Fix sync callback when attaching data listener causes sync read + * deps: type-is@~1.6.8 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.6 + +1.13.3 / 2015-07-31 +=================== + + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +1.13.2 / 2015-07-05 +=================== + + * deps: iconv-lite@0.4.11 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix user-visible incompatibilities from 3.1.0 + - Fix various parsing edge cases + * deps: raw-body@~2.1.2 + - Fix error stack traces to skip `makeError` + - deps: iconv-lite@0.4.11 + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +1.13.1 / 2015-06-16 +=================== + + * deps: qs@2.4.2 + - Downgraded from 3.1.0 because of user-visible incompatibilities + +1.13.0 / 2015-06-14 +=================== + + * Add `statusCode` property on `Error`s, in addition to `status` + * Change `type` default to `application/json` for JSON parser + * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser + * Provide static `require` analysis + * Use the `http-errors` module to generate errors + * deps: bytes@2.1.0 + - Slight optimizations + * deps: iconv-lite@0.4.10 + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + - Leading BOM is now removed when decoding + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: qs@3.1.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + - Parsed object now has `null` prototype + * deps: raw-body@~2.1.1 + - Use `unpipe` module for unpiping requests + - deps: iconv-lite@0.4.10 + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: remove argument reassignment + * perf: remove delete call + +1.12.4 / 2015-05-10 +=================== + + * deps: debug@~2.2.0 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: on-finished@~2.2.1 + * deps: raw-body@~2.0.1 + - Fix a false-positive when unpiping in Node.js 0.8 + - deps: bytes@2.0.1 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +1.12.3 / 2015-04-15 +=================== + + * Slight efficiency improvement when not debugging + * deps: depd@~1.0.1 + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + * deps: raw-body@1.3.4 + - Fix hanging callback if request aborts during read + - deps: iconv-lite@0.4.8 + +1.12.2 / 2015-03-16 +=================== + + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + +1.12.1 / 2015-03-15 +=================== + + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +1.12.0 / 2015-02-13 +=================== + + * add `debug` messages + * accept a function for the `type` option + * use `content-type` to parse `Content-Type` headers + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + * deps: raw-body@1.3.3 + - deps: iconv-lite@0.4.7 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +1.11.0 / 2015-01-30 +=================== + + * make internal `extended: true` depth limit infinity + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +1.10.2 / 2015-01-20 +=================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + * deps: raw-body@1.3.2 + - deps: iconv-lite@0.4.6 + +1.10.1 / 2015-01-01 +=================== + + * deps: on-finished@~2.2.0 + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +1.10.0 / 2014-12-02 +=================== + + * make internal `extended: true` array limit dynamic + +1.9.3 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + * deps: raw-body@1.3.1 + - deps: iconv-lite@0.4.5 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +1.9.2 / 2014-10-27 +================== + + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +1.9.1 / 2014-10-22 +================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +1.9.0 / 2014-09-24 +================== + + * include the charset in "unsupported charset" error message + * include the encoding in "unsupported content encoding" error message + * deps: depd@~1.0.0 + +1.8.4 / 2014-09-23 +================== + + * fix content encoding to be case-insensitive + +1.8.3 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +1.8.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + +1.8.1 / 2014-09-07 +================== + + * deps: media-typer@0.3.0 + * deps: type-is@~1.5.1 + +1.8.0 / 2014-09-05 +================== + + * make empty-body-handling consistent between chunked requests + - empty `json` produces `{}` + - empty `raw` produces `new Buffer(0)` + - empty `text` produces `''` + - empty `urlencoded` produces `{}` + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: type-is@~1.5.0 + - fix `hasbody` to be true for `content-length: 0` + +1.7.0 / 2014-09-01 +================== + + * add `parameterLimit` option to `urlencoded` parser + * change `urlencoded` extended array limit to 100 + * respond with 413 when over `parameterLimit` in `urlencoded` + +1.6.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +1.6.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +1.6.5 / 2014-08-16 +================== + + * deps: on-finished@2.1.0 + +1.6.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + +1.6.3 / 2014-08-10 +================== + + * deps: qs@1.2.1 + +1.6.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +1.6.1 / 2014-08-06 +================== + + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +1.6.0 / 2014-08-05 +================== + + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + +1.5.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +1.5.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +1.5.0 / 2014-07-20 +================== + + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + * deps: raw-body@1.3.0 + - deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + - Fix `Cannot switch to old mode now` error on Node.js 0.10+ + * deps: type-is@~1.3.2 + +1.4.3 / 2014-06-19 +================== + + * deps: type-is@1.3.1 + - fix global variable leak + +1.4.2 / 2014-06-19 +================== + + * deps: type-is@1.3.0 + - improve type parsing + +1.4.1 / 2014-06-19 +================== + + * fix urlencoded extended deprecation message + +1.4.0 / 2014-06-19 +================== + + * add `text` parser + * add `raw` parser + * check accepted charset in content-type (accepts utf-8) + * check accepted encoding in content-encoding (accepts identity) + * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed + * deprecate `urlencoded()` without provided `extended` option + * lazy-load urlencoded parsers + * parsers split into files for reduced mem usage + * support gzip and deflate bodies + - set `inflate: false` to turn off + * deps: raw-body@1.2.2 + - Support all encodings from `iconv-lite` + +1.3.1 / 2014-06-11 +================== + + * deps: type-is@1.2.1 + - Switch dependency from mime to mime-types@1.0.0 + +1.3.0 / 2014-05-31 +================== + + * add `extended` option to urlencoded parser + +1.2.2 / 2014-05-27 +================== + + * deps: raw-body@1.1.6 + - assert stream encoding on node.js 0.8 + - assert stream encoding on node.js < 0.10.6 + - deps: bytes@1 + +1.2.1 / 2014-05-26 +================== + + * invoke `next(err)` after request fully read + - prevents hung responses and socket hang ups + +1.2.0 / 2014-05-11 +================== + + * add `verify` option + * deps: type-is@1.2.0 + - support suffix matching + +1.1.2 / 2014-05-11 +================== + + * improve json parser speed + +1.1.1 / 2014-05-11 +================== + + * fix repeated limit parsing with every request + +1.1.0 / 2014-05-10 +================== + + * add `type` option + * deps: pin for safety and consistency + +1.0.2 / 2014-04-14 +================== + + * use `type-is` module + +1.0.1 / 2014-03-20 +================== + + * lower default limits to 100kb diff --git a/project starter code/node_modules/body-parser/LICENSE b/node_modules/body-parser/LICENSE similarity index 100% rename from project starter code/node_modules/body-parser/LICENSE rename to node_modules/body-parser/LICENSE diff --git a/node_modules/body-parser/README.md b/node_modules/body-parser/README.md new file mode 100644 index 00000000..38553bf7 --- /dev/null +++ b/node_modules/body-parser/README.md @@ -0,0 +1,465 @@ +# body-parser + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Node.js body parsing middleware. + +Parse incoming request bodies in a middleware before your handlers, available +under the `req.body` property. + +**Note** As `req.body`'s shape is based on user-controlled input, all +properties and values in this object are untrusted and should be validated +before trusting. For example, `req.body.foo.toString()` may fail in multiple +ways, for example the `foo` property may not be there or may not be a string, +and `toString` may not be a function and instead a string or other user input. + +[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/). + +_This does not handle multipart bodies_, due to their complex and typically +large nature. For multipart bodies, you may be interested in the following +modules: + + * [busboy](https://www.npmjs.org/package/busboy#readme) and + [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme) + * [multiparty](https://www.npmjs.org/package/multiparty#readme) and + [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme) + * [formidable](https://www.npmjs.org/package/formidable#readme) + * [multer](https://www.npmjs.org/package/multer#readme) + +This module provides the following parsers: + + * [JSON body parser](#bodyparserjsonoptions) + * [Raw body parser](#bodyparserrawoptions) + * [Text body parser](#bodyparsertextoptions) + * [URL-encoded form body parser](#bodyparserurlencodedoptions) + +Other body parsers you might be interested in: + +- [body](https://www.npmjs.org/package/body#readme) +- [co-body](https://www.npmjs.org/package/co-body#readme) + +## Installation + +```sh +$ npm install body-parser +``` + +## API + +```js +var bodyParser = require('body-parser') +``` + +The `bodyParser` object exposes various factories to create middlewares. All +middlewares will populate the `req.body` property with the parsed body when +the `Content-Type` request header matches the `type` option, or an empty +object (`{}`) if there was no body to parse, the `Content-Type` was not matched, +or an error occurred. + +The various errors returned by this module are described in the +[errors section](#errors). + +### bodyParser.json([options]) + +Returns middleware that only parses `json` and only looks at requests where +the `Content-Type` header matches the `type` option. This parser accepts any +Unicode encoding of the body and supports automatic inflation of `gzip` and +`deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). + +#### Options + +The `json` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### reviver + +The `reviver` option is passed directly to `JSON.parse` as the second +argument. You can find more information on this argument +[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter). + +##### strict + +When set to `true`, will only accept arrays and objects; when `false` will +accept anything `JSON.parse` accepts. Defaults to `true`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not a +function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `json`), a mime type (like `application/json`), or +a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a truthy +value. Defaults to `application/json`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.raw([options]) + +Returns middleware that parses all bodies as a `Buffer` and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a `Buffer` object +of the body. + +#### Options + +The `raw` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. +If not a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this +can be an extension name (like `bin`), a mime type (like +`application/octet-stream`), or a mime type with a wildcard (like `*/*` or +`application/*`). If a function, the `type` option is called as `fn(req)` +and the request is parsed if it returns a truthy value. Defaults to +`application/octet-stream`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.text([options]) + +Returns middleware that parses all bodies as a string and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` string containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a string of the +body. + +#### Options + +The `text` function takes an optional `options` object that may contain any of +the following keys: + +##### defaultCharset + +Specify the default character set for the text content if the charset is not +specified in the `Content-Type` header of the request. Defaults to `utf-8`. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `txt`), a mime type (like `text/plain`), or a mime +type with a wildcard (like `*/*` or `text/*`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a +truthy value. Defaults to `text/plain`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.urlencoded([options]) + +Returns middleware that only parses `urlencoded` bodies and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser accepts only UTF-8 encoding of the body and supports automatic +inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This object will contain +key-value pairs, where the value can be a string or array (when `extended` is +`false`), or any type (when `extended` is `true`). + +#### Options + +The `urlencoded` function takes an optional `options` object that may contain +any of the following keys: + +##### extended + +The `extended` option allows to choose between parsing the URL-encoded data +with the `querystring` library (when `false`) or the `qs` library (when +`true`). The "extended" syntax allows for rich objects and arrays to be +encoded into the URL-encoded format, allowing for a JSON-like experience +with URL-encoded. For more information, please +[see the qs library](https://www.npmjs.org/package/qs#readme). + +Defaults to `true`, but using the default has been deprecated. Please +research into the difference between `qs` and `querystring` and choose the +appropriate setting. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### parameterLimit + +The `parameterLimit` option controls the maximum number of parameters that +are allowed in the URL-encoded data. If a request contains more parameters +than this value, a 413 will be returned to the client. Defaults to `1000`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `urlencoded`), a mime type (like +`application/x-www-form-urlencoded`), or a mime type with a wildcard (like +`*/x-www-form-urlencoded`). If a function, the `type` option is called as +`fn(req)` and the request is parsed if it returns a truthy value. Defaults +to `application/x-www-form-urlencoded`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +## Errors + +The middlewares provided by this module create errors using the +[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors +will typically have a `status`/`statusCode` property that contains the suggested +HTTP response code, an `expose` property to determine if the `message` property +should be displayed to the client, a `type` property to determine the type of +error without matching against the `message`, and a `body` property containing +the read body, if available. + +The following are the common errors created, though any error can come through +for various reasons. + +### content encoding unsupported + +This error will occur when the request had a `Content-Encoding` header that +contained an encoding but the "inflation" option was set to `false`. The +`status` property is set to `415`, the `type` property is set to +`'encoding.unsupported'`, and the `charset` property will be set to the +encoding that is unsupported. + +### entity parse failed + +This error will occur when the request contained an entity that could not be +parsed by the middleware. The `status` property is set to `400`, the `type` +property is set to `'entity.parse.failed'`, and the `body` property is set to +the entity value that failed parsing. + +### entity verify failed + +This error will occur when the request contained an entity that could not be +failed verification by the defined `verify` option. The `status` property is +set to `403`, the `type` property is set to `'entity.verify.failed'`, and the +`body` property is set to the entity value that failed verification. + +### request aborted + +This error will occur when the request is aborted by the client before reading +the body has finished. The `received` property will be set to the number of +bytes received before the request was aborted and the `expected` property is +set to the number of expected bytes. The `status` property is set to `400` +and `type` property is set to `'request.aborted'`. + +### request entity too large + +This error will occur when the request body's size is larger than the "limit" +option. The `limit` property will be set to the byte limit and the `length` +property will be set to the request body's length. The `status` property is +set to `413` and the `type` property is set to `'entity.too.large'`. + +### request size did not match content length + +This error will occur when the request's length did not match the length from +the `Content-Length` header. This typically occurs when the request is malformed, +typically when the `Content-Length` header was calculated based on characters +instead of bytes. The `status` property is set to `400` and the `type` property +is set to `'request.size.invalid'`. + +### stream encoding should not be set + +This error will occur when something called the `req.setEncoding` method prior +to this middleware. This module operates directly on bytes only and you cannot +call `req.setEncoding` when using this module. The `status` property is set to +`500` and the `type` property is set to `'stream.encoding.set'`. + +### stream is not readable + +This error will occur when the request is no longer readable when this middleware +attempts to read it. This typically means something other than a middleware from +this module read the request body already and the middleware was also configured to +read the same request. The `status` property is set to `500` and the `type` +property is set to `'stream.not.readable'`. + +### too many parameters + +This error will occur when the content of the request exceeds the configured +`parameterLimit` for the `urlencoded` parser. The `status` property is set to +`413` and the `type` property is set to `'parameters.too.many'`. + +### unsupported charset "BOGUS" + +This error will occur when the request had a charset parameter in the +`Content-Type` header, but the `iconv-lite` module does not support it OR the +parser does not support it. The charset is contained in the message as well +as in the `charset` property. The `status` property is set to `415`, the +`type` property is set to `'charset.unsupported'`, and the `charset` property +is set to the charset that is unsupported. + +### unsupported content encoding "bogus" + +This error will occur when the request had a `Content-Encoding` header that +contained an unsupported encoding. The encoding is contained in the message +as well as in the `encoding` property. The `status` property is set to `415`, +the `type` property is set to `'encoding.unsupported'`, and the `encoding` +property is set to the encoding that is unsupported. + +## Examples + +### Express/Connect top-level generic + +This example demonstrates adding a generic JSON and URL-encoded parser as a +top-level middleware, which will parse the bodies of all incoming requests. +This is the simplest setup. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse application/x-www-form-urlencoded +app.use(bodyParser.urlencoded({ extended: false })) + +// parse application/json +app.use(bodyParser.json()) + +app.use(function (req, res) { + res.setHeader('Content-Type', 'text/plain') + res.write('you posted:\n') + res.end(JSON.stringify(req.body, null, 2)) +}) +``` + +### Express route-specific + +This example demonstrates adding body parsers specifically to the routes that +need them. In general, this is the most recommended way to use body-parser with +Express. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// create application/json parser +var jsonParser = bodyParser.json() + +// create application/x-www-form-urlencoded parser +var urlencodedParser = bodyParser.urlencoded({ extended: false }) + +// POST /login gets urlencoded bodies +app.post('/login', urlencodedParser, function (req, res) { + res.send('welcome, ' + req.body.username) +}) + +// POST /api/users gets JSON bodies +app.post('/api/users', jsonParser, function (req, res) { + // create user in req.body +}) +``` + +### Change accepted type for parsers + +All the parsers accept a `type` option which allows you to change the +`Content-Type` that the middleware will parse. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse various different custom JSON types as JSON +app.use(bodyParser.json({ type: 'application/*+json' })) + +// parse some custom thing into a Buffer +app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })) + +// parse an HTML body into a string +app.use(bodyParser.text({ type: 'text/html' })) +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci +[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master +[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master +[node-version-image]: https://badgen.net/npm/node/body-parser +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/body-parser +[npm-url]: https://npmjs.org/package/body-parser +[npm-version-image]: https://badgen.net/npm/v/body-parser diff --git a/project starter code/node_modules/body-parser/SECURITY.md b/node_modules/body-parser/SECURITY.md similarity index 100% rename from project starter code/node_modules/body-parser/SECURITY.md rename to node_modules/body-parser/SECURITY.md diff --git a/node_modules/body-parser/index.js b/node_modules/body-parser/index.js new file mode 100644 index 00000000..bb24d739 --- /dev/null +++ b/node_modules/body-parser/index.js @@ -0,0 +1,156 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('body-parser') + +/** + * Cache of loaded parsers. + * @private + */ + +var parsers = Object.create(null) + +/** + * @typedef Parsers + * @type {function} + * @property {function} json + * @property {function} raw + * @property {function} text + * @property {function} urlencoded + */ + +/** + * Module exports. + * @type {Parsers} + */ + +exports = module.exports = deprecate.function(bodyParser, + 'bodyParser: use individual json/urlencoded middlewares') + +/** + * JSON parser. + * @public + */ + +Object.defineProperty(exports, 'json', { + configurable: true, + enumerable: true, + get: createParserGetter('json') +}) + +/** + * Raw parser. + * @public + */ + +Object.defineProperty(exports, 'raw', { + configurable: true, + enumerable: true, + get: createParserGetter('raw') +}) + +/** + * Text parser. + * @public + */ + +Object.defineProperty(exports, 'text', { + configurable: true, + enumerable: true, + get: createParserGetter('text') +}) + +/** + * URL-encoded parser. + * @public + */ + +Object.defineProperty(exports, 'urlencoded', { + configurable: true, + enumerable: true, + get: createParserGetter('urlencoded') +}) + +/** + * Create a middleware to parse json and urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @deprecated + * @public + */ + +function bodyParser (options) { + // use default type for parsers + var opts = Object.create(options || null, { + type: { + configurable: true, + enumerable: true, + value: undefined, + writable: true + } + }) + + var _urlencoded = exports.urlencoded(opts) + var _json = exports.json(opts) + + return function bodyParser (req, res, next) { + _json(req, res, function (err) { + if (err) return next(err) + _urlencoded(req, res, next) + }) + } +} + +/** + * Create a getter for loading a parser. + * @private + */ + +function createParserGetter (name) { + return function get () { + return loadParser(name) + } +} + +/** + * Load a parser module. + * @private + */ + +function loadParser (parserName) { + var parser = parsers[parserName] + + if (parser !== undefined) { + return parser + } + + // this uses a switch for static require analysis + switch (parserName) { + case 'json': + parser = require('./lib/types/json') + break + case 'raw': + parser = require('./lib/types/raw') + break + case 'text': + parser = require('./lib/types/text') + break + case 'urlencoded': + parser = require('./lib/types/urlencoded') + break + } + + // store to prevent invoking require() + return (parsers[parserName] = parser) +} diff --git a/project starter code/node_modules/body-parser/lib/read.js b/node_modules/body-parser/lib/read.js similarity index 100% rename from project starter code/node_modules/body-parser/lib/read.js rename to node_modules/body-parser/lib/read.js diff --git a/project starter code/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js similarity index 91% rename from project starter code/node_modules/body-parser/lib/types/json.js rename to node_modules/body-parser/lib/types/json.js index f3e503ab..59f3f7e2 100644 --- a/project starter code/node_modules/body-parser/lib/types/json.js +++ b/node_modules/body-parser/lib/types/json.js @@ -16,7 +16,7 @@ var bytes = require('bytes') var contentType = require('content-type') var createError = require('http-errors') var debug = require('debug')('body-parser:json') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** @@ -39,6 +39,9 @@ module.exports = json var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex +var JSON_SYNTAX_CHAR = '#' +var JSON_SYNTAX_REGEXP = /#+/g + /** * Create a middleware to parse JSON bodies. * @@ -152,15 +155,23 @@ function json (options) { function createStrictSyntaxError (str, char) { var index = str.indexOf(char) - var partial = index !== -1 - ? str.substring(0, index) + '#' - : '' + var partial = '' + + if (index !== -1) { + partial = str.substring(0, index) + JSON_SYNTAX_CHAR + + for (var i = index + 1; i < str.length; i++) { + partial += JSON_SYNTAX_CHAR + } + } try { JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation') } catch (e) { return normalizeJsonSyntaxError(e, { - message: e.message.replace('#', char), + message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) { + return str.substring(index, index + placeholder.length) + }), stack: e.stack }) } diff --git a/project starter code/node_modules/body-parser/lib/types/raw.js b/node_modules/body-parser/lib/types/raw.js similarity index 97% rename from project starter code/node_modules/body-parser/lib/types/raw.js rename to node_modules/body-parser/lib/types/raw.js index 7b3a366d..f5d1b674 100644 --- a/project starter code/node_modules/body-parser/lib/types/raw.js +++ b/node_modules/body-parser/lib/types/raw.js @@ -12,7 +12,7 @@ var bytes = require('bytes') var debug = require('debug')('body-parser:raw') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** diff --git a/project starter code/node_modules/body-parser/lib/types/text.js b/node_modules/body-parser/lib/types/text.js similarity index 98% rename from project starter code/node_modules/body-parser/lib/types/text.js rename to node_modules/body-parser/lib/types/text.js index 6fe6a780..083a0090 100644 --- a/project starter code/node_modules/body-parser/lib/types/text.js +++ b/node_modules/body-parser/lib/types/text.js @@ -13,7 +13,7 @@ var bytes = require('bytes') var contentType = require('content-type') var debug = require('debug')('body-parser:text') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** diff --git a/project starter code/node_modules/body-parser/lib/types/urlencoded.js b/node_modules/body-parser/lib/types/urlencoded.js similarity index 99% rename from project starter code/node_modules/body-parser/lib/types/urlencoded.js rename to node_modules/body-parser/lib/types/urlencoded.js index 6c0fc14f..b2ca8f16 100644 --- a/project starter code/node_modules/body-parser/lib/types/urlencoded.js +++ b/node_modules/body-parser/lib/types/urlencoded.js @@ -17,7 +17,7 @@ var contentType = require('content-type') var createError = require('http-errors') var debug = require('debug')('body-parser:urlencoded') var deprecate = require('depd')('body-parser') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** diff --git a/node_modules/body-parser/package.json b/node_modules/body-parser/package.json new file mode 100644 index 00000000..46373043 --- /dev/null +++ b/node_modules/body-parser/package.json @@ -0,0 +1,56 @@ +{ + "name": "body-parser", + "description": "Node.js body parsing middleware", + "version": "1.20.2", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "expressjs/body-parser", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "devDependencies": { + "eslint": "8.34.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "methods": "1.1.2", + "mocha": "10.2.0", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "supertest": "6.3.3" + }, + "files": [ + "lib/", + "LICENSE", + "HISTORY.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/project starter code/node_modules/buffer-equal/.travis.yml b/node_modules/buffer-equal/.travis.yml similarity index 100% rename from project starter code/node_modules/buffer-equal/.travis.yml rename to node_modules/buffer-equal/.travis.yml diff --git a/project starter code/node_modules/buffer-equal/README.markdown b/node_modules/buffer-equal/README.markdown similarity index 100% rename from project starter code/node_modules/buffer-equal/README.markdown rename to node_modules/buffer-equal/README.markdown diff --git a/project starter code/node_modules/buffer-equal/example/eq.js b/node_modules/buffer-equal/example/eq.js similarity index 100% rename from project starter code/node_modules/buffer-equal/example/eq.js rename to node_modules/buffer-equal/example/eq.js diff --git a/project starter code/node_modules/buffer-equal/index.js b/node_modules/buffer-equal/index.js similarity index 100% rename from project starter code/node_modules/buffer-equal/index.js rename to node_modules/buffer-equal/index.js diff --git a/project starter code/node_modules/buffer-equal/package.json b/node_modules/buffer-equal/package.json similarity index 100% rename from project starter code/node_modules/buffer-equal/package.json rename to node_modules/buffer-equal/package.json diff --git a/project starter code/node_modules/buffer-equal/test/eq.js b/node_modules/buffer-equal/test/eq.js similarity index 100% rename from project starter code/node_modules/buffer-equal/test/eq.js rename to node_modules/buffer-equal/test/eq.js diff --git a/project starter code/node_modules/buffer/AUTHORS.md b/node_modules/buffer/AUTHORS.md similarity index 100% rename from project starter code/node_modules/buffer/AUTHORS.md rename to node_modules/buffer/AUTHORS.md diff --git a/project starter code/node_modules/buffer/LICENSE b/node_modules/buffer/LICENSE similarity index 100% rename from project starter code/node_modules/buffer/LICENSE rename to node_modules/buffer/LICENSE diff --git a/project starter code/node_modules/buffer/README.md b/node_modules/buffer/README.md similarity index 100% rename from project starter code/node_modules/buffer/README.md rename to node_modules/buffer/README.md diff --git a/project starter code/node_modules/buffer/index.d.ts b/node_modules/buffer/index.d.ts similarity index 100% rename from project starter code/node_modules/buffer/index.d.ts rename to node_modules/buffer/index.d.ts diff --git a/project starter code/node_modules/buffer/index.js b/node_modules/buffer/index.js similarity index 100% rename from project starter code/node_modules/buffer/index.js rename to node_modules/buffer/index.js diff --git a/project starter code/node_modules/buffer/package.json b/node_modules/buffer/package.json similarity index 100% rename from project starter code/node_modules/buffer/package.json rename to node_modules/buffer/package.json diff --git a/project starter code/node_modules/bytes/History.md b/node_modules/bytes/History.md similarity index 100% rename from project starter code/node_modules/bytes/History.md rename to node_modules/bytes/History.md diff --git a/project starter code/node_modules/bytes/LICENSE b/node_modules/bytes/LICENSE similarity index 100% rename from project starter code/node_modules/bytes/LICENSE rename to node_modules/bytes/LICENSE diff --git a/project starter code/node_modules/bytes/Readme.md b/node_modules/bytes/Readme.md similarity index 100% rename from project starter code/node_modules/bytes/Readme.md rename to node_modules/bytes/Readme.md diff --git a/project starter code/node_modules/bytes/index.js b/node_modules/bytes/index.js similarity index 100% rename from project starter code/node_modules/bytes/index.js rename to node_modules/bytes/index.js diff --git a/project starter code/node_modules/bytes/package.json b/node_modules/bytes/package.json similarity index 100% rename from project starter code/node_modules/bytes/package.json rename to node_modules/bytes/package.json diff --git a/project starter code/node_modules/call-bind/.eslintignore b/node_modules/call-bind/.eslintignore similarity index 100% rename from project starter code/node_modules/call-bind/.eslintignore rename to node_modules/call-bind/.eslintignore diff --git a/project starter code/node_modules/call-bind/.eslintrc b/node_modules/call-bind/.eslintrc similarity index 100% rename from project starter code/node_modules/call-bind/.eslintrc rename to node_modules/call-bind/.eslintrc diff --git a/project starter code/node_modules/call-bind/.github/FUNDING.yml b/node_modules/call-bind/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/call-bind/.github/FUNDING.yml rename to node_modules/call-bind/.github/FUNDING.yml diff --git a/project starter code/node_modules/call-bind/.nycrc b/node_modules/call-bind/.nycrc similarity index 100% rename from project starter code/node_modules/call-bind/.nycrc rename to node_modules/call-bind/.nycrc diff --git a/project starter code/node_modules/call-bind/CHANGELOG.md b/node_modules/call-bind/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/call-bind/CHANGELOG.md rename to node_modules/call-bind/CHANGELOG.md diff --git a/project starter code/node_modules/call-bind/LICENSE b/node_modules/call-bind/LICENSE similarity index 100% rename from project starter code/node_modules/call-bind/LICENSE rename to node_modules/call-bind/LICENSE diff --git a/project starter code/node_modules/call-bind/README.md b/node_modules/call-bind/README.md similarity index 100% rename from project starter code/node_modules/call-bind/README.md rename to node_modules/call-bind/README.md diff --git a/project starter code/node_modules/call-bind/callBound.js b/node_modules/call-bind/callBound.js similarity index 100% rename from project starter code/node_modules/call-bind/callBound.js rename to node_modules/call-bind/callBound.js diff --git a/project starter code/node_modules/call-bind/index.js b/node_modules/call-bind/index.js similarity index 100% rename from project starter code/node_modules/call-bind/index.js rename to node_modules/call-bind/index.js diff --git a/project starter code/node_modules/call-bind/package.json b/node_modules/call-bind/package.json similarity index 100% rename from project starter code/node_modules/call-bind/package.json rename to node_modules/call-bind/package.json diff --git a/project starter code/node_modules/call-bind/test/callBound.js b/node_modules/call-bind/test/callBound.js similarity index 100% rename from project starter code/node_modules/call-bind/test/callBound.js rename to node_modules/call-bind/test/callBound.js diff --git a/project starter code/node_modules/call-bind/test/index.js b/node_modules/call-bind/test/index.js similarity index 100% rename from project starter code/node_modules/call-bind/test/index.js rename to node_modules/call-bind/test/index.js diff --git a/node_modules/combined-stream/License b/node_modules/combined-stream/License new file mode 100644 index 00000000..4804b7ab --- /dev/null +++ b/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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. diff --git a/node_modules/combined-stream/Readme.md b/node_modules/combined-stream/Readme.md new file mode 100644 index 00000000..9e367b5b --- /dev/null +++ b/node_modules/combined-stream/Readme.md @@ -0,0 +1,138 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +**NB** Currently `combined-stream` works with streams version 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatibility with `combined-stream`. + +- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. + +- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. + +## Installation + +``` bash +npm install combined-stream +``` + +## Usage + +Here is a simple example that shows how you can use combined-stream to combine +two files into one: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +While the example above works great, it will pause all source streams until +they are needed. If you don't want that to happen, you can set `pauseStreams` +to `false`: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create({pauseStreams: false}); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +However, what if you don't have all the source streams yet, or you don't want +to allocate the resources (file descriptors, memory, etc.) for them right away? +Well, in that case you can simply provide a callback that supplies the stream +by calling a `next()` function: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(function(next) { + next(fs.createReadStream('file1.txt')); +}); +combinedStream.append(function(next) { + next(fs.createReadStream('file2.txt')); +}); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +## API + +### CombinedStream.create([options]) + +Returns a new combined stream object. Available options are: + +* `maxDataSize` +* `pauseStreams` + +The effect of those options is described below. + +### combinedStream.pauseStreams = `true` + +Whether to apply back pressure to the underlaying streams. If set to `false`, +the underlaying streams will never be paused. If set to `true`, the +underlaying streams will be paused right after being appended, as well as when +`delayedStream.pipe()` wants to throttle. + +### combinedStream.maxDataSize = `2 * 1024 * 1024` + +The maximum amount of bytes (or characters) to buffer for all source streams. +If this value is exceeded, `combinedStream` emits an `'error'` event. + +### combinedStream.dataSize = `0` + +The amount of bytes (or characters) currently buffered by `combinedStream`. + +### combinedStream.append(stream) + +Appends the given `stream` to the combinedStream object. If `pauseStreams` is +set to `true, this stream will also be paused right away. + +`streams` can also be a function that takes one parameter called `next`. `next` +is a function that must be invoked in order to provide the `next` stream, see +example above. + +Regardless of how the `stream` is appended, combined-stream always attaches an +`'error'` listener to it, so you don't have to do that manually. + +Special case: `stream` can also be a String or Buffer. + +### combinedStream.write(data) + +You should not call this, `combinedStream` takes care of piping the appended +streams into itself for you. + +### combinedStream.resume() + +Causes `combinedStream` to start drain the streams it manages. The function is +idempotent, and also emits a `'resume'` event each time which usually goes to +the stream that is currently being drained. + +### combinedStream.pause(); + +If `combinedStream.pauseStreams` is set to `false`, this does nothing. +Otherwise a `'pause'` event is emitted, this goes to the stream that is +currently being drained, so you can use it to apply back pressure. + +### combinedStream.end(); + +Sets `combinedStream.writable` to false, emits an `'end'` event, and removes +all streams from the queue. + +### combinedStream.destroy(); + +Same as `combinedStream.end()`, except it emits a `'close'` event instead of +`'end'`. + +## License + +combined-stream is licensed under the MIT license. diff --git a/node_modules/combined-stream/lib/combined_stream.js b/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 00000000..125f097f --- /dev/null +++ b/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,208 @@ +var util = require('util'); +var Stream = require('stream').Stream; +var DelayedStream = require('delayed-stream'); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; + this._insideLoop = false; + this._pendingNext = false; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + + if (this._insideLoop) { + this._pendingNext = true; + return; // defer call + } + + this._insideLoop = true; + try { + do { + this._pendingNext = false; + this._realGetNext(); + } while (this._pendingNext); + } finally { + this._insideLoop = false; + } +}; + +CombinedStream.prototype._realGetNext = function() { + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; diff --git a/node_modules/combined-stream/package.json b/node_modules/combined-stream/package.json new file mode 100644 index 00000000..6982b6da --- /dev/null +++ b/node_modules/combined-stream/package.json @@ -0,0 +1,25 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "name": "combined-stream", + "description": "A stream that emits multiple other streams one after another.", + "version": "1.0.8", + "homepage": "https://github.com/felixge/node-combined-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-combined-stream.git" + }, + "main": "./lib/combined_stream", + "scripts": { + "test": "node test/run.js" + }, + "engines": { + "node": ">= 0.8" + }, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "devDependencies": { + "far": "~0.0.7" + }, + "license": "MIT" +} diff --git a/node_modules/combined-stream/yarn.lock b/node_modules/combined-stream/yarn.lock new file mode 100644 index 00000000..7edf4184 --- /dev/null +++ b/node_modules/combined-stream/yarn.lock @@ -0,0 +1,17 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +far@~0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/far/-/far-0.0.7.tgz#01c1fd362bcd26ce9cf161af3938aa34619f79a7" + dependencies: + oop "0.0.3" + +oop@0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/oop/-/oop-0.0.3.tgz#70fa405a5650891a194fdc82ca68dad6dabf4401" diff --git a/project starter code/node_modules/content-disposition/HISTORY.md b/node_modules/content-disposition/HISTORY.md similarity index 100% rename from project starter code/node_modules/content-disposition/HISTORY.md rename to node_modules/content-disposition/HISTORY.md diff --git a/project starter code/node_modules/content-disposition/LICENSE b/node_modules/content-disposition/LICENSE similarity index 100% rename from project starter code/node_modules/content-disposition/LICENSE rename to node_modules/content-disposition/LICENSE diff --git a/project starter code/node_modules/content-disposition/README.md b/node_modules/content-disposition/README.md similarity index 100% rename from project starter code/node_modules/content-disposition/README.md rename to node_modules/content-disposition/README.md diff --git a/project starter code/node_modules/content-disposition/index.js b/node_modules/content-disposition/index.js similarity index 100% rename from project starter code/node_modules/content-disposition/index.js rename to node_modules/content-disposition/index.js diff --git a/project starter code/node_modules/content-disposition/package.json b/node_modules/content-disposition/package.json similarity index 100% rename from project starter code/node_modules/content-disposition/package.json rename to node_modules/content-disposition/package.json diff --git a/node_modules/content-type/HISTORY.md b/node_modules/content-type/HISTORY.md new file mode 100644 index 00000000..45836713 --- /dev/null +++ b/node_modules/content-type/HISTORY.md @@ -0,0 +1,29 @@ +1.0.5 / 2023-01-29 +================== + + * perf: skip value escaping when unnecessary + +1.0.4 / 2017-09-11 +================== + + * perf: skip parameter parsing when no parameters + +1.0.3 / 2017-09-10 +================== + + * perf: remove argument reassignment + +1.0.2 / 2016-05-09 +================== + + * perf: enable strict mode + +1.0.1 / 2015-02-13 +================== + + * Improve missing `Content-Type` header error message + +1.0.0 / 2015-02-01 +================== + + * Initial implementation, derived from `media-typer@0.3.0` diff --git a/project starter code/node_modules/content-type/LICENSE b/node_modules/content-type/LICENSE similarity index 100% rename from project starter code/node_modules/content-type/LICENSE rename to node_modules/content-type/LICENSE diff --git a/node_modules/content-type/README.md b/node_modules/content-type/README.md new file mode 100644 index 00000000..c1a922a9 --- /dev/null +++ b/node_modules/content-type/README.md @@ -0,0 +1,94 @@ +# content-type + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Create and parse HTTP Content-Type header according to RFC 7231 + +## Installation + +```sh +$ npm install content-type +``` + +## API + +```js +var contentType = require('content-type') +``` + +### contentType.parse(string) + +```js +var obj = contentType.parse('image/svg+xml; charset=utf-8') +``` + +Parse a `Content-Type` header. This will return an object with the following +properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The media type (the type and subtype, always lower case). + Example: `'image/svg+xml'` + + - `parameters`: An object of the parameters in the media type (name of parameter + always lower case). Example: `{charset: 'utf-8'}` + +Throws a `TypeError` if the string is missing or invalid. + +### contentType.parse(req) + +```js +var obj = contentType.parse(req) +``` + +Parse the `Content-Type` header from the given `req`. Short-cut for +`contentType.parse(req.headers['content-type'])`. + +Throws a `TypeError` if the `Content-Type` header is missing or invalid. + +### contentType.parse(res) + +```js +var obj = contentType.parse(res) +``` + +Parse the `Content-Type` header set on the given `res`. Short-cut for +`contentType.parse(res.getHeader('content-type'))`. + +Throws a `TypeError` if the `Content-Type` header is missing or invalid. + +### contentType.format(obj) + +```js +var str = contentType.format({ + type: 'image/svg+xml', + parameters: { charset: 'utf-8' } +}) +``` + +Format an object into a `Content-Type` header. This will return a string of the +content type for the given object with the following properties (examples are +shown that produce the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The media type (will be lower-cased). Example: `'image/svg+xml'` + + - `parameters`: An object of the parameters in the media type (name of the + parameter will be lower-cased). Example: `{charset: 'utf-8'}` + +Throws a `TypeError` if the object contains an invalid type or parameter names. + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/content-type/master?label=ci +[ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master +[coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master +[node-image]: https://badgen.net/npm/node/content-type +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/content-type +[npm-url]: https://npmjs.org/package/content-type +[npm-version-image]: https://badgen.net/npm/v/content-type diff --git a/node_modules/content-type/index.js b/node_modules/content-type/index.js new file mode 100644 index 00000000..41840e7b --- /dev/null +++ b/node_modules/content-type/index.js @@ -0,0 +1,225 @@ +/*! + * content-type + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 + * + * parameter = token "=" ( token / quoted-string ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE + * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text + * obs-text = %x80-FF + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + */ +var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g // eslint-disable-line no-control-regex +var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ // eslint-disable-line no-control-regex +var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ + +/** + * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 + * + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + * obs-text = %x80-FF + */ +var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g // eslint-disable-line no-control-regex + +/** + * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 + */ +var QUOTE_REGEXP = /([\\"])/g + +/** + * RegExp to match type in RFC 7231 sec 3.1.1.1 + * + * media-type = type "/" subtype + * type = token + * subtype = token + */ +var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ + +/** + * Module exports. + * @public + */ + +exports.format = format +exports.parse = parse + +/** + * Format object to media type. + * + * @param {object} obj + * @return {string} + * @public + */ + +function format (obj) { + if (!obj || typeof obj !== 'object') { + throw new TypeError('argument obj is required') + } + + var parameters = obj.parameters + var type = obj.type + + if (!type || !TYPE_REGEXP.test(type)) { + throw new TypeError('invalid type') + } + + var string = type + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + if (!TOKEN_REGEXP.test(param)) { + throw new TypeError('invalid parameter name') + } + + string += '; ' + param + '=' + qstring(parameters[param]) + } + } + + return string +} + +/** + * Parse media type to object. + * + * @param {string|object} string + * @return {Object} + * @public + */ + +function parse (string) { + if (!string) { + throw new TypeError('argument string is required') + } + + // support req/res-like objects as argument + var header = typeof string === 'object' + ? getcontenttype(string) + : string + + if (typeof header !== 'string') { + throw new TypeError('argument string is required to be a string') + } + + var index = header.indexOf(';') + var type = index !== -1 + ? header.slice(0, index).trim() + : header.trim() + + if (!TYPE_REGEXP.test(type)) { + throw new TypeError('invalid media type') + } + + var obj = new ContentType(type.toLowerCase()) + + // parse parameters + if (index !== -1) { + var key + var match + var value + + PARAM_REGEXP.lastIndex = index + + while ((match = PARAM_REGEXP.exec(header))) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value.charCodeAt(0) === 0x22 /* " */) { + // remove quotes + value = value.slice(1, -1) + + // remove escapes + if (value.indexOf('\\') !== -1) { + value = value.replace(QESC_REGEXP, '$1') + } + } + + obj.parameters[key] = value + } + + if (index !== header.length) { + throw new TypeError('invalid parameter format') + } + } + + return obj +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @private + */ + +function getcontenttype (obj) { + var header + + if (typeof obj.getHeader === 'function') { + // res-like + header = obj.getHeader('content-type') + } else if (typeof obj.headers === 'object') { + // req-like + header = obj.headers && obj.headers['content-type'] + } + + if (typeof header !== 'string') { + throw new TypeError('content-type header is missing from object') + } + + return header +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring (val) { + var str = String(val) + + // no need to quote tokens + if (TOKEN_REGEXP.test(str)) { + return str + } + + if (str.length > 0 && !TEXT_REGEXP.test(str)) { + throw new TypeError('invalid parameter value') + } + + return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' +} + +/** + * Class to represent a content type. + * @private + */ +function ContentType (type) { + this.parameters = Object.create(null) + this.type = type +} diff --git a/node_modules/content-type/package.json b/node_modules/content-type/package.json new file mode 100644 index 00000000..9db19f63 --- /dev/null +++ b/node_modules/content-type/package.json @@ -0,0 +1,42 @@ +{ + "name": "content-type", + "description": "Create and parse HTTP Content-Type header", + "version": "1.0.5", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "content-type", + "http", + "req", + "res", + "rfc7231" + ], + "repository": "jshttp/content-type", + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "8.32.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/project starter code/node_modules/cookie-signature/.npmignore b/node_modules/cookie-signature/.npmignore similarity index 100% rename from project starter code/node_modules/cookie-signature/.npmignore rename to node_modules/cookie-signature/.npmignore diff --git a/project starter code/node_modules/cookie-signature/History.md b/node_modules/cookie-signature/History.md similarity index 100% rename from project starter code/node_modules/cookie-signature/History.md rename to node_modules/cookie-signature/History.md diff --git a/project starter code/node_modules/cookie-signature/Readme.md b/node_modules/cookie-signature/Readme.md similarity index 100% rename from project starter code/node_modules/cookie-signature/Readme.md rename to node_modules/cookie-signature/Readme.md diff --git a/project starter code/node_modules/cookie-signature/index.js b/node_modules/cookie-signature/index.js similarity index 100% rename from project starter code/node_modules/cookie-signature/index.js rename to node_modules/cookie-signature/index.js diff --git a/project starter code/node_modules/cookie-signature/package.json b/node_modules/cookie-signature/package.json similarity index 100% rename from project starter code/node_modules/cookie-signature/package.json rename to node_modules/cookie-signature/package.json diff --git a/node_modules/cookie/HISTORY.md b/node_modules/cookie/HISTORY.md new file mode 100644 index 00000000..41ae4b01 --- /dev/null +++ b/node_modules/cookie/HISTORY.md @@ -0,0 +1,147 @@ +0.6.0 / 2023-11-06 +================== + + * Add `partitioned` option + +0.5.0 / 2022-04-11 +================== + + * Add `priority` option + * Fix `expires` option to reject invalid dates + * perf: improve default decode speed + * perf: remove slow string split in parse + +0.4.2 / 2022-02-02 +================== + + * perf: read value only when assigning in parse + * perf: remove unnecessary regexp in parse + +0.4.1 / 2020-04-21 +================== + + * Fix `maxAge` option to reject invalid values + +0.4.0 / 2019-05-15 +================== + + * Add `SameSite=None` support + +0.3.1 / 2016-05-26 +================== + + * Fix `sameSite: true` to work with draft-7 clients + - `true` now sends `SameSite=Strict` instead of `SameSite` + +0.3.0 / 2016-05-26 +================== + + * Add `sameSite` option + - Replaces `firstPartyOnly` option, never implemented by browsers + * Improve error message when `encode` is not a function + * Improve error message when `expires` is not a `Date` + +0.2.4 / 2016-05-20 +================== + + * perf: enable strict mode + * perf: use for loop in parse + * perf: use string concatenation for serialization + +0.2.3 / 2015-10-25 +================== + + * Fix cookie `Max-Age` to never be a floating point number + +0.2.2 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.2.1 / 2015-09-17 +================== + + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.2.0 / 2015-08-13 +================== + + * Add `firstPartyOnly` option + * Throw better error for invalid argument to parse + * perf: hoist regular expression + +0.1.5 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.1.4 / 2015-09-17 +================== + + * Throw better error for invalid argument to parse + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.1.3 / 2015-05-19 +================== + + * Reduce the scope of try-catch deopt + * Remove argument reassignments + +0.1.2 / 2014-04-16 +================== + + * Remove unnecessary files from npm package + +0.1.1 / 2014-02-23 +================== + + * Fix bad parse when cookie value contained a comma + * Fix support for `maxAge` of `0` + +0.1.0 / 2013-05-01 +================== + + * Add `decode` option + * Add `encode` option + +0.0.6 / 2013-04-08 +================== + + * Ignore cookie parts missing `=` + +0.0.5 / 2012-10-29 +================== + + * Return raw cookie value if value unescape errors + +0.0.4 / 2012-06-21 +================== + + * Use encode/decodeURIComponent for cookie encoding/decoding + - Improve server/client interoperability + +0.0.3 / 2012-06-06 +================== + + * Only escape special characters per the cookie RFC + +0.0.2 / 2012-06-01 +================== + + * Fix `maxAge` option to not throw error + +0.0.1 / 2012-05-28 +================== + + * Add more tests + +0.0.0 / 2012-05-28 +================== + + * Initial release diff --git a/project starter code/node_modules/cookie/LICENSE b/node_modules/cookie/LICENSE similarity index 100% rename from project starter code/node_modules/cookie/LICENSE rename to node_modules/cookie/LICENSE diff --git a/node_modules/cookie/README.md b/node_modules/cookie/README.md new file mode 100644 index 00000000..71fdac11 --- /dev/null +++ b/node_modules/cookie/README.md @@ -0,0 +1,317 @@ +# cookie + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install cookie +``` + +## API + +```js +var cookie = require('cookie'); +``` + +### cookie.parse(str, options) + +Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +`cookie.parse` accepts these properties in the options object. + +##### decode + +Specifies a function that will be used to decode a cookie's value. Since the value of a cookie +has a limited character set (and must be a simple string), this function can be used to decode +a previously-encoded cookie value into a JavaScript string or other object. + +The default function is the global `decodeURIComponent`, which will decode any URL-encoded +sequences into their byte representations. + +**note** if an error is thrown from this function, the original, non-decoded cookie value will +be returned as the cookie's value. + +### cookie.serialize(name, value, options) + +Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the +name for the cookie, the `value` argument is the value to set the cookie to, and the `options` +argument is an optional object containing additional serialization options. + +```js +var setCookie = cookie.serialize('foo', 'bar'); +// foo=bar +``` + +#### Options + +`cookie.serialize` accepts these properties in the options object. + +##### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no +domain is set, and most clients will consider the cookie to apply to only the current domain. + +##### encode + +Specifies a function that will be used to encode a cookie's value. Since value of a cookie +has a limited character set (and must be a simple string), this function can be used to encode +a value into a string suited for a cookie's value. + +The default function is the global `encodeURIComponent`, which will encode a JavaScript string +into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. + +##### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1]. +By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and +will delete it on a condition like exiting a web browser application. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### httpOnly + +Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy, +the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not allow client-side +JavaScript to see the cookie in `document.cookie`. + +##### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2]. +The given number will be converted to an integer by rounding down. By default, no maximum age is set. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### partitioned + +Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) +attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the +`Partitioned` attribute is not set. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +More information about can be found in [the proposal](https://github.com/privacycg/CHIPS). + +##### path + +Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path +is considered the ["default path"][rfc-6265-5.1.4]. + +##### priority + +Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. + + - `'low'` will set the `Priority` attribute to `Low`. + - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + - `'high'` will set the `Priority` attribute to `High`. + +More information about the different priority levels can be found in +[the specification][rfc-west-cookie-priority-00-4.1]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### sameSite + +Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7]. + + - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + - `false` will not set the `SameSite` attribute. + - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. + - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about the different enforcement levels can be found in +[the specification][rfc-6265bis-09-5.4.7]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### secure + +Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy, +the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to +the server in the future if the browser does not have an HTTPS connection. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require('cookie'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var url = require('url'); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { + httpOnly: true, + maxAge: 60 * 60 * 24 * 7 // 1 week + })); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader('Location', req.headers.referer || '/'); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parse(req.headers.cookie || ''); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader('Content-Type', 'text/html; charset=UTF-8'); + + if (name) { + res.write('

Welcome back, ' + escapeHtml(name) + '!

'); + } else { + res.write('

Hello, new visitor!

'); + } + + res.write('
'); + res.write(' '); + res.end('
'); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +$ npm test +``` + +## Benchmark + +``` +$ npm run bench + +> cookie@0.5.0 bench +> node benchmark/index.js + + node@18.18.2 + acorn@8.10.0 + ada@2.6.0 + ares@1.19.1 + brotli@1.0.9 + cldr@43.1 + icu@73.2 + llhttp@6.0.11 + modules@108 + napi@9 + nghttp2@1.57.0 + nghttp3@0.7.0 + ngtcp2@0.8.1 + openssl@3.0.10+quic + simdutf@3.2.14 + tz@2023c + undici@5.26.3 + unicode@15.0 + uv@1.44.2 + uvwasi@0.0.18 + v8@10.2.154.26-node.26 + zlib@1.2.13.1-motley + +> node benchmark/parse-top.js + + cookie.parse - top sites + + 14 tests completed. + + parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled) + parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled) + parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled) + parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled) + parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled) + parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled) + parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled) + parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled) + parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled) + parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled) + parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled) + parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled) + parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled) + parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled) + +> node benchmark/parse.js + + cookie.parse - generic + + 6 tests completed. + + simple x 3,214,032 ops/sec ±1.61% (183 runs sampled) + decode x 587,237 ops/sec ±1.16% (187 runs sampled) + unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled) + duplicates x 857,008 ops/sec ±0.89% (187 runs sampled) + 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled) + 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled) +``` + +## References + +- [RFC 6265: HTTP State Management Mechanism][rfc-6265] +- [Same-site Cookies][rfc-6265bis-09-5.4.7] + +[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/ +[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 +[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 +[rfc-6265]: https://tools.ietf.org/html/rfc6265 +[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4 +[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1 +[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2 +[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3 +[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4 +[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5 +[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6 +[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3 + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master +[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master +[node-image]: https://badgen.net/npm/node/cookie +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/cookie +[npm-url]: https://npmjs.org/package/cookie +[npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/project starter code/node_modules/cookie/SECURITY.md b/node_modules/cookie/SECURITY.md similarity index 100% rename from project starter code/node_modules/cookie/SECURITY.md rename to node_modules/cookie/SECURITY.md diff --git a/node_modules/cookie/index.js b/node_modules/cookie/index.js new file mode 100644 index 00000000..03d4c386 --- /dev/null +++ b/node_modules/cookie/index.js @@ -0,0 +1,274 @@ +/*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +exports.parse = parse; +exports.serialize = serialize; + +/** + * Module variables. + * @private + */ + +var __toString = Object.prototype.toString + +/** + * RegExp to match field-content in RFC 7230 sec 3.2 + * + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * obs-text = %x80-FF + */ + +var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; + +/** + * Parse a cookie header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + * + * @param {string} str + * @param {object} [options] + * @return {object} + * @public + */ + +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + + var obj = {} + var opt = options || {}; + var dec = opt.decode || decode; + + var index = 0 + while (index < str.length) { + var eqIdx = str.indexOf('=', index) + + // no more cookie pairs + if (eqIdx === -1) { + break + } + + var endIdx = str.indexOf(';', index) + + if (endIdx === -1) { + endIdx = str.length + } else if (endIdx < eqIdx) { + // backtrack on prior semicolon + index = str.lastIndexOf(';', eqIdx - 1) + 1 + continue + } + + var key = str.slice(index, eqIdx).trim() + + // only assign once + if (undefined === obj[key]) { + var val = str.slice(eqIdx + 1, endIdx).trim() + + // quoted values + if (val.charCodeAt(0) === 0x22) { + val = val.slice(1, -1) + } + + obj[key] = tryDecode(val, dec); + } + + index = endIdx + 1 + } + + return obj; +} + +/** + * Serialize data into a cookie header. + * + * Serialize the a name value pair into a cookie string suitable for + * http headers. An optional options object specified cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + * + * @param {string} name + * @param {string} val + * @param {object} [options] + * @return {string} + * @public + */ + +function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + + if (typeof enc !== 'function') { + throw new TypeError('option encode is invalid'); + } + + if (!fieldContentRegExp.test(name)) { + throw new TypeError('argument name is invalid'); + } + + var value = enc(val); + + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError('argument val is invalid'); + } + + var str = name + '=' + value; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + + if (isNaN(maxAge) || !isFinite(maxAge)) { + throw new TypeError('option maxAge is invalid') + } + + str += '; Max-Age=' + Math.floor(maxAge); + } + + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError('option domain is invalid'); + } + + str += '; Domain=' + opt.domain; + } + + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError('option path is invalid'); + } + + str += '; Path=' + opt.path; + } + + if (opt.expires) { + var expires = opt.expires + + if (!isDate(expires) || isNaN(expires.valueOf())) { + throw new TypeError('option expires is invalid'); + } + + str += '; Expires=' + expires.toUTCString() + } + + if (opt.httpOnly) { + str += '; HttpOnly'; + } + + if (opt.secure) { + str += '; Secure'; + } + + if (opt.partitioned) { + str += '; Partitioned' + } + + if (opt.priority) { + var priority = typeof opt.priority === 'string' + ? opt.priority.toLowerCase() + : opt.priority + + switch (priority) { + case 'low': + str += '; Priority=Low' + break + case 'medium': + str += '; Priority=Medium' + break + case 'high': + str += '; Priority=High' + break + default: + throw new TypeError('option priority is invalid') + } + } + + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === 'string' + ? opt.sameSite.toLowerCase() : opt.sameSite; + + switch (sameSite) { + case true: + str += '; SameSite=Strict'; + break; + case 'lax': + str += '; SameSite=Lax'; + break; + case 'strict': + str += '; SameSite=Strict'; + break; + case 'none': + str += '; SameSite=None'; + break; + default: + throw new TypeError('option sameSite is invalid'); + } + } + + return str; +} + +/** + * URL-decode string value. Optimized to skip native call when no %. + * + * @param {string} str + * @returns {string} + */ + +function decode (str) { + return str.indexOf('%') !== -1 + ? decodeURIComponent(str) + : str +} + +/** + * URL-encode value. + * + * @param {string} val + * @returns {string} + */ + +function encode (val) { + return encodeURIComponent(val) +} + +/** + * Determine if value is a Date. + * + * @param {*} val + * @private + */ + +function isDate (val) { + return __toString.call(val) === '[object Date]' || + val instanceof Date +} + +/** + * Try decoding a string using a decoding function. + * + * @param {string} str + * @param {function} decode + * @private + */ + +function tryDecode(str, decode) { + try { + return decode(str); + } catch (e) { + return str; + } +} diff --git a/node_modules/cookie/package.json b/node_modules/cookie/package.json new file mode 100644 index 00000000..0c3f0063 --- /dev/null +++ b/node_modules/cookie/package.json @@ -0,0 +1,44 @@ +{ + "name": "cookie", + "description": "HTTP server cookie parsing and serialization", + "version": "0.6.0", + "author": "Roman Shtylman ", + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "keywords": [ + "cookie", + "cookies" + ], + "repository": "jshttp/cookie", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "8.53.0", + "eslint-plugin-markdown": "3.0.1", + "mocha": "10.2.0", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "top-sites": "1.1.194" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "update-bench": "node scripts/update-benchmark.js", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/project starter code/node_modules/debug/.coveralls.yml b/node_modules/debug/.coveralls.yml similarity index 100% rename from project starter code/node_modules/debug/.coveralls.yml rename to node_modules/debug/.coveralls.yml diff --git a/project starter code/node_modules/debug/.eslintrc b/node_modules/debug/.eslintrc similarity index 100% rename from project starter code/node_modules/debug/.eslintrc rename to node_modules/debug/.eslintrc diff --git a/project starter code/node_modules/debug/.npmignore b/node_modules/debug/.npmignore similarity index 100% rename from project starter code/node_modules/debug/.npmignore rename to node_modules/debug/.npmignore diff --git a/project starter code/node_modules/debug/.travis.yml b/node_modules/debug/.travis.yml similarity index 100% rename from project starter code/node_modules/debug/.travis.yml rename to node_modules/debug/.travis.yml diff --git a/project starter code/node_modules/debug/CHANGELOG.md b/node_modules/debug/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/debug/CHANGELOG.md rename to node_modules/debug/CHANGELOG.md diff --git a/project starter code/node_modules/debug/LICENSE b/node_modules/debug/LICENSE similarity index 100% rename from project starter code/node_modules/debug/LICENSE rename to node_modules/debug/LICENSE diff --git a/project starter code/node_modules/debug/Makefile b/node_modules/debug/Makefile similarity index 100% rename from project starter code/node_modules/debug/Makefile rename to node_modules/debug/Makefile diff --git a/project starter code/node_modules/debug/README.md b/node_modules/debug/README.md similarity index 100% rename from project starter code/node_modules/debug/README.md rename to node_modules/debug/README.md diff --git a/project starter code/node_modules/debug/component.json b/node_modules/debug/component.json similarity index 100% rename from project starter code/node_modules/debug/component.json rename to node_modules/debug/component.json diff --git a/project starter code/node_modules/debug/karma.conf.js b/node_modules/debug/karma.conf.js similarity index 100% rename from project starter code/node_modules/debug/karma.conf.js rename to node_modules/debug/karma.conf.js diff --git a/project starter code/node_modules/debug/node.js b/node_modules/debug/node.js similarity index 100% rename from project starter code/node_modules/debug/node.js rename to node_modules/debug/node.js diff --git a/project starter code/node_modules/debug/package.json b/node_modules/debug/package.json similarity index 100% rename from project starter code/node_modules/debug/package.json rename to node_modules/debug/package.json diff --git a/project starter code/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js similarity index 100% rename from project starter code/node_modules/debug/src/browser.js rename to node_modules/debug/src/browser.js diff --git a/project starter code/node_modules/debug/src/debug.js b/node_modules/debug/src/debug.js similarity index 100% rename from project starter code/node_modules/debug/src/debug.js rename to node_modules/debug/src/debug.js diff --git a/project starter code/node_modules/debug/src/index.js b/node_modules/debug/src/index.js similarity index 100% rename from project starter code/node_modules/debug/src/index.js rename to node_modules/debug/src/index.js diff --git a/project starter code/node_modules/debug/src/inspector-log.js b/node_modules/debug/src/inspector-log.js similarity index 100% rename from project starter code/node_modules/debug/src/inspector-log.js rename to node_modules/debug/src/inspector-log.js diff --git a/project starter code/node_modules/debug/src/node.js b/node_modules/debug/src/node.js similarity index 100% rename from project starter code/node_modules/debug/src/node.js rename to node_modules/debug/src/node.js diff --git a/node_modules/delayed-stream/.npmignore b/node_modules/delayed-stream/.npmignore new file mode 100644 index 00000000..9daeafb9 --- /dev/null +++ b/node_modules/delayed-stream/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/delayed-stream/License b/node_modules/delayed-stream/License new file mode 100644 index 00000000..4804b7ab --- /dev/null +++ b/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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. diff --git a/node_modules/delayed-stream/Makefile b/node_modules/delayed-stream/Makefile new file mode 100644 index 00000000..b4ff85a3 --- /dev/null +++ b/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/node_modules/delayed-stream/Readme.md b/node_modules/delayed-stream/Readme.md new file mode 100644 index 00000000..aca36f9f --- /dev/null +++ b/node_modules/delayed-stream/Readme.md @@ -0,0 +1,141 @@ +# delayed-stream + +Buffers events from a stream until you are ready to handle them. + +## Installation + +``` bash +npm install delayed-stream +``` + +## Usage + +The following example shows how to write a http echo server that delays its +response by 1000 ms. + +``` javascript +var DelayedStream = require('delayed-stream'); +var http = require('http'); + +http.createServer(function(req, res) { + var delayed = DelayedStream.create(req); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 1000); +}); +``` + +If you are not using `Stream#pipe`, you can also manually release the buffered +events by calling `delayedStream.resume()`: + +``` javascript +var delayed = DelayedStream.create(req); + +setTimeout(function() { + // Emit all buffered events and resume underlaying source + delayed.resume(); +}, 1000); +``` + +## Implementation + +In order to use this meta stream properly, here are a few things you should +know about the implementation. + +### Event Buffering / Proxying + +All events of the `source` stream are hijacked by overwriting the `source.emit` +method. Until node implements a catch-all event listener, this is the only way. + +However, delayed-stream still continues to emit all events it captures on the +`source`, regardless of whether you have released the delayed stream yet or +not. + +Upon creation, delayed-stream captures all `source` events and stores them in +an internal event buffer. Once `delayedStream.release()` is called, all +buffered events are emitted on the `delayedStream`, and the event buffer is +cleared. After that, delayed-stream merely acts as a proxy for the underlaying +source. + +### Error handling + +Error events on `source` are buffered / proxied just like any other events. +However, `delayedStream.create` attaches a no-op `'error'` listener to the +`source`. This way you only have to handle errors on the `delayedStream` +object, rather than in two places. + +### Buffer limits + +delayed-stream provides a `maxDataSize` property that can be used to limit +the amount of data being buffered. In order to protect you from bad `source` +streams that don't react to `source.pause()`, this feature is enabled by +default. + +## API + +### DelayedStream.create(source, [options]) + +Returns a new `delayedStream`. Available options are: + +* `pauseStream` +* `maxDataSize` + +The description for those properties can be found below. + +### delayedStream.source + +The `source` stream managed by this object. This is useful if you are +passing your `delayedStream` around, and you still want to access properties +on the `source` object. + +### delayedStream.pauseStream = true + +Whether to pause the underlaying `source` when calling +`DelayedStream.create()`. Modifying this property afterwards has no effect. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. You can also modify this property during runtime. + +### delayedStream.dataSize = 0 + +The amount of data buffered so far. + +### delayedStream.readable + +An ECMA5 getter that returns the value of `source.readable`. + +### delayedStream.resume() + +If the `delayedStream` has not been released so far, `delayedStream.release()` +is called. + +In either case, `source.resume()` is called. + +### delayedStream.pause() + +Calls `source.pause()`. + +### delayedStream.pipe(dest) + +Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. + +### delayedStream.release() + +Emits and clears all events that have been buffered up so far. This does not +resume the underlaying source, use `delayedStream.resume()` instead. + +## License + +delayed-stream is licensed under the MIT license. diff --git a/node_modules/delayed-stream/lib/delayed_stream.js b/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 00000000..b38fc85f --- /dev/null +++ b/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,107 @@ +var Stream = require('stream').Stream; +var util = require('util'); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; diff --git a/node_modules/delayed-stream/package.json b/node_modules/delayed-stream/package.json new file mode 100644 index 00000000..eea3291c --- /dev/null +++ b/node_modules/delayed-stream/package.json @@ -0,0 +1,27 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "contributors": [ + "Mike Atkins " + ], + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "license": "MIT", + "version": "1.0.0", + "homepage": "https://github.com/felixge/node-delayed-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-delayed-stream.git" + }, + "main": "./lib/delayed_stream", + "engines": { + "node": ">=0.4.0" + }, + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + } +} diff --git a/project starter code/node_modules/depd/History.md b/node_modules/depd/History.md similarity index 100% rename from project starter code/node_modules/depd/History.md rename to node_modules/depd/History.md diff --git a/project starter code/node_modules/depd/LICENSE b/node_modules/depd/LICENSE similarity index 100% rename from project starter code/node_modules/depd/LICENSE rename to node_modules/depd/LICENSE diff --git a/project starter code/node_modules/depd/Readme.md b/node_modules/depd/Readme.md similarity index 100% rename from project starter code/node_modules/depd/Readme.md rename to node_modules/depd/Readme.md diff --git a/project starter code/node_modules/depd/index.js b/node_modules/depd/index.js similarity index 100% rename from project starter code/node_modules/depd/index.js rename to node_modules/depd/index.js diff --git a/project starter code/node_modules/depd/lib/browser/index.js b/node_modules/depd/lib/browser/index.js similarity index 100% rename from project starter code/node_modules/depd/lib/browser/index.js rename to node_modules/depd/lib/browser/index.js diff --git a/project starter code/node_modules/depd/package.json b/node_modules/depd/package.json similarity index 100% rename from project starter code/node_modules/depd/package.json rename to node_modules/depd/package.json diff --git a/project starter code/node_modules/destroy/LICENSE b/node_modules/destroy/LICENSE similarity index 100% rename from project starter code/node_modules/destroy/LICENSE rename to node_modules/destroy/LICENSE diff --git a/project starter code/node_modules/destroy/README.md b/node_modules/destroy/README.md similarity index 100% rename from project starter code/node_modules/destroy/README.md rename to node_modules/destroy/README.md diff --git a/project starter code/node_modules/destroy/index.js b/node_modules/destroy/index.js similarity index 100% rename from project starter code/node_modules/destroy/index.js rename to node_modules/destroy/index.js diff --git a/project starter code/node_modules/destroy/package.json b/node_modules/destroy/package.json similarity index 100% rename from project starter code/node_modules/destroy/package.json rename to node_modules/destroy/package.json diff --git a/project starter code/node_modules/dom-walk/LICENCE b/node_modules/dom-walk/LICENCE similarity index 100% rename from project starter code/node_modules/dom-walk/LICENCE rename to node_modules/dom-walk/LICENCE diff --git a/project starter code/node_modules/dom-walk/Makefile b/node_modules/dom-walk/Makefile similarity index 100% rename from project starter code/node_modules/dom-walk/Makefile rename to node_modules/dom-walk/Makefile diff --git a/project starter code/node_modules/dom-walk/README.md b/node_modules/dom-walk/README.md similarity index 100% rename from project starter code/node_modules/dom-walk/README.md rename to node_modules/dom-walk/README.md diff --git a/project starter code/node_modules/dom-walk/example/index.js b/node_modules/dom-walk/example/index.js similarity index 100% rename from project starter code/node_modules/dom-walk/example/index.js rename to node_modules/dom-walk/example/index.js diff --git a/project starter code/node_modules/dom-walk/index.js b/node_modules/dom-walk/index.js similarity index 100% rename from project starter code/node_modules/dom-walk/index.js rename to node_modules/dom-walk/index.js diff --git a/project starter code/node_modules/dom-walk/package.json b/node_modules/dom-walk/package.json similarity index 100% rename from project starter code/node_modules/dom-walk/package.json rename to node_modules/dom-walk/package.json diff --git a/project starter code/node_modules/ee-first/LICENSE b/node_modules/ee-first/LICENSE similarity index 100% rename from project starter code/node_modules/ee-first/LICENSE rename to node_modules/ee-first/LICENSE diff --git a/project starter code/node_modules/ee-first/README.md b/node_modules/ee-first/README.md similarity index 100% rename from project starter code/node_modules/ee-first/README.md rename to node_modules/ee-first/README.md diff --git a/project starter code/node_modules/ee-first/index.js b/node_modules/ee-first/index.js similarity index 100% rename from project starter code/node_modules/ee-first/index.js rename to node_modules/ee-first/index.js diff --git a/project starter code/node_modules/ee-first/package.json b/node_modules/ee-first/package.json similarity index 100% rename from project starter code/node_modules/ee-first/package.json rename to node_modules/ee-first/package.json diff --git a/project starter code/node_modules/encodeurl/HISTORY.md b/node_modules/encodeurl/HISTORY.md similarity index 100% rename from project starter code/node_modules/encodeurl/HISTORY.md rename to node_modules/encodeurl/HISTORY.md diff --git a/project starter code/node_modules/encodeurl/LICENSE b/node_modules/encodeurl/LICENSE similarity index 100% rename from project starter code/node_modules/encodeurl/LICENSE rename to node_modules/encodeurl/LICENSE diff --git a/project starter code/node_modules/encodeurl/README.md b/node_modules/encodeurl/README.md similarity index 100% rename from project starter code/node_modules/encodeurl/README.md rename to node_modules/encodeurl/README.md diff --git a/project starter code/node_modules/encodeurl/index.js b/node_modules/encodeurl/index.js similarity index 100% rename from project starter code/node_modules/encodeurl/index.js rename to node_modules/encodeurl/index.js diff --git a/project starter code/node_modules/encodeurl/package.json b/node_modules/encodeurl/package.json similarity index 100% rename from project starter code/node_modules/encodeurl/package.json rename to node_modules/encodeurl/package.json diff --git a/project starter code/node_modules/escape-html/LICENSE b/node_modules/escape-html/LICENSE similarity index 100% rename from project starter code/node_modules/escape-html/LICENSE rename to node_modules/escape-html/LICENSE diff --git a/project starter code/node_modules/escape-html/Readme.md b/node_modules/escape-html/Readme.md similarity index 100% rename from project starter code/node_modules/escape-html/Readme.md rename to node_modules/escape-html/Readme.md diff --git a/project starter code/node_modules/escape-html/index.js b/node_modules/escape-html/index.js similarity index 100% rename from project starter code/node_modules/escape-html/index.js rename to node_modules/escape-html/index.js diff --git a/project starter code/node_modules/escape-html/package.json b/node_modules/escape-html/package.json similarity index 100% rename from project starter code/node_modules/escape-html/package.json rename to node_modules/escape-html/package.json diff --git a/project starter code/node_modules/etag/HISTORY.md b/node_modules/etag/HISTORY.md similarity index 100% rename from project starter code/node_modules/etag/HISTORY.md rename to node_modules/etag/HISTORY.md diff --git a/project starter code/node_modules/etag/LICENSE b/node_modules/etag/LICENSE similarity index 100% rename from project starter code/node_modules/etag/LICENSE rename to node_modules/etag/LICENSE diff --git a/project starter code/node_modules/etag/README.md b/node_modules/etag/README.md similarity index 100% rename from project starter code/node_modules/etag/README.md rename to node_modules/etag/README.md diff --git a/project starter code/node_modules/etag/index.js b/node_modules/etag/index.js similarity index 100% rename from project starter code/node_modules/etag/index.js rename to node_modules/etag/index.js diff --git a/project starter code/node_modules/etag/package.json b/node_modules/etag/package.json similarity index 100% rename from project starter code/node_modules/etag/package.json rename to node_modules/etag/package.json diff --git a/project starter code/node_modules/exif-parser/.npmignore b/node_modules/exif-parser/.npmignore similarity index 100% rename from project starter code/node_modules/exif-parser/.npmignore rename to node_modules/exif-parser/.npmignore diff --git a/project starter code/node_modules/exif-parser/CHANGELOG.md b/node_modules/exif-parser/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/exif-parser/CHANGELOG.md rename to node_modules/exif-parser/CHANGELOG.md diff --git a/project starter code/node_modules/exif-parser/LICENSE.md b/node_modules/exif-parser/LICENSE.md similarity index 100% rename from project starter code/node_modules/exif-parser/LICENSE.md rename to node_modules/exif-parser/LICENSE.md diff --git a/project starter code/node_modules/exif-parser/Makefile b/node_modules/exif-parser/Makefile similarity index 100% rename from project starter code/node_modules/exif-parser/Makefile rename to node_modules/exif-parser/Makefile diff --git a/project starter code/node_modules/exif-parser/README.md b/node_modules/exif-parser/README.md similarity index 100% rename from project starter code/node_modules/exif-parser/README.md rename to node_modules/exif-parser/README.md diff --git a/project starter code/node_modules/exif-parser/browser-global.js b/node_modules/exif-parser/browser-global.js similarity index 100% rename from project starter code/node_modules/exif-parser/browser-global.js rename to node_modules/exif-parser/browser-global.js diff --git a/project starter code/node_modules/exif-parser/cmd/extract-thumbnail.js b/node_modules/exif-parser/cmd/extract-thumbnail.js similarity index 100% rename from project starter code/node_modules/exif-parser/cmd/extract-thumbnail.js rename to node_modules/exif-parser/cmd/extract-thumbnail.js diff --git a/project starter code/node_modules/exif-parser/cmd/list.js b/node_modules/exif-parser/cmd/list.js similarity index 100% rename from project starter code/node_modules/exif-parser/cmd/list.js rename to node_modules/exif-parser/cmd/list.js diff --git a/project starter code/node_modules/exif-parser/index.js b/node_modules/exif-parser/index.js similarity index 100% rename from project starter code/node_modules/exif-parser/index.js rename to node_modules/exif-parser/index.js diff --git a/project starter code/node_modules/exif-parser/lib/bufferstream.js b/node_modules/exif-parser/lib/bufferstream.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/bufferstream.js rename to node_modules/exif-parser/lib/bufferstream.js diff --git a/project starter code/node_modules/exif-parser/lib/date.js b/node_modules/exif-parser/lib/date.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/date.js rename to node_modules/exif-parser/lib/date.js diff --git a/project starter code/node_modules/exif-parser/lib/dom-bufferstream.js b/node_modules/exif-parser/lib/dom-bufferstream.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/dom-bufferstream.js rename to node_modules/exif-parser/lib/dom-bufferstream.js diff --git a/project starter code/node_modules/exif-parser/lib/exif-tags.js b/node_modules/exif-parser/lib/exif-tags.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/exif-tags.js rename to node_modules/exif-parser/lib/exif-tags.js diff --git a/project starter code/node_modules/exif-parser/lib/exif.js b/node_modules/exif-parser/lib/exif.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/exif.js rename to node_modules/exif-parser/lib/exif.js diff --git a/project starter code/node_modules/exif-parser/lib/jpeg.js b/node_modules/exif-parser/lib/jpeg.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/jpeg.js rename to node_modules/exif-parser/lib/jpeg.js diff --git a/project starter code/node_modules/exif-parser/lib/parser.js b/node_modules/exif-parser/lib/parser.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/parser.js rename to node_modules/exif-parser/lib/parser.js diff --git a/project starter code/node_modules/exif-parser/lib/simplify.js b/node_modules/exif-parser/lib/simplify.js similarity index 100% rename from project starter code/node_modules/exif-parser/lib/simplify.js rename to node_modules/exif-parser/lib/simplify.js diff --git a/project starter code/node_modules/exif-parser/package.json b/node_modules/exif-parser/package.json similarity index 100% rename from project starter code/node_modules/exif-parser/package.json rename to node_modules/exif-parser/package.json diff --git a/project starter code/node_modules/exif-parser/test/expected-exif-tags.json b/node_modules/exif-parser/test/expected-exif-tags.json similarity index 100% rename from project starter code/node_modules/exif-parser/test/expected-exif-tags.json rename to node_modules/exif-parser/test/expected-exif-tags.json diff --git a/project starter code/node_modules/exif-parser/test/starfish.jpg b/node_modules/exif-parser/test/starfish.jpg similarity index 100% rename from project starter code/node_modules/exif-parser/test/starfish.jpg rename to node_modules/exif-parser/test/starfish.jpg diff --git a/project starter code/node_modules/exif-parser/test/test-date.js b/node_modules/exif-parser/test/test-date.js similarity index 100% rename from project starter code/node_modules/exif-parser/test/test-date.js rename to node_modules/exif-parser/test/test-date.js diff --git a/project starter code/node_modules/exif-parser/test/test-exif.js b/node_modules/exif-parser/test/test-exif.js similarity index 100% rename from project starter code/node_modules/exif-parser/test/test-exif.js rename to node_modules/exif-parser/test/test-exif.js diff --git a/project starter code/node_modules/exif-parser/test/test-jpeg.js b/node_modules/exif-parser/test/test-jpeg.js similarity index 100% rename from project starter code/node_modules/exif-parser/test/test-jpeg.js rename to node_modules/exif-parser/test/test-jpeg.js diff --git a/project starter code/node_modules/exif-parser/test/test-simplify.js b/node_modules/exif-parser/test/test-simplify.js similarity index 100% rename from project starter code/node_modules/exif-parser/test/test-simplify.js rename to node_modules/exif-parser/test/test-simplify.js diff --git a/project starter code/node_modules/exif-parser/test/test.jpg b/node_modules/exif-parser/test/test.jpg similarity index 100% rename from project starter code/node_modules/exif-parser/test/test.jpg rename to node_modules/exif-parser/test/test.jpg diff --git a/node_modules/express/History.md b/node_modules/express/History.md new file mode 100644 index 00000000..ac2e7cf7 --- /dev/null +++ b/node_modules/express/History.md @@ -0,0 +1,3615 @@ +4.19.2 / 2024-03-25 +========== + + * Improved fix for open redirect allow list bypass + +4.19.1 / 2024-03-20 +========== + + * Allow passing non-strings to res.location with new encoding handling checks + +4.19.0 / 2024-03-20 +========== + + * Prevent open redirect allow list bypass due to encodeurl + * deps: cookie@0.6.0 + +4.18.3 / 2024-02-29 +========== + + * Fix routing requests without method + * deps: body-parser@1.20.2 + - Fix strict json error message on Node.js 19+ + - deps: content-type@~1.0.5 + - deps: raw-body@2.5.2 + * deps: cookie@0.6.0 + - Add `partitioned` option + +4.18.2 / 2022-10-08 +=================== + + * Fix regression routing a large stack in a single route + * deps: body-parser@1.20.1 + - deps: qs@6.11.0 + - perf: remove unnecessary object clone + * deps: qs@6.11.0 + +4.18.1 / 2022-04-29 +=================== + + * Fix hanging on large stack of sync routes + +4.18.0 / 2022-04-25 +=================== + + * Add "root" option to `res.download` + * Allow `options` without `filename` in `res.download` + * Deprecate string and non-integer arguments to `res.status` + * Fix behavior of `null`/`undefined` as `maxAge` in `res.cookie` + * Fix handling very large stacks of sync middleware + * Ignore `Object.prototype` values in settings through `app.set`/`app.get` + * Invoke `default` with same arguments as types in `res.format` + * Support proper 205 responses using `res.send` + * Use `http-errors` for `res.format` error + * deps: body-parser@1.20.0 + - Fix error message for json parse whitespace in `strict` + - Fix internal error when inflated body exceeds limit + - Prevent loss of async hooks context + - Prevent hanging when request already read + - deps: depd@2.0.0 + - deps: http-errors@2.0.0 + - deps: on-finished@2.4.1 + - deps: qs@6.10.3 + - deps: raw-body@2.5.1 + * deps: cookie@0.5.0 + - Add `priority` option + - Fix `expires` option to reject invalid dates + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: finalhandler@1.2.0 + - Remove set content headers that break response + - deps: on-finished@2.4.1 + - deps: statuses@2.0.1 + * deps: on-finished@2.4.1 + - Prevent loss of async hooks context + * deps: qs@6.10.3 + * deps: send@0.18.0 + - Fix emitted 416 error missing headers property + - Limit the headers removed for 304 response + - deps: depd@2.0.0 + - deps: destroy@1.2.0 + - deps: http-errors@2.0.0 + - deps: on-finished@2.4.1 + - deps: statuses@2.0.1 + * deps: serve-static@1.15.0 + - deps: send@0.18.0 + * deps: statuses@2.0.1 + - Remove code 306 + - Rename `425 Unordered Collection` to standard `425 Too Early` + +4.17.3 / 2022-02-16 +=================== + + * deps: accepts@~1.3.8 + - deps: mime-types@~2.1.34 + - deps: negotiator@0.6.3 + * deps: body-parser@1.19.2 + - deps: bytes@3.1.2 + - deps: qs@6.9.7 + - deps: raw-body@2.4.3 + * deps: cookie@0.4.2 + * deps: qs@6.9.7 + * Fix handling of `__proto__` keys + * pref: remove unnecessary regexp for trust proxy + +4.17.2 / 2021-12-16 +=================== + + * Fix handling of `undefined` in `res.jsonp` + * Fix handling of `undefined` when `"json escape"` is enabled + * Fix incorrect middleware execution with unanchored `RegExp`s + * Fix `res.jsonp(obj, status)` deprecation message + * Fix typo in `res.is` JSDoc + * deps: body-parser@1.19.1 + - deps: bytes@3.1.1 + - deps: http-errors@1.8.1 + - deps: qs@6.9.6 + - deps: raw-body@2.4.2 + - deps: safe-buffer@5.2.1 + - deps: type-is@~1.6.18 + * deps: content-disposition@0.5.4 + - deps: safe-buffer@5.2.1 + * deps: cookie@0.4.1 + - Fix `maxAge` option to reject invalid values + * deps: proxy-addr@~2.0.7 + - Use `req.socket` over deprecated `req.connection` + - deps: forwarded@0.2.0 + - deps: ipaddr.js@1.9.1 + * deps: qs@6.9.6 + * deps: safe-buffer@5.2.1 + * deps: send@0.17.2 + - deps: http-errors@1.8.1 + - deps: ms@2.1.3 + - pref: ignore empty http tokens + * deps: serve-static@1.14.2 + - deps: send@0.17.2 + * deps: setprototypeof@1.2.0 + +4.17.1 / 2019-05-25 +=================== + + * Revert "Improve error message for `null`/`undefined` to `res.status`" + +4.17.0 / 2019-05-16 +=================== + + * Add `express.raw` to parse bodies into `Buffer` + * Add `express.text` to parse bodies into string + * Improve error message for non-strings to `res.sendFile` + * Improve error message for `null`/`undefined` to `res.status` + * Support multiple hosts in `X-Forwarded-Host` + * deps: accepts@~1.3.7 + * deps: body-parser@1.19.0 + - Add encoding MIK + - Add petabyte (`pb`) support + - Fix parsing array brackets after index + - deps: bytes@3.1.0 + - deps: http-errors@1.7.2 + - deps: iconv-lite@0.4.24 + - deps: qs@6.7.0 + - deps: raw-body@2.4.0 + - deps: type-is@~1.6.17 + * deps: content-disposition@0.5.3 + * deps: cookie@0.4.0 + - Add `SameSite=None` support + * deps: finalhandler@~1.1.2 + - Set stricter `Content-Security-Policy` header + - deps: parseurl@~1.3.3 + - deps: statuses@~1.5.0 + * deps: parseurl@~1.3.3 + * deps: proxy-addr@~2.0.5 + - deps: ipaddr.js@1.9.0 + * deps: qs@6.7.0 + - Fix parsing array brackets after index + * deps: range-parser@~1.2.1 + * deps: send@0.17.1 + - Set stricter CSP header in redirect & error responses + - deps: http-errors@~1.7.2 + - deps: mime@1.6.0 + - deps: ms@2.1.1 + - deps: range-parser@~1.2.1 + - deps: statuses@~1.5.0 + - perf: remove redundant `path.normalize` call + * deps: serve-static@1.14.1 + - Set stricter CSP header in redirect response + - deps: parseurl@~1.3.3 + - deps: send@0.17.1 + * deps: setprototypeof@1.1.1 + * deps: statuses@~1.5.0 + - Add `103 Early Hints` + * deps: type-is@~1.6.18 + - deps: mime-types@~2.1.24 + - perf: prevent internal `throw` on invalid type + +4.16.4 / 2018-10-10 +=================== + + * Fix issue where `"Request aborted"` may be logged in `res.sendfile` + * Fix JSDoc for `Router` constructor + * deps: body-parser@1.18.3 + - Fix deprecation warnings on Node.js 10+ + - Fix stack trace for strict json parse error + - deps: depd@~1.1.2 + - deps: http-errors@~1.6.3 + - deps: iconv-lite@0.4.23 + - deps: qs@6.5.2 + - deps: raw-body@2.3.3 + - deps: type-is@~1.6.16 + * deps: proxy-addr@~2.0.4 + - deps: ipaddr.js@1.8.0 + * deps: qs@6.5.2 + * deps: safe-buffer@5.1.2 + +4.16.3 / 2018-03-12 +=================== + + * deps: accepts@~1.3.5 + - deps: mime-types@~2.1.18 + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: encodeurl@~1.0.2 + - Fix encoding `%` as last character + * deps: finalhandler@1.1.1 + - Fix 404 output for bad / missing pathnames + - deps: encodeurl@~1.0.2 + - deps: statuses@~1.4.0 + * deps: proxy-addr@~2.0.3 + - deps: ipaddr.js@1.6.0 + * deps: send@0.16.2 + - Fix incorrect end tag in default error & redirects + - deps: depd@~1.1.2 + - deps: encodeurl@~1.0.2 + - deps: statuses@~1.4.0 + * deps: serve-static@1.13.2 + - Fix incorrect end tag in redirects + - deps: encodeurl@~1.0.2 + - deps: send@0.16.2 + * deps: statuses@~1.4.0 + * deps: type-is@~1.6.16 + - deps: mime-types@~2.1.18 + +4.16.2 / 2017-10-09 +=================== + + * Fix `TypeError` in `res.send` when given `Buffer` and `ETag` header set + * perf: skip parsing of entire `X-Forwarded-Proto` header + +4.16.1 / 2017-09-29 +=================== + + * deps: send@0.16.1 + * deps: serve-static@1.13.1 + - Fix regression when `root` is incorrectly set to a file + - deps: send@0.16.1 + +4.16.0 / 2017-09-28 +=================== + + * Add `"json escape"` setting for `res.json` and `res.jsonp` + * Add `express.json` and `express.urlencoded` to parse bodies + * Add `options` argument to `res.download` + * Improve error message when autoloading invalid view engine + * Improve error messages when non-function provided as middleware + * Skip `Buffer` encoding when not generating ETag for small response + * Use `safe-buffer` for improved Buffer API + * deps: accepts@~1.3.4 + - deps: mime-types@~2.1.16 + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: etag@~1.8.1 + - perf: replace regular expression with substring + * deps: finalhandler@1.1.0 + - Use `res.headersSent` when available + * deps: parseurl@~1.3.2 + - perf: reduce overhead for full URLs + - perf: unroll the "fast-path" `RegExp` + * deps: proxy-addr@~2.0.2 + - Fix trimming leading / trailing OWS in `X-Forwarded-For` + - deps: forwarded@~0.1.2 + - deps: ipaddr.js@1.5.2 + - perf: reduce overhead when no `X-Forwarded-For` header + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: send@0.16.0 + - Add 70 new types for file extensions + - Add `immutable` option + - Fix missing `` in default error & redirects + - Set charset as "UTF-8" for .js and .json + - Use instance methods on steam to check for listeners + - deps: mime@1.4.1 + - perf: improve path validation speed + * deps: serve-static@1.13.0 + - Add 70 new types for file extensions + - Add `immutable` option + - Set charset as "UTF-8" for .js and .json + - deps: send@0.16.0 + * deps: setprototypeof@1.1.0 + * deps: utils-merge@1.0.1 + * deps: vary@~1.1.2 + - perf: improve header token parsing speed + * perf: re-use options object when generating ETags + * perf: remove dead `.charset` set in `res.jsonp` + +4.15.5 / 2017-09-24 +=================== + + * deps: debug@2.6.9 + * deps: finalhandler@~1.0.6 + - deps: debug@2.6.9 + - deps: parseurl@~1.3.2 + * deps: fresh@0.5.2 + - Fix handling of modified headers with invalid dates + - perf: improve ETag match loop + - perf: improve `If-None-Match` token parsing + * deps: send@0.15.6 + - Fix handling of modified headers with invalid dates + - deps: debug@2.6.9 + - deps: etag@~1.8.1 + - deps: fresh@0.5.2 + - perf: improve `If-Match` token parsing + * deps: serve-static@1.12.6 + - deps: parseurl@~1.3.2 + - deps: send@0.15.6 + - perf: improve slash collapsing + +4.15.4 / 2017-08-06 +=================== + + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: finalhandler@~1.0.4 + - deps: debug@2.6.8 + * deps: proxy-addr@~1.1.5 + - Fix array argument being altered + - deps: ipaddr.js@1.4.0 + * deps: qs@6.5.0 + * deps: send@0.15.4 + - deps: debug@2.6.8 + - deps: depd@~1.1.1 + - deps: http-errors@~1.6.2 + * deps: serve-static@1.12.4 + - deps: send@0.15.4 + +4.15.3 / 2017-05-16 +=================== + + * Fix error when `res.set` cannot add charset to `Content-Type` + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: finalhandler@~1.0.3 + - Fix missing `` in HTML document + - deps: debug@2.6.7 + * deps: proxy-addr@~1.1.4 + - deps: ipaddr.js@1.3.0 + * deps: send@0.15.3 + - deps: debug@2.6.7 + - deps: ms@2.0.0 + * deps: serve-static@1.12.3 + - deps: send@0.15.3 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + * deps: vary@~1.1.1 + - perf: hoist regular expression + +4.15.2 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +4.15.1 / 2017-03-05 +=================== + + * deps: send@0.15.1 + - Fix issue when `Date.parse` does not return `NaN` on invalid date + - Fix strict violation in broken environments + * deps: serve-static@1.12.1 + - Fix issue when `Date.parse` does not return `NaN` on invalid date + - deps: send@0.15.1 + +4.15.0 / 2017-03-01 +=================== + + * Add debug message when loading view engine + * Add `next("router")` to exit from router + * Fix case where `router.use` skipped requests routes did not + * Remove usage of `res._headers` private field + - Improves compatibility with Node.js 8 nightly + * Skip routing when `req.url` is not set + * Use `%o` in path debug to tell types apart + * Use `Object.create` to setup request & response prototypes + * Use `setprototypeof` module to replace `__proto__` setting + * Use `statuses` instead of `http` module for status messages + * deps: debug@2.6.1 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable set to `3` or higher + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: etag@~1.8.0 + - Use SHA1 instead of MD5 for ETag hashing + - Works with FIPS 140-2 OpenSSL configuration + * deps: finalhandler@~1.0.0 + - Fix exception when `err` cannot be converted to a string + - Fully URL-encode the pathname in the 404 + - Only include the pathname in the 404 message + - Send complete HTML document + - Set `Content-Security-Policy: default-src 'self'` header + - deps: debug@2.6.1 + * deps: fresh@0.5.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - perf: delay reading header values until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove duplicate conditional + - perf: remove unnecessary boolean coercions + - perf: skip checking modified time if ETag check failed + - perf: skip parsing `If-None-Match` when no `ETag` header + - perf: use `Date.parse` instead of `new Date` + * deps: qs@6.3.1 + - Fix array parsing from skipping empty values + - Fix compacting nested arrays + * deps: send@0.15.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - Remove usage of `res._headers` private field + - Support `If-Match` and `If-Unmodified-Since` headers + - Use `res.getHeaderNames()` when available + - Use `res.headersSent` when available + - deps: debug@2.6.1 + - deps: etag@~1.8.0 + - deps: fresh@0.5.0 + - deps: http-errors@~1.6.1 + * deps: serve-static@1.12.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - Remove usage of `res._headers` private field + - Send complete HTML document in redirect response + - Set default CSP header in redirect response + - Support `If-Match` and `If-Unmodified-Since` headers + - Use `res.getHeaderNames()` when available + - Use `res.headersSent` when available + - deps: send@0.15.0 + * perf: add fast match path for `*` route + * perf: improve `req.ips` performance + +4.14.1 / 2017-01-28 +=================== + + * deps: content-disposition@0.5.2 + * deps: finalhandler@0.5.1 + - Fix exception when `err.headers` is not an object + - deps: statuses@~1.3.1 + - perf: hoist regular expressions + - perf: remove duplicate validation path + * deps: proxy-addr@~1.1.3 + - deps: ipaddr.js@1.2.0 + * deps: send@0.14.2 + - deps: http-errors@~1.5.1 + - deps: ms@0.7.2 + - deps: statuses@~1.3.1 + * deps: serve-static@~1.11.2 + - deps: send@0.14.2 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +4.14.0 / 2016-06-16 +=================== + + * Add `acceptRanges` option to `res.sendFile`/`res.sendfile` + * Add `cacheControl` option to `res.sendFile`/`res.sendfile` + * Add `options` argument to `req.range` + - Includes the `combine` option + * Encode URL in `res.location`/`res.redirect` if not already encoded + * Fix some redirect handling in `res.sendFile`/`res.sendfile` + * Fix Windows absolute path check using forward slashes + * Improve error with invalid arguments to `req.get()` + * Improve performance for `res.json`/`res.jsonp` in most cases + * Improve `Range` header handling in `res.sendFile`/`res.sendfile` + * deps: accepts@~1.3.3 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Many performance improvements + - deps: mime-types@~2.1.11 + - deps: negotiator@0.6.1 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: cookie@0.3.1 + - Add `sameSite` option + - Fix cookie `Max-Age` to never be a floating point number + - Improve error message when `encode` is not a function + - Improve error message when `expires` is not a `Date` + - Throw better error for invalid argument to parse + - Throw on invalid values provided to `serialize` + - perf: enable strict mode + - perf: hoist regular expression + - perf: use for loop in parse + - perf: use string concatenation for serialization + * deps: finalhandler@0.5.0 + - Change invalid or non-numeric status code to 500 + - Overwrite status message to match set status code + - Prefer `err.statusCode` if `err.status` is invalid + - Set response headers from `err.headers` object + - Use `statuses` instead of `http` module for status messages + * deps: proxy-addr@~1.1.2 + - Fix accepting various invalid netmasks + - Fix IPv6-mapped IPv4 validation edge cases + - IPv4 netmasks must be contiguous + - IPv6 addresses cannot be used as a netmask + - deps: ipaddr.js@1.1.1 + * deps: qs@6.2.0 + - Add `decoder` option in `parse` function + * deps: range-parser@~1.2.0 + - Add `combine` option to combine overlapping ranges + - Fix incorrectly returning -1 when there is at least one valid range + - perf: remove internal function + * deps: send@0.14.1 + - Add `acceptRanges` option + - Add `cacheControl` option + - Attempt to combine multiple ranges into single range + - Correctly inherit from `Stream` class + - Fix `Content-Range` header in 416 responses when using `start`/`end` options + - Fix `Content-Range` header missing from default 416 responses + - Fix redirect error when `path` contains raw non-URL characters + - Fix redirect when `path` starts with multiple forward slashes + - Ignore non-byte `Range` headers + - deps: http-errors@~1.5.0 + - deps: range-parser@~1.2.0 + - deps: statuses@~1.3.0 + - perf: remove argument reassignment + * deps: serve-static@~1.11.1 + - Add `acceptRanges` option + - Add `cacheControl` option + - Attempt to combine multiple ranges into single range + - Fix redirect error when `req.url` contains raw non-URL characters + - Ignore non-byte `Range` headers + - Use status code 301 for redirects + - deps: send@0.14.1 + * deps: type-is@~1.6.13 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.11 + * deps: vary@~1.1.0 + - Only accept valid field names in the `field` argument + * perf: use strict equality when possible + +4.13.4 / 2016-01-21 +=================== + + * deps: content-disposition@0.5.1 + - perf: enable strict mode + * deps: cookie@0.1.5 + - Throw on invalid values provided to `serialize` + * deps: depd@~1.1.0 + - Support web browser loading + - perf: enable strict mode + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + * deps: finalhandler@0.4.1 + - deps: escape-html@~1.0.3 + * deps: merge-descriptors@1.0.1 + - perf: enable strict mode + * deps: methods@~1.1.2 + - perf: enable strict mode + * deps: parseurl@~1.3.1 + - perf: enable strict mode + * deps: proxy-addr@~1.0.10 + - deps: ipaddr.js@1.0.5 + - perf: enable strict mode + * deps: range-parser@~1.0.3 + - perf: enable strict mode + * deps: send@0.13.1 + - deps: depd@~1.1.0 + - deps: destroy@~1.0.4 + - deps: escape-html@~1.0.3 + - deps: range-parser@~1.0.3 + * deps: serve-static@~1.10.2 + - deps: escape-html@~1.0.3 + - deps: parseurl@~1.3.0 + - deps: send@0.13.1 + +4.13.3 / 2015-08-02 +=================== + + * Fix infinite loop condition using `mergeParams: true` + * Fix inner numeric indices incorrectly altering parent `req.params` + +4.13.2 / 2015-07-31 +=================== + + * deps: accepts@~1.2.12 + - deps: mime-types@~2.1.4 + * deps: array-flatten@1.1.1 + - perf: enable strict mode + * deps: path-to-regexp@0.1.7 + - Fix regression with escaped round brackets and matching groups + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +4.13.1 / 2015-07-05 +=================== + + * deps: accepts@~1.2.10 + - deps: mime-types@~2.1.2 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +4.13.0 / 2015-06-20 +=================== + + * Add settings to debug output + * Fix `res.format` error when only `default` provided + * Fix issue where `next('route')` in `app.param` would incorrectly skip values + * Fix hiding platform issues with `decodeURIComponent` + - Only `URIError`s are a 400 + * Fix using `*` before params in routes + * Fix using capture groups before params in routes + * Simplify `res.cookie` to call `res.append` + * Use `array-flatten` module for flattening arrays + * deps: accepts@~1.2.9 + - deps: mime-types@~2.1.1 + - perf: avoid argument reassignment & argument slice + - perf: avoid negotiator recursive construction + - perf: enable strict mode + - perf: remove unnecessary bitwise operator + * deps: cookie@0.1.3 + - perf: deduce the scope of try-catch deopt + - perf: remove argument reassignments + * deps: escape-html@1.0.2 + * deps: etag@~1.7.0 + - Always include entity length in ETags for hash length extensions + - Generate non-Stats ETags using MD5 only (no longer CRC32) + - Improve stat performance by removing hashing + - Improve support for JXcore + - Remove base64 padding in ETags to shorten + - Support "fake" stats objects in environments without fs + - Use MD5 instead of MD4 in weak ETags over 1KB + * deps: finalhandler@0.4.0 + - Fix a false-positive when unpiping in Node.js 0.8 + - Support `statusCode` property on `Error` objects + - Use `unpipe` module for unpiping requests + - deps: escape-html@1.0.2 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove argument reassignment + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: path-to-regexp@0.1.6 + * deps: send@0.13.0 + - Allow Node.js HTTP server to set `Date` response header + - Fix incorrectly removing `Content-Location` on 304 response + - Improve the default redirect response headers + - Send appropriate headers on default error response + - Use `http-errors` for standard emitted errors + - Use `statuses` instead of `http` module for status messages + - deps: escape-html@1.0.2 + - deps: etag@~1.7.0 + - deps: fresh@0.3.0 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove unnecessary array allocations + * deps: serve-static@~1.10.0 + - Add `fallthrough` option + - Fix reading options from options prototype + - Improve the default redirect response headers + - Malformed URLs now `next()` instead of 400 + - deps: escape-html@1.0.2 + - deps: send@0.13.0 + - perf: enable strict mode + - perf: remove argument reassignment + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: isolate `app.render` try block + * perf: remove argument reassignments in application + * perf: remove argument reassignments in request prototype + * perf: remove argument reassignments in response prototype + * perf: remove argument reassignments in routing + * perf: remove argument reassignments in `View` + * perf: skip attempting to decode zero length string + * perf: use saved reference to `http.STATUS_CODES` + +4.12.4 / 2015-05-17 +=================== + + * deps: accepts@~1.2.7 + - deps: mime-types@~2.0.11 + - deps: negotiator@0.5.3 + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + * deps: depd@~1.0.1 + * deps: etag@~1.6.0 + - Improve support for JXcore + - Support "fake" stats objects in environments without `fs` + * deps: finalhandler@0.3.6 + - deps: debug@~2.2.0 + - deps: on-finished@~2.2.1 + * deps: on-finished@~2.2.1 + - Fix `isFinished(req)` when data buffered + * deps: proxy-addr@~1.0.8 + - deps: ipaddr.js@1.0.1 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: send@0.12.3 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: etag@~1.6.0 + - deps: ms@0.7.1 + - deps: on-finished@~2.2.1 + * deps: serve-static@~1.9.3 + - deps: send@0.12.3 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +4.12.3 / 2015-03-17 +=================== + + * deps: accepts@~1.2.5 + - deps: mime-types@~2.0.10 + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: finalhandler@0.3.4 + - deps: debug@~2.1.3 + * deps: proxy-addr@~1.0.7 + - deps: ipaddr.js@0.1.9 + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + * deps: send@0.12.2 + - Throw errors early for invalid `extensions` or `index` options + - deps: debug@~2.1.3 + * deps: serve-static@~1.9.2 + - deps: send@0.12.2 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +4.12.2 / 2015-03-02 +=================== + + * Fix regression where `"Request aborted"` is logged using `res.sendFile` + +4.12.1 / 2015-03-01 +=================== + + * Fix constructing application with non-configurable prototype properties + * Fix `ECONNRESET` errors from `res.sendFile` usage + * Fix `req.host` when using "trust proxy" hops count + * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count + * Fix wrong `code` on aborted connections from `res.sendFile` + * deps: merge-descriptors@1.0.0 + +4.12.0 / 2015-02-23 +=================== + + * Fix `"trust proxy"` setting to inherit when app is mounted + * Generate `ETag`s for all request responses + - No longer restricted to only responses for `GET` and `HEAD` requests + * Use `content-type` to parse `Content-Type` headers + * deps: accepts@~1.2.4 + - Fix preference sorting to be stable for long acceptable lists + - deps: mime-types@~2.0.9 + - deps: negotiator@0.5.1 + * deps: cookie-signature@1.0.6 + * deps: send@0.12.1 + - Always read the stat size from the file + - Fix mutating passed-in `options` + - deps: mime@1.3.4 + * deps: serve-static@~1.9.1 + - deps: send@0.12.1 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +4.11.2 / 2015-02-01 +=================== + + * Fix `res.redirect` double-calling `res.end` for `HEAD` requests + * deps: accepts@~1.2.3 + - deps: mime-types@~2.0.8 + * deps: proxy-addr@~1.0.6 + - deps: ipaddr.js@0.1.8 + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +4.11.1 / 2015-01-20 +=================== + + * deps: send@0.11.1 + - Fix root path disclosure + * deps: serve-static@~1.8.1 + - Fix redirect loop in Node.js 0.11.14 + - Fix root path disclosure + - deps: send@0.11.1 + +4.11.0 / 2015-01-13 +=================== + + * Add `res.append(field, val)` to append headers + * Deprecate leading `:` in `name` for `app.param(name, fn)` + * Deprecate `req.param()` -- use `req.params`, `req.body`, or `req.query` instead + * Deprecate `app.param(fn)` + * Fix `OPTIONS` responses to include the `HEAD` method properly + * Fix `res.sendFile` not always detecting aborted connection + * Match routes iteratively to prevent stack overflows + * deps: accepts@~1.2.2 + - deps: mime-types@~2.0.7 + - deps: negotiator@0.5.0 + * deps: send@0.11.0 + - deps: debug@~2.1.1 + - deps: etag@~1.5.1 + - deps: ms@0.7.0 + - deps: on-finished@~2.2.0 + * deps: serve-static@~1.8.0 + - deps: send@0.11.0 + +4.10.8 / 2015-01-13 +=================== + + * Fix crash from error within `OPTIONS` response handler + * deps: proxy-addr@~1.0.5 + - deps: ipaddr.js@0.1.6 + +4.10.7 / 2015-01-04 +=================== + + * Fix `Allow` header for `OPTIONS` to not contain duplicate methods + * Fix incorrect "Request aborted" for `res.sendFile` when `HEAD` or 304 + * deps: debug@~2.1.1 + * deps: finalhandler@0.3.3 + - deps: debug@~2.1.1 + - deps: on-finished@~2.2.0 + * deps: methods@~1.1.1 + * deps: on-finished@~2.2.0 + * deps: serve-static@~1.7.2 + - Fix potential open redirect when mounted at root + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +4.10.6 / 2014-12-12 +=================== + + * Fix exception in `req.fresh`/`req.stale` without response headers + +4.10.5 / 2014-12-10 +=================== + + * Fix `res.send` double-calling `res.end` for `HEAD` requests + * deps: accepts@~1.1.4 + - deps: mime-types@~2.0.4 + * deps: type-is@~1.5.4 + - deps: mime-types@~2.0.4 + +4.10.4 / 2014-11-24 +=================== + + * Fix `res.sendfile` logging standard write errors + +4.10.3 / 2014-11-23 +=================== + + * Fix `res.sendFile` logging standard write errors + * deps: etag@~1.5.1 + * deps: proxy-addr@~1.0.4 + - deps: ipaddr.js@0.1.5 + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + +4.10.2 / 2014-11-09 +=================== + + * Correctly invoke async router callback asynchronously + * deps: accepts@~1.1.3 + - deps: mime-types@~2.0.3 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +4.10.1 / 2014-10-28 +=================== + + * Fix handling of URLs containing `://` in the path + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +4.10.0 / 2014-10-23 +=================== + + * Add support for `app.set('views', array)` + - Views are looked up in sequence in array of directories + * Fix `res.send(status)` to mention `res.sendStatus(status)` + * Fix handling of invalid empty URLs + * Use `content-disposition` module for `res.attachment`/`res.download` + - Sends standards-compliant `Content-Disposition` header + - Full Unicode support + * Use `path.resolve` in view lookup + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + * deps: depd@~1.0.0 + * deps: etag@~1.5.0 + - Improve string performance + - Slightly improve speed for weak ETags over 1KB + * deps: finalhandler@0.3.2 + - Terminate in progress response only on error + - Use `on-finished` to determine request status + - deps: debug@~2.1.0 + - deps: on-finished@~2.1.1 + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: send@0.10.1 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: etag@~1.5.0 + - deps: on-finished@~2.1.1 + * deps: serve-static@~1.7.1 + - deps: send@0.10.1 + +4.9.8 / 2014-10-17 +================== + + * Fix `res.redirect` body when redirect status specified + * deps: accepts@~1.1.2 + - Fix error when media type has invalid parameter + - deps: negotiator@0.4.9 + +4.9.7 / 2014-10-10 +================== + + * Fix using same param name in array of paths + +4.9.6 / 2014-10-08 +================== + + * deps: accepts@~1.1.1 + - deps: mime-types@~2.0.2 + - deps: negotiator@0.4.8 + * deps: serve-static@~1.6.4 + - Fix redirect loop when index file serving disabled + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +4.9.5 / 2014-09-24 +================== + + * deps: etag@~1.4.0 + * deps: proxy-addr@~1.0.3 + - Use `forwarded` npm module + * deps: send@0.9.3 + - deps: etag@~1.4.0 + * deps: serve-static@~1.6.3 + - deps: send@0.9.3 + +4.9.4 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +4.9.3 / 2014-09-18 +================== + + * deps: proxy-addr@~1.0.2 + - Fix a global leak when multiple subnets are trusted + - deps: ipaddr.js@0.1.3 + +4.9.2 / 2014-09-17 +================== + + * Fix regression for empty string `path` in `app.use` + * Fix `router.use` to accept array of middleware without path + * Improve error message for bad `app.use` arguments + +4.9.1 / 2014-09-16 +================== + + * Fix `app.use` to accept array of middleware without path + * deps: depd@0.4.5 + * deps: etag@~1.3.1 + * deps: send@0.9.2 + - deps: depd@0.4.5 + - deps: etag@~1.3.1 + - deps: range-parser@~1.0.2 + * deps: serve-static@~1.6.2 + - deps: send@0.9.2 + +4.9.0 / 2014-09-08 +================== + + * Add `res.sendStatus` + * Invoke callback for sendfile when client aborts + - Applies to `res.sendFile`, `res.sendfile`, and `res.download` + - `err` will be populated with request aborted error + * Support IP address host in `req.subdomains` + * Use `etag` to generate `ETag` headers + * deps: accepts@~1.1.0 + - update `mime-types` + * deps: cookie-signature@1.0.5 + * deps: debug@~2.0.0 + * deps: finalhandler@0.2.0 + - Set `X-Content-Type-Options: nosniff` header + - deps: debug@~2.0.0 + * deps: fresh@0.2.4 + * deps: media-typer@0.3.0 + - Throw error when parameter format invalid on parse + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: range-parser@~1.0.2 + * deps: send@0.9.1 + - Add `lastModified` option + - Use `etag` to generate `ETag` header + - deps: debug@~2.0.0 + - deps: fresh@0.2.4 + * deps: serve-static@~1.6.1 + - Add `lastModified` option + - deps: send@0.9.1 + * deps: type-is@~1.5.1 + - fix `hasbody` to be true for `content-length: 0` + - deps: media-typer@0.3.0 + - deps: mime-types@~2.0.1 + * deps: vary@~1.0.0 + - Accept valid `Vary` header string as `field` + +4.8.8 / 2014-09-04 +================== + + * deps: send@0.8.5 + - Fix a path traversal issue when using `root` + - Fix malicious path detection for empty string path + * deps: serve-static@~1.5.4 + - deps: send@0.8.5 + +4.8.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +4.8.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +4.8.5 / 2014-08-18 +================== + + * deps: send@0.8.3 + - deps: destroy@1.0.3 + - deps: on-finished@2.1.0 + * deps: serve-static@~1.5.3 + - deps: send@0.8.3 + +4.8.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + * deps: send@0.8.2 + - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + * deps: serve-static@~1.5.2 + - deps: send@0.8.2 + +4.8.3 / 2014-08-10 +================== + + * deps: parseurl@~1.3.0 + * deps: qs@1.2.1 + * deps: serve-static@~1.5.1 + - Fix parsing of weird `req.originalUrl` values + - deps: parseurl@~1.3.0 + - deps: utils-merge@1.0.0 + +4.8.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +4.8.1 / 2014-08-06 +================== + + * fix incorrect deprecation warnings on `res.download` + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +4.8.0 / 2014-08-05 +================== + + * add `res.sendFile` + - accepts a file system path instead of a URL + - requires an absolute path or `root` option specified + * deprecate `res.sendfile` -- use `res.sendFile` instead + * support mounted app as any argument to `app.use()` + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + * deps: send@0.8.1 + - Add `extensions` option + * deps: serve-static@~1.5.0 + - Add `extensions` option + - deps: send@0.8.1 + +4.7.4 / 2014-08-04 +================== + + * fix `res.sendfile` regression for serving directory index files + * deps: send@0.7.4 + - Fix incorrect 403 on Windows and Node.js 0.11 + - Fix serving index files without root dir + * deps: serve-static@~1.4.4 + - deps: send@0.7.4 + +4.7.3 / 2014-08-04 +================== + + * deps: send@0.7.3 + - Fix incorrect 403 on Windows and Node.js 0.11 + * deps: serve-static@~1.4.3 + - Fix incorrect 403 on Windows and Node.js 0.11 + - deps: send@0.7.3 + +4.7.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + * deps: send@0.7.2 + - deps: depd@0.4.4 + * deps: serve-static@~1.4.2 + +4.7.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + * deps: send@0.7.1 + - deps: depd@0.4.3 + * deps: serve-static@~1.4.1 + +4.7.0 / 2014-07-25 +================== + + * fix `req.protocol` for proxy-direct connections + * configurable query parser with `app.set('query parser', parser)` + - `app.set('query parser', 'extended')` parse with "qs" module + - `app.set('query parser', 'simple')` parse with "querystring" core module + - `app.set('query parser', false)` disable query string parsing + - `app.set('query parser', true)` enable simple parsing + * deprecate `res.json(status, obj)` -- use `res.status(status).json(obj)` instead + * deprecate `res.jsonp(status, obj)` -- use `res.status(status).jsonp(obj)` instead + * deprecate `res.send(status, body)` -- use `res.status(status).send(body)` instead + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: finalhandler@0.1.0 + - Respond after request fully read + - deps: debug@1.0.4 + * deps: parseurl@~1.2.0 + - Cache URLs based on original value + - Remove no-longer-needed URL mis-parse work-around + - Simplify the "fast-path" `RegExp` + * deps: send@0.7.0 + - Add `dotfiles` option + - Cap `maxAge` value to 1 year + - deps: debug@1.0.4 + - deps: depd@0.4.2 + * deps: serve-static@~1.4.0 + - deps: parseurl@~1.2.0 + - deps: send@0.7.0 + * perf: prevent multiple `Buffer` creation in `res.send` + +4.6.1 / 2014-07-12 +================== + + * fix `subapp.mountpath` regression for `app.use(subapp)` + +4.6.0 / 2014-07-11 +================== + + * accept multiple callbacks to `app.use()` + * add explicit "Rosetta Flash JSONP abuse" protection + - previous versions are not vulnerable; this is just explicit protection + * catch errors in multiple `req.param(name, fn)` handlers + * deprecate `res.redirect(url, status)` -- use `res.redirect(status, url)` instead + * fix `res.send(status, num)` to send `num` as json (not error) + * remove unnecessary escaping when `res.jsonp` returns JSON response + * support non-string `path` in `app.use(path, fn)` + - supports array of paths + - supports `RegExp` + * router: fix optimization on router exit + * router: refactor location of `try` blocks + * router: speed up standard `app.use(fn)` + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + * deps: finalhandler@0.0.3 + - deps: debug@1.0.3 + * deps: methods@1.1.0 + - add `CONNECT` + * deps: parseurl@~1.1.3 + - faster parsing of href-only URLs + * deps: path-to-regexp@0.1.3 + * deps: send@0.6.0 + - deps: debug@1.0.3 + * deps: serve-static@~1.3.2 + - deps: parseurl@~1.1.3 + - deps: send@0.6.0 + * perf: fix arguments reassign deopt in some `res` methods + +4.5.1 / 2014-07-06 +================== + + * fix routing regression when altering `req.method` + +4.5.0 / 2014-07-04 +================== + + * add deprecation message to non-plural `req.accepts*` + * add deprecation message to `res.send(body, status)` + * add deprecation message to `res.vary()` + * add `headers` option to `res.sendfile` + - use to set headers on successful file transfer + * add `mergeParams` option to `Router` + - merges `req.params` from parent routes + * add `req.hostname` -- correct name for what `req.host` returns + * deprecate things with `depd` module + * deprecate `req.host` -- use `req.hostname` instead + * fix behavior when handling request without routes + * fix handling when `route.all` is only route + * invoke `router.param()` only when route matches + * restore `req.params` after invoking router + * use `finalhandler` for final response handling + * use `media-typer` to alter content-type charset + * deps: accepts@~1.0.7 + * deps: send@0.5.0 + - Accept string for `maxage` (converted by `ms`) + - Include link in default redirect response + * deps: serve-static@~1.3.0 + - Accept string for `maxAge` (converted by `ms`) + - Add `setHeaders` option + - Include HTML link in redirect response + - deps: send@0.5.0 + * deps: type-is@~1.3.2 + +4.4.5 / 2014-06-26 +================== + + * deps: cookie-signature@1.0.4 + - fix for timing attacks + +4.4.4 / 2014-06-20 +================== + + * fix `res.attachment` Unicode filenames in Safari + * fix "trim prefix" debug message in `express:router` + * deps: accepts@~1.0.5 + * deps: buffer-crc32@0.2.3 + +4.4.3 / 2014-06-11 +================== + + * fix persistence of modified `req.params[name]` from `app.param()` + * deps: accepts@1.0.3 + - deps: negotiator@0.4.6 + * deps: debug@1.0.2 + * deps: send@0.4.3 + - Do not throw uncatchable error on file open race condition + - Use `escape-html` for HTML escaping + - deps: debug@1.0.2 + - deps: finished@1.2.2 + - deps: fresh@0.2.2 + * deps: serve-static@1.2.3 + - Do not throw uncatchable error on file open race condition + - deps: send@0.4.3 + +4.4.2 / 2014-06-09 +================== + + * fix catching errors from top-level handlers + * use `vary` module for `res.vary` + * deps: debug@1.0.1 + * deps: proxy-addr@1.0.1 + * deps: send@0.4.2 + - fix "event emitter leak" warnings + - deps: debug@1.0.1 + - deps: finished@1.2.1 + * deps: serve-static@1.2.2 + - fix "event emitter leak" warnings + - deps: send@0.4.2 + * deps: type-is@1.2.1 + +4.4.1 / 2014-06-02 +================== + + * deps: methods@1.0.1 + * deps: send@0.4.1 + - Send `max-age` in `Cache-Control` in correct format + * deps: serve-static@1.2.1 + - use `escape-html` for escaping + - deps: send@0.4.1 + +4.4.0 / 2014-05-30 +================== + + * custom etag control with `app.set('etag', val)` + - `app.set('etag', function(body, encoding){ return '"etag"' })` custom etag generation + - `app.set('etag', 'weak')` weak tag + - `app.set('etag', 'strong')` strong etag + - `app.set('etag', false)` turn off + - `app.set('etag', true)` standard etag + * mark `res.send` ETag as weak and reduce collisions + * update accepts to 1.0.2 + - Fix interpretation when header not in request + * update send to 0.4.0 + - Calculate ETag with md5 for reduced collisions + - Ignore stream errors after request ends + - deps: debug@0.8.1 + * update serve-static to 1.2.0 + - Calculate ETag with md5 for reduced collisions + - Ignore stream errors after request ends + - deps: send@0.4.0 + +4.3.2 / 2014-05-28 +================== + + * fix handling of errors from `router.param()` callbacks + +4.3.1 / 2014-05-23 +================== + + * revert "fix behavior of multiple `app.VERB` for the same path" + - this caused a regression in the order of route execution + +4.3.0 / 2014-05-21 +================== + + * add `req.baseUrl` to access the path stripped from `req.url` in routes + * fix behavior of multiple `app.VERB` for the same path + * fix issue routing requests among sub routers + * invoke `router.param()` only when necessary instead of every match + * proper proxy trust with `app.set('trust proxy', trust)` + - `app.set('trust proxy', 1)` trust first hop + - `app.set('trust proxy', 'loopback')` trust loopback addresses + - `app.set('trust proxy', '10.0.0.1')` trust single IP + - `app.set('trust proxy', '10.0.0.1/16')` trust subnet + - `app.set('trust proxy', '10.0.0.1, 10.0.0.2')` trust list + - `app.set('trust proxy', false)` turn off + - `app.set('trust proxy', true)` trust everything + * set proper `charset` in `Content-Type` for `res.send` + * update type-is to 1.2.0 + - support suffix matching + +4.2.0 / 2014-05-11 +================== + + * deprecate `app.del()` -- use `app.delete()` instead + * deprecate `res.json(obj, status)` -- use `res.json(status, obj)` instead + - the edge-case `res.json(status, num)` requires `res.status(status).json(num)` + * deprecate `res.jsonp(obj, status)` -- use `res.jsonp(status, obj)` instead + - the edge-case `res.jsonp(status, num)` requires `res.status(status).jsonp(num)` + * fix `req.next` when inside router instance + * include `ETag` header in `HEAD` requests + * keep previous `Content-Type` for `res.jsonp` + * support PURGE method + - add `app.purge` + - add `router.purge` + - include PURGE in `app.all` + * update debug to 0.8.0 + - add `enable()` method + - change from stderr to stdout + * update methods to 1.0.0 + - add PURGE + +4.1.2 / 2014-05-08 +================== + + * fix `req.host` for IPv6 literals + * fix `res.jsonp` error if callback param is object + +4.1.1 / 2014-04-27 +================== + + * fix package.json to reflect supported node version + +4.1.0 / 2014-04-24 +================== + + * pass options from `res.sendfile` to `send` + * preserve casing of headers in `res.header` and `res.set` + * support unicode file names in `res.attachment` and `res.download` + * update accepts to 1.0.1 + - deps: negotiator@0.4.0 + * update cookie to 0.1.2 + - Fix for maxAge == 0 + - made compat with expires field + * update send to 0.3.0 + - Accept API options in options object + - Coerce option types + - Control whether to generate etags + - Default directory access to 403 when index disabled + - Fix sending files with dots without root set + - Include file path in etag + - Make "Can't set headers after they are sent." catchable + - Send full entity-body for multi range requests + - Set etags to "weak" + - Support "If-Range" header + - Support multiple index paths + - deps: mime@1.2.11 + * update serve-static to 1.1.0 + - Accept options directly to `send` module + - Resolve relative paths at middleware setup + - Use parseurl to parse the URL from request + - deps: send@0.3.0 + * update type-is to 1.1.0 + - add non-array values support + - add `multipart` as a shorthand + +4.0.0 / 2014-04-09 +================== + + * remove: + - node 0.8 support + - connect and connect's patches except for charset handling + - express(1) - moved to [express-generator](https://github.com/expressjs/generator) + - `express.createServer()` - it has been deprecated for a long time. Use `express()` + - `app.configure` - use logic in your own app code + - `app.router` - is removed + - `req.auth` - use `basic-auth` instead + - `req.accepted*` - use `req.accepts*()` instead + - `res.location` - relative URL resolution is removed + - `res.charset` - include the charset in the content type when using `res.set()` + - all bundled middleware except `static` + * change: + - `app.route` -> `app.mountpath` when mounting an express app in another express app + - `json spaces` no longer enabled by default in development + - `req.accepts*` -> `req.accepts*s` - i.e. `req.acceptsEncoding` -> `req.acceptsEncodings` + - `req.params` is now an object instead of an array + - `res.locals` is no longer a function. It is a plain js object. Treat it as such. + - `res.headerSent` -> `res.headersSent` to match node.js ServerResponse object + * refactor: + - `req.accepts*` with [accepts](https://github.com/expressjs/accepts) + - `req.is` with [type-is](https://github.com/expressjs/type-is) + - [path-to-regexp](https://github.com/component/path-to-regexp) + * add: + - `app.router()` - returns the app Router instance + - `app.route()` - Proxy to the app's `Router#route()` method to create a new route + - Router & Route - public API + +3.21.2 / 2015-07-31 +=================== + + * deps: connect@2.30.2 + - deps: body-parser@~1.13.3 + - deps: compression@~1.5.2 + - deps: errorhandler@~1.4.2 + - deps: method-override@~2.3.5 + - deps: serve-index@~1.7.2 + - deps: type-is@~1.6.6 + - deps: vhost@~3.0.1 + * deps: vary@~1.0.1 + - Fix setting empty header from empty `field` + - perf: enable strict mode + - perf: remove argument reassignments + +3.21.1 / 2015-07-05 +=================== + + * deps: basic-auth@~1.0.3 + * deps: connect@2.30.1 + - deps: body-parser@~1.13.2 + - deps: compression@~1.5.1 + - deps: errorhandler@~1.4.1 + - deps: morgan@~1.6.1 + - deps: pause@0.1.0 + - deps: qs@4.0.0 + - deps: serve-index@~1.7.1 + - deps: type-is@~1.6.4 + +3.21.0 / 2015-06-18 +=================== + + * deps: basic-auth@1.0.2 + - perf: enable strict mode + - perf: hoist regular expression + - perf: parse with regular expressions + - perf: remove argument reassignment + * deps: connect@2.30.0 + - deps: body-parser@~1.13.1 + - deps: bytes@2.1.0 + - deps: compression@~1.5.0 + - deps: cookie@0.1.3 + - deps: cookie-parser@~1.3.5 + - deps: csurf@~1.8.3 + - deps: errorhandler@~1.4.0 + - deps: express-session@~1.11.3 + - deps: finalhandler@0.4.0 + - deps: fresh@0.3.0 + - deps: morgan@~1.6.0 + - deps: serve-favicon@~2.3.0 + - deps: serve-index@~1.7.0 + - deps: serve-static@~1.10.0 + - deps: type-is@~1.6.3 + * deps: cookie@0.1.3 + - perf: deduce the scope of try-catch deopt + - perf: remove argument reassignments + * deps: escape-html@1.0.2 + * deps: etag@~1.7.0 + - Always include entity length in ETags for hash length extensions + - Generate non-Stats ETags using MD5 only (no longer CRC32) + - Improve stat performance by removing hashing + - Improve support for JXcore + - Remove base64 padding in ETags to shorten + - Support "fake" stats objects in environments without fs + - Use MD5 instead of MD4 in weak ETags over 1KB + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * deps: mkdirp@0.5.1 + - Work in global strict mode + * deps: send@0.13.0 + - Allow Node.js HTTP server to set `Date` response header + - Fix incorrectly removing `Content-Location` on 304 response + - Improve the default redirect response headers + - Send appropriate headers on default error response + - Use `http-errors` for standard emitted errors + - Use `statuses` instead of `http` module for status messages + - deps: escape-html@1.0.2 + - deps: etag@~1.7.0 + - deps: fresh@0.3.0 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove unnecessary array allocations + +3.20.3 / 2015-05-17 +=================== + + * deps: connect@2.29.2 + - deps: body-parser@~1.12.4 + - deps: compression@~1.4.4 + - deps: connect-timeout@~1.6.2 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: errorhandler@~1.3.6 + - deps: finalhandler@0.3.6 + - deps: method-override@~2.3.3 + - deps: morgan@~1.5.3 + - deps: qs@2.4.2 + - deps: response-time@~2.3.1 + - deps: serve-favicon@~2.2.1 + - deps: serve-index@~1.6.4 + - deps: serve-static@~1.9.3 + - deps: type-is@~1.6.2 + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + * deps: depd@~1.0.1 + * deps: proxy-addr@~1.0.8 + - deps: ipaddr.js@1.0.1 + * deps: send@0.12.3 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: etag@~1.6.0 + - deps: ms@0.7.1 + - deps: on-finished@~2.2.1 + +3.20.2 / 2015-03-16 +=================== + + * deps: connect@2.29.1 + - deps: body-parser@~1.12.2 + - deps: compression@~1.4.3 + - deps: connect-timeout@~1.6.1 + - deps: debug@~2.1.3 + - deps: errorhandler@~1.3.5 + - deps: express-session@~1.10.4 + - deps: finalhandler@0.3.4 + - deps: method-override@~2.3.2 + - deps: morgan@~1.5.2 + - deps: qs@2.4.1 + - deps: serve-index@~1.6.3 + - deps: serve-static@~1.9.2 + - deps: type-is@~1.6.1 + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: merge-descriptors@1.0.0 + * deps: proxy-addr@~1.0.7 + - deps: ipaddr.js@0.1.9 + * deps: send@0.12.2 + - Throw errors early for invalid `extensions` or `index` options + - deps: debug@~2.1.3 + +3.20.1 / 2015-02-28 +=================== + + * Fix `req.host` when using "trust proxy" hops count + * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count + +3.20.0 / 2015-02-18 +=================== + + * Fix `"trust proxy"` setting to inherit when app is mounted + * Generate `ETag`s for all request responses + - No longer restricted to only responses for `GET` and `HEAD` requests + * Use `content-type` to parse `Content-Type` headers + * deps: connect@2.29.0 + - Use `content-type` to parse `Content-Type` headers + - deps: body-parser@~1.12.0 + - deps: compression@~1.4.1 + - deps: connect-timeout@~1.6.0 + - deps: cookie-parser@~1.3.4 + - deps: cookie-signature@1.0.6 + - deps: csurf@~1.7.0 + - deps: errorhandler@~1.3.4 + - deps: express-session@~1.10.3 + - deps: http-errors@~1.3.1 + - deps: response-time@~2.3.0 + - deps: serve-index@~1.6.2 + - deps: serve-static@~1.9.1 + - deps: type-is@~1.6.0 + * deps: cookie-signature@1.0.6 + * deps: send@0.12.1 + - Always read the stat size from the file + - Fix mutating passed-in `options` + - deps: mime@1.3.4 + +3.19.2 / 2015-02-01 +=================== + + * deps: connect@2.28.3 + - deps: compression@~1.3.1 + - deps: csurf@~1.6.6 + - deps: errorhandler@~1.3.3 + - deps: express-session@~1.10.2 + - deps: serve-index@~1.6.1 + - deps: type-is@~1.5.6 + * deps: proxy-addr@~1.0.6 + - deps: ipaddr.js@0.1.8 + +3.19.1 / 2015-01-20 +=================== + + * deps: connect@2.28.2 + - deps: body-parser@~1.10.2 + - deps: serve-static@~1.8.1 + * deps: send@0.11.1 + - Fix root path disclosure + +3.19.0 / 2015-01-09 +=================== + + * Fix `OPTIONS` responses to include the `HEAD` method property + * Use `readline` for prompt in `express(1)` + * deps: commander@2.6.0 + * deps: connect@2.28.1 + - deps: body-parser@~1.10.1 + - deps: compression@~1.3.0 + - deps: connect-timeout@~1.5.0 + - deps: csurf@~1.6.4 + - deps: debug@~2.1.1 + - deps: errorhandler@~1.3.2 + - deps: express-session@~1.10.1 + - deps: finalhandler@0.3.3 + - deps: method-override@~2.3.1 + - deps: morgan@~1.5.1 + - deps: serve-favicon@~2.2.0 + - deps: serve-index@~1.6.0 + - deps: serve-static@~1.8.0 + - deps: type-is@~1.5.5 + * deps: debug@~2.1.1 + * deps: methods@~1.1.1 + * deps: proxy-addr@~1.0.5 + - deps: ipaddr.js@0.1.6 + * deps: send@0.11.0 + - deps: debug@~2.1.1 + - deps: etag@~1.5.1 + - deps: ms@0.7.0 + - deps: on-finished@~2.2.0 + +3.18.6 / 2014-12-12 +=================== + + * Fix exception in `req.fresh`/`req.stale` without response headers + +3.18.5 / 2014-12-11 +=================== + + * deps: connect@2.27.6 + - deps: compression@~1.2.2 + - deps: express-session@~1.9.3 + - deps: http-errors@~1.2.8 + - deps: serve-index@~1.5.3 + - deps: type-is@~1.5.4 + +3.18.4 / 2014-11-23 +=================== + + * deps: connect@2.27.4 + - deps: body-parser@~1.9.3 + - deps: compression@~1.2.1 + - deps: errorhandler@~1.2.3 + - deps: express-session@~1.9.2 + - deps: qs@2.3.3 + - deps: serve-favicon@~2.1.7 + - deps: serve-static@~1.5.1 + - deps: type-is@~1.5.3 + * deps: etag@~1.5.1 + * deps: proxy-addr@~1.0.4 + - deps: ipaddr.js@0.1.5 + +3.18.3 / 2014-11-09 +=================== + + * deps: connect@2.27.3 + - Correctly invoke async callback asynchronously + - deps: csurf@~1.6.3 + +3.18.2 / 2014-10-28 +=================== + + * deps: connect@2.27.2 + - Fix handling of URLs containing `://` in the path + - deps: body-parser@~1.9.2 + - deps: qs@2.3.2 + +3.18.1 / 2014-10-22 +=================== + + * Fix internal `utils.merge` deprecation warnings + * deps: connect@2.27.1 + - deps: body-parser@~1.9.1 + - deps: express-session@~1.9.1 + - deps: finalhandler@0.3.2 + - deps: morgan@~1.4.1 + - deps: qs@2.3.0 + - deps: serve-static@~1.7.1 + * deps: send@0.10.1 + - deps: on-finished@~2.1.1 + +3.18.0 / 2014-10-17 +=================== + + * Use `content-disposition` module for `res.attachment`/`res.download` + - Sends standards-compliant `Content-Disposition` header + - Full Unicode support + * Use `etag` module to generate `ETag` headers + * deps: connect@2.27.0 + - Use `http-errors` module for creating errors + - Use `utils-merge` module for merging objects + - deps: body-parser@~1.9.0 + - deps: compression@~1.2.0 + - deps: connect-timeout@~1.4.0 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: express-session@~1.9.0 + - deps: finalhandler@0.3.1 + - deps: method-override@~2.3.0 + - deps: morgan@~1.4.0 + - deps: response-time@~2.2.0 + - deps: serve-favicon@~2.1.6 + - deps: serve-index@~1.5.0 + - deps: serve-static@~1.7.0 + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + * deps: depd@~1.0.0 + * deps: send@0.10.0 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: etag@~1.5.0 + +3.17.8 / 2014-10-15 +=================== + + * deps: connect@2.26.6 + - deps: compression@~1.1.2 + - deps: csurf@~1.6.2 + - deps: errorhandler@~1.2.2 + +3.17.7 / 2014-10-08 +=================== + + * deps: connect@2.26.5 + - Fix accepting non-object arguments to `logger` + - deps: serve-static@~1.6.4 + +3.17.6 / 2014-10-02 +=================== + + * deps: connect@2.26.4 + - deps: morgan@~1.3.2 + - deps: type-is@~1.5.2 + +3.17.5 / 2014-09-24 +=================== + + * deps: connect@2.26.3 + - deps: body-parser@~1.8.4 + - deps: serve-favicon@~2.1.5 + - deps: serve-static@~1.6.3 + * deps: proxy-addr@~1.0.3 + - Use `forwarded` npm module + * deps: send@0.9.3 + - deps: etag@~1.4.0 + +3.17.4 / 2014-09-19 +=================== + + * deps: connect@2.26.2 + - deps: body-parser@~1.8.3 + - deps: qs@2.2.4 + +3.17.3 / 2014-09-18 +=================== + + * deps: proxy-addr@~1.0.2 + - Fix a global leak when multiple subnets are trusted + - deps: ipaddr.js@0.1.3 + +3.17.2 / 2014-09-15 +=================== + + * Use `crc` instead of `buffer-crc32` for speed + * deps: connect@2.26.1 + - deps: body-parser@~1.8.2 + - deps: depd@0.4.5 + - deps: express-session@~1.8.2 + - deps: morgan@~1.3.1 + - deps: serve-favicon@~2.1.3 + - deps: serve-static@~1.6.2 + * deps: depd@0.4.5 + * deps: send@0.9.2 + - deps: depd@0.4.5 + - deps: etag@~1.3.1 + - deps: range-parser@~1.0.2 + +3.17.1 / 2014-09-08 +=================== + + * Fix error in `req.subdomains` on empty host + +3.17.0 / 2014-09-08 +=================== + + * Support `X-Forwarded-Host` in `req.subdomains` + * Support IP address host in `req.subdomains` + * deps: connect@2.26.0 + - deps: body-parser@~1.8.1 + - deps: compression@~1.1.0 + - deps: connect-timeout@~1.3.0 + - deps: cookie-parser@~1.3.3 + - deps: cookie-signature@1.0.5 + - deps: csurf@~1.6.1 + - deps: debug@~2.0.0 + - deps: errorhandler@~1.2.0 + - deps: express-session@~1.8.1 + - deps: finalhandler@0.2.0 + - deps: fresh@0.2.4 + - deps: media-typer@0.3.0 + - deps: method-override@~2.2.0 + - deps: morgan@~1.3.0 + - deps: qs@2.2.3 + - deps: serve-favicon@~2.1.3 + - deps: serve-index@~1.2.1 + - deps: serve-static@~1.6.1 + - deps: type-is@~1.5.1 + - deps: vhost@~3.0.0 + * deps: cookie-signature@1.0.5 + * deps: debug@~2.0.0 + * deps: fresh@0.2.4 + * deps: media-typer@0.3.0 + - Throw error when parameter format invalid on parse + * deps: range-parser@~1.0.2 + * deps: send@0.9.1 + - Add `lastModified` option + - Use `etag` to generate `ETag` header + - deps: debug@~2.0.0 + - deps: fresh@0.2.4 + * deps: vary@~1.0.0 + - Accept valid `Vary` header string as `field` + +3.16.10 / 2014-09-04 +==================== + + * deps: connect@2.25.10 + - deps: serve-static@~1.5.4 + * deps: send@0.8.5 + - Fix a path traversal issue when using `root` + - Fix malicious path detection for empty string path + +3.16.9 / 2014-08-29 +=================== + + * deps: connect@2.25.9 + - deps: body-parser@~1.6.7 + - deps: qs@2.2.2 + +3.16.8 / 2014-08-27 +=================== + + * deps: connect@2.25.8 + - deps: body-parser@~1.6.6 + - deps: csurf@~1.4.1 + - deps: qs@2.2.0 + +3.16.7 / 2014-08-18 +=================== + + * deps: connect@2.25.7 + - deps: body-parser@~1.6.5 + - deps: express-session@~1.7.6 + - deps: morgan@~1.2.3 + - deps: serve-static@~1.5.3 + * deps: send@0.8.3 + - deps: destroy@1.0.3 + - deps: on-finished@2.1.0 + +3.16.6 / 2014-08-14 +=================== + + * deps: connect@2.25.6 + - deps: body-parser@~1.6.4 + - deps: qs@1.2.2 + - deps: serve-static@~1.5.2 + * deps: send@0.8.2 + - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + +3.16.5 / 2014-08-11 +=================== + + * deps: connect@2.25.5 + - Fix backwards compatibility in `logger` + +3.16.4 / 2014-08-10 +=================== + + * Fix original URL parsing in `res.location` + * deps: connect@2.25.4 + - Fix `query` middleware breaking with argument + - deps: body-parser@~1.6.3 + - deps: compression@~1.0.11 + - deps: connect-timeout@~1.2.2 + - deps: express-session@~1.7.5 + - deps: method-override@~2.1.3 + - deps: on-headers@~1.0.0 + - deps: parseurl@~1.3.0 + - deps: qs@1.2.1 + - deps: response-time@~2.0.1 + - deps: serve-index@~1.1.6 + - deps: serve-static@~1.5.1 + * deps: parseurl@~1.3.0 + +3.16.3 / 2014-08-07 +=================== + + * deps: connect@2.25.3 + - deps: multiparty@3.3.2 + +3.16.2 / 2014-08-07 +=================== + + * deps: connect@2.25.2 + - deps: body-parser@~1.6.2 + - deps: qs@1.2.0 + +3.16.1 / 2014-08-06 +=================== + + * deps: connect@2.25.1 + - deps: body-parser@~1.6.1 + - deps: qs@1.1.0 + +3.16.0 / 2014-08-05 +=================== + + * deps: connect@2.25.0 + - deps: body-parser@~1.6.0 + - deps: compression@~1.0.10 + - deps: csurf@~1.4.0 + - deps: express-session@~1.7.4 + - deps: qs@1.0.2 + - deps: serve-static@~1.5.0 + * deps: send@0.8.1 + - Add `extensions` option + +3.15.3 / 2014-08-04 +=================== + + * fix `res.sendfile` regression for serving directory index files + * deps: connect@2.24.3 + - deps: serve-index@~1.1.5 + - deps: serve-static@~1.4.4 + * deps: send@0.7.4 + - Fix incorrect 403 on Windows and Node.js 0.11 + - Fix serving index files without root dir + +3.15.2 / 2014-07-27 +=================== + + * deps: connect@2.24.2 + - deps: body-parser@~1.5.2 + - deps: depd@0.4.4 + - deps: express-session@~1.7.2 + - deps: morgan@~1.2.2 + - deps: serve-static@~1.4.2 + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + * deps: send@0.7.2 + - deps: depd@0.4.4 + +3.15.1 / 2014-07-26 +=================== + + * deps: connect@2.24.1 + - deps: body-parser@~1.5.1 + - deps: depd@0.4.3 + - deps: express-session@~1.7.1 + - deps: morgan@~1.2.1 + - deps: serve-index@~1.1.4 + - deps: serve-static@~1.4.1 + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + * deps: send@0.7.1 + - deps: depd@0.4.3 + +3.15.0 / 2014-07-22 +=================== + + * Fix `req.protocol` for proxy-direct connections + * Pass options from `res.sendfile` to `send` + * deps: connect@2.24.0 + - deps: body-parser@~1.5.0 + - deps: compression@~1.0.9 + - deps: connect-timeout@~1.2.1 + - deps: debug@1.0.4 + - deps: depd@0.4.2 + - deps: express-session@~1.7.0 + - deps: finalhandler@0.1.0 + - deps: method-override@~2.1.2 + - deps: morgan@~1.2.0 + - deps: multiparty@3.3.1 + - deps: parseurl@~1.2.0 + - deps: serve-static@~1.4.0 + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: parseurl@~1.2.0 + - Cache URLs based on original value + - Remove no-longer-needed URL mis-parse work-around + - Simplify the "fast-path" `RegExp` + * deps: send@0.7.0 + - Add `dotfiles` option + - Cap `maxAge` value to 1 year + - deps: debug@1.0.4 + - deps: depd@0.4.2 + +3.14.0 / 2014-07-11 +=================== + + * add explicit "Rosetta Flash JSONP abuse" protection + - previous versions are not vulnerable; this is just explicit protection + * deprecate `res.redirect(url, status)` -- use `res.redirect(status, url)` instead + * fix `res.send(status, num)` to send `num` as json (not error) + * remove unnecessary escaping when `res.jsonp` returns JSON response + * deps: basic-auth@1.0.0 + - support empty password + - support empty username + * deps: connect@2.23.0 + - deps: debug@1.0.3 + - deps: express-session@~1.6.4 + - deps: method-override@~2.1.0 + - deps: parseurl@~1.1.3 + - deps: serve-static@~1.3.1 + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + * deps: methods@1.1.0 + - add `CONNECT` + * deps: parseurl@~1.1.3 + - faster parsing of href-only URLs + +3.13.0 / 2014-07-03 +=================== + + * add deprecation message to `app.configure` + * add deprecation message to `req.auth` + * use `basic-auth` to parse `Authorization` header + * deps: connect@2.22.0 + - deps: csurf@~1.3.0 + - deps: express-session@~1.6.1 + - deps: multiparty@3.3.0 + - deps: serve-static@~1.3.0 + * deps: send@0.5.0 + - Accept string for `maxage` (converted by `ms`) + - Include link in default redirect response + +3.12.1 / 2014-06-26 +=================== + + * deps: connect@2.21.1 + - deps: cookie-parser@1.3.2 + - deps: cookie-signature@1.0.4 + - deps: express-session@~1.5.2 + - deps: type-is@~1.3.2 + * deps: cookie-signature@1.0.4 + - fix for timing attacks + +3.12.0 / 2014-06-21 +=================== + + * use `media-typer` to alter content-type charset + * deps: connect@2.21.0 + - deprecate `connect(middleware)` -- use `app.use(middleware)` instead + - deprecate `connect.createServer()` -- use `connect()` instead + - fix `res.setHeader()` patch to work with get -> append -> set pattern + - deps: compression@~1.0.8 + - deps: errorhandler@~1.1.1 + - deps: express-session@~1.5.0 + - deps: serve-index@~1.1.3 + +3.11.0 / 2014-06-19 +=================== + + * deprecate things with `depd` module + * deps: buffer-crc32@0.2.3 + * deps: connect@2.20.2 + - deprecate `verify` option to `json` -- use `body-parser` npm module instead + - deprecate `verify` option to `urlencoded` -- use `body-parser` npm module instead + - deprecate things with `depd` module + - use `finalhandler` for final response handling + - use `media-typer` to parse `content-type` for charset + - deps: body-parser@1.4.3 + - deps: connect-timeout@1.1.1 + - deps: cookie-parser@1.3.1 + - deps: csurf@1.2.2 + - deps: errorhandler@1.1.0 + - deps: express-session@1.4.0 + - deps: multiparty@3.2.9 + - deps: serve-index@1.1.2 + - deps: type-is@1.3.1 + - deps: vhost@2.0.0 + +3.10.5 / 2014-06-11 +=================== + + * deps: connect@2.19.6 + - deps: body-parser@1.3.1 + - deps: compression@1.0.7 + - deps: debug@1.0.2 + - deps: serve-index@1.1.1 + - deps: serve-static@1.2.3 + * deps: debug@1.0.2 + * deps: send@0.4.3 + - Do not throw uncatchable error on file open race condition + - Use `escape-html` for HTML escaping + - deps: debug@1.0.2 + - deps: finished@1.2.2 + - deps: fresh@0.2.2 + +3.10.4 / 2014-06-09 +=================== + + * deps: connect@2.19.5 + - fix "event emitter leak" warnings + - deps: csurf@1.2.1 + - deps: debug@1.0.1 + - deps: serve-static@1.2.2 + - deps: type-is@1.2.1 + * deps: debug@1.0.1 + * deps: send@0.4.2 + - fix "event emitter leak" warnings + - deps: finished@1.2.1 + - deps: debug@1.0.1 + +3.10.3 / 2014-06-05 +=================== + + * use `vary` module for `res.vary` + * deps: connect@2.19.4 + - deps: errorhandler@1.0.2 + - deps: method-override@2.0.2 + - deps: serve-favicon@2.0.1 + * deps: debug@1.0.0 + +3.10.2 / 2014-06-03 +=================== + + * deps: connect@2.19.3 + - deps: compression@1.0.6 + +3.10.1 / 2014-06-03 +=================== + + * deps: connect@2.19.2 + - deps: compression@1.0.4 + * deps: proxy-addr@1.0.1 + +3.10.0 / 2014-06-02 +=================== + + * deps: connect@2.19.1 + - deprecate `methodOverride()` -- use `method-override` npm module instead + - deps: body-parser@1.3.0 + - deps: method-override@2.0.1 + - deps: multiparty@3.2.8 + - deps: response-time@2.0.0 + - deps: serve-static@1.2.1 + * deps: methods@1.0.1 + * deps: send@0.4.1 + - Send `max-age` in `Cache-Control` in correct format + +3.9.0 / 2014-05-30 +================== + + * custom etag control with `app.set('etag', val)` + - `app.set('etag', function(body, encoding){ return '"etag"' })` custom etag generation + - `app.set('etag', 'weak')` weak tag + - `app.set('etag', 'strong')` strong etag + - `app.set('etag', false)` turn off + - `app.set('etag', true)` standard etag + * Include ETag in HEAD requests + * mark `res.send` ETag as weak and reduce collisions + * update connect to 2.18.0 + - deps: compression@1.0.3 + - deps: serve-index@1.1.0 + - deps: serve-static@1.2.0 + * update send to 0.4.0 + - Calculate ETag with md5 for reduced collisions + - Ignore stream errors after request ends + - deps: debug@0.8.1 + +3.8.1 / 2014-05-27 +================== + + * update connect to 2.17.3 + - deps: body-parser@1.2.2 + - deps: express-session@1.2.1 + - deps: method-override@1.0.2 + +3.8.0 / 2014-05-21 +================== + + * keep previous `Content-Type` for `res.jsonp` + * set proper `charset` in `Content-Type` for `res.send` + * update connect to 2.17.1 + - fix `res.charset` appending charset when `content-type` has one + - deps: express-session@1.2.0 + - deps: morgan@1.1.1 + - deps: serve-index@1.0.3 + +3.7.0 / 2014-05-18 +================== + + * proper proxy trust with `app.set('trust proxy', trust)` + - `app.set('trust proxy', 1)` trust first hop + - `app.set('trust proxy', 'loopback')` trust loopback addresses + - `app.set('trust proxy', '10.0.0.1')` trust single IP + - `app.set('trust proxy', '10.0.0.1/16')` trust subnet + - `app.set('trust proxy', '10.0.0.1, 10.0.0.2')` trust list + - `app.set('trust proxy', false)` turn off + - `app.set('trust proxy', true)` trust everything + * update connect to 2.16.2 + - deprecate `res.headerSent` -- use `res.headersSent` + - deprecate `res.on("header")` -- use on-headers module instead + - fix edge-case in `res.appendHeader` that would append in wrong order + - json: use body-parser + - urlencoded: use body-parser + - dep: bytes@1.0.0 + - dep: cookie-parser@1.1.0 + - dep: csurf@1.2.0 + - dep: express-session@1.1.0 + - dep: method-override@1.0.1 + +3.6.0 / 2014-05-09 +================== + + * deprecate `app.del()` -- use `app.delete()` instead + * deprecate `res.json(obj, status)` -- use `res.json(status, obj)` instead + - the edge-case `res.json(status, num)` requires `res.status(status).json(num)` + * deprecate `res.jsonp(obj, status)` -- use `res.jsonp(status, obj)` instead + - the edge-case `res.jsonp(status, num)` requires `res.status(status).jsonp(num)` + * support PURGE method + - add `app.purge` + - add `router.purge` + - include PURGE in `app.all` + * update connect to 2.15.0 + * Add `res.appendHeader` + * Call error stack even when response has been sent + * Patch `res.headerSent` to return Boolean + * Patch `res.headersSent` for node.js 0.8 + * Prevent default 404 handler after response sent + * dep: compression@1.0.2 + * dep: connect-timeout@1.1.0 + * dep: debug@^0.8.0 + * dep: errorhandler@1.0.1 + * dep: express-session@1.0.4 + * dep: morgan@1.0.1 + * dep: serve-favicon@2.0.0 + * dep: serve-index@1.0.2 + * update debug to 0.8.0 + * add `enable()` method + * change from stderr to stdout + * update methods to 1.0.0 + - add PURGE + * update mkdirp to 0.5.0 + +3.5.3 / 2014-05-08 +================== + + * fix `req.host` for IPv6 literals + * fix `res.jsonp` error if callback param is object + +3.5.2 / 2014-04-24 +================== + + * update connect to 2.14.5 + * update cookie to 0.1.2 + * update mkdirp to 0.4.0 + * update send to 0.3.0 + +3.5.1 / 2014-03-25 +================== + + * pin less-middleware in generated app + +3.5.0 / 2014-03-06 +================== + + * bump deps + +3.4.8 / 2014-01-13 +================== + + * prevent incorrect automatic OPTIONS responses #1868 @dpatti + * update binary and examples for jade 1.0 #1876 @yossi, #1877 @reqshark, #1892 @matheusazzi + * throw 400 in case of malformed paths @rlidwka + +3.4.7 / 2013-12-10 +================== + + * update connect + +3.4.6 / 2013-12-01 +================== + + * update connect (raw-body) + +3.4.5 / 2013-11-27 +================== + + * update connect + * res.location: remove leading ./ #1802 @kapouer + * res.redirect: fix `res.redirect('toString') #1829 @michaelficarra + * res.send: always send ETag when content-length > 0 + * router: add Router.all() method + +3.4.4 / 2013-10-29 +================== + + * update connect + * update supertest + * update methods + * express(1): replace bodyParser() with urlencoded() and json() #1795 @chirag04 + +3.4.3 / 2013-10-23 +================== + + * update connect + +3.4.2 / 2013-10-18 +================== + + * update connect + * downgrade commander + +3.4.1 / 2013-10-15 +================== + + * update connect + * update commander + * jsonp: check if callback is a function + * router: wrap encodeURIComponent in a try/catch #1735 (@lxe) + * res.format: now includes charset @1747 (@sorribas) + * res.links: allow multiple calls @1746 (@sorribas) + +3.4.0 / 2013-09-07 +================== + + * add res.vary(). Closes #1682 + * update connect + +3.3.8 / 2013-09-02 +================== + + * update connect + +3.3.7 / 2013-08-28 +================== + + * update connect + +3.3.6 / 2013-08-27 +================== + + * Revert "remove charset from json responses. Closes #1631" (causes issues in some clients) + * add: req.accepts take an argument list + +3.3.4 / 2013-07-08 +================== + + * update send and connect + +3.3.3 / 2013-07-04 +================== + + * update connect + +3.3.2 / 2013-07-03 +================== + + * update connect + * update send + * remove .version export + +3.3.1 / 2013-06-27 +================== + + * update connect + +3.3.0 / 2013-06-26 +================== + + * update connect + * add support for multiple X-Forwarded-Proto values. Closes #1646 + * change: remove charset from json responses. Closes #1631 + * change: return actual booleans from req.accept* functions + * fix jsonp callback array throw + +3.2.6 / 2013-06-02 +================== + + * update connect + +3.2.5 / 2013-05-21 +================== + + * update connect + * update node-cookie + * add: throw a meaningful error when there is no default engine + * change generation of ETags with res.send() to GET requests only. Closes #1619 + +3.2.4 / 2013-05-09 +================== + + * fix `req.subdomains` when no Host is present + * fix `req.host` when no Host is present, return undefined + +3.2.3 / 2013-05-07 +================== + + * update connect / qs + +3.2.2 / 2013-05-03 +================== + + * update qs + +3.2.1 / 2013-04-29 +================== + + * add app.VERB() paths array deprecation warning + * update connect + * update qs and remove all ~ semver crap + * fix: accept number as value of Signed Cookie + +3.2.0 / 2013-04-15 +================== + + * add "view" constructor setting to override view behaviour + * add req.acceptsEncoding(name) + * add req.acceptedEncodings + * revert cookie signature change causing session race conditions + * fix sorting of Accept values of the same quality + +3.1.2 / 2013-04-12 +================== + + * add support for custom Accept parameters + * update cookie-signature + +3.1.1 / 2013-04-01 +================== + + * add X-Forwarded-Host support to `req.host` + * fix relative redirects + * update mkdirp + * update buffer-crc32 + * remove legacy app.configure() method from app template. + +3.1.0 / 2013-01-25 +================== + + * add support for leading "." in "view engine" setting + * add array support to `res.set()` + * add node 0.8.x to travis.yml + * add "subdomain offset" setting for tweaking `req.subdomains` + * add `res.location(url)` implementing `res.redirect()`-like setting of Location + * use app.get() for x-powered-by setting for inheritance + * fix colons in passwords for `req.auth` + +3.0.6 / 2013-01-04 +================== + + * add http verb methods to Router + * update connect + * fix mangling of the `res.cookie()` options object + * fix jsonp whitespace escape. Closes #1132 + +3.0.5 / 2012-12-19 +================== + + * add throwing when a non-function is passed to a route + * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses + * revert "add 'etag' option" + +3.0.4 / 2012-12-05 +================== + + * add 'etag' option to disable `res.send()` Etags + * add escaping of urls in text/plain in `res.redirect()` + for old browsers interpreting as html + * change crc32 module for a more liberal license + * update connect + +3.0.3 / 2012-11-13 +================== + + * update connect + * update cookie module + * fix cookie max-age + +3.0.2 / 2012-11-08 +================== + + * add OPTIONS to cors example. Closes #1398 + * fix route chaining regression. Closes #1397 + +3.0.1 / 2012-11-01 +================== + + * update connect + +3.0.0 / 2012-10-23 +================== + + * add `make clean` + * add "Basic" check to req.auth + * add `req.auth` test coverage + * add cb && cb(payload) to `res.jsonp()`. Closes #1374 + * add backwards compat for `res.redirect()` status. Closes #1336 + * add support for `res.json()` to retain previously defined Content-Types. Closes #1349 + * update connect + * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382 + * remove non-primitive string support for `res.send()` + * fix view-locals example. Closes #1370 + * fix route-separation example + +3.0.0rc5 / 2012-09-18 +================== + + * update connect + * add redis search example + * add static-files example + * add "x-powered-by" setting (`app.disable('x-powered-by')`) + * add "application/octet-stream" redirect Accept test case. Closes #1317 + +3.0.0rc4 / 2012-08-30 +================== + + * add `res.jsonp()`. Closes #1307 + * add "verbose errors" option to error-pages example + * add another route example to express(1) so people are not so confused + * add redis online user activity tracking example + * update connect dep + * fix etag quoting. Closes #1310 + * fix error-pages 404 status + * fix jsonp callback char restrictions + * remove old OPTIONS default response + +3.0.0rc3 / 2012-08-13 +================== + + * update connect dep + * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds] + * fix `res.render()` clobbering of "locals" + +3.0.0rc2 / 2012-08-03 +================== + + * add CORS example + * update connect dep + * deprecate `.createServer()` & remove old stale examples + * fix: escape `res.redirect()` link + * fix vhost example + +3.0.0rc1 / 2012-07-24 +================== + + * add more examples to view-locals + * add scheme-relative redirects (`res.redirect("//foo.com")`) support + * update cookie dep + * update connect dep + * update send dep + * fix `express(1)` -h flag, use -H for hogan. Closes #1245 + * fix `res.sendfile()` socket error handling regression + +3.0.0beta7 / 2012-07-16 +================== + + * update connect dep for `send()` root normalization regression + +3.0.0beta6 / 2012-07-13 +================== + + * add `err.view` property for view errors. Closes #1226 + * add "jsonp callback name" setting + * add support for "/foo/:bar*" non-greedy matches + * change `res.sendfile()` to use `send()` module + * change `res.send` to use "response-send" module + * remove `app.locals.use` and `res.locals.use`, use regular middleware + +3.0.0beta5 / 2012-07-03 +================== + + * add "make check" support + * add route-map example + * add `res.json(obj, status)` support back for BC + * add "methods" dep, remove internal methods module + * update connect dep + * update auth example to utilize cores pbkdf2 + * updated tests to use "supertest" + +3.0.0beta4 / 2012-06-25 +================== + + * Added `req.auth` + * Added `req.range(size)` + * Added `res.links(obj)` + * Added `res.send(body, status)` support back for backwards compat + * Added `.default()` support to `res.format()` + * Added 2xx / 304 check to `req.fresh` + * Revert "Added + support to the router" + * Fixed `res.send()` freshness check, respect res.statusCode + +3.0.0beta3 / 2012-06-15 +================== + + * Added hogan `--hjs` to express(1) [nullfirm] + * Added another example to content-negotiation + * Added `fresh` dep + * Changed: `res.send()` always checks freshness + * Fixed: expose connects mime module. Closes #1165 + +3.0.0beta2 / 2012-06-06 +================== + + * Added `+` support to the router + * Added `req.host` + * Changed `req.param()` to check route first + * Update connect dep + +3.0.0beta1 / 2012-06-01 +================== + + * Added `res.format()` callback to override default 406 behaviour + * Fixed `res.redirect()` 406. Closes #1154 + +3.0.0alpha5 / 2012-05-30 +================== + + * Added `req.ip` + * Added `{ signed: true }` option to `res.cookie()` + * Removed `res.signedCookie()` + * Changed: dont reverse `req.ips` + * Fixed "trust proxy" setting check for `req.ips` + +3.0.0alpha4 / 2012-05-09 +================== + + * Added: allow `[]` in jsonp callback. Closes #1128 + * Added `PORT` env var support in generated template. Closes #1118 [benatkin] + * Updated: connect 2.2.2 + +3.0.0alpha3 / 2012-05-04 +================== + + * Added public `app.routes`. Closes #887 + * Added _view-locals_ example + * Added _mvc_ example + * Added `res.locals.use()`. Closes #1120 + * Added conditional-GET support to `res.send()` + * Added: coerce `res.set()` values to strings + * Changed: moved `static()` in generated apps below router + * Changed: `res.send()` only set ETag when not previously set + * Changed connect 2.2.1 dep + * Changed: `make test` now runs unit / acceptance tests + * Fixed req/res proto inheritance + +3.0.0alpha2 / 2012-04-26 +================== + + * Added `make benchmark` back + * Added `res.send()` support for `String` objects + * Added client-side data exposing example + * Added `res.header()` and `req.header()` aliases for BC + * Added `express.createServer()` for BC + * Perf: memoize parsed urls + * Perf: connect 2.2.0 dep + * Changed: make `expressInit()` middleware self-aware + * Fixed: use app.get() for all core settings + * Fixed redis session example + * Fixed session example. Closes #1105 + * Fixed generated express dep. Closes #1078 + +3.0.0alpha1 / 2012-04-15 +================== + + * Added `app.locals.use(callback)` + * Added `app.locals` object + * Added `app.locals(obj)` + * Added `res.locals` object + * Added `res.locals(obj)` + * Added `res.format()` for content-negotiation + * Added `app.engine()` + * Added `res.cookie()` JSON cookie support + * Added "trust proxy" setting + * Added `req.subdomains` + * Added `req.protocol` + * Added `req.secure` + * Added `req.path` + * Added `req.ips` + * Added `req.fresh` + * Added `req.stale` + * Added comma-delimited / array support for `req.accepts()` + * Added debug instrumentation + * Added `res.set(obj)` + * Added `res.set(field, value)` + * Added `res.get(field)` + * Added `app.get(setting)`. Closes #842 + * Added `req.acceptsLanguage()` + * Added `req.acceptsCharset()` + * Added `req.accepted` + * Added `req.acceptedLanguages` + * Added `req.acceptedCharsets` + * Added "json replacer" setting + * Added "json spaces" setting + * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92 + * Added `--less` support to express(1) + * Added `express.response` prototype + * Added `express.request` prototype + * Added `express.application` prototype + * Added `app.path()` + * Added `app.render()` + * Added `res.type()` to replace `res.contentType()` + * Changed: `res.redirect()` to add relative support + * Changed: enable "jsonp callback" by default + * Changed: renamed "case sensitive routes" to "case sensitive routing" + * Rewrite of all tests with mocha + * Removed "root" setting + * Removed `res.redirect('home')` support + * Removed `req.notify()` + * Removed `app.register()` + * Removed `app.redirect()` + * Removed `app.is()` + * Removed `app.helpers()` + * Removed `app.dynamicHelpers()` + * Fixed `res.sendfile()` with non-GET. Closes #723 + * Fixed express(1) public dir for windows. Closes #866 + +2.5.9/ 2012-04-02 +================== + + * Added support for PURGE request method [pbuyle] + * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki] + +2.5.8 / 2012-02-08 +================== + + * Update mkdirp dep. Closes #991 + +2.5.7 / 2012-02-06 +================== + + * Fixed `app.all` duplicate DELETE requests [mscdex] + +2.5.6 / 2012-01-13 +================== + + * Updated hamljs dev dep. Closes #953 + +2.5.5 / 2012-01-08 +================== + + * Fixed: set `filename` on cached templates [matthewleon] + +2.5.4 / 2012-01-02 +================== + + * Fixed `express(1)` eol on 0.4.x. Closes #947 + +2.5.3 / 2011-12-30 +================== + + * Fixed `req.is()` when a charset is present + +2.5.2 / 2011-12-10 +================== + + * Fixed: express(1) LF -> CRLF for windows + +2.5.1 / 2011-11-17 +================== + + * Changed: updated connect to 1.8.x + * Removed sass.js support from express(1) + +2.5.0 / 2011-10-24 +================== + + * Added ./routes dir for generated app by default + * Added npm install reminder to express(1) app gen + * Added 0.5.x support + * Removed `make test-cov` since it wont work with node 0.5.x + * Fixed express(1) public dir for windows. Closes #866 + +2.4.7 / 2011-10-05 +================== + + * Added mkdirp to express(1). Closes #795 + * Added simple _json-config_ example + * Added shorthand for the parsed request's pathname via `req.path` + * Changed connect dep to 1.7.x to fix npm issue... + * Fixed `res.redirect()` __HEAD__ support. [reported by xerox] + * Fixed `req.flash()`, only escape args + * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie] + +2.4.6 / 2011-08-22 +================== + + * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode] + +2.4.5 / 2011-08-19 +================== + + * Added support for routes to handle errors. Closes #809 + * Added `app.routes.all()`. Closes #803 + * Added "basepath" setting to work in conjunction with reverse proxies etc. + * Refactored `Route` to use a single array of callbacks + * Added support for multiple callbacks for `app.param()`. Closes #801 +Closes #805 + * Changed: removed .call(self) for route callbacks + * Dependency: `qs >= 0.3.1` + * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808 + +2.4.4 / 2011-08-05 +================== + + * Fixed `res.header()` intention of a set, even when `undefined` + * Fixed `*`, value no longer required + * Fixed `res.send(204)` support. Closes #771 + +2.4.3 / 2011-07-14 +================== + + * Added docs for `status` option special-case. Closes #739 + * Fixed `options.filename`, exposing the view path to template engines + +2.4.2. / 2011-07-06 +================== + + * Revert "removed jsonp stripping" for XSS + +2.4.1 / 2011-07-06 +================== + + * Added `res.json()` JSONP support. Closes #737 + * Added _extending-templates_ example. Closes #730 + * Added "strict routing" setting for trailing slashes + * Added support for multiple envs in `app.configure()` calls. Closes #735 + * Changed: `res.send()` using `res.json()` + * Changed: when cookie `path === null` don't default it + * Changed; default cookie path to "home" setting. Closes #731 + * Removed _pids/logs_ creation from express(1) + +2.4.0 / 2011-06-28 +================== + + * Added chainable `res.status(code)` + * Added `res.json()`, an explicit version of `res.send(obj)` + * Added simple web-service example + +2.3.12 / 2011-06-22 +================== + + * \#express is now on freenode! come join! + * Added `req.get(field, param)` + * Added links to Japanese documentation, thanks @hideyukisaito! + * Added; the `express(1)` generated app outputs the env + * Added `content-negotiation` example + * Dependency: connect >= 1.5.1 < 2.0.0 + * Fixed view layout bug. Closes #720 + * Fixed; ignore body on 304. Closes #701 + +2.3.11 / 2011-06-04 +================== + + * Added `npm test` + * Removed generation of dummy test file from `express(1)` + * Fixed; `express(1)` adds express as a dep + * Fixed; prune on `prepublish` + +2.3.10 / 2011-05-27 +================== + + * Added `req.route`, exposing the current route + * Added _package.json_ generation support to `express(1)` + * Fixed call to `app.param()` function for optional params. Closes #682 + +2.3.9 / 2011-05-25 +================== + + * Fixed bug-ish with `../' in `res.partial()` calls + +2.3.8 / 2011-05-24 +================== + + * Fixed `app.options()` + +2.3.7 / 2011-05-23 +================== + + * Added route `Collection`, ex: `app.get('/user/:id').remove();` + * Added support for `app.param(fn)` to define param logic + * Removed `app.param()` support for callback with return value + * Removed module.parent check from express(1) generated app. Closes #670 + * Refactored router. Closes #639 + +2.3.6 / 2011-05-20 +================== + + * Changed; using devDependencies instead of git submodules + * Fixed redis session example + * Fixed markdown example + * Fixed view caching, should not be enabled in development + +2.3.5 / 2011-05-20 +================== + + * Added export `.view` as alias for `.View` + +2.3.4 / 2011-05-08 +================== + + * Added `./examples/say` + * Fixed `res.sendfile()` bug preventing the transfer of files with spaces + +2.3.3 / 2011-05-03 +================== + + * Added "case sensitive routes" option. + * Changed; split methods supported per rfc [slaskis] + * Fixed route-specific middleware when using the same callback function several times + +2.3.2 / 2011-04-27 +================== + + * Fixed view hints + +2.3.1 / 2011-04-26 +================== + + * Added `app.match()` as `app.match.all()` + * Added `app.lookup()` as `app.lookup.all()` + * Added `app.remove()` for `app.remove.all()` + * Added `app.remove.VERB()` + * Fixed template caching collision issue. Closes #644 + * Moved router over from connect and started refactor + +2.3.0 / 2011-04-25 +================== + + * Added options support to `res.clearCookie()` + * Added `res.helpers()` as alias of `res.locals()` + * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel * Dependency `connect >= 1.4.0` + * Changed; auto set Content-Type in res.attachement [Aaron Heckmann] + * Renamed "cache views" to "view cache". Closes #628 + * Fixed caching of views when using several apps. Closes #637 + * Fixed gotcha invoking `app.param()` callbacks once per route middleware. +Closes #638 + * Fixed partial lookup precedence. Closes #631 +Shaw] + +2.2.2 / 2011-04-12 +================== + + * Added second callback support for `res.download()` connection errors + * Fixed `filename` option passing to template engine + +2.2.1 / 2011-04-04 +================== + + * Added `layout(path)` helper to change the layout within a view. Closes #610 + * Fixed `partial()` collection object support. + Previously only anything with `.length` would work. + When `.length` is present one must still be aware of holes, + however now `{ collection: {foo: 'bar'}}` is valid, exposes + `keyInCollection` and `keysInCollection`. + + * Performance improved with better view caching + * Removed `request` and `response` locals + * Changed; errorHandler page title is now `Express` instead of `Connect` + +2.2.0 / 2011-03-30 +================== + + * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606 + * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606 + * Added `app.VERB(path)` as alias of `app.lookup.VERB()`. + * Dependency `connect >= 1.2.0` + +2.1.1 / 2011-03-29 +================== + + * Added; expose `err.view` object when failing to locate a view + * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann] + * Fixed; `res.send(undefined)` responds with 204 [aheckmann] + +2.1.0 / 2011-03-24 +================== + + * Added `/_?` partial lookup support. Closes #447 + * Added `request`, `response`, and `app` local variables + * Added `settings` local variable, containing the app's settings + * Added `req.flash()` exception if `req.session` is not available + * Added `res.send(bool)` support (json response) + * Fixed stylus example for latest version + * Fixed; wrap try/catch around `res.render()` + +2.0.0 / 2011-03-17 +================== + + * Fixed up index view path alternative. + * Changed; `res.locals()` without object returns the locals + +2.0.0rc3 / 2011-03-17 +================== + + * Added `res.locals(obj)` to compliment `res.local(key, val)` + * Added `res.partial()` callback support + * Fixed recursive error reporting issue in `res.render()` + +2.0.0rc2 / 2011-03-17 +================== + + * Changed; `partial()` "locals" are now optional + * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01] + * Fixed .filename view engine option [reported by drudge] + * Fixed blog example + * Fixed `{req,res}.app` reference when mounting [Ben Weaver] + +2.0.0rc / 2011-03-14 +================== + + * Fixed; expose `HTTPSServer` constructor + * Fixed express(1) default test charset. Closes #579 [reported by secoif] + * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP] + +2.0.0beta3 / 2011-03-09 +================== + + * Added support for `res.contentType()` literal + The original `res.contentType('.json')`, + `res.contentType('application/json')`, and `res.contentType('json')` + will work now. + * Added `res.render()` status option support back + * Added charset option for `res.render()` + * Added `.charset` support (via connect 1.0.4) + * Added view resolution hints when in development and a lookup fails + * Added layout lookup support relative to the page view. + For example while rendering `./views/user/index.jade` if you create + `./views/user/layout.jade` it will be used in favour of the root layout. + * Fixed `res.redirect()`. RFC states absolute url [reported by unlink] + * Fixed; default `res.send()` string charset to utf8 + * Removed `Partial` constructor (not currently used) + +2.0.0beta2 / 2011-03-07 +================== + + * Added res.render() `.locals` support back to aid in migration process + * Fixed flash example + +2.0.0beta / 2011-03-03 +================== + + * Added HTTPS support + * Added `res.cookie()` maxAge support + * Added `req.header()` _Referrer_ / _Referer_ special-case, either works + * Added mount support for `res.redirect()`, now respects the mount-point + * Added `union()` util, taking place of `merge(clone())` combo + * Added stylus support to express(1) generated app + * Added secret to session middleware used in examples and generated app + * Added `res.local(name, val)` for progressive view locals + * Added default param support to `req.param(name, default)` + * Added `app.disabled()` and `app.enabled()` + * Added `app.register()` support for omitting leading ".", either works + * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539 + * Added `app.param()` to map route params to async/sync logic + * Added; aliased `app.helpers()` as `app.locals()`. Closes #481 + * Added extname with no leading "." support to `res.contentType()` + * Added `cache views` setting, defaulting to enabled in "production" env + * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_. + * Added `req.accepts()` support for extensions + * Changed; `res.download()` and `res.sendfile()` now utilize Connect's + static file server `connect.static.send()`. + * Changed; replaced `connect.utils.mime()` with npm _mime_ module + * Changed; allow `req.query` to be pre-defined (via middleware or other parent + * Changed view partial resolution, now relative to parent view + * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`. + * Fixed `req.param()` bug returning Array.prototype methods. Closes #552 + * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()` + * Fixed; using _qs_ module instead of _querystring_ + * Fixed; strip unsafe chars from jsonp callbacks + * Removed "stream threshold" setting + +1.0.8 / 2011-03-01 +================== + + * Allow `req.query` to be pre-defined (via middleware or other parent app) + * "connect": ">= 0.5.0 < 1.0.0". Closes #547 + * Removed the long deprecated __EXPRESS_ENV__ support + +1.0.7 / 2011-02-07 +================== + + * Fixed `render()` setting inheritance. + Mounted apps would not inherit "view engine" + +1.0.6 / 2011-02-07 +================== + + * Fixed `view engine` setting bug when period is in dirname + +1.0.5 / 2011-02-05 +================== + + * Added secret to generated app `session()` call + +1.0.4 / 2011-02-05 +================== + + * Added `qs` dependency to _package.json_ + * Fixed namespaced `require()`s for latest connect support + +1.0.3 / 2011-01-13 +================== + + * Remove unsafe characters from JSONP callback names [Ryan Grove] + +1.0.2 / 2011-01-10 +================== + + * Removed nested require, using `connect.router` + +1.0.1 / 2010-12-29 +================== + + * Fixed for middleware stacked via `createServer()` + previously the `foo` middleware passed to `createServer(foo)` + would not have access to Express methods such as `res.send()` + or props like `req.query` etc. + +1.0.0 / 2010-11-16 +================== + + * Added; deduce partial object names from the last segment. + For example by default `partial('forum/post', postObject)` will + give you the _post_ object, providing a meaningful default. + * Added http status code string representation to `res.redirect()` body + * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__. + * Added `req.is()` to aid in content negotiation + * Added partial local inheritance [suggested by masylum]. Closes #102 + providing access to parent template locals. + * Added _-s, --session[s]_ flag to express(1) to add session related middleware + * Added _--template_ flag to express(1) to specify the + template engine to use. + * Added _--css_ flag to express(1) to specify the + stylesheet engine to use (or just plain css by default). + * Added `app.all()` support [thanks aheckmann] + * Added partial direct object support. + You may now `partial('user', user)` providing the "user" local, + vs previously `partial('user', { object: user })`. + * Added _route-separation_ example since many people question ways + to do this with CommonJS modules. Also view the _blog_ example for + an alternative. + * Performance; caching view path derived partial object names + * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454 + * Fixed jsonp support; _text/javascript_ as per mailinglist discussion + +1.0.0rc4 / 2010-10-14 +================== + + * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0 + * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware)) + * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass] + * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass] + * Added `partial()` support for array-like collections. Closes #434 + * Added support for swappable querystring parsers + * Added session usage docs. Closes #443 + * Added dynamic helper caching. Closes #439 [suggested by maritz] + * Added authentication example + * Added basic Range support to `res.sendfile()` (and `res.download()` etc) + * Changed; `express(1)` generated app using 2 spaces instead of 4 + * Default env to "development" again [aheckmann] + * Removed _context_ option is no more, use "scope" + * Fixed; exposing _./support_ libs to examples so they can run without installs + * Fixed mvc example + +1.0.0rc3 / 2010-09-20 +================== + + * Added confirmation for `express(1)` app generation. Closes #391 + * Added extending of flash formatters via `app.flashFormatters` + * Added flash formatter support. Closes #411 + * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold" + * Added _stream threshold_ setting for `res.sendfile()` + * Added `res.send()` __HEAD__ support + * Added `res.clearCookie()` + * Added `res.cookie()` + * Added `res.render()` headers option + * Added `res.redirect()` response bodies + * Added `res.render()` status option support. Closes #425 [thanks aheckmann] + * Fixed `res.sendfile()` responding with 403 on malicious path + * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_ + * Fixed; mounted apps settings now inherit from parent app [aheckmann] + * Fixed; stripping Content-Length / Content-Type when 204 + * Fixed `res.send()` 204. Closes #419 + * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402 + * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo] + + +1.0.0rc2 / 2010-08-17 +================== + + * Added `app.register()` for template engine mapping. Closes #390 + * Added `res.render()` callback support as second argument (no options) + * Added callback support to `res.download()` + * Added callback support for `res.sendfile()` + * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()` + * Added "partials" setting to docs + * Added default expresso tests to `express(1)` generated app. Closes #384 + * Fixed `res.sendfile()` error handling, defer via `next()` + * Fixed `res.render()` callback when a layout is used [thanks guillermo] + * Fixed; `make install` creating ~/.node_libraries when not present + * Fixed issue preventing error handlers from being defined anywhere. Closes #387 + +1.0.0rc / 2010-07-28 +================== + + * Added mounted hook. Closes #369 + * Added connect dependency to _package.json_ + + * Removed "reload views" setting and support code + development env never caches, production always caches. + + * Removed _param_ in route callbacks, signature is now + simply (req, res, next), previously (req, res, params, next). + Use _req.params_ for path captures, _req.query_ for GET params. + + * Fixed "home" setting + * Fixed middleware/router precedence issue. Closes #366 + * Fixed; _configure()_ callbacks called immediately. Closes #368 + +1.0.0beta2 / 2010-07-23 +================== + + * Added more examples + * Added; exporting `Server` constructor + * Added `Server#helpers()` for view locals + * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349 + * Added support for absolute view paths + * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363 + * Added Guillermo Rauch to the contributor list + * Added support for "as" for non-collection partials. Closes #341 + * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf] + * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo] + * Fixed instanceof `Array` checks, now `Array.isArray()` + * Fixed express(1) expansion of public dirs. Closes #348 + * Fixed middleware precedence. Closes #345 + * Fixed view watcher, now async [thanks aheckmann] + +1.0.0beta / 2010-07-15 +================== + + * Re-write + - much faster + - much lighter + - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs + +0.14.0 / 2010-06-15 +================== + + * Utilize relative requires + * Added Static bufferSize option [aheckmann] + * Fixed caching of view and partial subdirectories [aheckmann] + * Fixed mime.type() comments now that ".ext" is not supported + * Updated haml submodule + * Updated class submodule + * Removed bin/express + +0.13.0 / 2010-06-01 +================== + + * Added node v0.1.97 compatibility + * Added support for deleting cookies via Request#cookie('key', null) + * Updated haml submodule + * Fixed not-found page, now using charset utf-8 + * Fixed show-exceptions page, now using charset utf-8 + * Fixed view support due to fs.readFile Buffers + * Changed; mime.type() no longer accepts ".type" due to node extname() changes + +0.12.0 / 2010-05-22 +================== + + * Added node v0.1.96 compatibility + * Added view `helpers` export which act as additional local variables + * Updated haml submodule + * Changed ETag; removed inode, modified time only + * Fixed LF to CRLF for setting multiple cookies + * Fixed cookie compilation; values are now urlencoded + * Fixed cookies parsing; accepts quoted values and url escaped cookies + +0.11.0 / 2010-05-06 +================== + + * Added support for layouts using different engines + - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' }) + - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml' + - this.render('page.html.haml', { layout: false }) // no layout + * Updated ext submodule + * Updated haml submodule + * Fixed EJS partial support by passing along the context. Issue #307 + +0.10.1 / 2010-05-03 +================== + + * Fixed binary uploads. + +0.10.0 / 2010-04-30 +================== + + * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s + encoding is set to 'utf8' or 'utf-8'). + * Added "encoding" option to Request#render(). Closes #299 + * Added "dump exceptions" setting, which is enabled by default. + * Added simple ejs template engine support + * Added error response support for text/plain, application/json. Closes #297 + * Added callback function param to Request#error() + * Added Request#sendHead() + * Added Request#stream() + * Added support for Request#respond(304, null) for empty response bodies + * Added ETag support to Request#sendfile() + * Added options to Request#sendfile(), passed to fs.createReadStream() + * Added filename arg to Request#download() + * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request + * Performance enhanced by preventing several calls to toLowerCase() in Router#match() + * Changed; Request#sendfile() now streams + * Changed; Renamed Request#halt() to Request#respond(). Closes #289 + * Changed; Using sys.inspect() instead of JSON.encode() for error output + * Changed; run() returns the http.Server instance. Closes #298 + * Changed; Defaulting Server#host to null (INADDR_ANY) + * Changed; Logger "common" format scale of 0.4f + * Removed Logger "request" format + * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found + * Fixed several issues with http client + * Fixed Logger Content-Length output + * Fixed bug preventing Opera from retaining the generated session id. Closes #292 + +0.9.0 / 2010-04-14 +================== + + * Added DSL level error() route support + * Added DSL level notFound() route support + * Added Request#error() + * Added Request#notFound() + * Added Request#render() callback function. Closes #258 + * Added "max upload size" setting + * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254 + * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js + * Added callback function support to Request#halt() as 3rd/4th arg + * Added preprocessing of route param wildcards using param(). Closes #251 + * Added view partial support (with collections etc.) + * Fixed bug preventing falsey params (such as ?page=0). Closes #286 + * Fixed setting of multiple cookies. Closes #199 + * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml) + * Changed; session cookie is now httpOnly + * Changed; Request is no longer global + * Changed; Event is no longer global + * Changed; "sys" module is no longer global + * Changed; moved Request#download to Static plugin where it belongs + * Changed; Request instance created before body parsing. Closes #262 + * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253 + * Changed; Pre-caching view partials in memory when "cache view partials" is enabled + * Updated support to node --version 0.1.90 + * Updated dependencies + * Removed set("session cookie") in favour of use(Session, { cookie: { ... }}) + * Removed utils.mixin(); use Object#mergeDeep() + +0.8.0 / 2010-03-19 +================== + + * Added coffeescript example app. Closes #242 + * Changed; cache api now async friendly. Closes #240 + * Removed deprecated 'express/static' support. Use 'express/plugins/static' + +0.7.6 / 2010-03-19 +================== + + * Added Request#isXHR. Closes #229 + * Added `make install` (for the executable) + * Added `express` executable for setting up simple app templates + * Added "GET /public/*" to Static plugin, defaulting to /public + * Added Static plugin + * Fixed; Request#render() only calls cache.get() once + * Fixed; Namespacing View caches with "view:" + * Fixed; Namespacing Static caches with "static:" + * Fixed; Both example apps now use the Static plugin + * Fixed set("views"). Closes #239 + * Fixed missing space for combined log format + * Deprecated Request#sendfile() and 'express/static' + * Removed Server#running + +0.7.5 / 2010-03-16 +================== + + * Added Request#flash() support without args, now returns all flashes + * Updated ext submodule + +0.7.4 / 2010-03-16 +================== + + * Fixed session reaper + * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft) + +0.7.3 / 2010-03-16 +================== + + * Added package.json + * Fixed requiring of haml / sass due to kiwi removal + +0.7.2 / 2010-03-16 +================== + + * Fixed GIT submodules (HAH!) + +0.7.1 / 2010-03-16 +================== + + * Changed; Express now using submodules again until a PM is adopted + * Changed; chat example using millisecond conversions from ext + +0.7.0 / 2010-03-15 +================== + + * Added Request#pass() support (finds the next matching route, or the given path) + * Added Logger plugin (default "common" format replaces CommonLogger) + * Removed Profiler plugin + * Removed CommonLogger plugin + +0.6.0 / 2010-03-11 +================== + + * Added seed.yml for kiwi package management support + * Added HTTP client query string support when method is GET. Closes #205 + + * Added support for arbitrary view engines. + For example "foo.engine.html" will now require('engine'), + the exports from this module are cached after the first require(). + + * Added async plugin support + + * Removed usage of RESTful route funcs as http client + get() etc, use http.get() and friends + + * Removed custom exceptions + +0.5.0 / 2010-03-10 +================== + + * Added ext dependency (library of js extensions) + * Removed extname() / basename() utils. Use path module + * Removed toArray() util. Use arguments.values + * Removed escapeRegexp() util. Use RegExp.escape() + * Removed process.mixin() dependency. Use utils.mixin() + * Removed Collection + * Removed ElementCollection + * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com) ;) + +0.4.0 / 2010-02-11 +================== + + * Added flash() example to sample upload app + * Added high level restful http client module (express/http) + * Changed; RESTful route functions double as HTTP clients. Closes #69 + * Changed; throwing error when routes are added at runtime + * Changed; defaulting render() context to the current Request. Closes #197 + * Updated haml submodule + +0.3.0 / 2010-02-11 +================== + + * Updated haml / sass submodules. Closes #200 + * Added flash message support. Closes #64 + * Added accepts() now allows multiple args. fixes #117 + * Added support for plugins to halt. Closes #189 + * Added alternate layout support. Closes #119 + * Removed Route#run(). Closes #188 + * Fixed broken specs due to use(Cookie) missing + +0.2.1 / 2010-02-05 +================== + + * Added "plot" format option for Profiler (for gnuplot processing) + * Added request number to Profiler plugin + * Fixed binary encoding for multipart file uploads, was previously defaulting to UTF8 + * Fixed issue with routes not firing when not files are present. Closes #184 + * Fixed process.Promise -> events.Promise + +0.2.0 / 2010-02-03 +================== + + * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180 + * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174 + * Added expiration support to cache api with reaper. Closes #133 + * Added cache Store.Memory#reap() + * Added Cache; cache api now uses first class Cache instances + * Added abstract session Store. Closes #172 + * Changed; cache Memory.Store#get() utilizing Collection + * Renamed MemoryStore -> Store.Memory + * Fixed use() of the same plugin several time will always use latest options. Closes #176 + +0.1.0 / 2010-02-03 +================== + + * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context + * Updated node support to 0.1.27 Closes #169 + * Updated dirname(__filename) -> __dirname + * Updated libxmljs support to v0.2.0 + * Added session support with memory store / reaping + * Added quick uid() helper + * Added multi-part upload support + * Added Sass.js support / submodule + * Added production env caching view contents and static files + * Added static file caching. Closes #136 + * Added cache plugin with memory stores + * Added support to StaticFile so that it works with non-textual files. + * Removed dirname() helper + * Removed several globals (now their modules must be required) + +0.0.2 / 2010-01-10 +================== + + * Added view benchmarks; currently haml vs ejs + * Added Request#attachment() specs. Closes #116 + * Added use of node's parseQuery() util. Closes #123 + * Added `make init` for submodules + * Updated Haml + * Updated sample chat app to show messages on load + * Updated libxmljs parseString -> parseHtmlString + * Fixed `make init` to work with older versions of git + * Fixed specs can now run independent specs for those who can't build deps. Closes #127 + * Fixed issues introduced by the node url module changes. Closes 126. + * Fixed two assertions failing due to Collection#keys() returning strings + * Fixed faulty Collection#toArray() spec due to keys() returning strings + * Fixed `make test` now builds libxmljs.node before testing + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/project starter code/node_modules/express/LICENSE b/node_modules/express/LICENSE similarity index 100% rename from project starter code/node_modules/express/LICENSE rename to node_modules/express/LICENSE diff --git a/node_modules/express/Readme.md b/node_modules/express/Readme.md new file mode 100644 index 00000000..d0f3cf56 --- /dev/null +++ b/node_modules/express/Readme.md @@ -0,0 +1,166 @@ +[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/) + + Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org). + + [![NPM Version][npm-version-image]][npm-url] + [![NPM Install Size][npm-install-size-image]][npm-install-size-url] + [![NPM Downloads][npm-downloads-image]][npm-downloads-url] + +```js +const express = require('express') +const app = express() + +app.get('/', function (req, res) { + res.send('Hello World') +}) + +app.listen(3000) +``` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). + +Before installing, [download and install Node.js](https://nodejs.org/en/download/). +Node.js 0.10 or higher is required. + +If this is a brand new project, make sure to create a `package.json` first with +the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file). + +Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```console +$ npm install express +``` + +Follow [our installing guide](http://expressjs.com/en/starter/installing.html) +for more information. + +## Features + + * Robust routing + * Focus on high performance + * Super-high test coverage + * HTTP helpers (redirection, caching, etc) + * View system supporting 14+ template engines + * Content negotiation + * Executable for generating applications quickly + +## Docs & Community + + * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)] + * [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC + * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules + * Visit the [Wiki](https://github.com/expressjs/express/wiki) + * [Google Group](https://groups.google.com/group/express-js) for discussion + * [Gitter](https://gitter.im/expressjs/express) for support and discussion + +**PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/expressjs/express/wiki/New-features-in-4.x). + +## Quick Start + + The quickest way to get started with express is to utilize the executable [`express(1)`](https://github.com/expressjs/generator) to generate an application as shown below: + + Install the executable. The executable's major version will match Express's: + +```console +$ npm install -g express-generator@4 +``` + + Create the app: + +```console +$ express /tmp/foo && cd /tmp/foo +``` + + Install dependencies: + +```console +$ npm install +``` + + Start the server: + +```console +$ npm start +``` + + View the website at: http://localhost:3000 + +## Philosophy + + The Express philosophy is to provide small, robust tooling for HTTP servers, making + it a great solution for single page applications, websites, hybrids, or public + HTTP APIs. + + Express does not force you to use any specific ORM or template engine. With support for over + 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js), + you can quickly craft your perfect framework. + +## Examples + + To view the examples, clone the Express repo and install the dependencies: + +```console +$ git clone https://github.com/expressjs/express.git --depth 1 +$ cd express +$ npm install +``` + + Then run whichever example you want: + +```console +$ node examples/content-negotiation +``` + +## Contributing + + [![Linux Build][github-actions-ci-image]][github-actions-ci-url] + [![Windows Build][appveyor-image]][appveyor-url] + [![Test Coverage][coveralls-image]][coveralls-url] + +The Express.js project welcomes all constructive contributions. Contributions take many forms, +from code for bug fixes and enhancements, to additions and fixes to documentation, additional +tests, triaging incoming pull requests and issues, and more! + +See the [Contributing Guide](Contributing.md) for more technical details on contributing. + +### Security Issues + +If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md). + +### Running Tests + +To run the test suite, first install the dependencies, then run `npm test`: + +```console +$ npm install +$ npm test +``` + +## People + +The original author of Express is [TJ Holowaychuk](https://github.com/tj) + +The current lead maintainer is [Douglas Christopher Wilson](https://github.com/dougwilson) + +[List of all contributors](https://github.com/expressjs/express/graphs/contributors) + +## License + + [MIT](LICENSE) + +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/express/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/express +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master +[coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master +[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=linux +[github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml +[npm-downloads-image]: https://badgen.net/npm/dm/express +[npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true +[npm-install-size-image]: https://badgen.net/packagephobia/install/express +[npm-install-size-url]: https://packagephobia.com/result?p=express +[npm-url]: https://npmjs.org/package/express +[npm-version-image]: https://badgen.net/npm/v/express diff --git a/node_modules/express/index.js b/node_modules/express/index.js new file mode 100644 index 00000000..d219b0c8 --- /dev/null +++ b/node_modules/express/index.js @@ -0,0 +1,11 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +module.exports = require('./lib/express'); diff --git a/project starter code/node_modules/express/lib/application.js b/node_modules/express/lib/application.js similarity index 100% rename from project starter code/node_modules/express/lib/application.js rename to node_modules/express/lib/application.js diff --git a/project starter code/node_modules/express/lib/express.js b/node_modules/express/lib/express.js similarity index 88% rename from project starter code/node_modules/express/lib/express.js rename to node_modules/express/lib/express.js index 11c942f2..d188a16d 100644 --- a/project starter code/node_modules/express/lib/express.js +++ b/node_modules/express/lib/express.js @@ -15,11 +15,11 @@ var bodyParser = require('body-parser') var EventEmitter = require('events').EventEmitter; var mixin = require('merge-descriptors'); -var proto = require('express/lib/application'); -var Route = require('express/lib/router/route'); -var Router = require('express/lib/router'); -var req = require('express/lib/request'); -var res = require('express/lib/response'); +var proto = require('./application'); +var Route = require('./router/route'); +var Router = require('./router'); +var req = require('./request'); +var res = require('./response'); /** * Expose `createApplication()`. @@ -76,7 +76,7 @@ exports.Router = Router; */ exports.json = bodyParser.json -exports.query = require('express/lib/middleware/query'); +exports.query = require('./middleware/query'); exports.raw = bodyParser.raw exports.static = require('serve-static'); exports.text = bodyParser.text diff --git a/project starter code/node_modules/express/lib/middleware/init.js b/node_modules/express/lib/middleware/init.js similarity index 100% rename from project starter code/node_modules/express/lib/middleware/init.js rename to node_modules/express/lib/middleware/init.js diff --git a/project starter code/node_modules/express/lib/middleware/query.js b/node_modules/express/lib/middleware/query.js similarity index 100% rename from project starter code/node_modules/express/lib/middleware/query.js rename to node_modules/express/lib/middleware/query.js diff --git a/project starter code/node_modules/express/lib/request.js b/node_modules/express/lib/request.js similarity index 100% rename from project starter code/node_modules/express/lib/request.js rename to node_modules/express/lib/request.js diff --git a/project starter code/node_modules/express/lib/response.js b/node_modules/express/lib/response.js similarity index 98% rename from project starter code/node_modules/express/lib/response.js rename to node_modules/express/lib/response.js index fede486c..dd7b3c82 100644 --- a/project starter code/node_modules/express/lib/response.js +++ b/node_modules/express/lib/response.js @@ -55,6 +55,7 @@ module.exports = res */ var charsetRegExp = /;\s*charset\s*=/; +var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/; /** * Set status `code`. @@ -904,15 +905,23 @@ res.cookie = function (name, value, options) { */ res.location = function location(url) { - var loc = url; + var loc; // "back" is an alias for the referrer if (url === 'back') { loc = this.req.get('Referrer') || '/'; + } else { + loc = String(url); } - // set location - return this.set('Location', encodeUrl(loc)); + var m = schemaAndHostRegExp.exec(loc); + var pos = m ? m[0].length + 1 : 0; + + // Only encode after host to avoid invalid encoding which can introduce + // vulnerabilities (e.g. `\\` to `%5C`). + loc = loc.slice(0, pos) + encodeUrl(loc.slice(pos)); + + return this.set('Location', loc); }; /** diff --git a/node_modules/express/lib/router/index.js b/node_modules/express/lib/router/index.js new file mode 100644 index 00000000..abb3a6f5 --- /dev/null +++ b/node_modules/express/lib/router/index.js @@ -0,0 +1,673 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var Route = require('./route'); +var Layer = require('./layer'); +var methods = require('methods'); +var mixin = require('utils-merge'); +var debug = require('debug')('express:router'); +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var parseUrl = require('parseurl'); +var setPrototypeOf = require('setprototypeof') + +/** + * Module variables. + * @private + */ + +var objectRegExp = /^\[object (\S+)\]$/; +var slice = Array.prototype.slice; +var toString = Object.prototype.toString; + +/** + * Initialize a new `Router` with the given `options`. + * + * @param {Object} [options] + * @return {Router} which is a callable function + * @public + */ + +var proto = module.exports = function(options) { + var opts = options || {}; + + function router(req, res, next) { + router.handle(req, res, next); + } + + // mixin Router class functions + setPrototypeOf(router, proto) + + router.params = {}; + router._params = []; + router.caseSensitive = opts.caseSensitive; + router.mergeParams = opts.mergeParams; + router.strict = opts.strict; + router.stack = []; + + return router; +}; + +/** + * Map the given param placeholder `name`(s) to the given callback. + * + * Parameter mapping is used to provide pre-conditions to routes + * which use normalized placeholders. For example a _:user_id_ parameter + * could automatically load a user's information from the database without + * any additional code, + * + * The callback uses the same signature as middleware, the only difference + * being that the value of the placeholder is passed, in this case the _id_ + * of the user. Once the `next()` function is invoked, just like middleware + * it will continue on to execute the route, or subsequent parameter functions. + * + * Just like in middleware, you must either respond to the request or call next + * to avoid stalling the request. + * + * app.param('user_id', function(req, res, next, id){ + * User.find(id, function(err, user){ + * if (err) { + * return next(err); + * } else if (!user) { + * return next(new Error('failed to load user')); + * } + * req.user = user; + * next(); + * }); + * }); + * + * @param {String} name + * @param {Function} fn + * @return {app} for chaining + * @public + */ + +proto.param = function param(name, fn) { + // param logic + if (typeof name === 'function') { + deprecate('router.param(fn): Refactor to use path params'); + this._params.push(name); + return; + } + + // apply param functions + var params = this._params; + var len = params.length; + var ret; + + if (name[0] === ':') { + deprecate('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.slice(1)) + ', fn) instead') + name = name.slice(1) + } + + for (var i = 0; i < len; ++i) { + if (ret = params[i](name, fn)) { + fn = ret; + } + } + + // ensure we end up with a + // middleware function + if ('function' !== typeof fn) { + throw new Error('invalid param() call for ' + name + ', got ' + fn); + } + + (this.params[name] = this.params[name] || []).push(fn); + return this; +}; + +/** + * Dispatch a req, res into the router. + * @private + */ + +proto.handle = function handle(req, res, out) { + var self = this; + + debug('dispatching %s %s', req.method, req.url); + + var idx = 0; + var protohost = getProtohost(req.url) || '' + var removed = ''; + var slashAdded = false; + var sync = 0 + var paramcalled = {}; + + // store options for OPTIONS request + // only used if OPTIONS request + var options = []; + + // middleware and routes + var stack = self.stack; + + // manage inter-router variables + var parentParams = req.params; + var parentUrl = req.baseUrl || ''; + var done = restore(out, req, 'baseUrl', 'next', 'params'); + + // setup next layer + req.next = next; + + // for options requests, respond with a default if nothing else responds + if (req.method === 'OPTIONS') { + done = wrap(done, function(old, err) { + if (err || options.length === 0) return old(err); + sendOptionsResponse(res, options, old); + }); + } + + // setup basic req values + req.baseUrl = parentUrl; + req.originalUrl = req.originalUrl || req.url; + + next(); + + function next(err) { + var layerError = err === 'route' + ? null + : err; + + // remove added slash + if (slashAdded) { + req.url = req.url.slice(1) + slashAdded = false; + } + + // restore altered req.url + if (removed.length !== 0) { + req.baseUrl = parentUrl; + req.url = protohost + removed + req.url.slice(protohost.length) + removed = ''; + } + + // signal to exit router + if (layerError === 'router') { + setImmediate(done, null) + return + } + + // no more matching layers + if (idx >= stack.length) { + setImmediate(done, layerError); + return; + } + + // max sync stack + if (++sync > 100) { + return setImmediate(next, err) + } + + // get pathname of request + var path = getPathname(req); + + if (path == null) { + return done(layerError); + } + + // find next matching layer + var layer; + var match; + var route; + + while (match !== true && idx < stack.length) { + layer = stack[idx++]; + match = matchLayer(layer, path); + route = layer.route; + + if (typeof match !== 'boolean') { + // hold on to layerError + layerError = layerError || match; + } + + if (match !== true) { + continue; + } + + if (!route) { + // process non-route handlers normally + continue; + } + + if (layerError) { + // routes do not match with a pending error + match = false; + continue; + } + + var method = req.method; + var has_method = route._handles_method(method); + + // build up automatic options response + if (!has_method && method === 'OPTIONS') { + appendMethods(options, route._options()); + } + + // don't even bother matching route + if (!has_method && method !== 'HEAD') { + match = false; + } + } + + // no match + if (match !== true) { + return done(layerError); + } + + // store route for dispatch on change + if (route) { + req.route = route; + } + + // Capture one-time layer values + req.params = self.mergeParams + ? mergeParams(layer.params, parentParams) + : layer.params; + var layerPath = layer.path; + + // this should be done for the layer + self.process_params(layer, paramcalled, req, res, function (err) { + if (err) { + next(layerError || err) + } else if (route) { + layer.handle_request(req, res, next) + } else { + trim_prefix(layer, layerError, layerPath, path) + } + + sync = 0 + }); + } + + function trim_prefix(layer, layerError, layerPath, path) { + if (layerPath.length !== 0) { + // Validate path is a prefix match + if (layerPath !== path.slice(0, layerPath.length)) { + next(layerError) + return + } + + // Validate path breaks on a path separator + var c = path[layerPath.length] + if (c && c !== '/' && c !== '.') return next(layerError) + + // Trim off the part of the url that matches the route + // middleware (.use stuff) needs to have the path stripped + debug('trim prefix (%s) from url %s', layerPath, req.url); + removed = layerPath; + req.url = protohost + req.url.slice(protohost.length + removed.length) + + // Ensure leading slash + if (!protohost && req.url[0] !== '/') { + req.url = '/' + req.url; + slashAdded = true; + } + + // Setup base URL (no trailing slash) + req.baseUrl = parentUrl + (removed[removed.length - 1] === '/' + ? removed.substring(0, removed.length - 1) + : removed); + } + + debug('%s %s : %s', layer.name, layerPath, req.originalUrl); + + if (layerError) { + layer.handle_error(layerError, req, res, next); + } else { + layer.handle_request(req, res, next); + } + } +}; + +/** + * Process any parameters for the layer. + * @private + */ + +proto.process_params = function process_params(layer, called, req, res, done) { + var params = this.params; + + // captured parameters from the layer, keys and values + var keys = layer.keys; + + // fast track + if (!keys || keys.length === 0) { + return done(); + } + + var i = 0; + var name; + var paramIndex = 0; + var key; + var paramVal; + var paramCallbacks; + var paramCalled; + + // process params in order + // param callbacks can be async + function param(err) { + if (err) { + return done(err); + } + + if (i >= keys.length ) { + return done(); + } + + paramIndex = 0; + key = keys[i++]; + name = key.name; + paramVal = req.params[name]; + paramCallbacks = params[name]; + paramCalled = called[name]; + + if (paramVal === undefined || !paramCallbacks) { + return param(); + } + + // param previously called with same value or error occurred + if (paramCalled && (paramCalled.match === paramVal + || (paramCalled.error && paramCalled.error !== 'route'))) { + // restore value + req.params[name] = paramCalled.value; + + // next param + return param(paramCalled.error); + } + + called[name] = paramCalled = { + error: null, + match: paramVal, + value: paramVal + }; + + paramCallback(); + } + + // single param callbacks + function paramCallback(err) { + var fn = paramCallbacks[paramIndex++]; + + // store updated value + paramCalled.value = req.params[key.name]; + + if (err) { + // store error + paramCalled.error = err; + param(err); + return; + } + + if (!fn) return param(); + + try { + fn(req, res, paramCallback, paramVal, key.name); + } catch (e) { + paramCallback(e); + } + } + + param(); +}; + +/** + * Use the given middleware function, with optional path, defaulting to "/". + * + * Use (like `.all`) will run for any http METHOD, but it will not add + * handlers for those methods so OPTIONS requests will not consider `.use` + * functions even if they could respond. + * + * The other difference is that _route_ path is stripped and not visible + * to the handler function. The main effect of this feature is that mounted + * handlers can operate without any code changes regardless of the "prefix" + * pathname. + * + * @public + */ + +proto.use = function use(fn) { + var offset = 0; + var path = '/'; + + // default path to '/' + // disambiguate router.use([fn]) + if (typeof fn !== 'function') { + var arg = fn; + + while (Array.isArray(arg) && arg.length !== 0) { + arg = arg[0]; + } + + // first arg is the path + if (typeof arg !== 'function') { + offset = 1; + path = fn; + } + } + + var callbacks = flatten(slice.call(arguments, offset)); + + if (callbacks.length === 0) { + throw new TypeError('Router.use() requires a middleware function') + } + + for (var i = 0; i < callbacks.length; i++) { + var fn = callbacks[i]; + + if (typeof fn !== 'function') { + throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn)) + } + + // add the middleware + debug('use %o %s', path, fn.name || '') + + var layer = new Layer(path, { + sensitive: this.caseSensitive, + strict: false, + end: false + }, fn); + + layer.route = undefined; + + this.stack.push(layer); + } + + return this; +}; + +/** + * Create a new Route for the given path. + * + * Each route contains a separate middleware stack and VERB handlers. + * + * See the Route api documentation for details on adding handlers + * and middleware to routes. + * + * @param {String} path + * @return {Route} + * @public + */ + +proto.route = function route(path) { + var route = new Route(path); + + var layer = new Layer(path, { + sensitive: this.caseSensitive, + strict: this.strict, + end: true + }, route.dispatch.bind(route)); + + layer.route = route; + + this.stack.push(layer); + return route; +}; + +// create Router#VERB functions +methods.concat('all').forEach(function(method){ + proto[method] = function(path){ + var route = this.route(path) + route[method].apply(route, slice.call(arguments, 1)); + return this; + }; +}); + +// append methods to a list of methods +function appendMethods(list, addition) { + for (var i = 0; i < addition.length; i++) { + var method = addition[i]; + if (list.indexOf(method) === -1) { + list.push(method); + } + } +} + +// get pathname of request +function getPathname(req) { + try { + return parseUrl(req).pathname; + } catch (err) { + return undefined; + } +} + +// Get get protocol + host for a URL +function getProtohost(url) { + if (typeof url !== 'string' || url.length === 0 || url[0] === '/') { + return undefined + } + + var searchIndex = url.indexOf('?') + var pathLength = searchIndex !== -1 + ? searchIndex + : url.length + var fqdnIndex = url.slice(0, pathLength).indexOf('://') + + return fqdnIndex !== -1 + ? url.substring(0, url.indexOf('/', 3 + fqdnIndex)) + : undefined +} + +// get type for error message +function gettype(obj) { + var type = typeof obj; + + if (type !== 'object') { + return type; + } + + // inspect [[Class]] for objects + return toString.call(obj) + .replace(objectRegExp, '$1'); +} + +/** + * Match path to a layer. + * + * @param {Layer} layer + * @param {string} path + * @private + */ + +function matchLayer(layer, path) { + try { + return layer.match(path); + } catch (err) { + return err; + } +} + +// merge params with parent params +function mergeParams(params, parent) { + if (typeof parent !== 'object' || !parent) { + return params; + } + + // make copy of parent for base + var obj = mixin({}, parent); + + // simple non-numeric merging + if (!(0 in params) || !(0 in parent)) { + return mixin(obj, params); + } + + var i = 0; + var o = 0; + + // determine numeric gaps + while (i in params) { + i++; + } + + while (o in parent) { + o++; + } + + // offset numeric indices in params before merge + for (i--; i >= 0; i--) { + params[i + o] = params[i]; + + // create holes for the merge when necessary + if (i < o) { + delete params[i]; + } + } + + return mixin(obj, params); +} + +// restore obj props after function +function restore(fn, obj) { + var props = new Array(arguments.length - 2); + var vals = new Array(arguments.length - 2); + + for (var i = 0; i < props.length; i++) { + props[i] = arguments[i + 2]; + vals[i] = obj[props[i]]; + } + + return function () { + // restore vals + for (var i = 0; i < props.length; i++) { + obj[props[i]] = vals[i]; + } + + return fn.apply(this, arguments); + }; +} + +// send an OPTIONS response +function sendOptionsResponse(res, options, next) { + try { + var body = options.join(','); + res.set('Allow', body); + res.send(body); + } catch (err) { + next(err); + } +} + +// wrap a function +function wrap(old, fn) { + return function proxy() { + var args = new Array(arguments.length + 1); + + args[0] = old; + for (var i = 0, len = arguments.length; i < len; i++) { + args[i + 1] = arguments[i]; + } + + fn.apply(this, args); + }; +} diff --git a/project starter code/node_modules/express/lib/router/layer.js b/node_modules/express/lib/router/layer.js similarity index 100% rename from project starter code/node_modules/express/lib/router/layer.js rename to node_modules/express/lib/router/layer.js diff --git a/project starter code/node_modules/express/lib/router/route.js b/node_modules/express/lib/router/route.js similarity index 95% rename from project starter code/node_modules/express/lib/router/route.js rename to node_modules/express/lib/router/route.js index cc643ac8..a65756d6 100644 --- a/project starter code/node_modules/express/lib/router/route.js +++ b/node_modules/express/lib/router/route.js @@ -60,7 +60,10 @@ Route.prototype._handles_method = function _handles_method(method) { return true; } - var name = method.toLowerCase(); + // normalize name + var name = typeof method === 'string' + ? method.toLowerCase() + : method if (name === 'head' && !this.methods['head']) { name = 'get'; @@ -103,8 +106,10 @@ Route.prototype.dispatch = function dispatch(req, res, done) { if (stack.length === 0) { return done(); } + var method = typeof req.method === 'string' + ? req.method.toLowerCase() + : req.method - var method = req.method.toLowerCase(); if (method === 'head' && !this.methods['head']) { method = 'get'; } diff --git a/node_modules/express/lib/utils.js b/node_modules/express/lib/utils.js new file mode 100644 index 00000000..56e12b9b --- /dev/null +++ b/node_modules/express/lib/utils.js @@ -0,0 +1,303 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @api private + */ + +var Buffer = require('safe-buffer').Buffer +var contentDisposition = require('content-disposition'); +var contentType = require('content-type'); +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var mime = require('send').mime; +var etag = require('etag'); +var proxyaddr = require('proxy-addr'); +var qs = require('qs'); +var querystring = require('querystring'); + +/** + * Return strong ETag for `body`. + * + * @param {String|Buffer} body + * @param {String} [encoding] + * @return {String} + * @api private + */ + +exports.etag = createETagGenerator({ weak: false }) + +/** + * Return weak ETag for `body`. + * + * @param {String|Buffer} body + * @param {String} [encoding] + * @return {String} + * @api private + */ + +exports.wetag = createETagGenerator({ weak: true }) + +/** + * Check if `path` looks absolute. + * + * @param {String} path + * @return {Boolean} + * @api private + */ + +exports.isAbsolute = function(path){ + if ('/' === path[0]) return true; + if (':' === path[1] && ('\\' === path[2] || '/' === path[2])) return true; // Windows device path + if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path +}; + +/** + * Flatten the given `arr`. + * + * @param {Array} arr + * @return {Array} + * @api private + */ + +exports.flatten = deprecate.function(flatten, + 'utils.flatten: use array-flatten npm module instead'); + +/** + * Normalize the given `type`, for example "html" becomes "text/html". + * + * @param {String} type + * @return {Object} + * @api private + */ + +exports.normalizeType = function(type){ + return ~type.indexOf('/') + ? acceptParams(type) + : { value: mime.lookup(type), params: {} }; +}; + +/** + * Normalize `types`, for example "html" becomes "text/html". + * + * @param {Array} types + * @return {Array} + * @api private + */ + +exports.normalizeTypes = function(types){ + var ret = []; + + for (var i = 0; i < types.length; ++i) { + ret.push(exports.normalizeType(types[i])); + } + + return ret; +}; + +/** + * Generate Content-Disposition header appropriate for the filename. + * non-ascii filenames are urlencoded and a filename* parameter is added + * + * @param {String} filename + * @return {String} + * @api private + */ + +exports.contentDisposition = deprecate.function(contentDisposition, + 'utils.contentDisposition: use content-disposition npm module instead'); + +/** + * Parse accept params `str` returning an + * object with `.value`, `.quality` and `.params`. + * + * @param {String} str + * @return {Object} + * @api private + */ + +function acceptParams (str) { + var parts = str.split(/ *; */); + var ret = { value: parts[0], quality: 1, params: {} } + + for (var i = 1; i < parts.length; ++i) { + var pms = parts[i].split(/ *= */); + if ('q' === pms[0]) { + ret.quality = parseFloat(pms[1]); + } else { + ret.params[pms[0]] = pms[1]; + } + } + + return ret; +} + +/** + * Compile "etag" value to function. + * + * @param {Boolean|String|Function} val + * @return {Function} + * @api private + */ + +exports.compileETag = function(val) { + var fn; + + if (typeof val === 'function') { + return val; + } + + switch (val) { + case true: + case 'weak': + fn = exports.wetag; + break; + case false: + break; + case 'strong': + fn = exports.etag; + break; + default: + throw new TypeError('unknown value for etag function: ' + val); + } + + return fn; +} + +/** + * Compile "query parser" value to function. + * + * @param {String|Function} val + * @return {Function} + * @api private + */ + +exports.compileQueryParser = function compileQueryParser(val) { + var fn; + + if (typeof val === 'function') { + return val; + } + + switch (val) { + case true: + case 'simple': + fn = querystring.parse; + break; + case false: + fn = newObject; + break; + case 'extended': + fn = parseExtendedQueryString; + break; + default: + throw new TypeError('unknown value for query parser function: ' + val); + } + + return fn; +} + +/** + * Compile "proxy trust" value to function. + * + * @param {Boolean|String|Number|Array|Function} val + * @return {Function} + * @api private + */ + +exports.compileTrust = function(val) { + if (typeof val === 'function') return val; + + if (val === true) { + // Support plain true/false + return function(){ return true }; + } + + if (typeof val === 'number') { + // Support trusting hop count + return function(a, i){ return i < val }; + } + + if (typeof val === 'string') { + // Support comma-separated values + val = val.split(',') + .map(function (v) { return v.trim() }) + } + + return proxyaddr.compile(val || []); +} + +/** + * Set the charset in a given Content-Type string. + * + * @param {String} type + * @param {String} charset + * @return {String} + * @api private + */ + +exports.setCharset = function setCharset(type, charset) { + if (!type || !charset) { + return type; + } + + // parse type + var parsed = contentType.parse(type); + + // set charset + parsed.parameters.charset = charset; + + // format type + return contentType.format(parsed); +}; + +/** + * Create an ETag generator function, generating ETags with + * the given options. + * + * @param {object} options + * @return {function} + * @private + */ + +function createETagGenerator (options) { + return function generateETag (body, encoding) { + var buf = !Buffer.isBuffer(body) + ? Buffer.from(body, encoding) + : body + + return etag(buf, options) + } +} + +/** + * Parse an extended query string with qs. + * + * @param {String} str + * @return {Object} + * @private + */ + +function parseExtendedQueryString(str) { + return qs.parse(str, { + allowPrototypes: true + }); +} + +/** + * Return new empty object. + * + * @return {Object} + * @api private + */ + +function newObject() { + return {}; +} diff --git a/project starter code/node_modules/express/lib/view.js b/node_modules/express/lib/view.js similarity index 100% rename from project starter code/node_modules/express/lib/view.js rename to node_modules/express/lib/view.js diff --git a/node_modules/express/package.json b/node_modules/express/package.json new file mode 100644 index 00000000..f299d882 --- /dev/null +++ b/node_modules/express/package.json @@ -0,0 +1,98 @@ +{ + "name": "express", + "description": "Fast, unopinionated, minimalist web framework", + "version": "4.19.2", + "author": "TJ Holowaychuk ", + "contributors": [ + "Aaron Heckmann ", + "Ciaran Jessup ", + "Douglas Christopher Wilson ", + "Guillermo Rauch ", + "Jonathan Ong ", + "Roman Shtylman ", + "Young Jae Sim " + ], + "license": "MIT", + "repository": "expressjs/express", + "homepage": "http://expressjs.com/", + "keywords": [ + "express", + "framework", + "sinatra", + "web", + "http", + "rest", + "restful", + "router", + "app", + "api" + ], + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "devDependencies": { + "after": "0.8.2", + "connect-redis": "3.4.2", + "cookie-parser": "1.4.6", + "cookie-session": "2.0.0", + "ejs": "3.1.9", + "eslint": "8.47.0", + "express-session": "1.17.2", + "hbs": "4.2.0", + "marked": "0.7.0", + "method-override": "3.0.0", + "mocha": "10.2.0", + "morgan": "1.10.0", + "nyc": "15.1.0", + "pbkdf2-password": "1.2.1", + "supertest": "6.3.0", + "vhost": "~3.0.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "files": [ + "LICENSE", + "History.md", + "Readme.md", + "index.js", + "lib/" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/" + } +} diff --git a/node_modules/file-type/browser.d.ts b/node_modules/file-type/browser.d.ts new file mode 100644 index 00000000..5aeacb6e --- /dev/null +++ b/node_modules/file-type/browser.d.ts @@ -0,0 +1,50 @@ +/// +import * as core from './core'; + +export type FileTypeResult = core.FileTypeResult; +export type FileExtension = core.FileExtension; +export type MimeType = core.MimeType; + +/** +Determine file type from a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream). + +``` +import FileType = require('file-type/browser'); + +const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'; + +(async () => { + const response = await fetch(url); + const fileType = await FileType.fromStream(response.body); + + console.log(fileType); + //=> {ext: 'jpg', mime: 'image/jpeg'} +})(); +``` +*/ +export declare function fromStream(stream: ReadableStream): Promise; + +/** +Determine file type from a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob). + +``` +import FileType = require('file-type/browser'); + +(async () => { + const blob = new Blob([''], { + type: 'plain/text', + endings: 'native' + }); + + console.log(await FileType.fromBlob(blob)); + //=> {ext: 'txt', mime: 'plain/text'} +})(); +``` +*/ +export declare function fromBlob(blob: Blob): Promise; + +export { + fromBuffer, + extensions, + mimeTypes +} from './core'; diff --git a/node_modules/file-type/browser.js b/node_modules/file-type/browser.js new file mode 100644 index 00000000..299dd767 --- /dev/null +++ b/node_modules/file-type/browser.js @@ -0,0 +1,49 @@ +'use strict'; +const {ReadableWebToNodeStream} = require('readable-web-to-node-stream'); +const core = require('./core'); + +async function fromStream(stream) { + const readableWebToNodeStream = new ReadableWebToNodeStream(stream); + const fileType = await core.fromStream(readableWebToNodeStream); + await readableWebToNodeStream.close(); + return fileType; +} + +async function fromBlob(blob) { + const buffer = await blobToArrayBuffer(blob); + return core.fromBuffer(Buffer.from(buffer)); +} + +/** +Convert Blobs to ArrayBuffer. +@param {Blob} blob - Web API Blob. +@returns {Promise} +*/ +function blobToArrayBuffer(blob) { + if (blob.arrayBuffer) { + return blob.arrayBuffer(); + } + + // TODO: Remove when stop supporting older environments + return new Promise((resolve, reject) => { + const fileReader = new FileReader(); + fileReader.addEventListener('loadend', event => { + resolve(event.target.result); + }); + + fileReader.addEventListener('error', event => { + reject(new Error(event.message)); + }); + + fileReader.addEventListener('abort', event => { + reject(new Error(event.type)); + }); + + fileReader.readAsArrayBuffer(blob); + }); +} + +Object.assign(module.exports, core, { + fromStream, + fromBlob +}); diff --git a/node_modules/file-type/core.d.ts b/node_modules/file-type/core.d.ts new file mode 100644 index 00000000..e234094a --- /dev/null +++ b/node_modules/file-type/core.d.ts @@ -0,0 +1,386 @@ +/// +import {Readable as ReadableStream} from 'stream'; +import {ITokenizer} from 'strtok3/lib/core'; + +declare namespace core { + type FileExtension = + | 'jpg' + | 'png' + | 'apng' + | 'gif' + | 'webp' + | 'flif' + | 'xcf' + | 'cr2' + | 'cr3' + | 'orf' + | 'arw' + | 'dng' + | 'nef' + | 'rw2' + | 'raf' + | 'tif' + | 'bmp' + | 'icns' + | 'jxr' + | 'psd' + | 'indd' + | 'zip' + | 'tar' + | 'rar' + | 'gz' + | 'bz2' + | '7z' + | 'dmg' + | 'mp4' + | 'mid' + | 'mkv' + | 'webm' + | 'mov' + | 'avi' + | 'mpg' + | 'mp2' + | 'mp3' + | 'm4a' + | 'ogg' + | 'opus' + | 'flac' + | 'wav' + | 'qcp' + | 'amr' + | 'pdf' + | 'epub' + | 'mobi' + | 'exe' + | 'swf' + | 'rtf' + | 'woff' + | 'woff2' + | 'eot' + | 'ttf' + | 'otf' + | 'ico' + | 'flv' + | 'ps' + | 'xz' + | 'sqlite' + | 'nes' + | 'crx' + | 'xpi' + | 'cab' + | 'deb' + | 'ar' + | 'rpm' + | 'Z' + | 'lz' + | 'cfb' + | 'mxf' + | 'mts' + | 'wasm' + | 'blend' + | 'bpg' + | 'docx' + | 'pptx' + | 'xlsx' + | '3gp' + | '3g2' + | 'jp2' + | 'jpm' + | 'jpx' + | 'mj2' + | 'aif' + | 'odt' + | 'ods' + | 'odp' + | 'xml' + | 'heic' + | 'cur' + | 'ktx' + | 'ape' + | 'wv' + | 'asf' + | 'dcm' + | 'mpc' + | 'ics' + | 'glb' + | 'pcap' + | 'dsf' + | 'lnk' + | 'alias' + | 'voc' + | 'ac3' + | 'm4b' + | 'm4p' + | 'm4v' + | 'f4a' + | 'f4b' + | 'f4p' + | 'f4v' + | 'mie' + | 'ogv' + | 'ogm' + | 'oga' + | 'spx' + | 'ogx' + | 'arrow' + | 'shp' + | 'aac' + | 'mp1' + | 'it' + | 's3m' + | 'xm' + | 'ai' + | 'skp' + | 'avif' + | 'eps' + | 'lzh' + | 'pgp' + | 'asar' + | 'stl' + | 'chm' + | '3mf' + | 'zst' + | 'jxl' + | 'vcf'; + + type MimeType = + | 'image/jpeg' + | 'image/png' + | 'image/gif' + | 'image/webp' + | 'image/flif' + | 'image/x-xcf' + | 'image/x-canon-cr2' + | 'image/x-canon-cr3' + | 'image/tiff' + | 'image/bmp' + | 'image/icns' + | 'image/vnd.ms-photo' + | 'image/vnd.adobe.photoshop' + | 'application/x-indesign' + | 'application/epub+zip' + | 'application/x-xpinstall' + | 'application/vnd.oasis.opendocument.text' + | 'application/vnd.oasis.opendocument.spreadsheet' + | 'application/vnd.oasis.opendocument.presentation' + | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + | 'application/zip' + | 'application/x-tar' + | 'application/x-rar-compressed' + | 'application/gzip' + | 'application/x-bzip2' + | 'application/x-7z-compressed' + | 'application/x-apple-diskimage' + | 'video/mp4' + | 'audio/midi' + | 'video/x-matroska' + | 'video/webm' + | 'video/quicktime' + | 'video/vnd.avi' + | 'audio/vnd.wave' + | 'audio/qcelp' + | 'audio/x-ms-asf' + | 'video/x-ms-asf' + | 'application/vnd.ms-asf' + | 'video/mpeg' + | 'video/3gpp' + | 'audio/mpeg' + | 'audio/mp4' // RFC 4337 + | 'audio/opus' + | 'video/ogg' + | 'audio/ogg' + | 'application/ogg' + | 'audio/x-flac' + | 'audio/ape' + | 'audio/wavpack' + | 'audio/amr' + | 'application/pdf' + | 'application/x-msdownload' + | 'application/x-shockwave-flash' + | 'application/rtf' + | 'application/wasm' + | 'font/woff' + | 'font/woff2' + | 'application/vnd.ms-fontobject' + | 'font/ttf' + | 'font/otf' + | 'image/x-icon' + | 'video/x-flv' + | 'application/postscript' + | 'application/eps' + | 'application/x-xz' + | 'application/x-sqlite3' + | 'application/x-nintendo-nes-rom' + | 'application/x-google-chrome-extension' + | 'application/vnd.ms-cab-compressed' + | 'application/x-deb' + | 'application/x-unix-archive' + | 'application/x-rpm' + | 'application/x-compress' + | 'application/x-lzip' + | 'application/x-cfb' + | 'application/x-mie' + | 'application/x-apache-arrow' + | 'application/mxf' + | 'video/mp2t' + | 'application/x-blender' + | 'image/bpg' + | 'image/jp2' + | 'image/jpx' + | 'image/jpm' + | 'image/mj2' + | 'audio/aiff' + | 'application/xml' + | 'application/x-mobipocket-ebook' + | 'image/heif' + | 'image/heif-sequence' + | 'image/heic' + | 'image/heic-sequence' + | 'image/ktx' + | 'application/dicom' + | 'audio/x-musepack' + | 'text/calendar' + | 'text/vcard' + | 'model/gltf-binary' + | 'application/vnd.tcpdump.pcap' + | 'audio/x-dsf' // Non-standard + | 'application/x.ms.shortcut' // Invented by us + | 'application/x.apple.alias' // Invented by us + | 'audio/x-voc' + | 'audio/vnd.dolby.dd-raw' + | 'audio/x-m4a' + | 'image/apng' + | 'image/x-olympus-orf' + | 'image/x-sony-arw' + | 'image/x-adobe-dng' + | 'image/x-nikon-nef' + | 'image/x-panasonic-rw2' + | 'image/x-fujifilm-raf' + | 'video/x-m4v' + | 'video/3gpp2' + | 'application/x-esri-shape' + | 'audio/aac' + | 'audio/x-it' + | 'audio/x-s3m' + | 'audio/x-xm' + | 'video/MP1S' + | 'video/MP2P' + | 'application/vnd.sketchup.skp' + | 'image/avif' + | 'application/x-lzh-compressed' + | 'application/pgp-encrypted' + | 'application/x-asar' + | 'model/stl' + | 'application/vnd.ms-htmlhelp' + | 'model/3mf' + | 'image/jxl' + | 'application/zstd'; + + interface FileTypeResult { + /** + One of the supported [file types](https://github.com/sindresorhus/file-type#supported-file-types). + */ + readonly ext: FileExtension; + + /** + The detected [MIME type](https://en.wikipedia.org/wiki/Internet_media_type). + */ + readonly mime: MimeType; + } + + type ReadableStreamWithFileType = ReadableStream & { + readonly fileType?: FileTypeResult; + }; + + /** + Detect the file type of a `Buffer`, `Uint8Array`, or `ArrayBuffer`. + + The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + + If file access is available, it is recommended to use `.fromFile()` instead. + + @param buffer - A buffer representing file data. It works best if the buffer contains the entire file, it may work with a smaller portion as well. + @returns The detected file type and MIME type, or `undefined` when there is no match. + */ + function fromBuffer(buffer: Buffer | Uint8Array | ArrayBuffer): Promise; + + /** + Detect the file type of a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). + + The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + + @param stream - A readable stream representing file data. + @returns The detected file type and MIME type, or `undefined` when there is no match. + */ + function fromStream(stream: ReadableStream): Promise; + + /** + Detect the file type from an [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer) source. + + This method is used internally, but can also be used for a special "tokenizer" reader. + + A tokenizer propagates the internal read functions, allowing alternative transport mechanisms, to access files, to be implemented and used. + + An example is [`@tokenizer/http`](https://github.com/Borewit/tokenizer-http), which requests data using [HTTP-range-requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests). A difference with a conventional stream and the [*tokenizer*](https://github.com/Borewit/strtok3#tokenizer), is that it is able to *ignore* (seek, fast-forward) in the stream. For example, you may only need and read the first 6 bytes, and the last 128 bytes, which may be an advantage in case reading the entire file would take longer. + + ``` + import {makeTokenizer} = require('@tokenizer/http'); + import FileType = require('file-type'); + + const audioTrackUrl = 'https://test-audio.netlify.com/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3'; + + (async () => { + const httpTokenizer = await makeTokenizer(audioTrackUrl); + const fileType = await FileType.fromTokenizer(httpTokenizer); + + console.log(fileType); + //=> {ext: 'mp3', mime: 'audio/mpeg'} + })(); + ``` + + @param tokenizer - File source implementing the tokenizer interface. + @returns The detected file type and MIME type, or `undefined` when there is no match. + */ + function fromTokenizer(tokenizer: ITokenizer): Promise; + + /** + Supported file extensions. + */ + const extensions: Set; + + /** + Supported MIME types. + */ + const mimeTypes: Set; + + /** + Detect the file type of a readable stream. + + @param readableStream - A [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) containing a file to examine. + @returns A `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `FileType.fromFile()`. + + @example + ``` + import * as fs from 'fs'; + import * as crypto from 'crypto'; + import fileType = require('file-type'); + + (async () => { + const read = fs.createReadStream('encrypted.enc'); + const decipher = crypto.createDecipheriv(alg, key, iv); + const stream = await fileType.stream(read.pipe(decipher)); + + console.log(stream.fileType); + //=> {ext: 'mov', mime: 'video/quicktime'} + + const write = fs.createWriteStream(`decrypted.${stream.fileType.ext}`); + stream.pipe(write); + })(); + ``` + */ + function stream(readableStream: ReadableStream): Promise +} + +export = core; diff --git a/node_modules/file-type/core.js b/node_modules/file-type/core.js new file mode 100644 index 00000000..d653e66a --- /dev/null +++ b/node_modules/file-type/core.js @@ -0,0 +1,1465 @@ +'use strict'; +const Token = require('token-types'); +const strtok3 = require('strtok3/lib/core'); +const { + stringToBytes, + tarHeaderChecksumMatches, + uint32SyncSafeToken +} = require('./util'); +const supported = require('./supported'); + +const minimumBytes = 4100; // A fair amount of file-types are detectable within this range + +async function fromStream(stream) { + const tokenizer = await strtok3.fromStream(stream); + try { + return await fromTokenizer(tokenizer); + } finally { + await tokenizer.close(); + } +} + +async function fromBuffer(input) { + if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) { + throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof input}\``); + } + + const buffer = input instanceof Buffer ? input : Buffer.from(input); + + if (!(buffer && buffer.length > 1)) { + return; + } + + const tokenizer = strtok3.fromBuffer(buffer); + return fromTokenizer(tokenizer); +} + +function _check(buffer, headers, options) { + options = { + offset: 0, + ...options + }; + + for (const [index, header] of headers.entries()) { + // If a bitmask is set + if (options.mask) { + // If header doesn't equal `buf` with bits masked off + if (header !== (options.mask[index] & buffer[index + options.offset])) { + return false; + } + } else if (header !== buffer[index + options.offset]) { + return false; + } + } + + return true; +} + +async function fromTokenizer(tokenizer) { + try { + return _fromTokenizer(tokenizer); + } catch (error) { + if (!(error instanceof strtok3.EndOfStreamError)) { + throw error; + } + } +} + +async function _fromTokenizer(tokenizer) { + let buffer = Buffer.alloc(minimumBytes); + const bytesRead = 12; + const check = (header, options) => _check(buffer, header, options); + const checkString = (header, options) => check(stringToBytes(header), options); + + // Keep reading until EOF if the file size is unknown. + if (!tokenizer.fileInfo.size) { + tokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER; + } + + await tokenizer.peekBuffer(buffer, {length: bytesRead, mayBeLess: true}); + + // -- 2-byte signatures -- + + if (check([0x42, 0x4D])) { + return { + ext: 'bmp', + mime: 'image/bmp' + }; + } + + if (check([0x0B, 0x77])) { + return { + ext: 'ac3', + mime: 'audio/vnd.dolby.dd-raw' + }; + } + + if (check([0x78, 0x01])) { + return { + ext: 'dmg', + mime: 'application/x-apple-diskimage' + }; + } + + if (check([0x4D, 0x5A])) { + return { + ext: 'exe', + mime: 'application/x-msdownload' + }; + } + + if (check([0x25, 0x21])) { + await tokenizer.peekBuffer(buffer, {length: 24, mayBeLess: true}); + + if (checkString('PS-Adobe-', {offset: 2}) && + checkString(' EPSF-', {offset: 14})) { + return { + ext: 'eps', + mime: 'application/eps' + }; + } + + return { + ext: 'ps', + mime: 'application/postscript' + }; + } + + if ( + check([0x1F, 0xA0]) || + check([0x1F, 0x9D]) + ) { + return { + ext: 'Z', + mime: 'application/x-compress' + }; + } + + // -- 3-byte signatures -- + + if (check([0xFF, 0xD8, 0xFF])) { + return { + ext: 'jpg', + mime: 'image/jpeg' + }; + } + + if (check([0x49, 0x49, 0xBC])) { + return { + ext: 'jxr', + mime: 'image/vnd.ms-photo' + }; + } + + if (check([0x1F, 0x8B, 0x8])) { + return { + ext: 'gz', + mime: 'application/gzip' + }; + } + + if (check([0x42, 0x5A, 0x68])) { + return { + ext: 'bz2', + mime: 'application/x-bzip2' + }; + } + + if (checkString('ID3')) { + await tokenizer.ignore(6); // Skip ID3 header until the header size + const id3HeaderLen = await tokenizer.readToken(uint32SyncSafeToken); + if (tokenizer.position + id3HeaderLen > tokenizer.fileInfo.size) { + // Guess file type based on ID3 header for backward compatibility + return { + ext: 'mp3', + mime: 'audio/mpeg' + }; + } + + await tokenizer.ignore(id3HeaderLen); + return fromTokenizer(tokenizer); // Skip ID3 header, recursion + } + + // Musepack, SV7 + if (checkString('MP+')) { + return { + ext: 'mpc', + mime: 'audio/x-musepack' + }; + } + + if ( + (buffer[0] === 0x43 || buffer[0] === 0x46) && + check([0x57, 0x53], {offset: 1}) + ) { + return { + ext: 'swf', + mime: 'application/x-shockwave-flash' + }; + } + + // -- 4-byte signatures -- + + if (check([0x47, 0x49, 0x46])) { + return { + ext: 'gif', + mime: 'image/gif' + }; + } + + if (checkString('FLIF')) { + return { + ext: 'flif', + mime: 'image/flif' + }; + } + + if (checkString('8BPS')) { + return { + ext: 'psd', + mime: 'image/vnd.adobe.photoshop' + }; + } + + if (checkString('WEBP', {offset: 8})) { + return { + ext: 'webp', + mime: 'image/webp' + }; + } + + // Musepack, SV8 + if (checkString('MPCK')) { + return { + ext: 'mpc', + mime: 'audio/x-musepack' + }; + } + + if (checkString('FORM')) { + return { + ext: 'aif', + mime: 'audio/aiff' + }; + } + + if (checkString('icns', {offset: 0})) { + return { + ext: 'icns', + mime: 'image/icns' + }; + } + + // Zip-based file formats + // Need to be before the `zip` check + if (check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature + try { + while (tokenizer.position + 30 < tokenizer.fileInfo.size) { + await tokenizer.readBuffer(buffer, {length: 30}); + + // https://en.wikipedia.org/wiki/Zip_(file_format)#File_headers + const zipHeader = { + compressedSize: buffer.readUInt32LE(18), + uncompressedSize: buffer.readUInt32LE(22), + filenameLength: buffer.readUInt16LE(26), + extraFieldLength: buffer.readUInt16LE(28) + }; + + zipHeader.filename = await tokenizer.readToken(new Token.StringType(zipHeader.filenameLength, 'utf-8')); + await tokenizer.ignore(zipHeader.extraFieldLength); + + // Assumes signed `.xpi` from addons.mozilla.org + if (zipHeader.filename === 'META-INF/mozilla.rsa') { + return { + ext: 'xpi', + mime: 'application/x-xpinstall' + }; + } + + if (zipHeader.filename.endsWith('.rels') || zipHeader.filename.endsWith('.xml')) { + const type = zipHeader.filename.split('/')[0]; + switch (type) { + case '_rels': + break; + case 'word': + return { + ext: 'docx', + mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + }; + case 'ppt': + return { + ext: 'pptx', + mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + }; + case 'xl': + return { + ext: 'xlsx', + mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }; + default: + break; + } + } + + if (zipHeader.filename.startsWith('xl/')) { + return { + ext: 'xlsx', + mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }; + } + + if (zipHeader.filename.startsWith('3D/') && zipHeader.filename.endsWith('.model')) { + return { + ext: '3mf', + mime: 'model/3mf' + }; + } + + // The docx, xlsx and pptx file types extend the Office Open XML file format: + // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats + // We look for: + // - one entry named '[Content_Types].xml' or '_rels/.rels', + // - one entry indicating specific type of file. + // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. + if (zipHeader.filename === 'mimetype' && zipHeader.compressedSize === zipHeader.uncompressedSize) { + const mimeType = await tokenizer.readToken(new Token.StringType(zipHeader.compressedSize, 'utf-8')); + + switch (mimeType) { + case 'application/epub+zip': + return { + ext: 'epub', + mime: 'application/epub+zip' + }; + case 'application/vnd.oasis.opendocument.text': + return { + ext: 'odt', + mime: 'application/vnd.oasis.opendocument.text' + }; + case 'application/vnd.oasis.opendocument.spreadsheet': + return { + ext: 'ods', + mime: 'application/vnd.oasis.opendocument.spreadsheet' + }; + case 'application/vnd.oasis.opendocument.presentation': + return { + ext: 'odp', + mime: 'application/vnd.oasis.opendocument.presentation' + }; + default: + } + } + + // Try to find next header manually when current one is corrupted + if (zipHeader.compressedSize === 0) { + let nextHeaderIndex = -1; + + while (nextHeaderIndex < 0 && (tokenizer.position < tokenizer.fileInfo.size)) { + await tokenizer.peekBuffer(buffer, {mayBeLess: true}); + + nextHeaderIndex = buffer.indexOf('504B0304', 0, 'hex'); + // Move position to the next header if found, skip the whole buffer otherwise + await tokenizer.ignore(nextHeaderIndex >= 0 ? nextHeaderIndex : buffer.length); + } + } else { + await tokenizer.ignore(zipHeader.compressedSize); + } + } + } catch (error) { + if (!(error instanceof strtok3.EndOfStreamError)) { + throw error; + } + } + + return { + ext: 'zip', + mime: 'application/zip' + }; + } + + if (checkString('OggS')) { + // This is an OGG container + await tokenizer.ignore(28); + const type = Buffer.alloc(8); + await tokenizer.readBuffer(type); + + // Needs to be before `ogg` check + if (_check(type, [0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64])) { + return { + ext: 'opus', + mime: 'audio/opus' + }; + } + + // If ' theora' in header. + if (_check(type, [0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61])) { + return { + ext: 'ogv', + mime: 'video/ogg' + }; + } + + // If '\x01video' in header. + if (_check(type, [0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00])) { + return { + ext: 'ogm', + mime: 'video/ogg' + }; + } + + // If ' FLAC' in header https://xiph.org/flac/faq.html + if (_check(type, [0x7F, 0x46, 0x4C, 0x41, 0x43])) { + return { + ext: 'oga', + mime: 'audio/ogg' + }; + } + + // 'Speex ' in header https://en.wikipedia.org/wiki/Speex + if (_check(type, [0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20])) { + return { + ext: 'spx', + mime: 'audio/ogg' + }; + } + + // If '\x01vorbis' in header + if (_check(type, [0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73])) { + return { + ext: 'ogg', + mime: 'audio/ogg' + }; + } + + // Default OGG container https://www.iana.org/assignments/media-types/application/ogg + return { + ext: 'ogx', + mime: 'application/ogg' + }; + } + + if ( + check([0x50, 0x4B]) && + (buffer[2] === 0x3 || buffer[2] === 0x5 || buffer[2] === 0x7) && + (buffer[3] === 0x4 || buffer[3] === 0x6 || buffer[3] === 0x8) + ) { + return { + ext: 'zip', + mime: 'application/zip' + }; + } + + // + + // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format) + // It's not required to be first, but it's recommended to be. Almost all ISO base media files start with `ftyp` box. + // `ftyp` box must contain a brand major identifier, which must consist of ISO 8859-1 printable characters. + // Here we check for 8859-1 printable characters (for simplicity, it's a mask which also catches one non-printable character). + if ( + checkString('ftyp', {offset: 4}) && + (buffer[8] & 0x60) !== 0x00 // Brand major, first character ASCII? + ) { + // They all can have MIME `video/mp4` except `application/mp4` special-case which is hard to detect. + // For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension. + const brandMajor = buffer.toString('binary', 8, 12).replace('\0', ' ').trim(); + switch (brandMajor) { + case 'avif': + return {ext: 'avif', mime: 'image/avif'}; + case 'mif1': + return {ext: 'heic', mime: 'image/heif'}; + case 'msf1': + return {ext: 'heic', mime: 'image/heif-sequence'}; + case 'heic': + case 'heix': + return {ext: 'heic', mime: 'image/heic'}; + case 'hevc': + case 'hevx': + return {ext: 'heic', mime: 'image/heic-sequence'}; + case 'qt': + return {ext: 'mov', mime: 'video/quicktime'}; + case 'M4V': + case 'M4VH': + case 'M4VP': + return {ext: 'm4v', mime: 'video/x-m4v'}; + case 'M4P': + return {ext: 'm4p', mime: 'video/mp4'}; + case 'M4B': + return {ext: 'm4b', mime: 'audio/mp4'}; + case 'M4A': + return {ext: 'm4a', mime: 'audio/x-m4a'}; + case 'F4V': + return {ext: 'f4v', mime: 'video/mp4'}; + case 'F4P': + return {ext: 'f4p', mime: 'video/mp4'}; + case 'F4A': + return {ext: 'f4a', mime: 'audio/mp4'}; + case 'F4B': + return {ext: 'f4b', mime: 'audio/mp4'}; + case 'crx': + return {ext: 'cr3', mime: 'image/x-canon-cr3'}; + default: + if (brandMajor.startsWith('3g')) { + if (brandMajor.startsWith('3g2')) { + return {ext: '3g2', mime: 'video/3gpp2'}; + } + + return {ext: '3gp', mime: 'video/3gpp'}; + } + + return {ext: 'mp4', mime: 'video/mp4'}; + } + } + + if (checkString('MThd')) { + return { + ext: 'mid', + mime: 'audio/midi' + }; + } + + if ( + checkString('wOFF') && + ( + check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || + checkString('OTTO', {offset: 4}) + ) + ) { + return { + ext: 'woff', + mime: 'font/woff' + }; + } + + if ( + checkString('wOF2') && + ( + check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || + checkString('OTTO', {offset: 4}) + ) + ) { + return { + ext: 'woff2', + mime: 'font/woff2' + }; + } + + if (check([0xD4, 0xC3, 0xB2, 0xA1]) || check([0xA1, 0xB2, 0xC3, 0xD4])) { + return { + ext: 'pcap', + mime: 'application/vnd.tcpdump.pcap' + }; + } + + // Sony DSD Stream File (DSF) + if (checkString('DSD ')) { + return { + ext: 'dsf', + mime: 'audio/x-dsf' // Non-standard + }; + } + + if (checkString('LZIP')) { + return { + ext: 'lz', + mime: 'application/x-lzip' + }; + } + + if (checkString('fLaC')) { + return { + ext: 'flac', + mime: 'audio/x-flac' + }; + } + + if (check([0x42, 0x50, 0x47, 0xFB])) { + return { + ext: 'bpg', + mime: 'image/bpg' + }; + } + + if (checkString('wvpk')) { + return { + ext: 'wv', + mime: 'audio/wavpack' + }; + } + + if (checkString('%PDF')) { + await tokenizer.ignore(1350); + const maxBufferSize = 10 * 1024 * 1024; + const buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size)); + await tokenizer.readBuffer(buffer, {mayBeLess: true}); + + // Check if this is an Adobe Illustrator file + if (buffer.includes(Buffer.from('AIPrivateData'))) { + return { + ext: 'ai', + mime: 'application/postscript' + }; + } + + // Assume this is just a normal PDF + return { + ext: 'pdf', + mime: 'application/pdf' + }; + } + + if (check([0x00, 0x61, 0x73, 0x6D])) { + return { + ext: 'wasm', + mime: 'application/wasm' + }; + } + + // TIFF, little-endian type + if (check([0x49, 0x49, 0x2A, 0x0])) { + if (checkString('CR', {offset: 8})) { + return { + ext: 'cr2', + mime: 'image/x-canon-cr2' + }; + } + + if (check([0x1C, 0x00, 0xFE, 0x00], {offset: 8}) || check([0x1F, 0x00, 0x0B, 0x00], {offset: 8})) { + return { + ext: 'nef', + mime: 'image/x-nikon-nef' + }; + } + + if ( + check([0x08, 0x00, 0x00, 0x00], {offset: 4}) && + (check([0x2D, 0x00, 0xFE, 0x00], {offset: 8}) || + check([0x27, 0x00, 0xFE, 0x00], {offset: 8})) + ) { + return { + ext: 'dng', + mime: 'image/x-adobe-dng' + }; + } + + buffer = Buffer.alloc(24); + await tokenizer.peekBuffer(buffer); + if ( + (check([0x10, 0xFB, 0x86, 0x01], {offset: 4}) || check([0x08, 0x00, 0x00, 0x00], {offset: 4})) && + // This pattern differentiates ARW from other TIFF-ish file types: + check([0x00, 0xFE, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x01], {offset: 9}) + ) { + return { + ext: 'arw', + mime: 'image/x-sony-arw' + }; + } + + return { + ext: 'tif', + mime: 'image/tiff' + }; + } + + // TIFF, big-endian type + if (check([0x4D, 0x4D, 0x0, 0x2A])) { + return { + ext: 'tif', + mime: 'image/tiff' + }; + } + + if (checkString('MAC ')) { + return { + ext: 'ape', + mime: 'audio/ape' + }; + } + + // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska + if (check([0x1A, 0x45, 0xDF, 0xA3])) { // Root element: EBML + async function readField() { + const msb = await tokenizer.peekNumber(Token.UINT8); + let mask = 0x80; + let ic = 0; // 0 = A, 1 = B, 2 = C, 3 = D + + while ((msb & mask) === 0 && mask !== 0) { + ++ic; + mask >>= 1; + } + + const id = Buffer.alloc(ic + 1); + await tokenizer.readBuffer(id); + return id; + } + + async function readElement() { + const id = await readField(); + const lenField = await readField(); + lenField[0] ^= 0x80 >> (lenField.length - 1); + const nrLen = Math.min(6, lenField.length); // JavaScript can max read 6 bytes integer + return { + id: id.readUIntBE(0, id.length), + len: lenField.readUIntBE(lenField.length - nrLen, nrLen) + }; + } + + async function readChildren(level, children) { + while (children > 0) { + const e = await readElement(); + if (e.id === 0x4282) { + return tokenizer.readToken(new Token.StringType(e.len, 'utf-8')); // Return DocType + } + + await tokenizer.ignore(e.len); // ignore payload + --children; + } + } + + const re = await readElement(); + const docType = await readChildren(1, re.len); + + switch (docType) { + case 'webm': + return { + ext: 'webm', + mime: 'video/webm' + }; + + case 'matroska': + return { + ext: 'mkv', + mime: 'video/x-matroska' + }; + + default: + return; + } + } + + // RIFF file format which might be AVI, WAV, QCP, etc + if (check([0x52, 0x49, 0x46, 0x46])) { + if (check([0x41, 0x56, 0x49], {offset: 8})) { + return { + ext: 'avi', + mime: 'video/vnd.avi' + }; + } + + if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) { + return { + ext: 'wav', + mime: 'audio/vnd.wave' + }; + } + + // QLCM, QCP file + if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) { + return { + ext: 'qcp', + mime: 'audio/qcelp' + }; + } + } + + if (checkString('SQLi')) { + return { + ext: 'sqlite', + mime: 'application/x-sqlite3' + }; + } + + if (check([0x4E, 0x45, 0x53, 0x1A])) { + return { + ext: 'nes', + mime: 'application/x-nintendo-nes-rom' + }; + } + + if (checkString('Cr24')) { + return { + ext: 'crx', + mime: 'application/x-google-chrome-extension' + }; + } + + if ( + checkString('MSCF') || + checkString('ISc(') + ) { + return { + ext: 'cab', + mime: 'application/vnd.ms-cab-compressed' + }; + } + + if (check([0xED, 0xAB, 0xEE, 0xDB])) { + return { + ext: 'rpm', + mime: 'application/x-rpm' + }; + } + + if (check([0xC5, 0xD0, 0xD3, 0xC6])) { + return { + ext: 'eps', + mime: 'application/eps' + }; + } + + if (check([0x28, 0xB5, 0x2F, 0xFD])) { + return { + ext: 'zst', + mime: 'application/zstd' + }; + } + + // -- 5-byte signatures -- + + if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { + return { + ext: 'otf', + mime: 'font/otf' + }; + } + + if (checkString('#!AMR')) { + return { + ext: 'amr', + mime: 'audio/amr' + }; + } + + if (checkString('{\\rtf')) { + return { + ext: 'rtf', + mime: 'application/rtf' + }; + } + + if (check([0x46, 0x4C, 0x56, 0x01])) { + return { + ext: 'flv', + mime: 'video/x-flv' + }; + } + + if (checkString('IMPM')) { + return { + ext: 'it', + mime: 'audio/x-it' + }; + } + + if ( + checkString('-lh0-', {offset: 2}) || + checkString('-lh1-', {offset: 2}) || + checkString('-lh2-', {offset: 2}) || + checkString('-lh3-', {offset: 2}) || + checkString('-lh4-', {offset: 2}) || + checkString('-lh5-', {offset: 2}) || + checkString('-lh6-', {offset: 2}) || + checkString('-lh7-', {offset: 2}) || + checkString('-lzs-', {offset: 2}) || + checkString('-lz4-', {offset: 2}) || + checkString('-lz5-', {offset: 2}) || + checkString('-lhd-', {offset: 2}) + ) { + return { + ext: 'lzh', + mime: 'application/x-lzh-compressed' + }; + } + + // MPEG program stream (PS or MPEG-PS) + if (check([0x00, 0x00, 0x01, 0xBA])) { + // MPEG-PS, MPEG-1 Part 1 + if (check([0x21], {offset: 4, mask: [0xF1]})) { + return { + ext: 'mpg', // May also be .ps, .mpeg + mime: 'video/MP1S' + }; + } + + // MPEG-PS, MPEG-2 Part 1 + if (check([0x44], {offset: 4, mask: [0xC4]})) { + return { + ext: 'mpg', // May also be .mpg, .m2p, .vob or .sub + mime: 'video/MP2P' + }; + } + } + + if (checkString('ITSF')) { + return { + ext: 'chm', + mime: 'application/vnd.ms-htmlhelp' + }; + } + + // -- 6-byte signatures -- + + if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { + return { + ext: 'xz', + mime: 'application/x-xz' + }; + } + + if (checkString('')) { + await tokenizer.ignore(8); + const str = await tokenizer.readToken(new Token.StringType(13, 'ascii')); + if (str === 'debian-binary') { + return { + ext: 'deb', + mime: 'application/x-deb' + }; + } + + return { + ext: 'ar', + mime: 'application/x-unix-archive' + }; + } + + // -- 8-byte signatures -- + + if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { + // APNG format (https://wiki.mozilla.org/APNG_Specification) + // 1. Find the first IDAT (image data) chunk (49 44 41 54) + // 2. Check if there is an "acTL" chunk before the IDAT one (61 63 54 4C) + + // Offset calculated as follows: + // - 8 bytes: PNG signature + // - 4 (length) + 4 (chunk type) + 13 (chunk data) + 4 (CRC): IHDR chunk + + await tokenizer.ignore(8); // ignore PNG signature + + async function readChunkHeader() { + return { + length: await tokenizer.readToken(Token.INT32_BE), + type: await tokenizer.readToken(new Token.StringType(4, 'binary')) + }; + } + + do { + const chunk = await readChunkHeader(); + if (chunk.length < 0) { + return; // Invalid chunk length + } + + switch (chunk.type) { + case 'IDAT': + return { + ext: 'png', + mime: 'image/png' + }; + case 'acTL': + return { + ext: 'apng', + mime: 'image/apng' + }; + default: + await tokenizer.ignore(chunk.length + 4); // Ignore chunk-data + CRC + } + } while (tokenizer.position + 8 < tokenizer.fileInfo.size); + + return { + ext: 'png', + mime: 'image/png' + }; + } + + if (check([0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00])) { + return { + ext: 'arrow', + mime: 'application/x-apache-arrow' + }; + } + + if (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) { + return { + ext: 'glb', + mime: 'model/gltf-binary' + }; + } + + // `mov` format variants + if ( + check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || // `free` + check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // `mdat` MJPEG + check([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) || // `moov` + check([0x77, 0x69, 0x64, 0x65], {offset: 4}) // `wide` + ) { + return { + ext: 'mov', + mime: 'video/quicktime' + }; + } + + // -- 9-byte signatures -- + + if (check([0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18])) { + return { + ext: 'orf', + mime: 'image/x-olympus-orf' + }; + } + + if (checkString('gimp xcf ')) { + return { + ext: 'xcf', + mime: 'image/x-xcf' + }; + } + + // -- 12-byte signatures -- + + if (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) { + return { + ext: 'rw2', + mime: 'image/x-panasonic-rw2' + }; + } + + // ASF_Header_Object first 80 bytes + if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { + async function readHeader() { + const guid = Buffer.alloc(16); + await tokenizer.readBuffer(guid); + return { + id: guid, + size: Number(await tokenizer.readToken(Token.UINT64_LE)) + }; + } + + await tokenizer.ignore(30); + // Search for header should be in first 1KB of file. + while (tokenizer.position + 24 < tokenizer.fileInfo.size) { + const header = await readHeader(); + let payload = header.size - 24; + if (_check(header.id, [0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65])) { + // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365) + const typeId = Buffer.alloc(16); + payload -= await tokenizer.readBuffer(typeId); + + if (_check(typeId, [0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) { + // Found audio: + return { + ext: 'asf', + mime: 'audio/x-ms-asf' + }; + } + + if (_check(typeId, [0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) { + // Found video: + return { + ext: 'asf', + mime: 'video/x-ms-asf' + }; + } + + break; + } + + await tokenizer.ignore(payload); + } + + // Default to ASF generic extension + return { + ext: 'asf', + mime: 'application/vnd.ms-asf' + }; + } + + if (check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) { + return { + ext: 'ktx', + mime: 'image/ktx' + }; + } + + if ((check([0x7E, 0x10, 0x04]) || check([0x7E, 0x18, 0x04])) && check([0x30, 0x4D, 0x49, 0x45], {offset: 4})) { + return { + ext: 'mie', + mime: 'application/x-mie' + }; + } + + if (check([0x27, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], {offset: 2})) { + return { + ext: 'shp', + mime: 'application/x-esri-shape' + }; + } + + if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { + // JPEG-2000 family + + await tokenizer.ignore(20); + const type = await tokenizer.readToken(new Token.StringType(4, 'ascii')); + switch (type) { + case 'jp2 ': + return { + ext: 'jp2', + mime: 'image/jp2' + }; + case 'jpx ': + return { + ext: 'jpx', + mime: 'image/jpx' + }; + case 'jpm ': + return { + ext: 'jpm', + mime: 'image/jpm' + }; + case 'mjp2': + return { + ext: 'mj2', + mime: 'image/mj2' + }; + default: + return; + } + } + + if ( + check([0xFF, 0x0A]) || + check([0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A]) + ) { + return { + ext: 'jxl', + mime: 'image/jxl' + }; + } + + // -- Unsafe signatures -- + + if ( + check([0x0, 0x0, 0x1, 0xBA]) || + check([0x0, 0x0, 0x1, 0xB3]) + ) { + return { + ext: 'mpg', + mime: 'video/mpeg' + }; + } + + if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { + return { + ext: 'ttf', + mime: 'font/ttf' + }; + } + + if (check([0x00, 0x00, 0x01, 0x00])) { + return { + ext: 'ico', + mime: 'image/x-icon' + }; + } + + if (check([0x00, 0x00, 0x02, 0x00])) { + return { + ext: 'cur', + mime: 'image/x-icon' + }; + } + + if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { + // Detected Microsoft Compound File Binary File (MS-CFB) Format. + return { + ext: 'cfb', + mime: 'application/x-cfb' + }; + } + + // Increase sample size from 12 to 256. + await tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true}); + + // -- 15-byte signatures -- + + if (checkString('BEGIN:')) { + if (checkString('VCARD', {offset: 6})) { + return { + ext: 'vcf', + mime: 'text/vcard' + }; + } + + if (checkString('VCALENDAR', {offset: 6})) { + return { + ext: 'ics', + mime: 'text/calendar' + }; + } + } + + // `raf` is here just to keep all the raw image detectors together. + if (checkString('FUJIFILMCCD-RAW')) { + return { + ext: 'raf', + mime: 'image/x-fujifilm-raf' + }; + } + + if (checkString('Extended Module:')) { + return { + ext: 'xm', + mime: 'audio/x-xm' + }; + } + + if (checkString('Creative Voice File')) { + return { + ext: 'voc', + mime: 'audio/x-voc' + }; + } + + if (check([0x04, 0x00, 0x00, 0x00]) && buffer.length >= 16) { // Rough & quick check Pickle/ASAR + const jsonSize = buffer.readUInt32LE(12); + if (jsonSize > 12 && buffer.length >= jsonSize + 16) { + try { + const header = buffer.slice(16, jsonSize + 16).toString(); + const json = JSON.parse(header); + // Check if Pickle is ASAR + if (json.files) { // Final check, assuring Pickle/ASAR format + return { + ext: 'asar', + mime: 'application/x-asar' + }; + } + } catch (_) { + } + } + } + + if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { + return { + ext: 'mxf', + mime: 'application/mxf' + }; + } + + if (checkString('SCRM', {offset: 44})) { + return { + ext: 's3m', + mime: 'audio/x-s3m' + }; + } + + if (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) { + return { + ext: 'mts', + mime: 'video/mp2t' + }; + } + + if (check([0x42, 0x4F, 0x4F, 0x4B, 0x4D, 0x4F, 0x42, 0x49], {offset: 60})) { + return { + ext: 'mobi', + mime: 'application/x-mobipocket-ebook' + }; + } + + if (check([0x44, 0x49, 0x43, 0x4D], {offset: 128})) { + return { + ext: 'dcm', + mime: 'application/dicom' + }; + } + + if (check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) { + return { + ext: 'lnk', + mime: 'application/x.ms.shortcut' // Invented by us + }; + } + + if (check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) { + return { + ext: 'alias', + mime: 'application/x.apple.alias' // Invented by us + }; + } + + if ( + check([0x4C, 0x50], {offset: 34}) && + ( + check([0x00, 0x00, 0x01], {offset: 8}) || + check([0x01, 0x00, 0x02], {offset: 8}) || + check([0x02, 0x00, 0x02], {offset: 8}) + ) + ) { + return { + ext: 'eot', + mime: 'application/vnd.ms-fontobject' + }; + } + + if (check([0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xE5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D])) { + return { + ext: 'indd', + mime: 'application/x-indesign' + }; + } + + // Increase sample size from 256 to 512 + await tokenizer.peekBuffer(buffer, {length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true}); + + // Requires a buffer size of 512 bytes + if (tarHeaderChecksumMatches(buffer)) { + return { + ext: 'tar', + mime: 'application/x-tar' + }; + } + + if (check([0xFF, 0xFE, 0xFF, 0x0E, 0x53, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x74, 0x00, 0x63, 0x00, 0x68, 0x00, 0x55, 0x00, 0x70, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6C, 0x00])) { + return { + ext: 'skp', + mime: 'application/vnd.sketchup.skp' + }; + } + + if (checkString('-----BEGIN PGP MESSAGE-----')) { + return { + ext: 'pgp', + mime: 'application/pgp-encrypted' + }; + } + + // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE) + if (buffer.length >= 2 && check([0xFF, 0xE0], {offset: 0, mask: [0xFF, 0xE0]})) { + if (check([0x10], {offset: 1, mask: [0x16]})) { + // Check for (ADTS) MPEG-2 + if (check([0x08], {offset: 1, mask: [0x08]})) { + return { + ext: 'aac', + mime: 'audio/aac' + }; + } + + // Must be (ADTS) MPEG-4 + return { + ext: 'aac', + mime: 'audio/aac' + }; + } + + // MPEG 1 or 2 Layer 3 header + // Check for MPEG layer 3 + if (check([0x02], {offset: 1, mask: [0x06]})) { + return { + ext: 'mp3', + mime: 'audio/mpeg' + }; + } + + // Check for MPEG layer 2 + if (check([0x04], {offset: 1, mask: [0x06]})) { + return { + ext: 'mp2', + mime: 'audio/mpeg' + }; + } + + // Check for MPEG layer 1 + if (check([0x06], {offset: 1, mask: [0x06]})) { + return { + ext: 'mp1', + mime: 'audio/mpeg' + }; + } + } +} + +const stream = readableStream => new Promise((resolve, reject) => { + // Using `eval` to work around issues when bundling with Webpack + const stream = eval('require')('stream'); // eslint-disable-line no-eval + + readableStream.on('error', reject); + readableStream.once('readable', async () => { + // Set up output stream + const pass = new stream.PassThrough(); + let outputStream; + if (stream.pipeline) { + outputStream = stream.pipeline(readableStream, pass, () => { + }); + } else { + outputStream = readableStream.pipe(pass); + } + + // Read the input stream and detect the filetype + const chunk = readableStream.read(minimumBytes) || readableStream.read() || Buffer.alloc(0); + try { + const fileType = await fromBuffer(chunk); + pass.fileType = fileType; + } catch (error) { + reject(error); + } + + resolve(outputStream); + }); +}); + +const fileType = { + fromStream, + fromTokenizer, + fromBuffer, + stream +}; + +Object.defineProperty(fileType, 'extensions', { + get() { + return new Set(supported.extensions); + } +}); + +Object.defineProperty(fileType, 'mimeTypes', { + get() { + return new Set(supported.mimeTypes); + } +}); + +module.exports = fileType; diff --git a/node_modules/file-type/index.d.ts b/node_modules/file-type/index.d.ts new file mode 100644 index 00000000..30c8eff5 --- /dev/null +++ b/node_modules/file-type/index.d.ts @@ -0,0 +1,27 @@ +/// +import {Readable as ReadableStream} from 'stream'; +import * as core from './core'; + +export type ReadableStreamWithFileType = core.ReadableStreamWithFileType; +export type FileTypeResult = core.FileTypeResult; +export type FileExtension = core.FileExtension; +export type MimeType = core.MimeType; + +/** +Detect the file type of a file path. + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +@param path - The file path to parse. +@returns The detected file type and MIME type or `undefined` when there is no match. +*/ +export function fromFile(path: string): Promise; + +export { + fromBuffer, + fromStream, + fromTokenizer, + extensions, + mimeTypes, + stream +} from './core'; diff --git a/node_modules/file-type/index.js b/node_modules/file-type/index.js new file mode 100644 index 00000000..2c42ac0e --- /dev/null +++ b/node_modules/file-type/index.js @@ -0,0 +1,32 @@ +'use strict'; +const strtok3 = require('strtok3'); +const core = require('./core'); + +async function fromFile(path) { + const tokenizer = await strtok3.fromFile(path); + try { + return await core.fromTokenizer(tokenizer); + } finally { + await tokenizer.close(); + } +} + +const fileType = { + fromFile +}; + +Object.assign(fileType, core); + +Object.defineProperty(fileType, 'extensions', { + get() { + return core.extensions; + } +}); + +Object.defineProperty(fileType, 'mimeTypes', { + get() { + return core.mimeTypes; + } +}); + +module.exports = fileType; diff --git a/project starter code/node_modules/file-type/license b/node_modules/file-type/license similarity index 92% rename from project starter code/node_modules/file-type/license rename to node_modules/file-type/license index e7af2f77..fa7ceba3 100644 --- a/project starter code/node_modules/file-type/license +++ b/node_modules/file-type/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://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: diff --git a/node_modules/file-type/package.json b/node_modules/file-type/package.json new file mode 100644 index 00000000..82b840b0 --- /dev/null +++ b/node_modules/file-type/package.json @@ -0,0 +1,215 @@ +{ + "name": "file-type", + "version": "16.5.4", + "description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer", + "license": "MIT", + "repository": "sindresorhus/file-type", + "funding": "https://github.com/sindresorhus/file-type?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "ava": "ava --serial --verbose", + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts", + "browser.js", + "browser.d.ts", + "core.js", + "core.d.ts", + "supported.js", + "util.js" + ], + "keywords": [ + "mime", + "file", + "type", + "magic", + "archive", + "image", + "img", + "pic", + "picture", + "flash", + "photo", + "video", + "detect", + "check", + "is", + "exif", + "exe", + "binary", + "buffer", + "uint8array", + "jpg", + "png", + "apng", + "gif", + "webp", + "flif", + "xcf", + "cr2", + "cr3", + "orf", + "arw", + "dng", + "nef", + "rw2", + "raf", + "tif", + "bmp", + "icns", + "jxr", + "psd", + "indd", + "zip", + "tar", + "rar", + "gz", + "bz2", + "7z", + "dmg", + "mp4", + "mid", + "mkv", + "webm", + "mov", + "avi", + "mpg", + "mp2", + "mp3", + "m4a", + "ogg", + "opus", + "flac", + "wav", + "amr", + "pdf", + "epub", + "mobi", + "swf", + "rtf", + "woff", + "woff2", + "eot", + "ttf", + "otf", + "ico", + "flv", + "ps", + "xz", + "sqlite", + "xpi", + "cab", + "deb", + "ar", + "rpm", + "Z", + "lz", + "cfb", + "mxf", + "mts", + "wasm", + "webassembly", + "blend", + "bpg", + "docx", + "pptx", + "xlsx", + "3gp", + "jp2", + "jpm", + "jpx", + "mj2", + "aif", + "odt", + "ods", + "odp", + "xml", + "heic", + "ics", + "glb", + "pcap", + "dsf", + "lnk", + "alias", + "voc", + "ac3", + "3g2", + "m4b", + "m4p", + "m4v", + "f4a", + "f4b", + "f4p", + "f4v", + "mie", + "qcp", + "asf", + "ogv", + "ogm", + "oga", + "spx", + "ogx", + "ape", + "wv", + "cur", + "nes", + "crx", + "ktx", + "dcm", + "mpc", + "arrow", + "shp", + "aac", + "mp1", + "it", + "s3m", + "xm", + "ai", + "skp", + "avif", + "eps", + "lzh", + "pgp", + "asar", + "stl", + "chm", + "3mf", + "zst", + "jxl", + "vcf" + ], + "devDependencies": { + "@types/node": "^13.1.4", + "ava": "^2.3.0", + "noop-stream": "^0.1.0", + "read-chunk": "^3.2.0", + "tsd": "^0.11.0", + "xo": "^0.25.3" + }, + "dependencies": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + }, + "xo": { + "envs": [ + "node", + "browser" + ], + "rules": { + "no-inner-declarations": "warn", + "no-await-in-loop": "warn", + "promise/prefer-await-to-then": "warn", + "prefer-named-capture-group": "off" + } + } +} diff --git a/node_modules/file-type/readme.md b/node_modules/file-type/readme.md new file mode 100644 index 00000000..72474d60 --- /dev/null +++ b/node_modules/file-type/readme.md @@ -0,0 +1,470 @@ +# file-type + +> Detect the file type of a Buffer/Uint8Array/ArrayBuffer + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +This package is for detecting binary-based file formats, not text-based formats like `.txt`, `.csv`, `.svg`, etc. + +
+ +--- + + + +--- + +
+ +## Install + +``` +$ npm install file-type +``` + +## Usage + +#### Node.js + +Determine file type from a file: + +```js +const FileType = require('file-type'); + +(async () => { + console.log(await FileType.fromFile('Unicorn.png')); + //=> {ext: 'png', mime: 'image/png'} +})(); +``` + +Determine file type from a Buffer, which may be a portion of the beginning of a file: + +```js +const FileType = require('file-type'); +const readChunk = require('read-chunk'); + +(async () => { + const buffer = readChunk.sync('Unicorn.png', 0, 4100); + + console.log(await FileType.fromBuffer(buffer)); + //=> {ext: 'png', mime: 'image/png'} +})(); +``` + +Determine file type from a stream: + +```js +const fs = require('fs'); +const FileType = require('file-type'); + +(async () => { + const stream = fs.createReadStream('Unicorn.mp4'); + + console.log(await FileType.fromStream(stream)); + //=> {ext: 'mp4', mime: 'video/mp4'} +} +)(); +``` + +The stream method can also be used to read from a remote location: + +```js +const got = require('got'); +const FileType = require('file-type'); + +const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'; + +(async () => { + const stream = got.stream(url); + + console.log(await FileType.fromStream(stream)); + //=> {ext: 'jpg', mime: 'image/jpeg'} +})(); +``` + +Another stream example: + +```js +const stream = require('stream'); +const fs = require('fs'); +const crypto = require('crypto'); +const FileType = require('file-type'); + +(async () => { + const read = fs.createReadStream('encrypted.enc'); + const decipher = crypto.createDecipheriv(alg, key, iv); + + const fileTypeStream = await FileType.stream(stream.pipeline(read, decipher)); + + console.log(fileTypeStream.fileType); + //=> {ext: 'mov', mime: 'video/quicktime'} + + const write = fs.createWriteStream(`decrypted.${fileTypeStream.fileType.ext}`); + fileTypeStream.pipe(write); +})(); +``` + +#### Browser + +```js +const FileType = require('file-type/browser'); + +const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'; + +(async () => { + const response = await fetch(url); + const fileType = await FileType.fromStream(response.body); + + console.log(fileType); + //=> {ext: 'jpg', mime: 'image/jpeg'} +})(); +``` + +```js +const FileType = require('file-type/browser'); + +(async () => { + const blob = new Blob([''], { + type: 'plain/text', + endings: 'native' + }); + + console.log(await FileType.fromBlob(blob)); + //=> {ext: 'txt', mime: 'plain/text'} +})(); +``` + +## API + +### FileType.fromBuffer(buffer) + +Detect the file type of a `Buffer`, `Uint8Array`, or `ArrayBuffer`. + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +If file access is available, it is recommended to use `FileType.fromFile()` instead. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +#### buffer + +Type: `Buffer | Uint8Array | ArrayBuffer` + +A buffer representing file data. It works best if the buffer contains the entire file, it may work with a smaller portion as well. + +### FileType.fromFile(filePath) + +Detect the file type of a file path. + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +#### filePath + +Type: `string` + +The file path to parse. + +### FileType.fromStream(stream) + +Detect the file type of a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +#### stream + +Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) + +A readable stream representing file data. + +### FileType.fromTokenizer(tokenizer) + +Detect the file type from an `ITokenizer` source. + +This method is used internally, but can also be used for a special "tokenizer" reader. + +A tokenizer propagates the internal read functions, allowing alternative transport mechanisms, to access files, to be implemented and used. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +An example is [`@tokenizer/http`](https://github.com/Borewit/tokenizer-http), which requests data using [HTTP-range-requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests). A difference with a conventional stream and the [*tokenizer*](https://github.com/Borewit/strtok3#tokenizer), is that it can *ignore* (seek, fast-forward) in the stream. For example, you may only need and read the first 6 bytes, and the last 128 bytes, which may be an advantage in case reading the entire file would take longer. + +```js +const {makeTokenizer} = require('@tokenizer/http'); +const FileType = require('file-type'); + +const audioTrackUrl = 'https://test-audio.netlify.com/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3'; + +(async () => { + const httpTokenizer = await makeTokenizer(audioTrackUrl); + const fileType = await FileType.fromTokenizer(httpTokenizer); + + console.log(fileType); + //=> {ext: 'mp3', mime: 'audio/mpeg'} +})(); +``` + +Or use [`@tokenizer/s3`](https://github.com/Borewit/tokenizer-s3) to determine the file type of a file stored on [Amazon S3](https://aws.amazon.com/s3): + +```js +const FileType = require('file-type'); +const S3 = require('aws-sdk/clients/s3'); +const {makeTokenizer} = require('@tokenizer/s3'); + +(async () => { + // Initialize the S3 client + const s3 = new S3(); + + // Initialize the S3 tokenizer. + const s3Tokenizer = await makeTokenizer(s3, { + Bucket: 'affectlab', + Key: '1min_35sec.mp4' + }); + + // Figure out what kind of file it is. + const fileType = await FileType.fromTokenizer(s3Tokenizer); + console.log(fileType); +})(); +``` + +Note that only the minimum amount of data required to determine the file type is read (okay, just a bit extra to prevent too many fragmented reads). + +#### tokenizer + +Type: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer) + +A file source implementing the [tokenizer interface](https://github.com/Borewit/strtok3#tokenizer). + +### FileType.stream(readableStream) + +Detect the file type of a readable stream. + +Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `FileType.fromFile()`. + +*Note:* This method is only available using Node.js. + +#### readableStream + +Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) + +The input stream. + +### FileType.extensions + +Returns a set of supported file extensions. + +### FileType.mimeTypes + +Returns a set of supported MIME types. + +## Supported file types + +- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image +- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics +- [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics +- [`gif`](https://en.wikipedia.org/wiki/GIF) - Graphics Interchange Format +- [`webp`](https://en.wikipedia.org/wiki/WebP) - Web Picture format +- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) - Free Lossless Image Format +- [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility +- [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2) +- [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3) +- [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file +- [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file +- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file +- [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file +- [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file +- [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file +- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file +- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file +- [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) - Apple Icon image +- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range +- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document +- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document +- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file +- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tarball archive file +- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file +- [`gz`](https://en.wikipedia.org/wiki/Gzip) - Archive file +- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) - Archive file +- [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file +- [`7z`](https://en.wikipedia.org/wiki/7z) - 7-Zip archive +- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image +- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 Part 14 video file +- [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file +- [`mkv`](https://en.wikipedia.org/wiki/Matroska) - Matroska video file +- [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file +- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) - QuickTime video file +- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file +- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) - MPEG-1 file +- [`mp1`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I) - MPEG-1 Audio Layer I +- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) - MPEG-1 Audio Layer II +- [`mp3`](https://en.wikipedia.org/wiki/MP3) - Audio file +- [`ogg`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`ogv`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`ogm`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`oga`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`ogx`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file +- [`flac`](https://en.wikipedia.org/wiki/FLAC) - Free Lossless Audio Codec +- [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file +- [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data +- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec +- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format +- [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file +- [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket +- [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file +- [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file +- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format +- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format +- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format +- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) - Embedded OpenType font +- [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font +- [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font +- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file +- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) - Flash video +- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript +- [`xz`](https://en.wikipedia.org/wiki/Xz) - Compressed file +- [`sqlite`](https://www.sqlite.org/fileformat2.html) - SQLite file +- [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM +- [`crx`](https://developer.chrome.com/extensions/crx) - Google Chrome extension +- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file +- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - Cabinet file +- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package +- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file +- [`rpm`](https://fileinfo.com/extension/rpm) - Red Hat Package Manager file +- [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File +- [`lz`](https://en.wikipedia.org/wiki/Lzip) - Arhive file +- [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) - Compount File Binary Format +- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format +- [`mts`](https://en.wikipedia.org/wiki/.m2ts) - Blu-ray Disc Audio-Video MPEG-2 Transport Stream +- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format +- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project +- [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file +- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word +- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Powerpoint +- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel +- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 +- [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 +- [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 +- [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000 +- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file +- [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing +- [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets +- [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations +- [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language +- [`heic`](https://nokiatech.github.io/heif/technical.html) - High Efficiency Image File Format +- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Icon file +- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures +- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio +- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack +- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format +- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File +- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8) +- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar +- [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard +- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format +- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format +- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) +- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut +- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file +- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File +- [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File +- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2#3GP) - Multimedia container format defined by the Third Generation Partnership Project (3GPP) for 3G UMTS multimedia services +- [`3g2`](https://en.wikipedia.org/wiki/3GP_and_3G2#3G2) - Multimedia container format defined by the 3GPP2 for 3G CDMA2000 multimedia services +- [`m4v`](https://en.wikipedia.org/wiki/M4V) - MPEG-4 Visual bitstreams +- [`m4p`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 files with audio streams encrypted by FairPlay Digital Rights Management as were sold through the iTunes Store +- [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files +- [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks +- [`f4v`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format used by Adobe Flash Player +- [`f4p`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format protected by Adobe Access DRM used by Adobe Flash Player +- [`f4a`](https://en.wikipedia.org/wiki/Flash_Video) - Audio-only ISO base media file format used by Adobe Flash Player +- [`f4b`](https://en.wikipedia.org/wiki/Flash_Video) - Audiobook and podcast ISO base media file format used by Adobe Flash Player +- [`mie`](https://en.wikipedia.org/wiki/Sidecar_file) - Dedicated meta information format which supports storage of binary as well as textual meta information +- [`shp`](https://en.wikipedia.org/wiki/Shapefile) - Geospatial vector data format +- [`arrow`](https://arrow.apache.org) - Columnar format for tables of data +- [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding +- [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker +- [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3 +- [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2 +- [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork +- [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp +- [`avif`](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) - AV1 Image File Format +- [`eps`](https://en.wikipedia.org/wiki/Encapsulated_PostScript) - Encapsulated PostScript +- [`lzh`](https://en.wikipedia.org/wiki/LHA_(file_format)) - LZH archive +- [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy +- [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications +- [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only) +- [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help +- [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format +- [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format + +*Pull requests are welcome for additional commonly used file types.* + +The following file types will not be accepted: +- [MS-CFB: Microsoft Compound File Binary File Format based formats](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/53989ce4-7b05-4f8d-829b-d08d6148375b), too old and difficult to parse: + - `.doc` - Microsoft Word 97-2003 Document + - `.xls` - Microsoft Excel 97-2003 Document + - `.ppt` - Microsoft PowerPoint97-2003 Document + - `.msi` - Microsoft Windows Installer +- `.csv` - [Reason.](https://github.com/sindresorhus/file-type/issues/264#issuecomment-568439196) +- `.svg` - Detecting it requires a full-blown parser. Check out [`is-svg`](https://github.com/sindresorhus/is-svg) for something that mostly works. + +## file-type for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of file-type and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-file-type?utm_source=npm-file-type&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Mikael Finstad](https://github.com/mifi) +- [Ben Brook](https://github.com/bencmbrook) +- [Borewit](https://github.com/Borewit) diff --git a/node_modules/file-type/supported.js b/node_modules/file-type/supported.js new file mode 100644 index 00000000..1c39f909 --- /dev/null +++ b/node_modules/file-type/supported.js @@ -0,0 +1,279 @@ +'use strict'; + +module.exports = { + extensions: [ + 'jpg', + 'png', + 'apng', + 'gif', + 'webp', + 'flif', + 'xcf', + 'cr2', + 'cr3', + 'orf', + 'arw', + 'dng', + 'nef', + 'rw2', + 'raf', + 'tif', + 'bmp', + 'icns', + 'jxr', + 'psd', + 'indd', + 'zip', + 'tar', + 'rar', + 'gz', + 'bz2', + '7z', + 'dmg', + 'mp4', + 'mid', + 'mkv', + 'webm', + 'mov', + 'avi', + 'mpg', + 'mp2', + 'mp3', + 'm4a', + 'oga', + 'ogg', + 'ogv', + 'opus', + 'flac', + 'wav', + 'spx', + 'amr', + 'pdf', + 'epub', + 'exe', + 'swf', + 'rtf', + 'wasm', + 'woff', + 'woff2', + 'eot', + 'ttf', + 'otf', + 'ico', + 'flv', + 'ps', + 'xz', + 'sqlite', + 'nes', + 'crx', + 'xpi', + 'cab', + 'deb', + 'ar', + 'rpm', + 'Z', + 'lz', + 'cfb', + 'mxf', + 'mts', + 'blend', + 'bpg', + 'docx', + 'pptx', + 'xlsx', + '3gp', + '3g2', + 'jp2', + 'jpm', + 'jpx', + 'mj2', + 'aif', + 'qcp', + 'odt', + 'ods', + 'odp', + 'xml', + 'mobi', + 'heic', + 'cur', + 'ktx', + 'ape', + 'wv', + 'dcm', + 'ics', + 'glb', + 'pcap', + 'dsf', + 'lnk', + 'alias', + 'voc', + 'ac3', + 'm4v', + 'm4p', + 'm4b', + 'f4v', + 'f4p', + 'f4b', + 'f4a', + 'mie', + 'asf', + 'ogm', + 'ogx', + 'mpc', + 'arrow', + 'shp', + 'aac', + 'mp1', + 'it', + 's3m', + 'xm', + 'ai', + 'skp', + 'avif', + 'eps', + 'lzh', + 'pgp', + 'asar', + 'stl', + 'chm', + '3mf', + 'zst', + 'jxl', + 'vcf' + ], + mimeTypes: [ + 'image/jpeg', + 'image/png', + 'image/gif', + 'image/webp', + 'image/flif', + 'image/x-xcf', + 'image/x-canon-cr2', + 'image/x-canon-cr3', + 'image/tiff', + 'image/bmp', + 'image/vnd.ms-photo', + 'image/vnd.adobe.photoshop', + 'application/x-indesign', + 'application/epub+zip', + 'application/x-xpinstall', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/zip', + 'application/x-tar', + 'application/x-rar-compressed', + 'application/gzip', + 'application/x-bzip2', + 'application/x-7z-compressed', + 'application/x-apple-diskimage', + 'application/x-apache-arrow', + 'video/mp4', + 'audio/midi', + 'video/x-matroska', + 'video/webm', + 'video/quicktime', + 'video/vnd.avi', + 'audio/vnd.wave', + 'audio/qcelp', + 'audio/x-ms-asf', + 'video/x-ms-asf', + 'application/vnd.ms-asf', + 'video/mpeg', + 'video/3gpp', + 'audio/mpeg', + 'audio/mp4', // RFC 4337 + 'audio/opus', + 'video/ogg', + 'audio/ogg', + 'application/ogg', + 'audio/x-flac', + 'audio/ape', + 'audio/wavpack', + 'audio/amr', + 'application/pdf', + 'application/x-msdownload', + 'application/x-shockwave-flash', + 'application/rtf', + 'application/wasm', + 'font/woff', + 'font/woff2', + 'application/vnd.ms-fontobject', + 'font/ttf', + 'font/otf', + 'image/x-icon', + 'video/x-flv', + 'application/postscript', + 'application/eps', + 'application/x-xz', + 'application/x-sqlite3', + 'application/x-nintendo-nes-rom', + 'application/x-google-chrome-extension', + 'application/vnd.ms-cab-compressed', + 'application/x-deb', + 'application/x-unix-archive', + 'application/x-rpm', + 'application/x-compress', + 'application/x-lzip', + 'application/x-cfb', + 'application/x-mie', + 'application/mxf', + 'video/mp2t', + 'application/x-blender', + 'image/bpg', + 'image/jp2', + 'image/jpx', + 'image/jpm', + 'image/mj2', + 'audio/aiff', + 'application/xml', + 'application/x-mobipocket-ebook', + 'image/heif', + 'image/heif-sequence', + 'image/heic', + 'image/heic-sequence', + 'image/icns', + 'image/ktx', + 'application/dicom', + 'audio/x-musepack', + 'text/calendar', + 'text/vcard', + 'model/gltf-binary', + 'application/vnd.tcpdump.pcap', + 'audio/x-dsf', // Non-standard + 'application/x.ms.shortcut', // Invented by us + 'application/x.apple.alias', // Invented by us + 'audio/x-voc', + 'audio/vnd.dolby.dd-raw', + 'audio/x-m4a', + 'image/apng', + 'image/x-olympus-orf', + 'image/x-sony-arw', + 'image/x-adobe-dng', + 'image/x-nikon-nef', + 'image/x-panasonic-rw2', + 'image/x-fujifilm-raf', + 'video/x-m4v', + 'video/3gpp2', + 'application/x-esri-shape', + 'audio/aac', + 'audio/x-it', + 'audio/x-s3m', + 'audio/x-xm', + 'video/MP1S', + 'video/MP2P', + 'application/vnd.sketchup.skp', + 'image/avif', + 'application/x-lzh-compressed', + 'application/pgp-encrypted', + 'application/x-asar', + 'model/stl', + 'application/vnd.ms-htmlhelp', + 'model/3mf', + 'image/jxl', + 'application/zstd' + ] +}; diff --git a/node_modules/file-type/util.js b/node_modules/file-type/util.js new file mode 100644 index 00000000..d9cd54dd --- /dev/null +++ b/node_modules/file-type/util.js @@ -0,0 +1,40 @@ +'use strict'; + +exports.stringToBytes = string => [...string].map(character => character.charCodeAt(0)); + +/** +Checks whether the TAR checksum is valid. + +@param {Buffer} buffer - The TAR header `[offset ... offset + 512]`. +@param {number} offset - TAR header offset. +@returns {boolean} `true` if the TAR checksum is valid, otherwise `false`. +*/ +exports.tarHeaderChecksumMatches = (buffer, offset = 0) => { + const readSum = parseInt(buffer.toString('utf8', 148, 154).replace(/\0.*$/, '').trim(), 8); // Read sum in header + if (isNaN(readSum)) { + return false; + } + + let sum = 8 * 0x20; // Initialize signed bit sum + + for (let i = offset; i < offset + 148; i++) { + sum += buffer[i]; + } + + for (let i = offset + 156; i < offset + 512; i++) { + sum += buffer[i]; + } + + return readSum === sum; +}; + +/** +ID3 UINT32 sync-safe tokenizer token. +28 bits (representing up to 256MB) integer, the msb is 0 to avoid "false syncsignals". +*/ +exports.uint32SyncSafeToken = { + get: (buffer, offset) => { + return (buffer[offset + 3] & 0x7F) | ((buffer[offset + 2]) << 7) | ((buffer[offset + 1]) << 14) | ((buffer[offset]) << 21); + }, + len: 4 +}; diff --git a/project starter code/node_modules/finalhandler/HISTORY.md b/node_modules/finalhandler/HISTORY.md similarity index 100% rename from project starter code/node_modules/finalhandler/HISTORY.md rename to node_modules/finalhandler/HISTORY.md diff --git a/project starter code/node_modules/finalhandler/LICENSE b/node_modules/finalhandler/LICENSE similarity index 100% rename from project starter code/node_modules/finalhandler/LICENSE rename to node_modules/finalhandler/LICENSE diff --git a/project starter code/node_modules/finalhandler/README.md b/node_modules/finalhandler/README.md similarity index 100% rename from project starter code/node_modules/finalhandler/README.md rename to node_modules/finalhandler/README.md diff --git a/project starter code/node_modules/finalhandler/SECURITY.md b/node_modules/finalhandler/SECURITY.md similarity index 100% rename from project starter code/node_modules/finalhandler/SECURITY.md rename to node_modules/finalhandler/SECURITY.md diff --git a/project starter code/node_modules/finalhandler/index.js b/node_modules/finalhandler/index.js similarity index 100% rename from project starter code/node_modules/finalhandler/index.js rename to node_modules/finalhandler/index.js diff --git a/project starter code/node_modules/finalhandler/package.json b/node_modules/finalhandler/package.json similarity index 100% rename from project starter code/node_modules/finalhandler/package.json rename to node_modules/finalhandler/package.json diff --git a/node_modules/follow-redirects/LICENSE b/node_modules/follow-redirects/LICENSE new file mode 100644 index 00000000..742cbada --- /dev/null +++ b/node_modules/follow-redirects/LICENSE @@ -0,0 +1,18 @@ +Copyright 2014–present Olivier Lalonde , James Talmage , Ruben Verborgh + +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. diff --git a/node_modules/follow-redirects/README.md b/node_modules/follow-redirects/README.md new file mode 100644 index 00000000..eb869a6f --- /dev/null +++ b/node_modules/follow-redirects/README.md @@ -0,0 +1,155 @@ +## Follow Redirects + +Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects. + +[![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) +[![Build Status](https://github.com/follow-redirects/follow-redirects/workflows/CI/badge.svg)](https://github.com/follow-redirects/follow-redirects/actions) +[![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master) +[![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) +[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor&message=%F0%9F%92%96&logo=GitHub)](https://github.com/sponsors/RubenVerborgh) + +`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback) + methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback) + modules, with the exception that they will seamlessly follow redirects. + +```javascript +const { http, https } = require('follow-redirects'); + +http.get('http://bit.ly/900913', response => { + response.on('data', chunk => { + console.log(chunk); + }); +}).on('error', err => { + console.error(err); +}); +``` + +You can inspect the final redirected URL through the `responseUrl` property on the `response`. +If no redirection happened, `responseUrl` is the original request URL. + +```javascript +const request = https.request({ + host: 'bitly.com', + path: '/UHfDGO', +}, response => { + console.log(response.responseUrl); + // 'http://duckduckgo.com/robots.txt' +}); +request.end(); +``` + +## Options +### Global options +Global options are set directly on the `follow-redirects` module: + +```javascript +const followRedirects = require('follow-redirects'); +followRedirects.maxRedirects = 10; +followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB +``` + +The following global options are supported: + +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. + +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. + +### Per-request options +Per-request options are set by passing an `options` object: + +```javascript +const url = require('url'); +const { http, https } = require('follow-redirects'); + +const options = url.parse('http://bit.ly/900913'); +options.maxRedirects = 10; +options.beforeRedirect = (options, response, request) => { + // Use this to adjust the request options upon redirecting, + // to inspect the latest response headers, + // or to cancel the request by throwing an error + + // response.headers = the redirect response headers + // response.statusCode = the redirect response code (eg. 301, 307, etc.) + + // request.url = the requested URL that resulted in a redirect + // request.headers = the headers in the request that resulted in a redirect + // request.method = the method of the request that resulted in a redirect + if (options.hostname === "example.com") { + options.auth = "user:password"; + } +}; +http.request(options); +``` + +In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback), +the following per-request options are supported: +- `followRedirects` (default: `true`) – whether redirects should be followed. + +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. + +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. + +- `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error. + +- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }` + +- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object. + + +### Advanced usage +By default, `follow-redirects` will use the Node.js default implementations +of [`http`](https://nodejs.org/api/http.html) +and [`https`](https://nodejs.org/api/https.html). +To enable features such as caching and/or intermediate request tracking, +you might instead want to wrap `follow-redirects` around custom protocol implementations: + +```javascript +const { http, https } = require('follow-redirects').wrap({ + http: require('your-custom-http'), + https: require('your-custom-https'), +}); +``` + +Such custom protocols only need an implementation of the `request` method. + +## Browser Usage + +Due to the way the browser works, +the `http` and `https` browser equivalents perform redirects by default. + +By requiring `follow-redirects` this way: +```javascript +const http = require('follow-redirects/http'); +const https = require('follow-redirects/https'); +``` +you can easily tell webpack and friends to replace +`follow-redirect` by the built-in versions: + +```json +{ + "follow-redirects/http" : "http", + "follow-redirects/https" : "https" +} +``` + +## Contributing + +Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues) + detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied + by tests. You can run the test suite locally with a simple `npm test` command. + +## Debug Logging + +`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging + set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test + suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well. + +## Authors + +- [Ruben Verborgh](https://ruben.verborgh.org/) +- [Olivier Lalonde](mailto:olalonde@gmail.com) +- [James Talmage](mailto:james@talmage.io) + +## License + +[MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE) diff --git a/node_modules/follow-redirects/debug.js b/node_modules/follow-redirects/debug.js new file mode 100644 index 00000000..decb77de --- /dev/null +++ b/node_modules/follow-redirects/debug.js @@ -0,0 +1,15 @@ +var debug; + +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = require("debug")("follow-redirects"); + } + catch (error) { /* */ } + if (typeof debug !== "function") { + debug = function () { /* */ }; + } + } + debug.apply(null, arguments); +}; diff --git a/node_modules/follow-redirects/http.js b/node_modules/follow-redirects/http.js new file mode 100644 index 00000000..695e3561 --- /dev/null +++ b/node_modules/follow-redirects/http.js @@ -0,0 +1 @@ +module.exports = require("./").http; diff --git a/node_modules/follow-redirects/https.js b/node_modules/follow-redirects/https.js new file mode 100644 index 00000000..d21c921d --- /dev/null +++ b/node_modules/follow-redirects/https.js @@ -0,0 +1 @@ +module.exports = require("./").https; diff --git a/node_modules/follow-redirects/index.js b/node_modules/follow-redirects/index.js new file mode 100644 index 00000000..c649cab4 --- /dev/null +++ b/node_modules/follow-redirects/index.js @@ -0,0 +1,672 @@ +var url = require("url"); +var URL = url.URL; +var http = require("http"); +var https = require("https"); +var Writable = require("stream").Writable; +var assert = require("assert"); +var debug = require("./debug"); + +// Whether to use the native URL object or the legacy url module +var useNativeURL = false; +try { + assert(new URL()); +} +catch (error) { + useNativeURL = error.code === "ERR_INVALID_URL"; +} + +// URL fields to preserve in copy operations +var preservedUrlFields = [ + "auth", + "host", + "hostname", + "href", + "path", + "pathname", + "port", + "protocol", + "query", + "search", + "hash", +]; + +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); + +// Error types with codes +var InvalidUrlError = createErrorType( + "ERR_INVALID_URL", + "Invalid URL", + TypeError +); +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "Redirected request failed" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded", + RedirectionError +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); + +// istanbul ignore next +var destroy = Writable.prototype.destroy || noop; + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + try { + self._processResponse(response); + } + catch (cause) { + self.emit("error", cause instanceof RedirectionError ? + cause : new RedirectionError({ cause: cause })); + } + }; + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +RedirectableRequest.prototype.abort = function () { + destroyRequest(this._currentRequest); + this._currentRequest.abort(); + this.emit("abort"); +}; + +RedirectableRequest.prototype.destroy = function (error) { + destroyRequest(this._currentRequest, error); + destroy.call(this, error); + return this; +}; + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } + + // Validate input and shift parameters if necessary + if (!isString(data) && !isBuffer(data)) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (isFunction(data)) { + callback = data; + data = encoding = null; + } + else if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + + // Destroys the socket on timeout + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + + // Stops a timeout from triggering + function clearTimer() { + // Clear the timeout + if (self._timeout) { + clearTimeout(self._timeout); + self._timeout = null; + } + + // Clean up all attached listeners + self.removeListener("abort", clearTimer); + self.removeListener("error", clearTimer); + self.removeListener("response", clearTimer); + self.removeListener("close", clearTimer); + if (callback) { + self.removeListener("timeout", callback); + } + if (!self.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } + + // Attach callback if passed + if (callback) { + this.on("timeout", callback); + } + + // Start the timer if or when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } + + // Clean up on events + this.on("socket", destroyOnTimeout); + this.on("abort", clearTimer); + this.on("error", clearTimer); + this.on("response", clearTimer); + this.on("close", clearTimer); + + return this; +}; + +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } +}; + + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + throw new TypeError("Unsupported protocol " + protocol); + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.slice(0, -1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request and set up its event handlers + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + request._redirectable = this; + for (var event of events) { + request.on(event, eventHandlers[event]); + } + + // RFC7230§5.3.1: When making a request directly to an origin server, […] + // a client MUST send only the absolute path […] as the request-target. + this._currentUrl = /^\//.test(this._options.path) ? + url.format(this._options) : + // When making a request to a proxy, […] + // a client MUST send the target URI in absolute-form […]. + this._options.path; + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + + // If the response is not a redirect; return it as-is + var location = response.headers.location; + if (!location || this._options.followRedirects === false || + statusCode < 300 || statusCode >= 400) { + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + return; + } + + // The response is a redirect, so abort the current request + destroyRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + throw new TooManyRedirectsError(); + } + + // Store the request headers if applicable + var requestHeaders; + var beforeRedirect = this._options.beforeRedirect; + if (beforeRedirect) { + requestHeaders = Object.assign({ + // The Host header was set by nativeProtocol.request + Host: response.req.getHeader("host"), + }, this._options.headers); + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + var method = this._options.method; + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + + // Drop the Host header, as the redirect might lead to a different host + var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); + + // If the redirect is relative, carry over the host of the last request + var currentUrlParts = parseUrl(this._currentUrl); + var currentHost = currentHostHeader || currentUrlParts.host; + var currentUrl = /^\w+:/.test(location) ? this._currentUrl : + url.format(Object.assign(currentUrlParts, { host: currentHost })); + + // Create the redirected request + var redirectUrl = resolveUrl(location, currentUrl); + debug("redirecting to", redirectUrl.href); + this._isRedirect = true; + spreadUrlObject(redirectUrl, this._options); + + // Drop confidential headers when redirecting to a less secure protocol + // or to a different domain that is not a superdomain + if (redirectUrl.protocol !== currentUrlParts.protocol && + redirectUrl.protocol !== "https:" || + redirectUrl.host !== currentHost && + !isSubdomain(redirectUrl.host, currentHost)) { + removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers); + } + + // Evaluate the beforeRedirect callback + if (isFunction(beforeRedirect)) { + var responseDetails = { + headers: response.headers, + statusCode: statusCode, + }; + var requestDetails = { + url: currentUrl, + method: method, + headers: requestHeaders, + }; + beforeRedirect(this._options, responseDetails, requestDetails); + this._sanitizeOptions(this._options); + } + + // Perform the redirected request + this._performRequest(); +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters, ensuring that input is an object + if (isURL(input)) { + input = spreadUrlObject(input); + } + else if (isString(input)) { + input = spreadUrlObject(parseUrl(input)); + } + else { + callback = options; + options = validateUrl(input); + input = { protocol: protocol }; + } + if (isFunction(options)) { + callback = options; + options = null; + } + + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; + if (!isString(options.host) && !isString(options.hostname)) { + options.hostname = "::1"; + } + + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } + + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; +} + +function noop() { /* empty */ } + +function parseUrl(input) { + var parsed; + /* istanbul ignore else */ + if (useNativeURL) { + parsed = new URL(input); + } + else { + // Ensure the URL is valid and absolute + parsed = validateUrl(url.parse(input)); + if (!isString(parsed.protocol)) { + throw new InvalidUrlError({ input }); + } + } + return parsed; +} + +function resolveUrl(relative, base) { + /* istanbul ignore next */ + return useNativeURL ? new URL(relative, base) : parseUrl(url.resolve(base, relative)); +} + +function validateUrl(input) { + if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) { + throw new InvalidUrlError({ input: input.href || input }); + } + if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) { + throw new InvalidUrlError({ input: input.href || input }); + } + return input; +} + +function spreadUrlObject(urlObject, target) { + var spread = target || {}; + for (var key of preservedUrlFields) { + spread[key] = urlObject[key]; + } + + // Fix IPv6 hostname + if (spread.hostname.startsWith("[")) { + spread.hostname = spread.hostname.slice(1, -1); + } + // Ensure port is a number + if (spread.port !== "") { + spread.port = Number(spread.port); + } + // Concatenate path + spread.path = spread.search ? spread.pathname + spread.search : spread.pathname; + + return spread; +} + +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return (lastValue === null || typeof lastValue === "undefined") ? + undefined : String(lastValue).trim(); +} + +function createErrorType(code, message, baseClass) { + // Create constructor + function CustomError(properties) { + Error.captureStackTrace(this, this.constructor); + Object.assign(this, properties || {}); + this.code = code; + this.message = this.cause ? message + ": " + this.cause.message : message; + } + + // Attach constructor and set default properties + CustomError.prototype = new (baseClass || Error)(); + Object.defineProperties(CustomError.prototype, { + constructor: { + value: CustomError, + enumerable: false, + }, + name: { + value: "Error [" + code + "]", + enumerable: false, + }, + }); + return CustomError; +} + +function destroyRequest(request, error) { + for (var event of events) { + request.removeListener(event, eventHandlers[event]); + } + request.on("error", noop); + request.destroy(error); +} + +function isSubdomain(subdomain, domain) { + assert(isString(subdomain) && isString(domain)); + var dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); +} + +function isString(value) { + return typeof value === "string" || value instanceof String; +} + +function isFunction(value) { + return typeof value === "function"; +} + +function isBuffer(value) { + return typeof value === "object" && ("length" in value); +} + +function isURL(value) { + return URL && value instanceof URL; +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; diff --git a/node_modules/follow-redirects/package.json b/node_modules/follow-redirects/package.json new file mode 100644 index 00000000..149943bb --- /dev/null +++ b/node_modules/follow-redirects/package.json @@ -0,0 +1,58 @@ +{ + "name": "follow-redirects", + "version": "1.15.6", + "description": "HTTP and HTTPS modules that follow redirects.", + "license": "MIT", + "main": "index.js", + "files": [ + "*.js" + ], + "engines": { + "node": ">=4.0" + }, + "scripts": { + "lint": "eslint *.js test", + "test": "nyc mocha" + }, + "repository": { + "type": "git", + "url": "git@github.com:follow-redirects/follow-redirects.git" + }, + "homepage": "https://github.com/follow-redirects/follow-redirects", + "bugs": { + "url": "https://github.com/follow-redirects/follow-redirects/issues" + }, + "keywords": [ + "http", + "https", + "url", + "redirect", + "client", + "location", + "utility" + ], + "author": "Ruben Verborgh (https://ruben.verborgh.org/)", + "contributors": [ + "Olivier Lalonde (http://www.syskall.com)", + "James Talmage " + ], + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "peerDependenciesMeta": { + "debug": { + "optional": true + } + }, + "devDependencies": { + "concat-stream": "^2.0.0", + "eslint": "^5.16.0", + "express": "^4.16.4", + "lolex": "^3.1.0", + "mocha": "^6.0.2", + "nyc": "^14.1.1" + } +} diff --git a/node_modules/form-data/License b/node_modules/form-data/License new file mode 100644 index 00000000..c7ff12a2 --- /dev/null +++ b/node_modules/form-data/License @@ -0,0 +1,19 @@ +Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and 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. diff --git a/node_modules/form-data/README.md.bak b/node_modules/form-data/README.md.bak new file mode 100644 index 00000000..298a1a24 --- /dev/null +++ b/node_modules/form-data/README.md.bak @@ -0,0 +1,358 @@ +# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) + +A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. + +The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. + +[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface + +[![Linux Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![Windows Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data) + +[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v4.0.0.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) +[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) + +## Install + +``` +npm install --save form-data +``` + +## Usage + +In this example we are constructing a form with 3 fields that contain a string, +a buffer and a file stream. + +``` javascript +var FormData = require('form-data'); +var fs = require('fs'); + +var form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); +``` + +Also you can use http-response stream: + +``` javascript +var FormData = require('form-data'); +var http = require('http'); + +var form = new FormData(); + +http.request('http://nodejs.org/images/logo.png', function(response) { + form.append('my_field', 'my value'); + form.append('my_buffer', new Buffer(10)); + form.append('my_logo', response); +}); +``` + +Or @mikeal's [request](https://github.com/request/request) stream: + +``` javascript +var FormData = require('form-data'); +var request = require('request'); + +var form = new FormData(); + +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_logo', request('http://nodejs.org/images/logo.png')); +``` + +In order to submit this form to a web application, call ```submit(url, [callback])``` method: + +``` javascript +form.submit('http://example.org/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +}); + +``` + +For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. + +### Custom options + +You can provide custom options, such as `maxDataSize`: + +``` javascript +var FormData = require('form-data'); + +var form = new FormData({ maxDataSize: 20971520 }); +form.append('my_field', 'my value'); +form.append('my_buffer', /* something big */); +``` + +List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) + +### Alternative submission methods + +You can use node's http client interface: + +``` javascript +var http = require('http'); + +var request = http.request({ + method: 'post', + host: 'example.org', + path: '/upload', + headers: form.getHeaders() +}); + +form.pipe(request); + +request.on('response', function(res) { + console.log(res.statusCode); +}); +``` + +Or if you would prefer the `'Content-Length'` header to be set for you: + +``` javascript +form.submit('example.org/upload', function(err, res) { + console.log(res.statusCode); +}); +``` + +To use custom headers and pre-known length in parts: + +``` javascript +var CRLF = '\r\n'; +var form = new FormData(); + +var options = { + header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, + knownLength: 1 +}; + +form.append('my_buffer', buffer, options); + +form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); +}); +``` + +Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: + +``` javascript +someModule.stream(function(err, stdout, stderr) { + if (err) throw err; + + var form = new FormData(); + + form.append('file', stdout, { + filename: 'unicycle.jpg', // ... or: + filepath: 'photos/toys/unicycle.jpg', + contentType: 'image/jpeg', + knownLength: 19806 + }); + + form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); + }); +}); +``` + +The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). + +For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: + +``` javascript +form.submit({ + host: 'example.com', + path: '/probably.php?extra=params', + auth: 'username:password' +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: + +``` javascript +form.submit({ + host: 'example.com', + path: '/surelynot.php', + headers: {'x-test-header': 'test-header-value'} +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +### Methods + +- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). +- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-) +- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary) +- [_Void_ setBoundary()](https://github.com/form-data/form-data#void-setboundary) +- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer) +- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync) +- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-) +- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength) +- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-) +- [_String_ toString()](https://github.com/form-data/form-data#string-tostring) + +#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] ) +Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user. +```javascript +var form = new FormData(); +form.append( 'my_string', 'my value' ); +form.append( 'my_integer', 1 ); +form.append( 'my_boolean', true ); +form.append( 'my_buffer', new Buffer(10) ); +form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) ) +``` + +You may provide a string for options, or an object. +```javascript +// Set filename by providing a string for options +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' ); + +// provide an object. +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} ); +``` + +#### _Headers_ getHeaders( [**Headers** _userHeaders_] ) +This method adds the correct `content-type` header to the provided array of `userHeaders`. + +#### _String_ getBoundary() +Return the boundary of the formData. By default, the boundary consists of 26 `-` followed by 24 numbers +for example: +```javascript +--------------------------515890814546601021194782 +``` + +#### _Void_ setBoundary(String _boundary_) +Set the boundary string, overriding the default behavior described above. + +_Note: The boundary must be unique and may not appear in the data._ + +#### _Buffer_ getBuffer() +Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data. +```javascript +var form = new FormData(); +form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) ); +form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') ); + +axios.post( 'https://example.com/path/to/api', + form.getBuffer(), + form.getHeaders() + ) +``` +**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error. + +#### _Integer_ getLengthSync() +Same as `getLength` but synchronous. + +_Note: getLengthSync __doesn't__ calculate streams length._ + +#### _Integer_ getLength( **function** _callback_ ) +Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated +```javascript +this.getLength(function(err, length) { + if (err) { + this._error(err); + return; + } + + // add content length + request.setHeader('Content-Length', length); + + ... +}.bind(this)); +``` + +#### _Boolean_ hasKnownLength() +Checks if the length of added values is known. + +#### _Request_ submit( _params_, **function** _callback_ ) +Submit the form to a web application. +```javascript +var form = new FormData(); +form.append( 'my_string', 'Hello World' ); + +form.submit( 'http://example.com/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +} ); +``` + +#### _String_ toString() +Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead. + +### Integration with other libraries + +#### Request + +Form submission using [request](https://github.com/request/request): + +```javascript +var formData = { + my_field: 'my_value', + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), +}; + +request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). + +#### node-fetch + +You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): + +```javascript +var form = new FormData(); + +form.append('a', 1); + +fetch('http://example.com', { method: 'POST', body: form }) + .then(function(res) { + return res.json(); + }).then(function(json) { + console.log(json); + }); +``` + +#### axios + +In Node.js you can post a file using [axios](https://github.com/axios/axios): +```javascript +const form = new FormData(); +const stream = fs.createReadStream(PATH_TO_FILE); + +form.append('image', stream); + +// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders` +const formHeaders = form.getHeaders(); + +axios.post('http://example.com', form, { + headers: { + ...formHeaders, + }, +}) +.then(response => response) +.catch(error => error) +``` + +## Notes + +- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. +- ```getLength(cb)``` will send an error as first parameter of callback if stream length cannot be calculated (e.g. send in custom streams w/o using ```knownLength```). +- ```submit``` will not add `content-length` if form length is unknown or not calculable. +- Starting version `2.x` FormData has dropped support for `node@0.10.x`. +- Starting version `3.x` FormData has dropped support for `node@4.x`. + +## License + +Form-Data is released under the [MIT](License) license. diff --git a/node_modules/form-data/Readme.md b/node_modules/form-data/Readme.md new file mode 100644 index 00000000..298a1a24 --- /dev/null +++ b/node_modules/form-data/Readme.md @@ -0,0 +1,358 @@ +# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) + +A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. + +The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. + +[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface + +[![Linux Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![Windows Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data) + +[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v4.0.0.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) +[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) + +## Install + +``` +npm install --save form-data +``` + +## Usage + +In this example we are constructing a form with 3 fields that contain a string, +a buffer and a file stream. + +``` javascript +var FormData = require('form-data'); +var fs = require('fs'); + +var form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); +``` + +Also you can use http-response stream: + +``` javascript +var FormData = require('form-data'); +var http = require('http'); + +var form = new FormData(); + +http.request('http://nodejs.org/images/logo.png', function(response) { + form.append('my_field', 'my value'); + form.append('my_buffer', new Buffer(10)); + form.append('my_logo', response); +}); +``` + +Or @mikeal's [request](https://github.com/request/request) stream: + +``` javascript +var FormData = require('form-data'); +var request = require('request'); + +var form = new FormData(); + +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_logo', request('http://nodejs.org/images/logo.png')); +``` + +In order to submit this form to a web application, call ```submit(url, [callback])``` method: + +``` javascript +form.submit('http://example.org/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +}); + +``` + +For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. + +### Custom options + +You can provide custom options, such as `maxDataSize`: + +``` javascript +var FormData = require('form-data'); + +var form = new FormData({ maxDataSize: 20971520 }); +form.append('my_field', 'my value'); +form.append('my_buffer', /* something big */); +``` + +List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) + +### Alternative submission methods + +You can use node's http client interface: + +``` javascript +var http = require('http'); + +var request = http.request({ + method: 'post', + host: 'example.org', + path: '/upload', + headers: form.getHeaders() +}); + +form.pipe(request); + +request.on('response', function(res) { + console.log(res.statusCode); +}); +``` + +Or if you would prefer the `'Content-Length'` header to be set for you: + +``` javascript +form.submit('example.org/upload', function(err, res) { + console.log(res.statusCode); +}); +``` + +To use custom headers and pre-known length in parts: + +``` javascript +var CRLF = '\r\n'; +var form = new FormData(); + +var options = { + header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, + knownLength: 1 +}; + +form.append('my_buffer', buffer, options); + +form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); +}); +``` + +Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: + +``` javascript +someModule.stream(function(err, stdout, stderr) { + if (err) throw err; + + var form = new FormData(); + + form.append('file', stdout, { + filename: 'unicycle.jpg', // ... or: + filepath: 'photos/toys/unicycle.jpg', + contentType: 'image/jpeg', + knownLength: 19806 + }); + + form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); + }); +}); +``` + +The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). + +For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: + +``` javascript +form.submit({ + host: 'example.com', + path: '/probably.php?extra=params', + auth: 'username:password' +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: + +``` javascript +form.submit({ + host: 'example.com', + path: '/surelynot.php', + headers: {'x-test-header': 'test-header-value'} +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +### Methods + +- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). +- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-) +- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary) +- [_Void_ setBoundary()](https://github.com/form-data/form-data#void-setboundary) +- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer) +- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync) +- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-) +- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength) +- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-) +- [_String_ toString()](https://github.com/form-data/form-data#string-tostring) + +#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] ) +Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user. +```javascript +var form = new FormData(); +form.append( 'my_string', 'my value' ); +form.append( 'my_integer', 1 ); +form.append( 'my_boolean', true ); +form.append( 'my_buffer', new Buffer(10) ); +form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) ) +``` + +You may provide a string for options, or an object. +```javascript +// Set filename by providing a string for options +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' ); + +// provide an object. +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} ); +``` + +#### _Headers_ getHeaders( [**Headers** _userHeaders_] ) +This method adds the correct `content-type` header to the provided array of `userHeaders`. + +#### _String_ getBoundary() +Return the boundary of the formData. By default, the boundary consists of 26 `-` followed by 24 numbers +for example: +```javascript +--------------------------515890814546601021194782 +``` + +#### _Void_ setBoundary(String _boundary_) +Set the boundary string, overriding the default behavior described above. + +_Note: The boundary must be unique and may not appear in the data._ + +#### _Buffer_ getBuffer() +Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data. +```javascript +var form = new FormData(); +form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) ); +form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') ); + +axios.post( 'https://example.com/path/to/api', + form.getBuffer(), + form.getHeaders() + ) +``` +**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error. + +#### _Integer_ getLengthSync() +Same as `getLength` but synchronous. + +_Note: getLengthSync __doesn't__ calculate streams length._ + +#### _Integer_ getLength( **function** _callback_ ) +Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated +```javascript +this.getLength(function(err, length) { + if (err) { + this._error(err); + return; + } + + // add content length + request.setHeader('Content-Length', length); + + ... +}.bind(this)); +``` + +#### _Boolean_ hasKnownLength() +Checks if the length of added values is known. + +#### _Request_ submit( _params_, **function** _callback_ ) +Submit the form to a web application. +```javascript +var form = new FormData(); +form.append( 'my_string', 'Hello World' ); + +form.submit( 'http://example.com/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +} ); +``` + +#### _String_ toString() +Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead. + +### Integration with other libraries + +#### Request + +Form submission using [request](https://github.com/request/request): + +```javascript +var formData = { + my_field: 'my_value', + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), +}; + +request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). + +#### node-fetch + +You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): + +```javascript +var form = new FormData(); + +form.append('a', 1); + +fetch('http://example.com', { method: 'POST', body: form }) + .then(function(res) { + return res.json(); + }).then(function(json) { + console.log(json); + }); +``` + +#### axios + +In Node.js you can post a file using [axios](https://github.com/axios/axios): +```javascript +const form = new FormData(); +const stream = fs.createReadStream(PATH_TO_FILE); + +form.append('image', stream); + +// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders` +const formHeaders = form.getHeaders(); + +axios.post('http://example.com', form, { + headers: { + ...formHeaders, + }, +}) +.then(response => response) +.catch(error => error) +``` + +## Notes + +- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. +- ```getLength(cb)``` will send an error as first parameter of callback if stream length cannot be calculated (e.g. send in custom streams w/o using ```knownLength```). +- ```submit``` will not add `content-length` if form length is unknown or not calculable. +- Starting version `2.x` FormData has dropped support for `node@0.10.x`. +- Starting version `3.x` FormData has dropped support for `node@4.x`. + +## License + +Form-Data is released under the [MIT](License) license. diff --git a/node_modules/form-data/index.d.ts b/node_modules/form-data/index.d.ts new file mode 100644 index 00000000..295e9e9b --- /dev/null +++ b/node_modules/form-data/index.d.ts @@ -0,0 +1,62 @@ +// Definitions by: Carlos Ballesteros Velasco +// Leon Yu +// BendingBender +// Maple Miao + +/// +import * as stream from 'stream'; +import * as http from 'http'; + +export = FormData; + +// Extracted because @types/node doesn't export interfaces. +interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + read?(this: stream.Readable, size: number): void; + destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void; + autoDestroy?: boolean; +} + +interface Options extends ReadableOptions { + writable?: boolean; + readable?: boolean; + dataSize?: number; + maxDataSize?: number; + pauseStreams?: boolean; +} + +declare class FormData extends stream.Readable { + constructor(options?: Options); + append(key: string, value: any, options?: FormData.AppendOptions | string): void; + getHeaders(userHeaders?: FormData.Headers): FormData.Headers; + submit( + params: string | FormData.SubmitOptions, + callback?: (error: Error | null, response: http.IncomingMessage) => void + ): http.ClientRequest; + getBuffer(): Buffer; + setBoundary(boundary: string): void; + getBoundary(): string; + getLength(callback: (err: Error | null, length: number) => void): void; + getLengthSync(): number; + hasKnownLength(): boolean; +} + +declare namespace FormData { + interface Headers { + [key: string]: any; + } + + interface AppendOptions { + header?: string | Headers; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + + interface SubmitOptions extends http.RequestOptions { + protocol?: 'https:' | 'http:'; + } +} diff --git a/node_modules/form-data/lib/browser.js b/node_modules/form-data/lib/browser.js new file mode 100644 index 00000000..09e7c70e --- /dev/null +++ b/node_modules/form-data/lib/browser.js @@ -0,0 +1,2 @@ +/* eslint-env browser */ +module.exports = typeof self == 'object' ? self.FormData : window.FormData; diff --git a/node_modules/form-data/lib/form_data.js b/node_modules/form-data/lib/form_data.js new file mode 100644 index 00000000..18dc819c --- /dev/null +++ b/node_modules/form-data/lib/form_data.js @@ -0,0 +1,501 @@ +var CombinedStream = require('combined-stream'); +var util = require('util'); +var path = require('path'); +var http = require('http'); +var https = require('https'); +var parseUrl = require('url').parse; +var fs = require('fs'); +var Stream = require('stream').Stream; +var mime = require('mime-types'); +var asynckit = require('asynckit'); +var populate = require('./populate.js'); + +// Public API +module.exports = FormData; + +// make it a Stream +util.inherits(FormData, CombinedStream); + +/** + * Create readable "multipart/form-data" streams. + * Can be used to submit forms + * and file uploads to other web applications. + * + * @constructor + * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream + */ +function FormData(options) { + if (!(this instanceof FormData)) { + return new FormData(options); + } + + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + + CombinedStream.call(this); + + options = options || {}; + for (var option in options) { + this[option] = options[option]; + } +} + +FormData.LINE_BREAK = '\r\n'; +FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; + +FormData.prototype.append = function(field, value, options) { + + options = options || {}; + + // allow filename as single option + if (typeof options == 'string') { + options = {filename: options}; + } + + var append = CombinedStream.prototype.append.bind(this); + + // all that streamy business can't handle numbers + if (typeof value == 'number') { + value = '' + value; + } + + // https://github.com/felixge/node-form-data/issues/38 + if (util.isArray(value)) { + // Please convert your array into string + // the way web server expects it + this._error(new Error('Arrays are not supported.')); + return; + } + + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + + append(header); + append(value); + append(footer); + + // pass along options.knownLength + this._trackLength(header, value, options); +}; + +FormData.prototype._trackLength = function(header, value, options) { + var valueLength = 0; + + // used w/ getLengthSync(), when length is known. + // e.g. for streaming directly from a remote server, + // w/ a known file a size, and not wanting to wait for + // incoming file to finish to get its size. + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === 'string') { + valueLength = Buffer.byteLength(value); + } + + this._valueLength += valueLength; + + // @check why add CRLF? does this account for custom/multiple CRLFs? + this._overheadLength += + Buffer.byteLength(header) + + FormData.LINE_BREAK.length; + + // empty or either doesn't have path or not an http response or not a stream + if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) { + return; + } + + // no need to bother with the length + if (!options.knownLength) { + this._valuesToMeasure.push(value); + } +}; + +FormData.prototype._lengthRetriever = function(value, callback) { + + if (value.hasOwnProperty('fd')) { + + // take read range into a account + // `end` = Infinity –> read file till the end + // + // TODO: Looks like there is bug in Node fs.createReadStream + // it doesn't respect `end` options without `start` options + // Fix it when node fixes it. + // https://github.com/joyent/node/issues/7819 + if (value.end != undefined && value.end != Infinity && value.start != undefined) { + + // when end specified + // no need to calculate range + // inclusive, starts with 0 + callback(null, value.end + 1 - (value.start ? value.start : 0)); + + // not that fast snoopy + } else { + // still need to fetch file size from fs + fs.stat(value.path, function(err, stat) { + + var fileSize; + + if (err) { + callback(err); + return; + } + + // update final size based on the range options + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + + // or http response + } else if (value.hasOwnProperty('httpVersion')) { + callback(null, +value.headers['content-length']); + + // or request stream http://github.com/mikeal/request + } else if (value.hasOwnProperty('httpModule')) { + // wait till response come back + value.on('response', function(response) { + value.pause(); + callback(null, +response.headers['content-length']); + }); + value.resume(); + + // something else + } else { + callback('Unknown stream'); + } +}; + +FormData.prototype._multiPartHeader = function(field, value, options) { + // custom header specified (as string)? + // it becomes responsible for boundary + // (e.g. to handle extra CRLFs on .NET servers) + if (typeof options.header == 'string') { + return options.header; + } + + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + + var contents = ''; + var headers = { + // add custom disposition as third element or keep it two elements if not + 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), + // if no content type. allow it to be empty array + 'Content-Type': [].concat(contentType || []) + }; + + // allow custom headers. + if (typeof options.header == 'object') { + populate(headers, options.header); + } + + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) continue; + header = headers[prop]; + + // skip nullish headers. + if (header == null) { + continue; + } + + // convert all headers to arrays. + if (!Array.isArray(header)) { + header = [header]; + } + + // add non-empty headers. + if (header.length) { + contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; + } + } + + return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; +}; + +FormData.prototype._getContentDisposition = function(value, options) { + + var filename + , contentDisposition + ; + + if (typeof options.filepath === 'string') { + // custom filepath for relative paths + filename = path.normalize(options.filepath).replace(/\\/g, '/'); + } else if (options.filename || value.name || value.path) { + // custom filename take precedence + // formidable and the browser add a name property + // fs- and request- streams have path property + filename = path.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty('httpVersion')) { + // or try http response + filename = path.basename(value.client._httpMessage.path || ''); + } + + if (filename) { + contentDisposition = 'filename="' + filename + '"'; + } + + return contentDisposition; +}; + +FormData.prototype._getContentType = function(value, options) { + + // use custom content-type above all + var contentType = options.contentType; + + // or try `name` from formidable, browser + if (!contentType && value.name) { + contentType = mime.lookup(value.name); + } + + // or try `path` from fs-, request- streams + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } + + // or if it's http-reponse + if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { + contentType = value.headers['content-type']; + } + + // or guess it from the filepath or filename + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } + + // fallback to the default content type if `value` is not simple value + if (!contentType && typeof value == 'object') { + contentType = FormData.DEFAULT_CONTENT_TYPE; + } + + return contentType; +}; + +FormData.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData.LINE_BREAK; + + var lastPart = (this._streams.length === 0); + if (lastPart) { + footer += this._lastBoundary(); + } + + next(footer); + }.bind(this); +}; + +FormData.prototype._lastBoundary = function() { + return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; +}; + +FormData.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() + }; + + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } + + return formHeaders; +}; + +FormData.prototype.setBoundary = function(boundary) { + this._boundary = boundary; +}; + +FormData.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } + + return this._boundary; +}; + +FormData.prototype.getBuffer = function() { + var dataBuffer = new Buffer.alloc( 0 ); + var boundary = this.getBoundary(); + + // Create the form content. Add Line breaks to the end of data. + for (var i = 0, len = this._streams.length; i < len; i++) { + if (typeof this._streams[i] !== 'function') { + + // Add content to the buffer. + if(Buffer.isBuffer(this._streams[i])) { + dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]); + }else { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]); + } + + // Add break after content. + if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] ); + } + } + } + + // Add the footer and return the Buffer object. + return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] ); +}; + +FormData.prototype._generateBoundary = function() { + // This generates a 50 character boundary similar to those used by Firefox. + // They are optimized for boyer-moore parsing. + var boundary = '--------------------------'; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } + + this._boundary = boundary; +}; + +// Note: getLengthSync DOESN'T calculate streams length +// As workaround one can calculate file size manually +// and add it as knownLength option +FormData.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; + + // Don't get confused, there are 3 "internal" streams for each keyval pair + // so it basically checks if there is any value added to the form + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + // https://github.com/form-data/form-data/issues/40 + if (!this.hasKnownLength()) { + // Some async length retrievers are present + // therefore synchronous length calculation is false. + // Please use getLength(callback) to get proper length + this._error(new Error('Cannot calculate proper length in synchronous way.')); + } + + return knownLength; +}; + +// Public API to check if length of added values is known +// https://github.com/form-data/form-data/issues/196 +// https://github.com/form-data/form-data/issues/262 +FormData.prototype.hasKnownLength = function() { + var hasKnownLength = true; + + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } + + return hasKnownLength; +}; + +FormData.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; + + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } + + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } + + values.forEach(function(length) { + knownLength += length; + }); + + cb(null, knownLength); + }); +}; + +FormData.prototype.submit = function(params, cb) { + var request + , options + , defaults = {method: 'post'} + ; + + // parse provided url if it's string + // or treat it as options object + if (typeof params == 'string') { + + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + + // use custom params + } else { + + options = populate(params, defaults); + // if no port provided use default one + if (!options.port) { + options.port = options.protocol == 'https:' ? 443 : 80; + } + } + + // put that good code in getHeaders to some use + options.headers = this.getHeaders(params.headers); + + // https if specified, fallback to http in any other case + if (options.protocol == 'https:') { + request = https.request(options); + } else { + request = http.request(options); + } + + // get content length and fire away + this.getLength(function(err, length) { + if (err && err !== 'Unknown stream') { + this._error(err); + return; + } + + // add content length + if (length) { + request.setHeader('Content-Length', length); + } + + this.pipe(request); + if (cb) { + var onResponse; + + var callback = function (error, responce) { + request.removeListener('error', callback); + request.removeListener('response', onResponse); + + return cb.call(this, error, responce); + }; + + onResponse = callback.bind(this, null); + + request.on('error', callback); + request.on('response', onResponse); + } + }.bind(this)); + + return request; +}; + +FormData.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit('error', err); + } +}; + +FormData.prototype.toString = function () { + return '[object FormData]'; +}; diff --git a/node_modules/form-data/lib/populate.js b/node_modules/form-data/lib/populate.js new file mode 100644 index 00000000..4d35738d --- /dev/null +++ b/node_modules/form-data/lib/populate.js @@ -0,0 +1,10 @@ +// populates missing values +module.exports = function(dst, src) { + + Object.keys(src).forEach(function(prop) + { + dst[prop] = dst[prop] || src[prop]; + }); + + return dst; +}; diff --git a/node_modules/form-data/package.json b/node_modules/form-data/package.json new file mode 100644 index 00000000..0f20240b --- /dev/null +++ b/node_modules/form-data/package.json @@ -0,0 +1,68 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "name": "form-data", + "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", + "version": "4.0.0", + "repository": { + "type": "git", + "url": "git://github.com/form-data/form-data.git" + }, + "main": "./lib/form_data", + "browser": "./lib/browser", + "typings": "./index.d.ts", + "scripts": { + "pretest": "rimraf coverage test/tmp", + "test": "istanbul cover test/run.js", + "posttest": "istanbul report lcov text", + "lint": "eslint lib/*.js test/*.js test/integration/*.js", + "report": "istanbul report lcov text", + "ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8", + "ci-test": "npm run test && npm run browser && npm run report", + "predebug": "rimraf coverage test/tmp", + "debug": "verbose=1 ./test/run.js", + "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage", + "check": "istanbul check-coverage coverage/coverage*.json", + "files": "pkgfiles --sort=name", + "get-version": "node -e \"console.log(require('./package.json').version)\"", + "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md", + "restore-readme": "mv README.md.bak README.md", + "prepublish": "in-publish && npm run update-readme || not-in-publish", + "postpublish": "npm run restore-readme" + }, + "pre-commit": [ + "lint", + "ci-test", + "check" + ], + "engines": { + "node": ">= 6" + }, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "devDependencies": { + "@types/node": "^12.0.10", + "browserify": "^13.1.1", + "browserify-istanbul": "^2.0.0", + "coveralls": "^3.0.4", + "cross-spawn": "^6.0.5", + "eslint": "^6.0.1", + "fake": "^0.2.2", + "far": "^0.0.7", + "formidable": "^1.0.17", + "in-publish": "^2.0.0", + "is-node-modern": "^1.0.0", + "istanbul": "^0.4.5", + "obake": "^0.1.2", + "puppeteer": "^1.19.0", + "pkgfiles": "^2.3.0", + "pre-commit": "^1.1.3", + "request": "^2.88.0", + "rimraf": "^2.7.1", + "tape": "^4.6.2", + "typescript": "^3.5.2" + }, + "license": "MIT" +} diff --git a/project starter code/node_modules/forwarded/HISTORY.md b/node_modules/forwarded/HISTORY.md similarity index 100% rename from project starter code/node_modules/forwarded/HISTORY.md rename to node_modules/forwarded/HISTORY.md diff --git a/project starter code/node_modules/forwarded/LICENSE b/node_modules/forwarded/LICENSE similarity index 100% rename from project starter code/node_modules/forwarded/LICENSE rename to node_modules/forwarded/LICENSE diff --git a/project starter code/node_modules/forwarded/README.md b/node_modules/forwarded/README.md similarity index 100% rename from project starter code/node_modules/forwarded/README.md rename to node_modules/forwarded/README.md diff --git a/project starter code/node_modules/forwarded/index.js b/node_modules/forwarded/index.js similarity index 100% rename from project starter code/node_modules/forwarded/index.js rename to node_modules/forwarded/index.js diff --git a/project starter code/node_modules/forwarded/package.json b/node_modules/forwarded/package.json similarity index 100% rename from project starter code/node_modules/forwarded/package.json rename to node_modules/forwarded/package.json diff --git a/project starter code/node_modules/fresh/HISTORY.md b/node_modules/fresh/HISTORY.md similarity index 100% rename from project starter code/node_modules/fresh/HISTORY.md rename to node_modules/fresh/HISTORY.md diff --git a/project starter code/node_modules/fresh/LICENSE b/node_modules/fresh/LICENSE similarity index 100% rename from project starter code/node_modules/fresh/LICENSE rename to node_modules/fresh/LICENSE diff --git a/project starter code/node_modules/fresh/README.md b/node_modules/fresh/README.md similarity index 100% rename from project starter code/node_modules/fresh/README.md rename to node_modules/fresh/README.md diff --git a/project starter code/node_modules/fresh/index.js b/node_modules/fresh/index.js similarity index 100% rename from project starter code/node_modules/fresh/index.js rename to node_modules/fresh/index.js diff --git a/project starter code/node_modules/fresh/package.json b/node_modules/fresh/package.json similarity index 100% rename from project starter code/node_modules/fresh/package.json rename to node_modules/fresh/package.json diff --git a/project starter code/node_modules/function-bind/.editorconfig b/node_modules/function-bind/.editorconfig similarity index 100% rename from project starter code/node_modules/function-bind/.editorconfig rename to node_modules/function-bind/.editorconfig diff --git a/project starter code/node_modules/function-bind/.eslintrc b/node_modules/function-bind/.eslintrc similarity index 100% rename from project starter code/node_modules/function-bind/.eslintrc rename to node_modules/function-bind/.eslintrc diff --git a/project starter code/node_modules/function-bind/.jscs.json b/node_modules/function-bind/.jscs.json similarity index 100% rename from project starter code/node_modules/function-bind/.jscs.json rename to node_modules/function-bind/.jscs.json diff --git a/project starter code/node_modules/function-bind/.npmignore b/node_modules/function-bind/.npmignore similarity index 100% rename from project starter code/node_modules/function-bind/.npmignore rename to node_modules/function-bind/.npmignore diff --git a/project starter code/node_modules/function-bind/.travis.yml b/node_modules/function-bind/.travis.yml similarity index 100% rename from project starter code/node_modules/function-bind/.travis.yml rename to node_modules/function-bind/.travis.yml diff --git a/project starter code/node_modules/function-bind/LICENSE b/node_modules/function-bind/LICENSE similarity index 100% rename from project starter code/node_modules/function-bind/LICENSE rename to node_modules/function-bind/LICENSE diff --git a/project starter code/node_modules/function-bind/README.md b/node_modules/function-bind/README.md similarity index 100% rename from project starter code/node_modules/function-bind/README.md rename to node_modules/function-bind/README.md diff --git a/project starter code/node_modules/function-bind/implementation.js b/node_modules/function-bind/implementation.js similarity index 100% rename from project starter code/node_modules/function-bind/implementation.js rename to node_modules/function-bind/implementation.js diff --git a/project starter code/node_modules/function-bind/index.js b/node_modules/function-bind/index.js similarity index 100% rename from project starter code/node_modules/function-bind/index.js rename to node_modules/function-bind/index.js diff --git a/project starter code/node_modules/function-bind/package.json b/node_modules/function-bind/package.json similarity index 100% rename from project starter code/node_modules/function-bind/package.json rename to node_modules/function-bind/package.json diff --git a/project starter code/node_modules/function-bind/test/.eslintrc b/node_modules/function-bind/test/.eslintrc similarity index 100% rename from project starter code/node_modules/function-bind/test/.eslintrc rename to node_modules/function-bind/test/.eslintrc diff --git a/project starter code/node_modules/function-bind/test/index.js b/node_modules/function-bind/test/index.js similarity index 100% rename from project starter code/node_modules/function-bind/test/index.js rename to node_modules/function-bind/test/index.js diff --git a/project starter code/node_modules/get-intrinsic/.eslintrc b/node_modules/get-intrinsic/.eslintrc similarity index 100% rename from project starter code/node_modules/get-intrinsic/.eslintrc rename to node_modules/get-intrinsic/.eslintrc diff --git a/project starter code/node_modules/get-intrinsic/.github/FUNDING.yml b/node_modules/get-intrinsic/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/get-intrinsic/.github/FUNDING.yml rename to node_modules/get-intrinsic/.github/FUNDING.yml diff --git a/project starter code/node_modules/get-intrinsic/.nycrc b/node_modules/get-intrinsic/.nycrc similarity index 100% rename from project starter code/node_modules/get-intrinsic/.nycrc rename to node_modules/get-intrinsic/.nycrc diff --git a/project starter code/node_modules/get-intrinsic/CHANGELOG.md b/node_modules/get-intrinsic/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/get-intrinsic/CHANGELOG.md rename to node_modules/get-intrinsic/CHANGELOG.md diff --git a/project starter code/node_modules/get-intrinsic/LICENSE b/node_modules/get-intrinsic/LICENSE similarity index 100% rename from project starter code/node_modules/get-intrinsic/LICENSE rename to node_modules/get-intrinsic/LICENSE diff --git a/project starter code/node_modules/get-intrinsic/README.md b/node_modules/get-intrinsic/README.md similarity index 100% rename from project starter code/node_modules/get-intrinsic/README.md rename to node_modules/get-intrinsic/README.md diff --git a/project starter code/node_modules/get-intrinsic/index.js b/node_modules/get-intrinsic/index.js similarity index 100% rename from project starter code/node_modules/get-intrinsic/index.js rename to node_modules/get-intrinsic/index.js diff --git a/project starter code/node_modules/get-intrinsic/package.json b/node_modules/get-intrinsic/package.json similarity index 100% rename from project starter code/node_modules/get-intrinsic/package.json rename to node_modules/get-intrinsic/package.json diff --git a/project starter code/node_modules/get-intrinsic/test/GetIntrinsic.js b/node_modules/get-intrinsic/test/GetIntrinsic.js similarity index 100% rename from project starter code/node_modules/get-intrinsic/test/GetIntrinsic.js rename to node_modules/get-intrinsic/test/GetIntrinsic.js diff --git a/project starter code/node_modules/gifwrap/.jshintrc b/node_modules/gifwrap/.jshintrc similarity index 100% rename from project starter code/node_modules/gifwrap/.jshintrc rename to node_modules/gifwrap/.jshintrc diff --git a/project starter code/node_modules/gifwrap/LICENSE b/node_modules/gifwrap/LICENSE similarity index 100% rename from project starter code/node_modules/gifwrap/LICENSE rename to node_modules/gifwrap/LICENSE diff --git a/project starter code/node_modules/gifwrap/README.md b/node_modules/gifwrap/README.md similarity index 100% rename from project starter code/node_modules/gifwrap/README.md rename to node_modules/gifwrap/README.md diff --git a/project starter code/node_modules/gifwrap/index.d.ts b/node_modules/gifwrap/index.d.ts similarity index 100% rename from project starter code/node_modules/gifwrap/index.d.ts rename to node_modules/gifwrap/index.d.ts diff --git a/project starter code/node_modules/gifwrap/package.json b/node_modules/gifwrap/package.json similarity index 100% rename from project starter code/node_modules/gifwrap/package.json rename to node_modules/gifwrap/package.json diff --git a/project starter code/node_modules/gifwrap/src/bitmapimage.js b/node_modules/gifwrap/src/bitmapimage.js similarity index 100% rename from project starter code/node_modules/gifwrap/src/bitmapimage.js rename to node_modules/gifwrap/src/bitmapimage.js diff --git a/project starter code/node_modules/gifwrap/src/gif.js b/node_modules/gifwrap/src/gif.js similarity index 100% rename from project starter code/node_modules/gifwrap/src/gif.js rename to node_modules/gifwrap/src/gif.js diff --git a/project starter code/node_modules/gifwrap/src/gifcodec.js b/node_modules/gifwrap/src/gifcodec.js similarity index 100% rename from project starter code/node_modules/gifwrap/src/gifcodec.js rename to node_modules/gifwrap/src/gifcodec.js diff --git a/project starter code/node_modules/gifwrap/src/gifframe.js b/node_modules/gifwrap/src/gifframe.js similarity index 100% rename from project starter code/node_modules/gifwrap/src/gifframe.js rename to node_modules/gifwrap/src/gifframe.js diff --git a/project starter code/node_modules/gifwrap/src/gifutil.js b/node_modules/gifwrap/src/gifutil.js similarity index 100% rename from project starter code/node_modules/gifwrap/src/gifutil.js rename to node_modules/gifwrap/src/gifutil.js diff --git a/project starter code/node_modules/gifwrap/src/index.js b/node_modules/gifwrap/src/index.js similarity index 100% rename from project starter code/node_modules/gifwrap/src/index.js rename to node_modules/gifwrap/src/index.js diff --git a/project starter code/node_modules/gifwrap/src/omggif.d.ts b/node_modules/gifwrap/src/omggif.d.ts similarity index 100% rename from project starter code/node_modules/gifwrap/src/omggif.d.ts rename to node_modules/gifwrap/src/omggif.d.ts diff --git a/project starter code/node_modules/gifwrap/templates/README.hbs b/node_modules/gifwrap/templates/README.hbs similarity index 100% rename from project starter code/node_modules/gifwrap/templates/README.hbs rename to node_modules/gifwrap/templates/README.hbs diff --git a/project starter code/node_modules/gifwrap/test/fixtures/count5x7.gif b/node_modules/gifwrap/test/fixtures/count5x7.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/count5x7.gif rename to node_modules/gifwrap/test/fixtures/count5x7.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/countConstantDelay0.gif b/node_modules/gifwrap/test/fixtures/countConstantDelay0.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/countConstantDelay0.gif rename to node_modules/gifwrap/test/fixtures/countConstantDelay0.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/countConstantDelay1.gif b/node_modules/gifwrap/test/fixtures/countConstantDelay1.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/countConstantDelay1.gif rename to node_modules/gifwrap/test/fixtures/countConstantDelay1.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/countConstantDelay3.gif b/node_modules/gifwrap/test/fixtures/countConstantDelay3.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/countConstantDelay3.gif rename to node_modules/gifwrap/test/fixtures/countConstantDelay3.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/countIncreasingDelay.gif b/node_modules/gifwrap/test/fixtures/countIncreasingDelay.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/countIncreasingDelay.gif rename to node_modules/gifwrap/test/fixtures/countIncreasingDelay.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/hairstreak.jpg b/node_modules/gifwrap/test/fixtures/hairstreak.jpg similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/hairstreak.jpg rename to node_modules/gifwrap/test/fixtures/hairstreak.jpg diff --git a/project starter code/node_modules/gifwrap/test/fixtures/lenna.png b/node_modules/gifwrap/test/fixtures/lenna.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/lenna.png rename to node_modules/gifwrap/test/fixtures/lenna.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/nburling-public.gif b/node_modules/gifwrap/test/fixtures/nburling-public.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/nburling-public.gif rename to node_modules/gifwrap/test/fixtures/nburling-public.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/pelagrina.jpg b/node_modules/gifwrap/test/fixtures/pelagrina.jpg similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/pelagrina.jpg rename to node_modules/gifwrap/test/fixtures/pelagrina.jpg diff --git a/project starter code/node_modules/gifwrap/test/fixtures/penguins.png b/node_modules/gifwrap/test/fixtures/penguins.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/penguins.png rename to node_modules/gifwrap/test/fixtures/penguins.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Dekker.png b/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Dekker.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Dekker.png rename to node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Dekker.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Sorokin.png b/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Sorokin.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Sorokin.png rename to node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Sorokin.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Wu.png b/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Wu.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Wu.png rename to node_modules/gifwrap/test/fixtures/quantized/hairstreak256_Wu.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Dekker.png b/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Dekker.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Dekker.png rename to node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Dekker.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Sorokin.png b/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Sorokin.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Sorokin.png rename to node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Sorokin.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Wu.png b/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Wu.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Wu.png rename to node_modules/gifwrap/test/fixtures/quantized/hairstreak32_Wu.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Dekker.png b/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Dekker.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Dekker.png rename to node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Dekker.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Sorokin.png b/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Sorokin.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Sorokin.png rename to node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Sorokin.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Wu.png b/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Wu.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Wu.png rename to node_modules/gifwrap/test/fixtures/quantized/rosewithtrans256_Wu.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Dekker.png b/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Dekker.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Dekker.png rename to node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Dekker.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Sorokin.png b/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Sorokin.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Sorokin.png rename to node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Sorokin.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Wu.png b/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Wu.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Wu.png rename to node_modules/gifwrap/test/fixtures/quantized/rosewithtrans32_Wu.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker_FloydSteinberg.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker_FloydSteinberg.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker_FloydSteinberg.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Dekker_FloydSteinberg.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin_FloydSteinberg.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin_FloydSteinberg.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin_FloydSteinberg.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Sorokin_FloydSteinberg.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu_FloydSteinberg.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu_FloydSteinberg.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu_FloydSteinberg.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap256_Wu_FloydSteinberg.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Dekker.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Dekker.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Dekker.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Dekker.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Sorokin.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Sorokin.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Sorokin.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Sorokin.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Wu.png b/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Wu.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Wu.png rename to node_modules/gifwrap/test/fixtures/quantized/sculptmap32_Wu.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/rnaples-frame-10.png b/node_modules/gifwrap/test/fixtures/rnaples-frame-10.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/rnaples-frame-10.png rename to node_modules/gifwrap/test/fixtures/rnaples-frame-10.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/rnaples-offsets-public.gif b/node_modules/gifwrap/test/fixtures/rnaples-offsets-public.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/rnaples-offsets-public.gif rename to node_modules/gifwrap/test/fixtures/rnaples-offsets-public.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/rosewithtrans.png b/node_modules/gifwrap/test/fixtures/rosewithtrans.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/rosewithtrans.png rename to node_modules/gifwrap/test/fixtures/rosewithtrans.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/sculptmap.png b/node_modules/gifwrap/test/fixtures/sculptmap.png similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/sculptmap.png rename to node_modules/gifwrap/test/fixtures/sculptmap.png diff --git a/project starter code/node_modules/gifwrap/test/fixtures/singleFrameBWOpaque.gif b/node_modules/gifwrap/test/fixtures/singleFrameBWOpaque.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/singleFrameBWOpaque.gif rename to node_modules/gifwrap/test/fixtures/singleFrameBWOpaque.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/singleFrameMonoOpaque.gif b/node_modules/gifwrap/test/fixtures/singleFrameMonoOpaque.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/singleFrameMonoOpaque.gif rename to node_modules/gifwrap/test/fixtures/singleFrameMonoOpaque.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/singleFrameMonoTrans.gif b/node_modules/gifwrap/test/fixtures/singleFrameMonoTrans.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/singleFrameMonoTrans.gif rename to node_modules/gifwrap/test/fixtures/singleFrameMonoTrans.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/singleFrameMultiOpaque.gif b/node_modules/gifwrap/test/fixtures/singleFrameMultiOpaque.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/singleFrameMultiOpaque.gif rename to node_modules/gifwrap/test/fixtures/singleFrameMultiOpaque.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/singleFrameMultiTrans.gif b/node_modules/gifwrap/test/fixtures/singleFrameMultiTrans.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/singleFrameMultiTrans.gif rename to node_modules/gifwrap/test/fixtures/singleFrameMultiTrans.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/singleFrameNoColorTrans.gif b/node_modules/gifwrap/test/fixtures/singleFrameNoColorTrans.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/singleFrameNoColorTrans.gif rename to node_modules/gifwrap/test/fixtures/singleFrameNoColorTrans.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/threeFrameMonoTrans.gif b/node_modules/gifwrap/test/fixtures/threeFrameMonoTrans.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/threeFrameMonoTrans.gif rename to node_modules/gifwrap/test/fixtures/threeFrameMonoTrans.gif diff --git a/project starter code/node_modules/gifwrap/test/fixtures/twoFrameMultiOpaque.gif b/node_modules/gifwrap/test/fixtures/twoFrameMultiOpaque.gif similarity index 100% rename from project starter code/node_modules/gifwrap/test/fixtures/twoFrameMultiOpaque.gif rename to node_modules/gifwrap/test/fixtures/twoFrameMultiOpaque.gif diff --git a/project starter code/node_modules/gifwrap/test/lib/bitmaps.js b/node_modules/gifwrap/test/lib/bitmaps.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/lib/bitmaps.js rename to node_modules/gifwrap/test/lib/bitmaps.js diff --git a/project starter code/node_modules/gifwrap/test/lib/tools.js b/node_modules/gifwrap/test/lib/tools.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/lib/tools.js rename to node_modules/gifwrap/test/lib/tools.js diff --git a/project starter code/node_modules/gifwrap/test/test_bitmap.js b/node_modules/gifwrap/test/test_bitmap.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/test_bitmap.js rename to node_modules/gifwrap/test/test_bitmap.js diff --git a/project starter code/node_modules/gifwrap/test/test_decoding.js b/node_modules/gifwrap/test/test_decoding.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/test_decoding.js rename to node_modules/gifwrap/test/test_decoding.js diff --git a/project starter code/node_modules/gifwrap/test/test_encoding.js b/node_modules/gifwrap/test/test_encoding.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/test_encoding.js rename to node_modules/gifwrap/test/test_encoding.js diff --git a/project starter code/node_modules/gifwrap/test/test_frame.js b/node_modules/gifwrap/test/test_frame.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/test_frame.js rename to node_modules/gifwrap/test/test_frame.js diff --git a/project starter code/node_modules/gifwrap/test/test_properties.js b/node_modules/gifwrap/test/test_properties.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/test_properties.js rename to node_modules/gifwrap/test/test_properties.js diff --git a/project starter code/node_modules/gifwrap/test/test_quantize.js b/node_modules/gifwrap/test/test_quantize.js similarity index 100% rename from project starter code/node_modules/gifwrap/test/test_quantize.js rename to node_modules/gifwrap/test/test_quantize.js diff --git a/project starter code/node_modules/global/.travis.yml b/node_modules/global/.travis.yml similarity index 100% rename from project starter code/node_modules/global/.travis.yml rename to node_modules/global/.travis.yml diff --git a/project starter code/node_modules/global/LICENSE b/node_modules/global/LICENSE similarity index 100% rename from project starter code/node_modules/global/LICENSE rename to node_modules/global/LICENSE diff --git a/project starter code/node_modules/global/README.md b/node_modules/global/README.md similarity index 100% rename from project starter code/node_modules/global/README.md rename to node_modules/global/README.md diff --git a/project starter code/node_modules/global/console.js b/node_modules/global/console.js similarity index 100% rename from project starter code/node_modules/global/console.js rename to node_modules/global/console.js diff --git a/project starter code/node_modules/global/document.js b/node_modules/global/document.js similarity index 100% rename from project starter code/node_modules/global/document.js rename to node_modules/global/document.js diff --git a/project starter code/node_modules/global/package.json b/node_modules/global/package.json similarity index 100% rename from project starter code/node_modules/global/package.json rename to node_modules/global/package.json diff --git a/project starter code/node_modules/global/process.js b/node_modules/global/process.js similarity index 100% rename from project starter code/node_modules/global/process.js rename to node_modules/global/process.js diff --git a/project starter code/node_modules/global/window.js b/node_modules/global/window.js similarity index 100% rename from project starter code/node_modules/global/window.js rename to node_modules/global/window.js diff --git a/project starter code/node_modules/has-symbols/.eslintrc b/node_modules/has-symbols/.eslintrc similarity index 100% rename from project starter code/node_modules/has-symbols/.eslintrc rename to node_modules/has-symbols/.eslintrc diff --git a/project starter code/node_modules/has-symbols/.github/FUNDING.yml b/node_modules/has-symbols/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/has-symbols/.github/FUNDING.yml rename to node_modules/has-symbols/.github/FUNDING.yml diff --git a/project starter code/node_modules/has-symbols/.nycrc b/node_modules/has-symbols/.nycrc similarity index 100% rename from project starter code/node_modules/has-symbols/.nycrc rename to node_modules/has-symbols/.nycrc diff --git a/project starter code/node_modules/has-symbols/CHANGELOG.md b/node_modules/has-symbols/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/has-symbols/CHANGELOG.md rename to node_modules/has-symbols/CHANGELOG.md diff --git a/project starter code/node_modules/has-symbols/LICENSE b/node_modules/has-symbols/LICENSE similarity index 100% rename from project starter code/node_modules/has-symbols/LICENSE rename to node_modules/has-symbols/LICENSE diff --git a/project starter code/node_modules/has-symbols/README.md b/node_modules/has-symbols/README.md similarity index 100% rename from project starter code/node_modules/has-symbols/README.md rename to node_modules/has-symbols/README.md diff --git a/project starter code/node_modules/has-symbols/index.js b/node_modules/has-symbols/index.js similarity index 100% rename from project starter code/node_modules/has-symbols/index.js rename to node_modules/has-symbols/index.js diff --git a/project starter code/node_modules/has-symbols/package.json b/node_modules/has-symbols/package.json similarity index 100% rename from project starter code/node_modules/has-symbols/package.json rename to node_modules/has-symbols/package.json diff --git a/project starter code/node_modules/has-symbols/shams.js b/node_modules/has-symbols/shams.js similarity index 100% rename from project starter code/node_modules/has-symbols/shams.js rename to node_modules/has-symbols/shams.js diff --git a/project starter code/node_modules/has-symbols/test/index.js b/node_modules/has-symbols/test/index.js similarity index 100% rename from project starter code/node_modules/has-symbols/test/index.js rename to node_modules/has-symbols/test/index.js diff --git a/project starter code/node_modules/has-symbols/test/shams/core-js.js b/node_modules/has-symbols/test/shams/core-js.js similarity index 100% rename from project starter code/node_modules/has-symbols/test/shams/core-js.js rename to node_modules/has-symbols/test/shams/core-js.js diff --git a/project starter code/node_modules/has-symbols/test/shams/get-own-property-symbols.js b/node_modules/has-symbols/test/shams/get-own-property-symbols.js similarity index 100% rename from project starter code/node_modules/has-symbols/test/shams/get-own-property-symbols.js rename to node_modules/has-symbols/test/shams/get-own-property-symbols.js diff --git a/project starter code/node_modules/has-symbols/test/tests.js b/node_modules/has-symbols/test/tests.js similarity index 100% rename from project starter code/node_modules/has-symbols/test/tests.js rename to node_modules/has-symbols/test/tests.js diff --git a/project starter code/node_modules/has/LICENSE-MIT b/node_modules/has/LICENSE-MIT similarity index 100% rename from project starter code/node_modules/has/LICENSE-MIT rename to node_modules/has/LICENSE-MIT diff --git a/project starter code/node_modules/has/README.md b/node_modules/has/README.md similarity index 100% rename from project starter code/node_modules/has/README.md rename to node_modules/has/README.md diff --git a/project starter code/node_modules/has/package.json b/node_modules/has/package.json similarity index 100% rename from project starter code/node_modules/has/package.json rename to node_modules/has/package.json diff --git a/project starter code/node_modules/has/src/index.js b/node_modules/has/src/index.js similarity index 100% rename from project starter code/node_modules/has/src/index.js rename to node_modules/has/src/index.js diff --git a/project starter code/node_modules/has/test/index.js b/node_modules/has/test/index.js similarity index 100% rename from project starter code/node_modules/has/test/index.js rename to node_modules/has/test/index.js diff --git a/project starter code/node_modules/http-errors/HISTORY.md b/node_modules/http-errors/HISTORY.md similarity index 100% rename from project starter code/node_modules/http-errors/HISTORY.md rename to node_modules/http-errors/HISTORY.md diff --git a/project starter code/node_modules/http-errors/LICENSE b/node_modules/http-errors/LICENSE similarity index 100% rename from project starter code/node_modules/http-errors/LICENSE rename to node_modules/http-errors/LICENSE diff --git a/project starter code/node_modules/http-errors/README.md b/node_modules/http-errors/README.md similarity index 100% rename from project starter code/node_modules/http-errors/README.md rename to node_modules/http-errors/README.md diff --git a/project starter code/node_modules/http-errors/index.js b/node_modules/http-errors/index.js similarity index 100% rename from project starter code/node_modules/http-errors/index.js rename to node_modules/http-errors/index.js diff --git a/project starter code/node_modules/http-errors/package.json b/node_modules/http-errors/package.json similarity index 100% rename from project starter code/node_modules/http-errors/package.json rename to node_modules/http-errors/package.json diff --git a/project starter code/node_modules/iconv-lite/Changelog.md b/node_modules/iconv-lite/Changelog.md similarity index 100% rename from project starter code/node_modules/iconv-lite/Changelog.md rename to node_modules/iconv-lite/Changelog.md diff --git a/project starter code/node_modules/iconv-lite/LICENSE b/node_modules/iconv-lite/LICENSE similarity index 100% rename from project starter code/node_modules/iconv-lite/LICENSE rename to node_modules/iconv-lite/LICENSE diff --git a/project starter code/node_modules/iconv-lite/README.md b/node_modules/iconv-lite/README.md similarity index 100% rename from project starter code/node_modules/iconv-lite/README.md rename to node_modules/iconv-lite/README.md diff --git a/project starter code/node_modules/iconv-lite/encodings/dbcs-codec.js b/node_modules/iconv-lite/encodings/dbcs-codec.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/dbcs-codec.js rename to node_modules/iconv-lite/encodings/dbcs-codec.js diff --git a/project starter code/node_modules/iconv-lite/encodings/dbcs-data.js b/node_modules/iconv-lite/encodings/dbcs-data.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/dbcs-data.js rename to node_modules/iconv-lite/encodings/dbcs-data.js diff --git a/project starter code/node_modules/iconv-lite/encodings/index.js b/node_modules/iconv-lite/encodings/index.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/index.js rename to node_modules/iconv-lite/encodings/index.js diff --git a/project starter code/node_modules/iconv-lite/encodings/internal.js b/node_modules/iconv-lite/encodings/internal.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/internal.js rename to node_modules/iconv-lite/encodings/internal.js diff --git a/project starter code/node_modules/iconv-lite/encodings/sbcs-codec.js b/node_modules/iconv-lite/encodings/sbcs-codec.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/sbcs-codec.js rename to node_modules/iconv-lite/encodings/sbcs-codec.js diff --git a/project starter code/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/node_modules/iconv-lite/encodings/sbcs-data-generated.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/sbcs-data-generated.js rename to node_modules/iconv-lite/encodings/sbcs-data-generated.js diff --git a/project starter code/node_modules/iconv-lite/encodings/sbcs-data.js b/node_modules/iconv-lite/encodings/sbcs-data.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/sbcs-data.js rename to node_modules/iconv-lite/encodings/sbcs-data.js diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/big5-added.json b/node_modules/iconv-lite/encodings/tables/big5-added.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/big5-added.json rename to node_modules/iconv-lite/encodings/tables/big5-added.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/cp936.json b/node_modules/iconv-lite/encodings/tables/cp936.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/cp936.json rename to node_modules/iconv-lite/encodings/tables/cp936.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/cp949.json b/node_modules/iconv-lite/encodings/tables/cp949.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/cp949.json rename to node_modules/iconv-lite/encodings/tables/cp949.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/cp950.json b/node_modules/iconv-lite/encodings/tables/cp950.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/cp950.json rename to node_modules/iconv-lite/encodings/tables/cp950.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/eucjp.json b/node_modules/iconv-lite/encodings/tables/eucjp.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/eucjp.json rename to node_modules/iconv-lite/encodings/tables/eucjp.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json rename to node_modules/iconv-lite/encodings/tables/gb18030-ranges.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/gbk-added.json b/node_modules/iconv-lite/encodings/tables/gbk-added.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/gbk-added.json rename to node_modules/iconv-lite/encodings/tables/gbk-added.json diff --git a/project starter code/node_modules/iconv-lite/encodings/tables/shiftjis.json b/node_modules/iconv-lite/encodings/tables/shiftjis.json similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/tables/shiftjis.json rename to node_modules/iconv-lite/encodings/tables/shiftjis.json diff --git a/project starter code/node_modules/iconv-lite/encodings/utf16.js b/node_modules/iconv-lite/encodings/utf16.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/utf16.js rename to node_modules/iconv-lite/encodings/utf16.js diff --git a/project starter code/node_modules/iconv-lite/encodings/utf7.js b/node_modules/iconv-lite/encodings/utf7.js similarity index 100% rename from project starter code/node_modules/iconv-lite/encodings/utf7.js rename to node_modules/iconv-lite/encodings/utf7.js diff --git a/project starter code/node_modules/iconv-lite/lib/bom-handling.js b/node_modules/iconv-lite/lib/bom-handling.js similarity index 100% rename from project starter code/node_modules/iconv-lite/lib/bom-handling.js rename to node_modules/iconv-lite/lib/bom-handling.js diff --git a/project starter code/node_modules/iconv-lite/lib/extend-node.js b/node_modules/iconv-lite/lib/extend-node.js similarity index 100% rename from project starter code/node_modules/iconv-lite/lib/extend-node.js rename to node_modules/iconv-lite/lib/extend-node.js diff --git a/project starter code/node_modules/iconv-lite/lib/index.d.ts b/node_modules/iconv-lite/lib/index.d.ts similarity index 100% rename from project starter code/node_modules/iconv-lite/lib/index.d.ts rename to node_modules/iconv-lite/lib/index.d.ts diff --git a/project starter code/node_modules/iconv-lite/lib/index.js b/node_modules/iconv-lite/lib/index.js similarity index 100% rename from project starter code/node_modules/iconv-lite/lib/index.js rename to node_modules/iconv-lite/lib/index.js diff --git a/project starter code/node_modules/iconv-lite/lib/streams.js b/node_modules/iconv-lite/lib/streams.js similarity index 100% rename from project starter code/node_modules/iconv-lite/lib/streams.js rename to node_modules/iconv-lite/lib/streams.js diff --git a/project starter code/node_modules/iconv-lite/package.json b/node_modules/iconv-lite/package.json similarity index 100% rename from project starter code/node_modules/iconv-lite/package.json rename to node_modules/iconv-lite/package.json diff --git a/project starter code/node_modules/ieee754/LICENSE b/node_modules/ieee754/LICENSE similarity index 100% rename from project starter code/node_modules/ieee754/LICENSE rename to node_modules/ieee754/LICENSE diff --git a/project starter code/node_modules/ieee754/README.md b/node_modules/ieee754/README.md similarity index 100% rename from project starter code/node_modules/ieee754/README.md rename to node_modules/ieee754/README.md diff --git a/project starter code/node_modules/ieee754/index.d.ts b/node_modules/ieee754/index.d.ts similarity index 100% rename from project starter code/node_modules/ieee754/index.d.ts rename to node_modules/ieee754/index.d.ts diff --git a/project starter code/node_modules/ieee754/index.js b/node_modules/ieee754/index.js similarity index 100% rename from project starter code/node_modules/ieee754/index.js rename to node_modules/ieee754/index.js diff --git a/project starter code/node_modules/ieee754/package.json b/node_modules/ieee754/package.json similarity index 100% rename from project starter code/node_modules/ieee754/package.json rename to node_modules/ieee754/package.json diff --git a/project starter code/node_modules/image-q/LICENSE b/node_modules/image-q/LICENSE similarity index 100% rename from project starter code/node_modules/image-q/LICENSE rename to node_modules/image-q/LICENSE diff --git a/project starter code/node_modules/image-q/README.md b/node_modules/image-q/README.md similarity index 100% rename from project starter code/node_modules/image-q/README.md rename to node_modules/image-q/README.md diff --git a/project starter code/node_modules/image-q/dist/cjs/image-q.cjs b/node_modules/image-q/dist/cjs/image-q.cjs similarity index 100% rename from project starter code/node_modules/image-q/dist/cjs/image-q.cjs rename to node_modules/image-q/dist/cjs/image-q.cjs diff --git a/project starter code/node_modules/image-q/dist/cjs/image-q.cjs.map b/node_modules/image-q/dist/cjs/image-q.cjs.map similarity index 100% rename from project starter code/node_modules/image-q/dist/cjs/image-q.cjs.map rename to node_modules/image-q/dist/cjs/image-q.cjs.map diff --git a/project starter code/node_modules/image-q/dist/esm/image-q.mjs b/node_modules/image-q/dist/esm/image-q.mjs similarity index 100% rename from project starter code/node_modules/image-q/dist/esm/image-q.mjs rename to node_modules/image-q/dist/esm/image-q.mjs diff --git a/project starter code/node_modules/image-q/dist/esm/image-q.mjs.map b/node_modules/image-q/dist/esm/image-q.mjs.map similarity index 100% rename from project starter code/node_modules/image-q/dist/esm/image-q.mjs.map rename to node_modules/image-q/dist/esm/image-q.mjs.map diff --git a/project starter code/node_modules/image-q/dist/types/src/basicAPI.d.ts b/node_modules/image-q/dist/types/src/basicAPI.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/basicAPI.d.ts rename to node_modules/image-q/dist/types/src/basicAPI.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/basicAPI.d.ts.map b/node_modules/image-q/dist/types/src/basicAPI.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/basicAPI.d.ts.map rename to node_modules/image-q/dist/types/src/basicAPI.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/constants/bt709.d.ts b/node_modules/image-q/dist/types/src/constants/bt709.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/constants/bt709.d.ts rename to node_modules/image-q/dist/types/src/constants/bt709.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/constants/bt709.d.ts.map b/node_modules/image-q/dist/types/src/constants/bt709.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/constants/bt709.d.ts.map rename to node_modules/image-q/dist/types/src/constants/bt709.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/constants/index.d.ts b/node_modules/image-q/dist/types/src/constants/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/constants/index.d.ts rename to node_modules/image-q/dist/types/src/constants/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/constants/index.d.ts.map b/node_modules/image-q/dist/types/src/constants/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/constants/index.d.ts.map rename to node_modules/image-q/dist/types/src/constants/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/index.d.ts b/node_modules/image-q/dist/types/src/conversion/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/index.d.ts rename to node_modules/image-q/dist/types/src/conversion/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/index.d.ts.map b/node_modules/image-q/dist/types/src/conversion/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/index.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts b/node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts rename to node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts.map b/node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/lab2rgb.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts b/node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts rename to node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts.map b/node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/lab2xyz.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts b/node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts rename to node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts.map b/node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/rgb2hsl.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts b/node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts rename to node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts.map b/node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/rgb2lab.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts b/node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts rename to node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts.map b/node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/rgb2xyz.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts b/node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts rename to node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts.map b/node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/xyz2lab.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts b/node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts rename to node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts.map b/node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts.map rename to node_modules/image-q/dist/types/src/conversion/xyz2rgb.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/cie94.d.ts b/node_modules/image-q/dist/types/src/distance/cie94.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/cie94.d.ts rename to node_modules/image-q/dist/types/src/distance/cie94.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/cie94.d.ts.map b/node_modules/image-q/dist/types/src/distance/cie94.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/cie94.d.ts.map rename to node_modules/image-q/dist/types/src/distance/cie94.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/ciede2000.d.ts b/node_modules/image-q/dist/types/src/distance/ciede2000.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/ciede2000.d.ts rename to node_modules/image-q/dist/types/src/distance/ciede2000.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/ciede2000.d.ts.map b/node_modules/image-q/dist/types/src/distance/ciede2000.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/ciede2000.d.ts.map rename to node_modules/image-q/dist/types/src/distance/ciede2000.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/cmetric.d.ts b/node_modules/image-q/dist/types/src/distance/cmetric.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/cmetric.d.ts rename to node_modules/image-q/dist/types/src/distance/cmetric.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/cmetric.d.ts.map b/node_modules/image-q/dist/types/src/distance/cmetric.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/cmetric.d.ts.map rename to node_modules/image-q/dist/types/src/distance/cmetric.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts b/node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts rename to node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts.map b/node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts.map rename to node_modules/image-q/dist/types/src/distance/distanceCalculator.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/euclidean.d.ts b/node_modules/image-q/dist/types/src/distance/euclidean.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/euclidean.d.ts rename to node_modules/image-q/dist/types/src/distance/euclidean.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/euclidean.d.ts.map b/node_modules/image-q/dist/types/src/distance/euclidean.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/euclidean.d.ts.map rename to node_modules/image-q/dist/types/src/distance/euclidean.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/index.d.ts b/node_modules/image-q/dist/types/src/distance/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/index.d.ts rename to node_modules/image-q/dist/types/src/distance/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/index.d.ts.map b/node_modules/image-q/dist/types/src/distance/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/index.d.ts.map rename to node_modules/image-q/dist/types/src/distance/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/manhattan.d.ts b/node_modules/image-q/dist/types/src/distance/manhattan.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/manhattan.d.ts rename to node_modules/image-q/dist/types/src/distance/manhattan.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/manhattan.d.ts.map b/node_modules/image-q/dist/types/src/distance/manhattan.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/manhattan.d.ts.map rename to node_modules/image-q/dist/types/src/distance/manhattan.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/pngQuant.d.ts b/node_modules/image-q/dist/types/src/distance/pngQuant.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/pngQuant.d.ts rename to node_modules/image-q/dist/types/src/distance/pngQuant.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/distance/pngQuant.d.ts.map b/node_modules/image-q/dist/types/src/distance/pngQuant.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/distance/pngQuant.d.ts.map rename to node_modules/image-q/dist/types/src/distance/pngQuant.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/array.d.ts b/node_modules/image-q/dist/types/src/image/array.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/array.d.ts rename to node_modules/image-q/dist/types/src/image/array.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/array.d.ts.map b/node_modules/image-q/dist/types/src/image/array.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/array.d.ts.map rename to node_modules/image-q/dist/types/src/image/array.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts b/node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts rename to node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts.map b/node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts.map rename to node_modules/image-q/dist/types/src/image/imageQuantizer.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts b/node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts rename to node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts.map b/node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts.map rename to node_modules/image-q/dist/types/src/image/imageQuantizerYieldValue.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/index.d.ts b/node_modules/image-q/dist/types/src/image/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/index.d.ts rename to node_modules/image-q/dist/types/src/image/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/index.d.ts.map b/node_modules/image-q/dist/types/src/image/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/index.d.ts.map rename to node_modules/image-q/dist/types/src/image/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/nearestColor.d.ts b/node_modules/image-q/dist/types/src/image/nearestColor.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/nearestColor.d.ts rename to node_modules/image-q/dist/types/src/image/nearestColor.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/nearestColor.d.ts.map b/node_modules/image-q/dist/types/src/image/nearestColor.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/nearestColor.d.ts.map rename to node_modules/image-q/dist/types/src/image/nearestColor.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/riemersma.d.ts b/node_modules/image-q/dist/types/src/image/riemersma.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/riemersma.d.ts rename to node_modules/image-q/dist/types/src/image/riemersma.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/riemersma.d.ts.map b/node_modules/image-q/dist/types/src/image/riemersma.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/riemersma.d.ts.map rename to node_modules/image-q/dist/types/src/image/riemersma.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts b/node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts rename to node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts.map b/node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts.map rename to node_modules/image-q/dist/types/src/image/spaceFillingCurves/hilbertCurve.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/index.d.ts b/node_modules/image-q/dist/types/src/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/index.d.ts rename to node_modules/image-q/dist/types/src/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/index.d.ts.map b/node_modules/image-q/dist/types/src/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/index.d.ts.map rename to node_modules/image-q/dist/types/src/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/index.d.ts b/node_modules/image-q/dist/types/src/palette/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/index.d.ts rename to node_modules/image-q/dist/types/src/palette/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/index.d.ts.map b/node_modules/image-q/dist/types/src/palette/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/index.d.ts.map rename to node_modules/image-q/dist/types/src/palette/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts b/node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts rename to node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts.map b/node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts.map rename to node_modules/image-q/dist/types/src/palette/neuquant/neuquant.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts b/node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts rename to node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts.map b/node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts.map rename to node_modules/image-q/dist/types/src/palette/neuquant/neuquantFloat.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts b/node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts rename to node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts.map b/node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts.map rename to node_modules/image-q/dist/types/src/palette/paletteQuantizer.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts b/node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts rename to node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts.map b/node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts.map rename to node_modules/image-q/dist/types/src/palette/paletteQuantizerYieldValue.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts b/node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts rename to node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts.map b/node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts.map rename to node_modules/image-q/dist/types/src/palette/rgbquant/colorHistogram.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts b/node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts rename to node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts.map b/node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts.map rename to node_modules/image-q/dist/types/src/palette/rgbquant/rgbquant.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts b/node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts rename to node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts.map b/node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts.map rename to node_modules/image-q/dist/types/src/palette/wu/wuQuant.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/quality/index.d.ts b/node_modules/image-q/dist/types/src/quality/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/quality/index.d.ts rename to node_modules/image-q/dist/types/src/quality/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/quality/index.d.ts.map b/node_modules/image-q/dist/types/src/quality/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/quality/index.d.ts.map rename to node_modules/image-q/dist/types/src/quality/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/quality/ssim.d.ts b/node_modules/image-q/dist/types/src/quality/ssim.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/quality/ssim.d.ts rename to node_modules/image-q/dist/types/src/quality/ssim.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/quality/ssim.d.ts.map b/node_modules/image-q/dist/types/src/quality/ssim.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/quality/ssim.d.ts.map rename to node_modules/image-q/dist/types/src/quality/ssim.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/arithmetic.d.ts b/node_modules/image-q/dist/types/src/utils/arithmetic.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/arithmetic.d.ts rename to node_modules/image-q/dist/types/src/utils/arithmetic.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/arithmetic.d.ts.map b/node_modules/image-q/dist/types/src/utils/arithmetic.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/arithmetic.d.ts.map rename to node_modules/image-q/dist/types/src/utils/arithmetic.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts b/node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts rename to node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts.map b/node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts.map rename to node_modules/image-q/dist/types/src/utils/hueStatistics.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/index.d.ts b/node_modules/image-q/dist/types/src/utils/index.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/index.d.ts rename to node_modules/image-q/dist/types/src/utils/index.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/index.d.ts.map b/node_modules/image-q/dist/types/src/utils/index.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/index.d.ts.map rename to node_modules/image-q/dist/types/src/utils/index.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/palette.d.ts b/node_modules/image-q/dist/types/src/utils/palette.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/palette.d.ts rename to node_modules/image-q/dist/types/src/utils/palette.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/palette.d.ts.map b/node_modules/image-q/dist/types/src/utils/palette.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/palette.d.ts.map rename to node_modules/image-q/dist/types/src/utils/palette.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/point.d.ts b/node_modules/image-q/dist/types/src/utils/point.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/point.d.ts rename to node_modules/image-q/dist/types/src/utils/point.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/point.d.ts.map b/node_modules/image-q/dist/types/src/utils/point.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/point.d.ts.map rename to node_modules/image-q/dist/types/src/utils/point.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/pointContainer.d.ts b/node_modules/image-q/dist/types/src/utils/pointContainer.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/pointContainer.d.ts rename to node_modules/image-q/dist/types/src/utils/pointContainer.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/pointContainer.d.ts.map b/node_modules/image-q/dist/types/src/utils/pointContainer.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/pointContainer.d.ts.map rename to node_modules/image-q/dist/types/src/utils/pointContainer.d.ts.map diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/progressTracker.d.ts b/node_modules/image-q/dist/types/src/utils/progressTracker.d.ts similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/progressTracker.d.ts rename to node_modules/image-q/dist/types/src/utils/progressTracker.d.ts diff --git a/project starter code/node_modules/image-q/dist/types/src/utils/progressTracker.d.ts.map b/node_modules/image-q/dist/types/src/utils/progressTracker.d.ts.map similarity index 100% rename from project starter code/node_modules/image-q/dist/types/src/utils/progressTracker.d.ts.map rename to node_modules/image-q/dist/types/src/utils/progressTracker.d.ts.map diff --git a/project starter code/node_modules/image-q/package.json b/node_modules/image-q/package.json similarity index 100% rename from project starter code/node_modules/image-q/package.json rename to node_modules/image-q/package.json diff --git a/project starter code/node_modules/image-q/src/basicAPI.ts b/node_modules/image-q/src/basicAPI.ts similarity index 100% rename from project starter code/node_modules/image-q/src/basicAPI.ts rename to node_modules/image-q/src/basicAPI.ts diff --git a/project starter code/node_modules/image-q/src/constants/bt709.ts b/node_modules/image-q/src/constants/bt709.ts similarity index 100% rename from project starter code/node_modules/image-q/src/constants/bt709.ts rename to node_modules/image-q/src/constants/bt709.ts diff --git a/project starter code/node_modules/image-q/src/constants/index.ts b/node_modules/image-q/src/constants/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/constants/index.ts rename to node_modules/image-q/src/constants/index.ts diff --git a/project starter code/node_modules/image-q/src/conversion/index.ts b/node_modules/image-q/src/conversion/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/index.ts rename to node_modules/image-q/src/conversion/index.ts diff --git a/project starter code/node_modules/image-q/src/conversion/lab2rgb.ts b/node_modules/image-q/src/conversion/lab2rgb.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/lab2rgb.ts rename to node_modules/image-q/src/conversion/lab2rgb.ts diff --git a/project starter code/node_modules/image-q/src/conversion/lab2xyz.ts b/node_modules/image-q/src/conversion/lab2xyz.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/lab2xyz.ts rename to node_modules/image-q/src/conversion/lab2xyz.ts diff --git a/project starter code/node_modules/image-q/src/conversion/rgb2hsl.ts b/node_modules/image-q/src/conversion/rgb2hsl.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/rgb2hsl.ts rename to node_modules/image-q/src/conversion/rgb2hsl.ts diff --git a/project starter code/node_modules/image-q/src/conversion/rgb2lab.ts b/node_modules/image-q/src/conversion/rgb2lab.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/rgb2lab.ts rename to node_modules/image-q/src/conversion/rgb2lab.ts diff --git a/project starter code/node_modules/image-q/src/conversion/rgb2xyz.ts b/node_modules/image-q/src/conversion/rgb2xyz.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/rgb2xyz.ts rename to node_modules/image-q/src/conversion/rgb2xyz.ts diff --git a/project starter code/node_modules/image-q/src/conversion/xyz2lab.ts b/node_modules/image-q/src/conversion/xyz2lab.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/xyz2lab.ts rename to node_modules/image-q/src/conversion/xyz2lab.ts diff --git a/project starter code/node_modules/image-q/src/conversion/xyz2rgb.ts b/node_modules/image-q/src/conversion/xyz2rgb.ts similarity index 100% rename from project starter code/node_modules/image-q/src/conversion/xyz2rgb.ts rename to node_modules/image-q/src/conversion/xyz2rgb.ts diff --git a/project starter code/node_modules/image-q/src/distance/cie94.ts b/node_modules/image-q/src/distance/cie94.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/cie94.ts rename to node_modules/image-q/src/distance/cie94.ts diff --git a/project starter code/node_modules/image-q/src/distance/ciede2000.ts b/node_modules/image-q/src/distance/ciede2000.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/ciede2000.ts rename to node_modules/image-q/src/distance/ciede2000.ts diff --git a/project starter code/node_modules/image-q/src/distance/cmetric.ts b/node_modules/image-q/src/distance/cmetric.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/cmetric.ts rename to node_modules/image-q/src/distance/cmetric.ts diff --git a/project starter code/node_modules/image-q/src/distance/distanceCalculator.ts b/node_modules/image-q/src/distance/distanceCalculator.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/distanceCalculator.ts rename to node_modules/image-q/src/distance/distanceCalculator.ts diff --git a/project starter code/node_modules/image-q/src/distance/euclidean.ts b/node_modules/image-q/src/distance/euclidean.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/euclidean.ts rename to node_modules/image-q/src/distance/euclidean.ts diff --git a/project starter code/node_modules/image-q/src/distance/index.ts b/node_modules/image-q/src/distance/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/index.ts rename to node_modules/image-q/src/distance/index.ts diff --git a/project starter code/node_modules/image-q/src/distance/manhattan.ts b/node_modules/image-q/src/distance/manhattan.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/manhattan.ts rename to node_modules/image-q/src/distance/manhattan.ts diff --git a/project starter code/node_modules/image-q/src/distance/pngQuant.ts b/node_modules/image-q/src/distance/pngQuant.ts similarity index 100% rename from project starter code/node_modules/image-q/src/distance/pngQuant.ts rename to node_modules/image-q/src/distance/pngQuant.ts diff --git a/project starter code/node_modules/image-q/src/image/array.ts b/node_modules/image-q/src/image/array.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/array.ts rename to node_modules/image-q/src/image/array.ts diff --git a/project starter code/node_modules/image-q/src/image/imageQuantizer.ts b/node_modules/image-q/src/image/imageQuantizer.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/imageQuantizer.ts rename to node_modules/image-q/src/image/imageQuantizer.ts diff --git a/project starter code/node_modules/image-q/src/image/imageQuantizerYieldValue.ts b/node_modules/image-q/src/image/imageQuantizerYieldValue.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/imageQuantizerYieldValue.ts rename to node_modules/image-q/src/image/imageQuantizerYieldValue.ts diff --git a/project starter code/node_modules/image-q/src/image/index.ts b/node_modules/image-q/src/image/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/index.ts rename to node_modules/image-q/src/image/index.ts diff --git a/project starter code/node_modules/image-q/src/image/nearestColor.ts b/node_modules/image-q/src/image/nearestColor.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/nearestColor.ts rename to node_modules/image-q/src/image/nearestColor.ts diff --git a/project starter code/node_modules/image-q/src/image/riemersma.ts b/node_modules/image-q/src/image/riemersma.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/riemersma.ts rename to node_modules/image-q/src/image/riemersma.ts diff --git a/project starter code/node_modules/image-q/src/image/spaceFillingCurves/hilbertCurve.ts b/node_modules/image-q/src/image/spaceFillingCurves/hilbertCurve.ts similarity index 100% rename from project starter code/node_modules/image-q/src/image/spaceFillingCurves/hilbertCurve.ts rename to node_modules/image-q/src/image/spaceFillingCurves/hilbertCurve.ts diff --git a/project starter code/node_modules/image-q/src/index.ts b/node_modules/image-q/src/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/index.ts rename to node_modules/image-q/src/index.ts diff --git a/project starter code/node_modules/image-q/src/missing-types.d.ts b/node_modules/image-q/src/missing-types.d.ts similarity index 100% rename from project starter code/node_modules/image-q/src/missing-types.d.ts rename to node_modules/image-q/src/missing-types.d.ts diff --git a/project starter code/node_modules/image-q/src/palette/index.ts b/node_modules/image-q/src/palette/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/index.ts rename to node_modules/image-q/src/palette/index.ts diff --git a/project starter code/node_modules/image-q/src/palette/neuquant/neuquant.ts b/node_modules/image-q/src/palette/neuquant/neuquant.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/neuquant/neuquant.ts rename to node_modules/image-q/src/palette/neuquant/neuquant.ts diff --git a/project starter code/node_modules/image-q/src/palette/neuquant/neuquantFloat.ts b/node_modules/image-q/src/palette/neuquant/neuquantFloat.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/neuquant/neuquantFloat.ts rename to node_modules/image-q/src/palette/neuquant/neuquantFloat.ts diff --git a/project starter code/node_modules/image-q/src/palette/paletteQuantizer.ts b/node_modules/image-q/src/palette/paletteQuantizer.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/paletteQuantizer.ts rename to node_modules/image-q/src/palette/paletteQuantizer.ts diff --git a/project starter code/node_modules/image-q/src/palette/paletteQuantizerYieldValue.ts b/node_modules/image-q/src/palette/paletteQuantizerYieldValue.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/paletteQuantizerYieldValue.ts rename to node_modules/image-q/src/palette/paletteQuantizerYieldValue.ts diff --git a/project starter code/node_modules/image-q/src/palette/rgbquant/colorHistogram.ts b/node_modules/image-q/src/palette/rgbquant/colorHistogram.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/rgbquant/colorHistogram.ts rename to node_modules/image-q/src/palette/rgbquant/colorHistogram.ts diff --git a/project starter code/node_modules/image-q/src/palette/rgbquant/rgbquant.ts b/node_modules/image-q/src/palette/rgbquant/rgbquant.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/rgbquant/rgbquant.ts rename to node_modules/image-q/src/palette/rgbquant/rgbquant.ts diff --git a/project starter code/node_modules/image-q/src/palette/wu/wuQuant.ts b/node_modules/image-q/src/palette/wu/wuQuant.ts similarity index 100% rename from project starter code/node_modules/image-q/src/palette/wu/wuQuant.ts rename to node_modules/image-q/src/palette/wu/wuQuant.ts diff --git a/project starter code/node_modules/image-q/src/quality/index.ts b/node_modules/image-q/src/quality/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/quality/index.ts rename to node_modules/image-q/src/quality/index.ts diff --git a/project starter code/node_modules/image-q/src/quality/ssim.ts b/node_modules/image-q/src/quality/ssim.ts similarity index 100% rename from project starter code/node_modules/image-q/src/quality/ssim.ts rename to node_modules/image-q/src/quality/ssim.ts diff --git a/project starter code/node_modules/image-q/src/utils/arithmetic.ts b/node_modules/image-q/src/utils/arithmetic.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/arithmetic.ts rename to node_modules/image-q/src/utils/arithmetic.ts diff --git a/project starter code/node_modules/image-q/src/utils/hueStatistics.ts b/node_modules/image-q/src/utils/hueStatistics.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/hueStatistics.ts rename to node_modules/image-q/src/utils/hueStatistics.ts diff --git a/project starter code/node_modules/image-q/src/utils/index.ts b/node_modules/image-q/src/utils/index.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/index.ts rename to node_modules/image-q/src/utils/index.ts diff --git a/project starter code/node_modules/image-q/src/utils/palette.ts b/node_modules/image-q/src/utils/palette.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/palette.ts rename to node_modules/image-q/src/utils/palette.ts diff --git a/project starter code/node_modules/image-q/src/utils/point.ts b/node_modules/image-q/src/utils/point.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/point.ts rename to node_modules/image-q/src/utils/point.ts diff --git a/project starter code/node_modules/image-q/src/utils/pointContainer.ts b/node_modules/image-q/src/utils/pointContainer.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/pointContainer.ts rename to node_modules/image-q/src/utils/pointContainer.ts diff --git a/project starter code/node_modules/image-q/src/utils/progressTracker.ts b/node_modules/image-q/src/utils/progressTracker.ts similarity index 100% rename from project starter code/node_modules/image-q/src/utils/progressTracker.ts rename to node_modules/image-q/src/utils/progressTracker.ts diff --git a/project starter code/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE similarity index 100% rename from project starter code/node_modules/inherits/LICENSE rename to node_modules/inherits/LICENSE diff --git a/project starter code/node_modules/inherits/README.md b/node_modules/inherits/README.md similarity index 100% rename from project starter code/node_modules/inherits/README.md rename to node_modules/inherits/README.md diff --git a/project starter code/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js similarity index 100% rename from project starter code/node_modules/inherits/inherits.js rename to node_modules/inherits/inherits.js diff --git a/project starter code/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js similarity index 100% rename from project starter code/node_modules/inherits/inherits_browser.js rename to node_modules/inherits/inherits_browser.js diff --git a/project starter code/node_modules/inherits/package.json b/node_modules/inherits/package.json similarity index 100% rename from project starter code/node_modules/inherits/package.json rename to node_modules/inherits/package.json diff --git a/project starter code/node_modules/ipaddr.js/LICENSE b/node_modules/ipaddr.js/LICENSE similarity index 100% rename from project starter code/node_modules/ipaddr.js/LICENSE rename to node_modules/ipaddr.js/LICENSE diff --git a/project starter code/node_modules/ipaddr.js/README.md b/node_modules/ipaddr.js/README.md similarity index 100% rename from project starter code/node_modules/ipaddr.js/README.md rename to node_modules/ipaddr.js/README.md diff --git a/project starter code/node_modules/ipaddr.js/ipaddr.min.js b/node_modules/ipaddr.js/ipaddr.min.js similarity index 100% rename from project starter code/node_modules/ipaddr.js/ipaddr.min.js rename to node_modules/ipaddr.js/ipaddr.min.js diff --git a/project starter code/node_modules/ipaddr.js/lib/ipaddr.js b/node_modules/ipaddr.js/lib/ipaddr.js similarity index 100% rename from project starter code/node_modules/ipaddr.js/lib/ipaddr.js rename to node_modules/ipaddr.js/lib/ipaddr.js diff --git a/project starter code/node_modules/ipaddr.js/lib/ipaddr.js.d.ts b/node_modules/ipaddr.js/lib/ipaddr.js.d.ts similarity index 100% rename from project starter code/node_modules/ipaddr.js/lib/ipaddr.js.d.ts rename to node_modules/ipaddr.js/lib/ipaddr.js.d.ts diff --git a/project starter code/node_modules/ipaddr.js/package.json b/node_modules/ipaddr.js/package.json similarity index 100% rename from project starter code/node_modules/ipaddr.js/package.json rename to node_modules/ipaddr.js/package.json diff --git a/project starter code/node_modules/is-function/LICENSE b/node_modules/is-function/LICENSE similarity index 100% rename from project starter code/node_modules/is-function/LICENSE rename to node_modules/is-function/LICENSE diff --git a/project starter code/node_modules/is-function/README.md b/node_modules/is-function/README.md similarity index 100% rename from project starter code/node_modules/is-function/README.md rename to node_modules/is-function/README.md diff --git a/project starter code/node_modules/is-function/index.js b/node_modules/is-function/index.js similarity index 100% rename from project starter code/node_modules/is-function/index.js rename to node_modules/is-function/index.js diff --git a/project starter code/node_modules/is-function/package.json b/node_modules/is-function/package.json similarity index 100% rename from project starter code/node_modules/is-function/package.json rename to node_modules/is-function/package.json diff --git a/project starter code/node_modules/is-function/test.js b/node_modules/is-function/test.js similarity index 100% rename from project starter code/node_modules/is-function/test.js rename to node_modules/is-function/test.js diff --git a/node_modules/jimp/CHANGELOG.md b/node_modules/jimp/CHANGELOG.md new file mode 100644 index 00000000..8f76f63d --- /dev/null +++ b/node_modules/jimp/CHANGELOG.md @@ -0,0 +1,134 @@ +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Fix edgeHandling types [#1080](https://github.com/jimp-dev/jimp/pull/1080) ([@domdomegg](https://github.com/domdomegg)) +- Readme: Fix measureText sample code [#1102](https://github.com/jimp-dev/jimp/pull/1102) ([@dkong](https://github.com/dkong) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### ⚠️ Pushed to `master` + +- try this ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 3 + +- Adam Jones ([@domdomegg](https://github.com/domdomegg)) +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Dara Kong ([@dkong](https://github.com/dkong)) + +--- + +# v0.15.0 (Fri Aug 07 2020) + +#### 🚀 Enhancement + +- Remove 'browser' field from main jimp package's package.json. [#918](https://github.com/oliver-moran/jimp/pull/918) ([@Gustavo6046](https://github.com/Gustavo6046)) + +#### Authors: 1 + +- Gustavo Ramos Rehermann ([@Gustavo6046](https://github.com/Gustavo6046)) + +--- + +# v0.14.0 (Mon Jun 29 2020) + +#### 🚀 Enhancement + +- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) + +#### Authors: 1 + +- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) + +--- + +# v0.13.0 (Fri Jun 05 2020) + +#### 🚀 Enhancement + +- Add single frame encoder for type-gif [#899](https://github.com/oliver-moran/jimp/pull/899) ([@jeffbseeking](https://github.com/jeffbseeking) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Jeff Bonnes ([@jeffbseeking](https://github.com/jeffbseeking)) + +--- + +# v0.11.0 (Fri May 15 2020) + +#### 🚀 Enhancement + +- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) + +#### Authors: 1 + +- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) + +--- + +# v0.10.2 (Tue Apr 14 2020) + +#### 🐛 Bug Fix + +- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee)) + +#### Authors: 1 + +- Sebastian Skałacki ([@skalee](https://github.com/skalee)) + +--- + +# v0.10.0 (Mon Mar 30 2020) + +#### 🚀 Enhancement + +- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) + +#### Authors: 1 + +- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) + +--- + +# v0.9.7 (Fri Mar 27 2020) + +#### 🐛 Bug Fix + +- Added missing plugins to the types [#863](https://github.com/oliver-moran/jimp/pull/863) ([@crutchcorn](https://github.com/crutchcorn)) + +#### Authors: 1 + +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) + +--- + +# v0.9.6 (Wed Mar 18 2020) + +#### 🐛 Bug Fix + +- upgrade auto [#860](https://github.com/oliver-moran/jimp/pull/860) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### 🏠 Internal + +- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) + +--- + +# v0.9.3 (Tue Nov 26 2019) + +#### 🐛 Bug Fix + +- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` + - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/jimp/LICENSE b/node_modules/jimp/LICENSE similarity index 100% rename from project starter code/node_modules/jimp/LICENSE rename to node_modules/jimp/LICENSE diff --git a/node_modules/jimp/README.md b/node_modules/jimp/README.md new file mode 100644 index 00000000..320698df --- /dev/null +++ b/node_modules/jimp/README.md @@ -0,0 +1,794 @@ +
+ +

Jimp

+

JavaScript Image Manipulation Program

+
+ +The "JavaScript Image Manipulation Program" :-) + +An image processing library for Node written entirely in JavaScript, with zero native dependencies. + +The default jimp configuration. + +Supported types: + +- `@jimp/jpeg` +- `@jimp/png` +- `@jimp/bmp` +- `@jimp/tiff` +- `@jimp/gif` + +## Installation + +`npm install --save jimp` + +Example usage (Promise will never resolve if callback is passed): + +```js +var Jimp = require("jimp"); + +// open a file called "lenna.png" +Jimp.read("lenna.png", (err, lenna) => { + if (err) throw err; + lenna + .resize(256, 256) // resize + .quality(60) // set JPEG quality + .greyscale() // set greyscale + .write("lena-small-bw.jpg"); // save +}); +``` + +Using promises: + +```js +Jimp.read("lenna.png") + .then((lenna) => { + return lenna + .resize(256, 256) // resize + .quality(60) // set JPEG quality + .greyscale() // set greyscale + .write("lena-small-bw.jpg"); // save + }) + .catch((err) => { + console.error(err); + }); +``` + +## TypeScript Usage + +If you're using this library with TypeScript the method of importing slightly differs from JavaScript. Instead of using require, you must import it with ES6 default import scheme + +```ts +import Jimp from "jimp"; +``` + +This requires setting the `allowSyntheticDefaultImports` compiler option to `true` in your `tsconfig` + +**Note 1**: `esModuleInterop` implicitly sets `allowSyntheticDefaultImports` to `true` + +**Note 2**: `allowSyntheticDefaultImports` nor `esModuleInterop` change the runtime behavior of your code at all. They are just flags that tells TypeScript you need the compatibility they offer. + +## Module Build + +If you're using a web bundles (webpack, rollup, parcel) you can benefit from using the `module` build of jimp. Using the module build will allow your bundler to understand your code better and exclude things you aren't using. + +```js +import Jimp from "jimp/es"; +``` + +### WebPack + +If you're using webpack you can set `process.browser` to true and your build of jimp will exclude certain parts, making it load faster. + +```js +{ + plugins: [ + new webpack.DefinePlugin({ + 'process.browser': 'true' + }), + ... + ], +} +``` + +## Basic usage + +The static `Jimp.read` method takes the path to a file, URL, dimensions, a Jimp instance or a buffer and returns a Promise: + +```js +Jimp.read("./path/to/image.jpg") + .then((image) => { + // Do stuff with the image. + }) + .catch((err) => { + // Handle an exception. + }); + +Jimp.read("http://www.example.com/path/to/lenna.jpg") + .then((image) => { + // Do stuff with the image. + }) + .catch((err) => { + // Handle an exception. + }); + +Jimp.read(jimpInstance) + .then((image) => { + // Do stuff with the image. + }) + .catch((err) => { + // Handle an exception. + }); + +Jimp.read(buffer) + .then((image) => { + // Do stuff with the image. + }) + .catch((err) => { + // Handle an exception. + }); +``` + +In some cases, you need to pass additional parameters with an image's URL. You can pass an object to the `Jimp.read` method: + +```js +Jimp.read({ + url: 'http://www.example.com/path/to/lenna.jpg', // Required! + headers: {}, + ... +}) + .then(image => { + // Do stuff with the image. + }) + .catch(err => { + // Handle an exception. + }); +``` + +Jimp uses [phin](https://github.com/ethanent/phin) as it's HTTP client. Phin uses [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods for making HTTP requests. Phin parses a `url` with the `url.parse(...)` method and passes it with all the other parameters as an `options` to the [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods. + +Briefly speaking, you can pass any options from [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback), [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) or even [`tls.connect(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/tls.html#tls_tls_connect_options_callback). + +Phin parses a `url` and combines it with any options you want. This behavior can be very useful when you need to pass some additional `headers`. Also, you can pass `rejectUnauthorized: false` if you don't require an SSL certificate to be valid (it helps to prevent `unable to verify the first certificate` error). + +The convenience method `Jimp.create` also exists. It is just a wrapper around `Jimp.read`. + +### Custom Constructor + +You might want to initialize jimp in so custom way. To do this Jimp exposes the static function `appendConstructorOption`. The appended constructor options run after all the defaults. + +To define a custom constructor provide a name for it, a function to call to determine if the arguments provided to jimp match your constructor, and a function called where you can construct the image however you want. + +```js +Jimp.appendConstructorOption( + "Name of Option", + (args) => arg.hasSomeCustomThing, + function (resolve, reject, args) { + this.bitmap = customParser(args); + resolve(); + } +); +``` + +If you don't want to handle parsing the bitmap. For example if you want to do some sort of authentication for URL request. Jimp exposes `parseBitmap` so you can fall back to jimp to do the heavy lifting. + +Parse bitmap takes the raw image data in a Buffer, a path (optional), and a node style callback. + +```js +Jimp.appendConstructorOption( + "Custom Url", + (options) => options.url, + function (resolve, reject, options) { + phin(options, (err, res) => { + if (err) { + return reject(err); + } + + this.parseBitmap(res.body, options.url, (err) => { + if (err) { + return reject(err); + } + + resolve(); + }); + }); + } +); +``` + +### Methods + +Once the promise is fulfilled, the following methods can be called on the image: + +```js +/* Resize */ +image.contain( w, h[, alignBits || mode, mode] ); // scale the image to the given width and height, some parts of the image may be letter boxed +image.cover( w, h[, alignBits || mode, mode] ); // scale the image to the given width and height, some parts of the image may be clipped +image.resize( w, h[, mode] ); // resize the image. Jimp.AUTO can be passed as one of the values. +image.scale( f[, mode] ); // scale the image by the factor f +image.scaleToFit( w, h[, mode] ); // scale the image to the largest size that fits inside the given width and height + +// An optional resize mode can be passed with all resize methods. + +/* Crop */ +image.autocrop([tolerance, frames]); // automatically crop same-color borders from image (if any), frames must be a Boolean +image.autocrop(options); // automatically crop same-color borders from image (if any), options may contain tolerance, cropOnlyFrames, cropSymmetric, leaveBorder +image.crop( x, y, w, h ); // crop to the given region + +/* Composing */ +image.blit( src, x, y, [srcx, srcy, srcw, srch] ); + // blit the image with another Jimp image at x, y, optionally cropped. +image.composite( src, x, y, [{ mode, opacitySource, opacityDest }] ); // composites another Jimp image over this image at x, y +image.mask( src, x, y ); // masks the image with another Jimp image at x, y using average pixel value +image.convolute( kernel ); // applies a convolution kernel matrix to the image or a region + +/* Flip and rotate */ +image.flip( horz, vert ); // flip the image horizontally or vertically +image.mirror( horz, vert ); // an alias for flip +image.rotate( deg[, mode] ); // rotate the image clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized. + +/* Colour */ +image.brightness( val ); // adjust the brighness by a value -1 to +1 +image.contrast( val ); // adjust the contrast by a value -1 to +1 +image.dither565(); // ordered dithering of the image and reduce color space to 16-bits (RGB565) +image.greyscale(); // remove colour from the image +image.invert(); // invert the image colours +image.normalize(); // normalize the channels in an image + +/* Alpha channel */ +image.hasAlpha(); // determines if an image contains opaque pixels +image.fade( f ); // an alternative to opacity, fades the image by a factor 0 - 1. 0 will haven no effect. 1 will turn the image +image.opacity( f ); // multiply the alpha channel by each pixel by the factor f, 0 - 1 +image.opaque(); // set the alpha channel on every pixel to fully opaque +image.background( hex ); // set the default new pixel colour (e.g. 0xFFFFFFFF or 0x00000000) for by some operations (e.g. image.contain and + +/* Blurs */ +image.gaussian( r ); // Gaussian blur the image by r pixels (VERY slow) +image.blur( r ); // fast blur the image by r pixels + +/* Effects */ +image.posterize( n ); // apply a posterization effect with n level +image.sepia(); // apply a sepia wash to the image +image.pixelate( size[, x, y, w, h ]); // apply a pixelation effect to the image or a region + +/* 3D */ +image.displace( map, offset ); // displaces the image pixels based on the provided displacement map. Useful for making stereoscopic 3D images. +``` + +Some of these methods are irreversible, so it can be useful to perform them on a clone of the original image: + +```js +image.clone(); // returns a clone of the image +``` + +(Contributions of more methods are welcome!) + +### Resize modes + +The default resizing algorithm uses a bilinear method as follows: + +```js +image.resize(250, 250); // resize the image to 250 x 250 +image.resize(Jimp.AUTO, 250); // resize the height to 250 and scale the width accordingly +image.resize(250, Jimp.AUTO); // resize the width to 250 and scale the height accordingly +``` + +Optionally, the following constants can be passed to choose a particular resizing algorithm: + +```js +Jimp.RESIZE_NEAREST_NEIGHBOR; +Jimp.RESIZE_BILINEAR; +Jimp.RESIZE_BICUBIC; +Jimp.RESIZE_HERMITE; +Jimp.RESIZE_BEZIER; +``` + +For example: + +```js +image.resize(250, 250, Jimp.RESIZE_BEZIER); +``` + +### Align modes + +The following constants can be passed to the `image.cover`, `image.contain` and `image.print` methods: + +```js +Jimp.HORIZONTAL_ALIGN_LEFT; +Jimp.HORIZONTAL_ALIGN_CENTER; +Jimp.HORIZONTAL_ALIGN_RIGHT; + +Jimp.VERTICAL_ALIGN_TOP; +Jimp.VERTICAL_ALIGN_MIDDLE; +Jimp.VERTICAL_ALIGN_BOTTOM; +``` + +Where the align mode changes the position of the associated axis as described in the table below. + +| Align Mode | Axis Point | +| ------------------------------ | ----------------------------------------------- | +| `Jimp.HORIZONTAL_ALIGN_LEFT` | Positions the x-axis at the left of the image | +| `Jimp.HORIZONTAL_ALIGN_CENTER` | Positions the x-axis at the center of the image | +| `Jimp.HORIZONTAL_ALIGN_RIGHT` | Positions the x-axis at the right of the image | +| `Jimp.VERTICAL_ALIGN_TOP` | Positions the y-axis at the top of the image | +| `Jimp.VERTICAL_ALIGN_MIDDLE` | Positions the y-axis at the center of the image | +| `Jimp.VERTICAL_ALIGN_BOTTOM` | Positions the y-axis at the bottom of the image | + +For example: + +```js +image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); +``` + +Default align modes for `image.cover` and `image.contain` are: + +```js +Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; +``` + +Default align modes for `image.print` are: + +```js +{ + alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT, + alignmentY: Jimp.VERTICAL_ALIGN_TOP +} +``` + +### Compositing and blend modes + +The following modes can be used for compositing two images together. mode defaults to Jimp.BLEND_SOURCE_OVER. + +```js +Jimp.BLEND_SOURCE_OVER; +Jimp.BLEND_DESTINATION_OVER; +Jimp.BLEND_MULTIPLY; +Jimp.BLEND_ADD; +Jimp.BLEND_SCREEN; +Jimp.BLEND_OVERLAY; +Jimp.BLEND_DARKEN; +Jimp.BLEND_LIGHTEN; +Jimp.BLEND_HARDLIGHT; +Jimp.BLEND_DIFFERENCE; +Jimp.BLEND_EXCLUSION; +``` + +```js +image.composite(srcImage, 100, 0, { + mode: Jimp.BLEND_MULTIPLY, + opacitySource: 0.5, + opacityDest: 0.9, +}); +``` + +### Writing text + +Jimp supports basic typography using BMFont format (.fnt) even ones in different languages! Just find a bitmap font that is suitable [bitmap fonts](https://en.wikipedia.org/wiki/Bitmap_fonts): + +```js +Jimp.loadFont(pathOrURL).then((font) => { + // load font from .fnt file + image.print(font, x, y, message); // print a message on an image. message can be a any type + image.print(font, x, y, message, maxWidth); // print a message on an image with text wrapped at maxWidth +}); +``` + +Alignment modes are supported by replacing the `str` argument with an object containing `text`, `alignmentX` and `alignmentY`. `alignmentX` defaults to `Jimp.HORIZONTAL_ALIGN_LEFT` and `alignmentY` defaults to `Jimp.VERTICAL_ALIGN_TOP`. + +```js +Jimp.loadFont(pathOrURL).then((font) => { + image.print( + font, + x, + y, + { + text: "Hello world!", + alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, + }, + maxWidth, + maxHeight + ); // prints 'Hello world!' on an image, middle and center-aligned, when x = 0 and y = 0 +}); +``` + +```js +Jimp.loadFont(path, cb); // using a callback pattern +``` + +BMFont fonts are raster based and fixed in size and colour. Jimp comes with a set of fonts that can be used on images: + +```js +Jimp.FONT_SANS_8_BLACK; // Open Sans, 8px, black +Jimp.FONT_SANS_10_BLACK; // Open Sans, 10px, black +Jimp.FONT_SANS_12_BLACK; // Open Sans, 12px, black +Jimp.FONT_SANS_14_BLACK; // Open Sans, 14px, black +Jimp.FONT_SANS_16_BLACK; // Open Sans, 16px, black +Jimp.FONT_SANS_32_BLACK; // Open Sans, 32px, black +Jimp.FONT_SANS_64_BLACK; // Open Sans, 64px, black +Jimp.FONT_SANS_128_BLACK; // Open Sans, 128px, black + +Jimp.FONT_SANS_8_WHITE; // Open Sans, 8px, white +Jimp.FONT_SANS_16_WHITE; // Open Sans, 16px, white +Jimp.FONT_SANS_32_WHITE; // Open Sans, 32px, white +Jimp.FONT_SANS_64_WHITE; // Open Sans, 64px, white +Jimp.FONT_SANS_128_WHITE; // Open Sans, 128px, white +``` + +These can be used as follows: + +```js +Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then((font) => { + image.print(font, 10, 10, "Hello world!"); +}); +``` + +#### Measuring text + +If you need to do calculations on where to place your text jimp provides two methods that measure how wide and how tall a piece of text will be. You can use these methods to lay out multiple pieces of text in relation to each other + +```js +Jimp.measureText(await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK), "Some string"); // width of text +Jimp.measureTextHeight( + await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK), + "Some string", + 100 +); // height of text +``` + +#### Staggering Text + +If you need to stagger text position along the x or y-axis the print method also returns the final coordinates as an argument to the callback. + +```js +Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then((font) => { + image.print( + font, + 10, + 10, + "Hello world that wraps!", + 50, + (err, image, { x, y }) => { + image.print(font, x, y + 20, "More text on another line", 50); + } + ); +}); +``` + +Online tools are also available to convert TTF fonts to BMFont format. They can be used to create color font or sprite packs. + +:star: [Littera](http://kvazars.com/littera/) + +:star: [Hiero](https://github.com/libgdx/libgdx/wiki/Hiero) + +## Writing to files and buffers + +### Writing to files + +The image can be written to disk in PNG, JPEG or BMP format (based on the save path extension or if no extension is provided the original image's MIME type which, if not available, defaults to PNG) using: + +```js +image.write(path, cb); // Node-style callback will be fired when write is successful +image.writeAsync(path); // Returns Promise +``` + +The original extension for an image (or "png") can accessed as using `image.getExtension()`. The following will save an image using its original format: + +```js +var file = "new_name." + image.getExtension(); +//or +var file = "new_name"; // with no extension +image.write(file); +``` + +### Writing to Buffers + +A PNG, JPEG or BMP binary Buffer of an image (e.g. for storage in a database) can be generated using: + +```js +image.getBuffer(mime, cb); // Node-style callback will be fired with result +image.getBufferAsync(mime); // Returns Promise +``` + +For convenience, supported MIME types are available as static properties: + +```js +Jimp.MIME_PNG; // "image/png" +Jimp.MIME_JPEG; // "image/jpeg" +Jimp.MIME_BMP; // "image/bmp" +``` + +If `Jimp.AUTO` is passed as the MIME type then the original MIME type for the image (or "image/png") will be used. Alternatively, `image.getMIME()` will return the original MIME type of the image (or "image/png"). + +### Data URI + +A Base64 data URI can be generated in the same way as a Buffer, using: + +```js +image.getBase64(mime, cb); // Node-style callback will be fired with result +image.getBase64Async(mime); // Returns Promise +``` + +### PNG and JPEG quality + +The quality of JPEGs can be set with: + +```js +image.quality(n); // set the quality of saved JPEG, 0 - 100 +``` + +The format of PNGs can be set with: + +```js +image.rgba(bool); // set whether PNGs are saved as RGBA (true, default) or RGB (false) +image.filterType(number); // set the filter type for the saved PNG +image.deflateLevel(number); // set the deflate level for the saved PNG +Jimp.deflateStrategy(number); // set the deflate for the saved PNG (0-3) +``` + +For convenience, supported filter types are available as static properties: + +```js +Jimp.PNG_FILTER_AUTO; // -1 +Jimp.PNG_FILTER_NONE; // 0 +Jimp.PNG_FILTER_SUB; // 1 +Jimp.PNG_FILTER_UP; // 2 +Jimp.PNG_FILTER_AVERAGE; // 3 +Jimp.PNG_FILTER_PATH; // 4 +``` + +## Advanced usage + +### Colour manipulation + +Jimp supports advanced colour manipulation using a single method as follows: + +```js +image.color([ + { apply: "hue", params: [-90] }, + { apply: "lighten", params: [50] }, + { apply: "xor", params: ["#06D"] }, +]); +``` + +The method supports the following modifiers: + +| Modifier | Description | +| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **lighten** {amount} | Lighten the color a given amount, from 0 to 100. Providing 100 will always return white (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **brighten** {amount} | Brighten the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **darken** {amount} | Darken the color a given amount, from 0 to 100. Providing 100 will always return black (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **desaturate** {amount} | Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **saturate** {amount} | Saturate the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **greyscale** {amount} | Completely desaturates a color into greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **spin** {degree} | Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing - since it sets the hue back to what it was before. (works through [TinyColor](https://github.com/bgrins/TinyColor)) | +| **hue** {degree} | Alias for **spin** | +| **mix** {color, amount} | Mixes colors by their RGB component values. Amount is opacity of overlaying color | +| **tint** {amount} | Same as applying **mix** with white color | +| **shade** {amount} | Same as applying **mix** with black color | +| **xor** {color} | Treats the two colors as bitfields and applies an XOR operation to the red, green, and blue components | +| **red** {amount} | Modify Red component by a given amount | +| **green** {amount} | Modify Green component by a given amount | +| **blue** {amount} | Modify Blue component by a given amount | + +### Convolution matrix + +Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanation with examples at [GIMP's Convolution Matrix plugin](https://docs.gimp.org/2.6/en/plug-in-convmatrix.html) + +Implement emboss effect: + +```js +image.convolute([ + [-2, -1, 0], + [-1, 1, 1], + [0, 1, 2], +]); +``` + +### Low-level manipulation + +Jimp enables low-level manipulation of images in memory through the bitmap property of each Jimp object: + +```js +image.bitmap.data; // a Buffer of the raw bitmap data +image.bitmap.width; // the width of the image +image.bitmap.height; // the height of the image +``` + +This data can be manipulated directly, but remember: garbage in, garbage out. + +A helper method is available to scan a region of the bitmap: + +```js +image.scan(x, y, w, h, f); // scan a given region of the bitmap and call the function f on every pixel +``` + +Example usage: + +```js +image.scan(0, 0, image.bitmap.width, image.bitmap.height, function (x, y, idx) { + // x, y is the position of this pixel on the image + // idx is the position start position of this rgba tuple in the bitmap Buffer + // this is the image + + var red = this.bitmap.data[idx + 0]; + var green = this.bitmap.data[idx + 1]; + var blue = this.bitmap.data[idx + 2]; + var alpha = this.bitmap.data[idx + 3]; + + // rgba values run from 0 - 255 + // e.g. this.bitmap.data[idx] = 0; // removes red from this pixel +}); +``` + +If you need to do something with the image at the end of the scan: + +```js +image.scan(0, 0, image.bitmap.width, image.bitmap.height, function (x, y, idx) { + // do your stuff.. + + if (x == image.bitmap.width - 1 && y == image.bitmap.height - 1) { + // image scan finished, do your stuff + } +}); +``` + +It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication: + +```js +for (const { x, y, idx, image } of image.scanIterator( + 0, + 0, + image.bitmap.width, + image.bitmap.height +)) { +} +``` + +A helper to locate a particular pixel within the raw bitmap buffer: + +```js +image.getPixelIndex(x, y); // returns the index within image.bitmap.data +``` + +One of the following may be optionally passed as a third parameter to indicate a strategy for x, y positions that are outside of boundaries of the image: + +```js +Jimp.EDGE_EXTEND = 1; +Jimp.EDGE_WRAP = 2; +Jimp.EDGE_CROP = 3; +``` + +Alternatively, you can manipulate individual pixels using the following these functions: + +```js +image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF +image.setPixelColor(hex, x, y); // sets the colour of that pixel +``` + +Two static helper functions exist to convert RGBA values into single integer (hex) values: + +```js +Jimp.rgbaToInt(r, g, b, a); // e.g. converts 255, 255, 255, 255 to 0xFFFFFFFF +Jimp.intToRGBA(hex); // e.g. converts 0xFFFFFFFF to {r: 255, g: 255, b: 255, a:255} +``` + +You can convert a css color (Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to its hexadecimal equivalent: + +```js +Jimp.cssColorToHex(cssColor); // e.g. converts #FF00FF to 0xFF00FFFF +``` + +### Creating new images + +If you want to begin with an empty Jimp image, you can call the Jimp constructor passing the width and height of the image to create and a Node-style callback: + +```js +new Jimp(256, 256, (err, image) => { + // this image is 256 x 256, every pixel is set to 0x00000000 +}); +``` + +You can optionally set the pixel colour as follows: + +```js +new Jimp(256, 256, 0xff0000ff, (err, image) => { + // this image is 256 x 256, every pixel is set to 0xFF0000FF +}); +``` + +Or you can use a css color format: + +```js +new Jimp(256, 256, "#FF00FF", (err, image) => { + // this image is 256 x 256, every pixel is set to #FF00FF +}); +``` + +You can also initialize a new Jimp image with a raw image buffer: + +```js +new Jimp({ data: buffer, width: 1280, height: 768 }, (err, image) => { + // this image is 1280 x 768, pixels are loaded from the given buffer. +}); +``` + +This can be useful for interoperating with other image processing libraries. `buffer` is expected to be four-channel (rgba) image data. + +## Comparing images + +To generate a [perceptual hash](https://en.wikipedia.org/wiki/Perceptual_hashing) of a Jimp image, based on the [pHash](http://phash.org/) algorithm, use: + +```js +image.hash(); // aHgG4GgoFjA +``` + +By default the hash is returned as base 64. The hash can be returned at another base by passing a number from 2 to 64 to the method: + +```js +image.hash(2); // 1010101011010000101010000100101010010000011001001001010011100100 +``` + +There are 18,446,744,073,709,551,615 unique hashes. The hamming distance between the binary representation of these hashes can be used to find similar-looking images. + +To calculate the hamming distance between two Jimp images based on their perceptual hash use: + +```js +Jimp.distance(image1, image2); // returns a number 0-1, where 0 means the two images are perceived to be identical +``` + +Jimp also allows the diffing of two Jimp images using [PixelMatch](https://github.com/mapbox/pixelmatch) as follows: + +```js +var diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1) +diff.image; // a Jimp image showing differences +diff.percent; // the proportion of different pixels (0-1), where 0 means the images are pixel identical +``` + +Using a mix of hamming distance and pixel diffing to compare images, the following code has a 99% success rate of detecting the same image from a random sample (with 1% false positives). The test this figure is drawn from attempts to match each image from a sample of 120 PNGs against 120 corresponding JPEGs saved at a quality setting of 60. + +```js +var distance = Jimp.distance(png, jpeg); // perceived distance +var diff = Jimp.diff(png, jpeg); // pixel difference + +if (distance < 0.15 || diff.percent < 0.15) { + // images match +} else { + // not a match +} +``` + +You can also calculate the raw pHash (no padding or custom base). You can then use this in `distanceFromHash` to calculate the hash distance from a loaded image. + +```js +const hash1 = image1.pHash(); +const hash2 = image2.pHash(); + +image2.distanceFromHash(hash1); +Jimp.compareHashes(hash1, hash2); // same result as above +``` + +## Chaining or callbacks + +Most instance methods can be chained together, for example as follows: + +```js +Jimp.read("lenna.png").then((image) => { + image.greyscale().scale(0.5).write("lena-half-bw.png"); +}); +``` + +Alternatively, methods can be passed Node-style callbacks: + +```js +Jimp.read("lenna.png").then((image) => { + image.greyscale((err, image) => { + image.scale(0.5, (err, image) => { + image.write("lena-half-bw.png"); + }); + }); +}); +``` + +The Node-style callback pattern allows Jimp to be used with frameworks that expect or build on the Node-style callback pattern. diff --git a/node_modules/jimp/browser/README.md b/node_modules/jimp/browser/README.md new file mode 100644 index 00000000..9cc92c47 --- /dev/null +++ b/node_modules/jimp/browser/README.md @@ -0,0 +1,67 @@ +# Jimp ... in a browser + +Browser support for Jimp was added by Phil Seaton. This enabled Jimp to be used in [Electron](http://electron.atom.io/) applications as well as web browsers. + +Example usage: + +```html + + +``` + +See the [main documentation](https://github.com/jimp-dev/jimp) for the full API documenatinon. + +## WebWorkers + +For better performance, it recommended that Jimp methods are run on a separate thread using [`WebWorkers`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers). The following shows how using two files (`index.html` and `jimp-worker.js`): + +```js +// index.html + +var worker = new Worker("jimp-worker.js"); +worker.onmessage = function (e) { + // append a new img element using the base 64 image + var img = document.createElement("img"); + img.setAttribute("src", e.data); + document.body.appendChild(img); +}; +worker.postMessage("lenna.png"); // message the worker thread +``` + +```js +// jimp-worker.js + +importScripts("jimp.min.js"); + +self.addEventListener("message", function (e) { + Jimp.read(e.data).then(function (lenna) { + lenna + .resize(256, 256) // resize + .quality(60) // set JPEG quality + .greyscale() // set greyscale + .getBase64(Jimp.MIME_JPEG, function (err, src) { + self.postMessage(src); // message the main thread + }); + }); +}); +``` + +## License + +Jimp is licensed under the MIT license. diff --git a/project starter code/node_modules/jimp/browser/examples/dice.png b/node_modules/jimp/browser/examples/dice.png similarity index 100% rename from project starter code/node_modules/jimp/browser/examples/dice.png rename to node_modules/jimp/browser/examples/dice.png diff --git a/node_modules/jimp/browser/examples/example1.html b/node_modules/jimp/browser/examples/example1.html new file mode 100644 index 00000000..1145053f --- /dev/null +++ b/node_modules/jimp/browser/examples/example1.html @@ -0,0 +1,25 @@ + + + + Jimp browser example 1 + + +

Demonstrates loading a local file using Jimp on the main thread

+ + + + diff --git a/node_modules/jimp/browser/examples/example2.html b/node_modules/jimp/browser/examples/example2.html new file mode 100644 index 00000000..b2448a09 --- /dev/null +++ b/node_modules/jimp/browser/examples/example2.html @@ -0,0 +1,20 @@ + + + + Jimp browser example 2 + + +

+ Demonstrates loading a relative file using Jimp on a WebWorker thread +

+ + + diff --git a/node_modules/jimp/browser/examples/example3.html b/node_modules/jimp/browser/examples/example3.html new file mode 100644 index 00000000..eec88c48 --- /dev/null +++ b/node_modules/jimp/browser/examples/example3.html @@ -0,0 +1,31 @@ + + + + Jimp browser example 3 + + +

Demonstrates loading a local file using Jimp on a WebWorker thread

+

+ + + diff --git a/node_modules/jimp/browser/examples/example4.html b/node_modules/jimp/browser/examples/example4.html new file mode 100644 index 00000000..d9f922e5 --- /dev/null +++ b/node_modules/jimp/browser/examples/example4.html @@ -0,0 +1,74 @@ + + + + Jimp browser example 4 + + +

Demonstrates how to write a text over an image

+ + + + +
+ +
+ +
+
+
+
+ + + diff --git a/node_modules/jimp/browser/examples/jimp-worker.js b/node_modules/jimp/browser/examples/jimp-worker.js new file mode 100644 index 00000000..a8fd8ed6 --- /dev/null +++ b/node_modules/jimp/browser/examples/jimp-worker.js @@ -0,0 +1,18 @@ +/* eslint-env worker */ +/* global Jimp */ + +importScripts("../lib/jimp.min.js"); + +self.addEventListener("message", (e) => { + Jimp.read(e.data).then((lenna) => { + lenna + .resize(256, Jimp.AUTO) // resize + .quality(60) // set JPEG quality + .greyscale() // set greyscale + .getBase64(Jimp.AUTO, (err, src) => { + if (err) throw err; + self.postMessage(src); + self.close(); + }); + }); +}); diff --git a/project starter code/node_modules/jimp/browser/examples/lenna.png b/node_modules/jimp/browser/examples/lenna.png similarity index 100% rename from project starter code/node_modules/jimp/browser/examples/lenna.png rename to node_modules/jimp/browser/examples/lenna.png diff --git a/node_modules/jimp/browser/examples/test.html b/node_modules/jimp/browser/examples/test.html new file mode 100644 index 00000000..ae1f022c --- /dev/null +++ b/node_modules/jimp/browser/examples/test.html @@ -0,0 +1,49 @@ + + + + Jimp browser example 1 + + + + + + + diff --git a/project starter code/node_modules/jimp/dist/index.js b/node_modules/jimp/dist/index.js similarity index 100% rename from project starter code/node_modules/jimp/dist/index.js rename to node_modules/jimp/dist/index.js diff --git a/node_modules/jimp/dist/index.js.map b/node_modules/jimp/dist/index.js.map new file mode 100644 index 00000000..fb48434b --- /dev/null +++ b/node_modules/jimp/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":["types","plugins"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe,wBAAU;AACvBA,EAAAA,KAAK,EAAE,CAACA,iBAAD,CADgB;AAEvBC,EAAAA,OAAO,EAAE,CAACA,mBAAD;AAFc,CAAV,C","sourcesContent":["import configure from \"@jimp/custom\";\n\nimport types from \"@jimp/types\";\nimport plugins from \"@jimp/plugins\";\n\nexport default configure({\n types: [types],\n plugins: [plugins],\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/jimp/fonts/open-sans/Apache License.txt b/node_modules/jimp/fonts/open-sans/Apache License.txt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/Apache License.txt rename to node_modules/jimp/fonts/open-sans/Apache License.txt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.png b/node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-10-black/open-sans-10-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.png b/node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-12-black/open-sans-12-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png b/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt b/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png b/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png rename to node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.png b/node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-14-black/open-sans-14-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png b/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt b/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png b/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png rename to node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png b/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt b/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png b/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png rename to node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png b/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt b/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png b/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png rename to node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt b/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png b/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png rename to node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt b/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt rename to node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png b/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png similarity index 100% rename from project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png rename to node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png diff --git a/node_modules/jimp/package.json b/node_modules/jimp/package.json new file mode 100644 index 00000000..aa80ff06 --- /dev/null +++ b/node_modules/jimp/package.json @@ -0,0 +1,110 @@ +{ + "name": "jimp", + "version": "0.16.13", + "description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies)", + "main": "dist/index.js", + "module": "es/index.js", + "types": "types/index.d.ts", + "typesVersions": { + ">=3.1.0-0": { + "*": [ + "types/ts3.1/index.d.ts" + ] + } + }, + "tonicExampleFilename": "example.js", + "files": [ + "browser", + "dist", + "es", + "index.d.ts", + "fonts", + "types" + ], + "repository": "jimp-dev/jimp", + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", + "browser-build": "node tools/browser-build.js test", + "build": "npm run build:browser && npm run build:node:production && npm run build:module", + "build:watch": "npm run build:node:debug -- -- --watch --verbose", + "build:debug": "npm run build:browser:debug && npm run build:node:debug", + "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", + "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", + "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", + "build:node:production": "cross-env BABEL_ENV=production npm run build:node", + "build:browser": "cross-env BABEL_ENV=production node tools/browser-build.js prepublish", + "build:browser:debug": "cross-env BABEL_ENV=development ENV=browser node tools/browser-build.js prepublish" + }, + "keywords": [ + "image", + "image processing", + "image manipulation", + "png", + "jpg", + "jpeg", + "bmp", + "resize", + "scale", + "crop" + ], + "author": "Oliver Moran ", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/custom": "^0.16.13", + "@jimp/plugins": "^0.16.13", + "@jimp/types": "^0.16.13", + "regenerator-runtime": "^0.13.3" + }, + "devDependencies": { + "@babel/cli": "^7.7.0", + "@babel/core": "^7.7.2", + "@babel/plugin-proposal-class-properties": "^7.7.0", + "@babel/plugin-syntax-object-rest-spread": "^7.2.0", + "@babel/preset-env": "^7.7.1", + "@babel/register": "^7.7.0", + "@jimp/test-utils": "^0.16.13", + "babel-eslint": "^10.0.3", + "babel-plugin-add-module-exports": "^1.0.2", + "babel-plugin-istanbul": "^5.2.0", + "babel-plugin-source-map-support": "^2.1.1", + "babelify": "^10.0.0", + "browserify": "^16.5.0", + "cross-env": "^6.0.0", + "dtslint": "^0.9.8", + "envify": "^4.1.0", + "eslint": "^6.4.0", + "express": "^4.17.1", + "husky": "^3.0.5", + "karma": "^4.3.0", + "karma-browserify": "^6.1.0", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^1.2.0", + "lerna": "^3.16.4", + "lerna-changelog": "^0.8.2", + "lint-staged": "^9.2.5", + "mocha": "^6.2.0", + "nyc": "^14.1.1", + "source-map-support": "^0.5.13", + "tfilter": "^1.0.1", + "uglify-js": "^3.6.0", + "watchify": "^3.11.1" + }, + "nyc": { + "sourceMap": false, + "instrument": false, + "reporter": [ + "text", + "text-summary", + "lcov", + "html" + ], + "exclude": [ + "src/modules/*.js", + "test/*.js" + ] + }, + "gitHead": "9eec86086634329a072901dca3a800b850548572" +} diff --git a/node_modules/jimp/types/index.d.ts b/node_modules/jimp/types/index.d.ts new file mode 100644 index 00000000..b3b46b38 --- /dev/null +++ b/node_modules/jimp/types/index.d.ts @@ -0,0 +1,607 @@ +// TypeScript Version: 2.8 + +declare const DepreciatedJimp: DepreciatedJimp; + +export = DepreciatedJimp; + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface DepreciatedJimp { + // Constructors + new (path: string, cb?: ImageCallback): this; + new (urlOptions: URLOptions, cb?: ImageCallback): this; + new (image: DepreciatedJimp, cb?: ImageCallback): this; + new (data: Buffer | Bitmap, cb?: ImageCallback): this; + new (w: number, h: number, cb?: ImageCallback): this; + new ( + w: number, + h: number, + background?: number | string, + cb?: ImageCallback + ): this; + // For custom constructors when using Jimp.appendConstructorOption + new (...args: any[]): this; + prototype: this; + + // Constants + AUTO: -1; + + // supported mime types + MIME_PNG: "image/png"; + MIME_TIFF: "image/tiff"; + MIME_JPEG: "image/jpeg"; + MIME_JGD: "image/jgd"; + MIME_BMP: "image/bmp"; + MIME_X_MS_BMP: "image/x-ms-bmp"; + MIME_GIF: "image/gif"; + // PNG filter types + PNG_FILTER_AUTO: -1; + PNG_FILTER_NONE: 0; + PNG_FILTER_SUB: 1; + PNG_FILTER_UP: 2; + PNG_FILTER_AVERAGE: 3; + PNG_FILTER_PATH: 4; + + // resize methods + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor"; + RESIZE_BILINEAR: "bilinearInterpolation"; + RESIZE_BICUBIC: "bicubicInterpolation"; + RESIZE_HERMITE: "hermiteInterpolation"; + RESIZE_BEZIER: "bezierInterpolation"; + + // blend modes + BLEND_SOURCE_OVER: string; + BLEND_DESTINATION_OVER: string; + BLEND_MULTIPLY: string; + BLEND_SCREEN: string; + BLEND_OVERLAY: string; + BLEND_DARKEN: string; + BLEND_LIGHTEN: string; + BLEND_HARDLIGHT: string; + BLEND_DIFFERENCE: string; + BLEND_EXCLUSION: string; + + // Align modes for cover, contain, bit masks + HORIZONTAL_ALIGN_LEFT: 1; + HORIZONTAL_ALIGN_CENTER: 2; + HORIZONTAL_ALIGN_RIGHT: 4; + + VERTICAL_ALIGN_TOP: 8; + VERTICAL_ALIGN_MIDDLE: 16; + VERTICAL_ALIGN_BOTTOM: 32; + + // Font locations + FONT_SANS_8_BLACK: string; + FONT_SANS_10_BLACK: string; + FONT_SANS_12_BLACK: string; + FONT_SANS_14_BLACK: string; + FONT_SANS_16_BLACK: string; + FONT_SANS_32_BLACK: string; + FONT_SANS_64_BLACK: string; + FONT_SANS_128_BLACK: string; + + FONT_SANS_8_WHITE: string; + FONT_SANS_16_WHITE: string; + FONT_SANS_32_WHITE: string; + FONT_SANS_64_WHITE: string; + FONT_SANS_128_WHITE: string; + + // Edge Handling + EDGE_EXTEND: 1; + EDGE_WRAP: 2; + EDGE_CROP: 3; + + // Properties + bitmap: Bitmap; + + _quality: number; + _deflateLevel: number; + _deflateStrategy: number; + _filterType: number; + _rgba: boolean; + _background: number; + _originalMime: string; + + // Methods + on( + event: T, + cb: (data: ListenerData) => any + ): any; + parseBitmap( + data: Buffer, + path: string | null | undefined, + cb?: ImageCallback + ): void; + hasAlpha(): boolean; + getHeight(): number; + getWidth(): number; + inspect(): string; + toString(): string; + getMIME(): string; + getExtension(): string; + distanceFromHash(hash: string): number; + write(path: string, cb?: ImageCallback): this; + writeAsync(path: string): Promise; + deflateLevel(l: number, cb?: ImageCallback): this; + deflateStrategy(s: number, cb?: ImageCallback): this; + colorType(s: number, cb?: ImageCallback): this; + filterType(f: number, cb?: ImageCallback): this; + rgba(bool: boolean, cb?: ImageCallback): this; + quality(n: number, cb?: ImageCallback): this; + getBase64(mime: string, cb: GenericCallback): this; + getBase64Async(mime: string): Promise; + hash(cb?: GenericCallback): string; + hash( + base: number | null | undefined, + cb?: GenericCallback + ): string; + getBuffer(mime: string, cb: GenericCallback): this; + getBufferAsync(mime: string): Promise; + getPixelIndex( + x: number, + y: number, + cb?: GenericCallback + ): number; + getPixelIndex( + x: number, + y: number, + edgeHandling: number, + cb?: GenericCallback + ): number; + getPixelColor( + x: number, + y: number, + cb?: GenericCallback + ): number; + getPixelColour( + x: number, + y: number, + cb?: GenericCallback + ): number; + setPixelColor(hex: number, x: number, y: number, cb?: ImageCallback): this; + setPixelColour(hex: number, x: number, y: number, cb?: ImageCallback): this; + clone(cb?: ImageCallback): this; + cloneQuiet(cb?: ImageCallback): this; + background(hex: number, cb?: ImageCallback): this; + backgroundQuiet(hex: number, cb?: ImageCallback): this; + scan( + x: number, + y: number, + w: number, + h: number, + f: (this: this, x: number, y: number, idx: number) => any, + cb?: ImageCallback + ): this; + scanQuiet( + x: number, + y: number, + w: number, + h: number, + f: (this: this, x: number, y: number, idx: number) => any, + cb?: ImageCallback + ): this; + scanIterator( + x: number, + y: number, + w: number, + h: number + ): IterableIterator<{ + x: number; + y: number; + idx: number; + image: DepreciatedJimp; + }>; + crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this; + cropQuiet( + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + + // Color methods + brightness(val: number, cb?: ImageCallback): this; + contrast(val: number, cb?: ImageCallback): this; + posterize(n: number, cb?: ImageCallback): this; + greyscale(cb?: ImageCallback): this; + grayscale(cb?: ImageCallback): this; + opacity(f: number, cb?: ImageCallback): this; + sepia(cb?: ImageCallback): this; + fade(f: number, cb?: ImageCallback): this; + convolution(kernel: number[][], cb?: ImageCallback): this; + convolution( + kernel: number[][], + edgeHandling: number, + cb?: ImageCallback + ): this; + opaque(cb?: ImageCallback): this; + pixelate(size: number, cb?: ImageCallback): this; + pixelate( + size: number, + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + convolute(kernel: number[][], cb?: ImageCallback): this; + convolute( + kernel: number[][], + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + color(actions: ColorAction[], cb?: ImageCallback): this; + colour(actions: ColorAction[], cb?: ImageCallback): this; + + // Shape methods + rotate(deg: number, cb?: ImageCallback): this; + rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; + flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; + mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; + resize(w: number, h: number, cb?: ImageCallback): this; + resize(w: number, h: number, mode?: string, cb?: ImageCallback): this; + cover(w: number, h: number, cb?: ImageCallback): this; + cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; + cover( + w: number, + h: number, + alignBits?: number, + mode?: string, + cb?: ImageCallback + ): this; + contain(w: number, h: number, cb?: ImageCallback): this; + contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; + contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; + contain( + w: number, + h: number, + alignBits?: number, + mode?: string, + cb?: ImageCallback + ): this; + scale(f: number, cb?: ImageCallback): this; + scale(f: number, mode?: string, cb?: ImageCallback): this; + scaleToFit(w: number, h: number, cb?: ImageCallback): this; + scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; + displace(map: DepreciatedJimp, offset: number, cb?: ImageCallback): this; + autocrop(tolerance?: number, cb?: ImageCallback): this; + autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): this; + autocrop( + tolerance?: number, + cropOnlyFrames?: boolean, + cb?: ImageCallback + ): this; + autocrop( + options: { + tolerance?: number; + cropOnlyFrames?: boolean; + cropSymmetric?: boolean; + leaveBorder?: number; + }, + cb?: ImageCallback + ): this; + + // Text methods + print( + font: Font, + x: number, + y: number, + text: PrintableText, + cb?: ImageCallback + ): this; + print( + font: Font, + x: number, + y: number, + text: PrintableText, + maxWidth?: number, + cb?: ImageCallback + ): this; + print( + font: Font, + x: number, + y: number, + text: PrintableText, + maxWidth?: number, + maxHeight?: number, + cb?: ImageCallback + ): this; + + // Effect methods + blur(r: number, cb?: ImageCallback): this; + dither565(cb?: ImageCallback): this; + dither16(cb?: ImageCallback): this; + histogram(): { + r: number[]; + g: number[]; + b: number[]; + }; + normalize(cb?: ImageCallback): this; + invert(cb?: ImageCallback): this; + gaussian(r: number, cb?: ImageCallback): this; + composite( + src: DepreciatedJimp, + x: number, + y: number, + options?: BlendMode, + cb?: ImageCallback + ): this; + blit(src: DepreciatedJimp, x: number, y: number, cb?: ImageCallback): this; + blit( + src: DepreciatedJimp, + x: number, + y: number, + srcx: number, + srcy: number, + srcw: number, + srch: number, + cb?: ImageCallback + ): this; + mask(src: this, x: number, y: number, cb?: ImageCallback): this; + + // Functions + /** + * I'd like to make `Args` generic and used in `run` and `test` but alas, + * it's not possible RN: + * https://github.com/microsoft/TypeScript/issues/26113 + */ + appendConstructorOption( + name: string, + test: (...args: any[]) => boolean, + run: ( + this: this, + resolve: (jimp?: this) => any, + reject: (reason: Error) => any, + ...args: any[] + ) => any + ): void; + read(path: string, cb?: ImageCallback): Promise; + read(image: this, cb?: ImageCallback): Promise; + read(data: Buffer, cb?: ImageCallback): Promise; + read( + w: number, + h: number, + background?: number | string, + cb?: ImageCallback + ): Promise; + create(path: string): Promise; + create(image: this): Promise; + create(data: Buffer): Promise; + create(w: number, h: number, background?: number | string): Promise; + rgbaToInt( + r: number, + g: number, + b: number, + a: number, + cb: GenericCallback + ): number; + intToRGBA(i: number, cb?: GenericCallback): RGBA; + cssColorToHex(cssColor: string): number; + limit255(n: number): number; + diff( + img1: this, + img2: this, + threshold?: number + ): { + percent: number; + image: DepreciatedJimp; + }; + distance(img1: this, img2: this): number; + compareHashes(hash1: string, hash2: string): number; + colorDiff(rgba1: RGB, rgba2: RGB): number; + colorDiff(rgba1: RGBA, rgba2: RGBA): number; + loadFont(file: string): Promise; + loadFont(file: string, cb: GenericCallback): Promise; + measureText(font: Font, text: PrintableText): number; + measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; + circle( + options?: { + radius: number; + x: number; + y: number; + }, + cb?: ImageCallback + ): this; + circle(cb?: ImageCallback): this; + fishEye(opts?: { r: number }, cb?: ImageCallback): this; + fishEye(cb?: ImageCallback): this; + shadow( + options?: { + size?: number; + opacity?: number; + x?: number; + y?: number; + }, + cb?: ImageCallback + ): this; + shadow(cb?: ImageCallback): this; + threshold( + opts: { + max: number; + replace?: number; + autoGreyscale?: boolean; + }, + cb?: ImageCallback + ): this; +} + +type GenericCallback = ( + this: TThis, + err: Error | null, + value: T +) => U; + +type ImageCallback = ( + this: DepreciatedJimp, + err: Error | null, + value: DepreciatedJimp, + coords: { + x: number; + y: number; + } +) => U; + +type ColorActionName = + | "mix" + | "tint" + | "shade" + | "xor" + | "red" + | "green" + | "blue" + | "hue"; + +type ColorAction = { + apply: ColorActionName; + params: any; +}; + +type BlendMode = { + mode: string; + opacitySource: number; + opacityDest: number; +}; + +type ChangeName = "background" | "scan" | "crop"; + +type ListenableName = + | "any" + | "initialized" + | "before-change" + | "changed" + | "before-clone" + | "cloned" + | ChangeName; + +type ListenerData = T extends "any" + ? any + : T extends ChangeName + ? { + eventName: "before-change" | "changed"; + methodName: T; + [key: string]: any; + } + : { + eventName: T; + methodName: T extends "initialized" + ? "constructor" + : T extends "before-change" | "changed" + ? ChangeName + : T extends "before-clone" | "cloned" + ? "clone" + : any; + }; + +type PrintableText = + | any + | { + text: string; + alignmentX: number; + alignmentY: number; + }; + +type URLOptions = { + url: string; + compression?: boolean; + headers: { + [key: string]: any; + }; +}; + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface Bitmap { + data: Buffer; + width: number; + height: number; +} +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface RGB { + r: number; + g: number; + b: number; +} + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface RGBA { + r: number; + g: number; + b: number; + a: number; +} + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface FontChar { + id: number; + x: number; + y: number; + width: number; + height: number; + xoffset: number; + yoffset: number; + xadvance: number; + page: number; + chnl: number; +} + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface FontInfo { + face: string; + size: number; + bold: number; + italic: number; + charset: string; + unicode: number; + stretchH: number; + smooth: number; + aa: number; + padding: [number, number, number, number]; + spacing: [number, number]; +} + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface FontCommon { + lineHeight: number; + base: number; + scaleW: number; + scaleH: number; + pages: number; + packed: number; + alphaChnl: number; + redChnl: number; + greenChnl: number; + blueChnl: number; +} + +/** + * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version + */ +interface Font { + chars: { + [char: string]: FontChar; + }; + kernings: { + [firstString: string]: { + [secondString: string]: number; + }; + }; + pages: string[]; + common: FontCommon; + info: FontInfo; +} diff --git a/node_modules/jimp/types/test.ts b/node_modules/jimp/types/test.ts new file mode 100644 index 00000000..e0bfb99c --- /dev/null +++ b/node_modules/jimp/types/test.ts @@ -0,0 +1,101 @@ +import * as Jimp from "jimp"; + +const jimpInst: Jimp = new Jimp("test"); + +// Main Jimp export should already have all of these already applied +jimpInst.read("Test"); +jimpInst.displace(jimpInst, 2); +jimpInst.resize(40, 40); +// $ExpectType 0 +jimpInst.PNG_FILTER_NONE; + +// $ExpectError +jimpInst.test; + +// $ExpectError +jimpInst.func(); + +// Main Jimp export should already have all of these already applied +Jimp.read("Test"); +Jimp.displace(Jimp, 2); +Jimp.shadow((err, val, coords) => {}); +Jimp.resize(40, 40); +// $ExpectType 0 +Jimp.PNG_FILTER_NONE; + +// $ExpectError +Jimp.test; + +// $ExpectError +Jimp.func(); + +test("can clone properly", async () => { + const baseImage = await Jimp.read("filename"); + const cloneBaseImage = baseImage.clone(); + + // $ExpectType -1 + cloneBaseImage.PNG_FILTER_AUTO; + + test("can handle `this` returns on the core type properly", () => { + // $ExpectType -1 + cloneBaseImage.diff(jimpInst, jimpInst).image.PNG_FILTER_AUTO; + }); + + test("can handle `this` returns properly", () => { + cloneBaseImage + .resize(1, 1) + .crop(0, 0, 0, 0) + .mask(cloneBaseImage, 2, 2) + .print("a" as any, 2, 2, "a" as any) + .resize(1, 1) + .quality(1) + .deflateLevel(2).PNG_FILTER_AUTO; + }); + + test("can handle imageCallbacks `this` properly", () => { + cloneBaseImage.rgba(false, (_, jimpCBIn) => { + jimpCBIn.read("Test"); + jimpCBIn.displace(jimpInst, 2); + jimpCBIn.resize(40, 40); + // $ExpectType 0 + jimpCBIn.PNG_FILTER_NONE; + + // $ExpectError + jimpCBIn.test; + + // $ExpectError + jimpCBIn.func(); + }); + }); +}); + +test("Can handle callback with constructor", () => { + const myBmpBuffer: Buffer = {} as any; + + Jimp.read(myBmpBuffer, (err, cbJimpInst) => { + cbJimpInst.read("Test"); + cbJimpInst.displace(jimpInst, 2); + cbJimpInst.resize(40, 40); + // $ExpectType 0 + cbJimpInst.PNG_FILTER_NONE; + + // $ExpectError + cbJimpInst.test; + + // $ExpectError + cbJimpInst.func(); + }); +}); + +test("Can handle appendConstructorOption", () => { + Jimp.appendConstructorOption( + "Name of Option", + (args) => args.hasSomeCustomThing, + function (resolve, reject, args) { + // $ExpectError + this.bitmap = 3; + Jimp.resize(2, 2); + resolve(); + } + ); +}); diff --git a/node_modules/jimp/types/ts3.1/index.d.ts b/node_modules/jimp/types/ts3.1/index.d.ts new file mode 100644 index 00000000..8ddf4c58 --- /dev/null +++ b/node_modules/jimp/types/ts3.1/index.d.ts @@ -0,0 +1,51 @@ +/** + * While there is nothing in these typings that prevent it from running in TS 2.8 even, + * due to the complexity of the typings anything lower than TS 3.1 will only see + * Jimp as `any`. In order to test the strict versions of these types in our typing + * test suite, the version has been bumped to 3.1 + */ + +import { + Jimp as JimpType, + Bitmap, + RGB, + RGBA, + UnionToIntersection, + GetPluginVal, + GetPluginConst, + GetPluginEncoders, + GetPluginDecoders, + JimpConstructors, +} from "@jimp/core"; +import typeFn from "@jimp/types"; +import pluginFn from "@jimp/plugins"; + +type Types = ReturnType; +type Plugins = ReturnType; + +type IntersectedPluginTypes = UnionToIntersection< + GetPluginVal | GetPluginVal +>; + +type IntersectedPluginConsts = UnionToIntersection< + GetPluginConst | GetPluginConst +>; + +type IntersectedPluginEncoders = UnionToIntersection< + GetPluginEncoders | GetPluginEncoders +>; + +type IntersectedPluginDecoders = UnionToIntersection< + GetPluginDecoders | GetPluginDecoders +>; + +type Jimp = JimpType & IntersectedPluginTypes; + +declare const Jimp: JimpConstructors & + IntersectedPluginConsts & { + prototype: Jimp; + encoders: IntersectedPluginEncoders; + decoders: IntersectedPluginDecoders; + }; + +export = Jimp; diff --git a/node_modules/jimp/types/ts3.1/test.ts b/node_modules/jimp/types/ts3.1/test.ts new file mode 100644 index 00000000..64ea9315 --- /dev/null +++ b/node_modules/jimp/types/ts3.1/test.ts @@ -0,0 +1,93 @@ +import * as Jimp from "jimp"; + +const jimpInst: Jimp = new Jimp("test"); + +// Main Jimp export should already have all of these already applied +// $ExpectError +jimpInst.read("Test"); +jimpInst.displace(jimpInst, 2); +jimpInst.resize(40, 40); +jimpInst.displace(jimpInst, 2); +jimpInst.shadow((err, val, coords) => {}); +jimpInst.fishEye({ r: 12 }); +jimpInst.circle({ radius: 12, x: 12, y: 12 }); +// $ExpectError +jimpInst.PNG_FILTER_NONE; + +// $ExpectError +jimpInst.test; + +// $ExpectError +jimpInst.func(); + +// Main Jimp export should already have all of these already applied +Jimp.read("Test"); + +// $ExpectType 0 +Jimp.PNG_FILTER_NONE; + +// $ExpectError +Jimp.test; + +// $ExpectError +Jimp.func(); + +test("can clone properly", async () => { + const baseImage = await Jimp.read("filename"); + const cloneBaseImage = baseImage.clone(); + + // $ExpectType number + cloneBaseImage._deflateLevel; + + test("can handle `this` returns on the core type properly", () => { + // $ExpectType number + cloneBaseImage.posterize(3)._quality; + }); + + test("can handle `this` returns properly", () => { + cloneBaseImage + .resize(1, 1) + .crop(0, 0, 0, 0) + .mask(cloneBaseImage, 2, 2) + .print("a" as any, 2, 2, "a" as any) + .resize(1, 1) + .quality(1) + .deflateLevel(2)._filterType; + }); + + test("can handle imageCallbacks `this` properly", () => { + cloneBaseImage.rgba(false, (_, jimpCBIn) => { + // $ExpectError + jimpCBIn.read("Test"); + jimpCBIn.displace(jimpInst, 2); + jimpCBIn.resize(40, 40); + // $ExpectType number + jimpCBIn._filterType; + + // $ExpectError + jimpCBIn.test; + + // $ExpectError + jimpCBIn.func(); + }); + }); +}); + +test("Can handle callback with constructor", () => { + const myBmpBuffer: Buffer = {} as any; + + Jimp.read(myBmpBuffer, (err, cbJimpInst) => { + // $ExpectError + cbJimpInst.read("Test"); + cbJimpInst.displace(jimpInst, 2); + cbJimpInst.resize(40, 40); + // $ExpectType number + cbJimpInst._filterType; + + // $ExpectError + cbJimpInst.test; + + // $ExpectError + cbJimpInst.func(); + }); +}); diff --git a/project starter code/node_modules/jimp/types/ts3.1/tsconfig.json b/node_modules/jimp/types/ts3.1/tsconfig.json similarity index 100% rename from project starter code/node_modules/jimp/types/ts3.1/tsconfig.json rename to node_modules/jimp/types/ts3.1/tsconfig.json diff --git a/project starter code/node_modules/jimp/types/tsconfig.json b/node_modules/jimp/types/tsconfig.json similarity index 100% rename from project starter code/node_modules/jimp/types/tsconfig.json rename to node_modules/jimp/types/tsconfig.json diff --git a/project starter code/node_modules/jpeg-js/.github/workflows/ci.yml b/node_modules/jpeg-js/.github/workflows/ci.yml similarity index 100% rename from project starter code/node_modules/jpeg-js/.github/workflows/ci.yml rename to node_modules/jpeg-js/.github/workflows/ci.yml diff --git a/project starter code/node_modules/jpeg-js/CONTRIBUTING.md b/node_modules/jpeg-js/CONTRIBUTING.md similarity index 100% rename from project starter code/node_modules/jpeg-js/CONTRIBUTING.md rename to node_modules/jpeg-js/CONTRIBUTING.md diff --git a/project starter code/node_modules/jpeg-js/LICENSE b/node_modules/jpeg-js/LICENSE similarity index 100% rename from project starter code/node_modules/jpeg-js/LICENSE rename to node_modules/jpeg-js/LICENSE diff --git a/project starter code/node_modules/jpeg-js/README.md b/node_modules/jpeg-js/README.md similarity index 100% rename from project starter code/node_modules/jpeg-js/README.md rename to node_modules/jpeg-js/README.md diff --git a/project starter code/node_modules/jpeg-js/index.d.ts b/node_modules/jpeg-js/index.d.ts similarity index 100% rename from project starter code/node_modules/jpeg-js/index.d.ts rename to node_modules/jpeg-js/index.d.ts diff --git a/project starter code/node_modules/jpeg-js/index.js b/node_modules/jpeg-js/index.js similarity index 100% rename from project starter code/node_modules/jpeg-js/index.js rename to node_modules/jpeg-js/index.js diff --git a/project starter code/node_modules/jpeg-js/lib/decoder.js b/node_modules/jpeg-js/lib/decoder.js similarity index 100% rename from project starter code/node_modules/jpeg-js/lib/decoder.js rename to node_modules/jpeg-js/lib/decoder.js diff --git a/project starter code/node_modules/jpeg-js/lib/encoder.js b/node_modules/jpeg-js/lib/encoder.js similarity index 100% rename from project starter code/node_modules/jpeg-js/lib/encoder.js rename to node_modules/jpeg-js/lib/encoder.js diff --git a/project starter code/node_modules/jpeg-js/package.json b/node_modules/jpeg-js/package.json similarity index 100% rename from project starter code/node_modules/jpeg-js/package.json rename to node_modules/jpeg-js/package.json diff --git a/project starter code/node_modules/load-bmfont/LICENSE.md b/node_modules/load-bmfont/LICENSE.md similarity index 100% rename from project starter code/node_modules/load-bmfont/LICENSE.md rename to node_modules/load-bmfont/LICENSE.md diff --git a/project starter code/node_modules/load-bmfont/README.md b/node_modules/load-bmfont/README.md similarity index 100% rename from project starter code/node_modules/load-bmfont/README.md rename to node_modules/load-bmfont/README.md diff --git a/project starter code/node_modules/load-bmfont/browser.js b/node_modules/load-bmfont/browser.js similarity index 100% rename from project starter code/node_modules/load-bmfont/browser.js rename to node_modules/load-bmfont/browser.js diff --git a/project starter code/node_modules/load-bmfont/index.js b/node_modules/load-bmfont/index.js similarity index 100% rename from project starter code/node_modules/load-bmfont/index.js rename to node_modules/load-bmfont/index.js diff --git a/project starter code/node_modules/load-bmfont/json-spec.md b/node_modules/load-bmfont/json-spec.md similarity index 100% rename from project starter code/node_modules/load-bmfont/json-spec.md rename to node_modules/load-bmfont/json-spec.md diff --git a/project starter code/node_modules/load-bmfont/lib/is-binary.js b/node_modules/load-bmfont/lib/is-binary.js similarity index 100% rename from project starter code/node_modules/load-bmfont/lib/is-binary.js rename to node_modules/load-bmfont/lib/is-binary.js diff --git a/project starter code/node_modules/load-bmfont/package.json b/node_modules/load-bmfont/package.json similarity index 100% rename from project starter code/node_modules/load-bmfont/package.json rename to node_modules/load-bmfont/package.json diff --git a/project starter code/node_modules/media-typer/HISTORY.md b/node_modules/media-typer/HISTORY.md similarity index 100% rename from project starter code/node_modules/media-typer/HISTORY.md rename to node_modules/media-typer/HISTORY.md diff --git a/project starter code/node_modules/media-typer/LICENSE b/node_modules/media-typer/LICENSE similarity index 100% rename from project starter code/node_modules/media-typer/LICENSE rename to node_modules/media-typer/LICENSE diff --git a/project starter code/node_modules/media-typer/README.md b/node_modules/media-typer/README.md similarity index 100% rename from project starter code/node_modules/media-typer/README.md rename to node_modules/media-typer/README.md diff --git a/project starter code/node_modules/media-typer/index.js b/node_modules/media-typer/index.js similarity index 100% rename from project starter code/node_modules/media-typer/index.js rename to node_modules/media-typer/index.js diff --git a/project starter code/node_modules/media-typer/package.json b/node_modules/media-typer/package.json similarity index 100% rename from project starter code/node_modules/media-typer/package.json rename to node_modules/media-typer/package.json diff --git a/project starter code/node_modules/merge-descriptors/HISTORY.md b/node_modules/merge-descriptors/HISTORY.md similarity index 100% rename from project starter code/node_modules/merge-descriptors/HISTORY.md rename to node_modules/merge-descriptors/HISTORY.md diff --git a/project starter code/node_modules/merge-descriptors/LICENSE b/node_modules/merge-descriptors/LICENSE similarity index 100% rename from project starter code/node_modules/merge-descriptors/LICENSE rename to node_modules/merge-descriptors/LICENSE diff --git a/project starter code/node_modules/merge-descriptors/README.md b/node_modules/merge-descriptors/README.md similarity index 100% rename from project starter code/node_modules/merge-descriptors/README.md rename to node_modules/merge-descriptors/README.md diff --git a/project starter code/node_modules/merge-descriptors/index.js b/node_modules/merge-descriptors/index.js similarity index 100% rename from project starter code/node_modules/merge-descriptors/index.js rename to node_modules/merge-descriptors/index.js diff --git a/project starter code/node_modules/merge-descriptors/package.json b/node_modules/merge-descriptors/package.json similarity index 100% rename from project starter code/node_modules/merge-descriptors/package.json rename to node_modules/merge-descriptors/package.json diff --git a/project starter code/node_modules/methods/HISTORY.md b/node_modules/methods/HISTORY.md similarity index 100% rename from project starter code/node_modules/methods/HISTORY.md rename to node_modules/methods/HISTORY.md diff --git a/project starter code/node_modules/methods/LICENSE b/node_modules/methods/LICENSE similarity index 100% rename from project starter code/node_modules/methods/LICENSE rename to node_modules/methods/LICENSE diff --git a/project starter code/node_modules/methods/README.md b/node_modules/methods/README.md similarity index 100% rename from project starter code/node_modules/methods/README.md rename to node_modules/methods/README.md diff --git a/project starter code/node_modules/methods/index.js b/node_modules/methods/index.js similarity index 100% rename from project starter code/node_modules/methods/index.js rename to node_modules/methods/index.js diff --git a/project starter code/node_modules/methods/package.json b/node_modules/methods/package.json similarity index 100% rename from project starter code/node_modules/methods/package.json rename to node_modules/methods/package.json diff --git a/project starter code/node_modules/mime-db/HISTORY.md b/node_modules/mime-db/HISTORY.md similarity index 100% rename from project starter code/node_modules/mime-db/HISTORY.md rename to node_modules/mime-db/HISTORY.md diff --git a/project starter code/node_modules/mime-db/LICENSE b/node_modules/mime-db/LICENSE similarity index 100% rename from project starter code/node_modules/mime-db/LICENSE rename to node_modules/mime-db/LICENSE diff --git a/project starter code/node_modules/mime-db/README.md b/node_modules/mime-db/README.md similarity index 100% rename from project starter code/node_modules/mime-db/README.md rename to node_modules/mime-db/README.md diff --git a/project starter code/node_modules/mime-db/db.json b/node_modules/mime-db/db.json similarity index 100% rename from project starter code/node_modules/mime-db/db.json rename to node_modules/mime-db/db.json diff --git a/project starter code/node_modules/mime-db/index.js b/node_modules/mime-db/index.js similarity index 100% rename from project starter code/node_modules/mime-db/index.js rename to node_modules/mime-db/index.js diff --git a/project starter code/node_modules/mime-db/package.json b/node_modules/mime-db/package.json similarity index 100% rename from project starter code/node_modules/mime-db/package.json rename to node_modules/mime-db/package.json diff --git a/project starter code/node_modules/mime-types/HISTORY.md b/node_modules/mime-types/HISTORY.md similarity index 100% rename from project starter code/node_modules/mime-types/HISTORY.md rename to node_modules/mime-types/HISTORY.md diff --git a/project starter code/node_modules/mime-types/LICENSE b/node_modules/mime-types/LICENSE similarity index 100% rename from project starter code/node_modules/mime-types/LICENSE rename to node_modules/mime-types/LICENSE diff --git a/project starter code/node_modules/mime-types/README.md b/node_modules/mime-types/README.md similarity index 100% rename from project starter code/node_modules/mime-types/README.md rename to node_modules/mime-types/README.md diff --git a/project starter code/node_modules/mime-types/index.js b/node_modules/mime-types/index.js similarity index 100% rename from project starter code/node_modules/mime-types/index.js rename to node_modules/mime-types/index.js diff --git a/project starter code/node_modules/mime-types/package.json b/node_modules/mime-types/package.json similarity index 100% rename from project starter code/node_modules/mime-types/package.json rename to node_modules/mime-types/package.json diff --git a/project starter code/node_modules/mime/.npmignore b/node_modules/mime/.npmignore similarity index 100% rename from project starter code/node_modules/mime/.npmignore rename to node_modules/mime/.npmignore diff --git a/project starter code/node_modules/mime/CHANGELOG.md b/node_modules/mime/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/mime/CHANGELOG.md rename to node_modules/mime/CHANGELOG.md diff --git a/project starter code/node_modules/mime/LICENSE b/node_modules/mime/LICENSE similarity index 100% rename from project starter code/node_modules/mime/LICENSE rename to node_modules/mime/LICENSE diff --git a/project starter code/node_modules/mime/README.md b/node_modules/mime/README.md similarity index 100% rename from project starter code/node_modules/mime/README.md rename to node_modules/mime/README.md diff --git a/project starter code/node_modules/mime/cli.js b/node_modules/mime/cli.js similarity index 100% rename from project starter code/node_modules/mime/cli.js rename to node_modules/mime/cli.js diff --git a/project starter code/node_modules/mime/mime.js b/node_modules/mime/mime.js similarity index 100% rename from project starter code/node_modules/mime/mime.js rename to node_modules/mime/mime.js diff --git a/project starter code/node_modules/mime/package.json b/node_modules/mime/package.json similarity index 100% rename from project starter code/node_modules/mime/package.json rename to node_modules/mime/package.json diff --git a/project starter code/node_modules/mime/src/build.js b/node_modules/mime/src/build.js similarity index 100% rename from project starter code/node_modules/mime/src/build.js rename to node_modules/mime/src/build.js diff --git a/project starter code/node_modules/mime/src/test.js b/node_modules/mime/src/test.js similarity index 100% rename from project starter code/node_modules/mime/src/test.js rename to node_modules/mime/src/test.js diff --git a/project starter code/node_modules/mime/types.json b/node_modules/mime/types.json similarity index 100% rename from project starter code/node_modules/mime/types.json rename to node_modules/mime/types.json diff --git a/project starter code/node_modules/min-document/.jshintrc b/node_modules/min-document/.jshintrc similarity index 100% rename from project starter code/node_modules/min-document/.jshintrc rename to node_modules/min-document/.jshintrc diff --git a/project starter code/node_modules/min-document/.npmignore b/node_modules/min-document/.npmignore similarity index 100% rename from project starter code/node_modules/min-document/.npmignore rename to node_modules/min-document/.npmignore diff --git a/project starter code/node_modules/min-document/.testem.json b/node_modules/min-document/.testem.json similarity index 100% rename from project starter code/node_modules/min-document/.testem.json rename to node_modules/min-document/.testem.json diff --git a/project starter code/node_modules/min-document/.travis.yml b/node_modules/min-document/.travis.yml similarity index 100% rename from project starter code/node_modules/min-document/.travis.yml rename to node_modules/min-document/.travis.yml diff --git a/project starter code/node_modules/min-document/CONTRIBUTION.md b/node_modules/min-document/CONTRIBUTION.md similarity index 100% rename from project starter code/node_modules/min-document/CONTRIBUTION.md rename to node_modules/min-document/CONTRIBUTION.md diff --git a/project starter code/node_modules/min-document/LICENCE b/node_modules/min-document/LICENCE similarity index 100% rename from project starter code/node_modules/min-document/LICENCE rename to node_modules/min-document/LICENCE diff --git a/project starter code/node_modules/min-document/README.md b/node_modules/min-document/README.md similarity index 100% rename from project starter code/node_modules/min-document/README.md rename to node_modules/min-document/README.md diff --git a/project starter code/node_modules/min-document/docs.mli b/node_modules/min-document/docs.mli similarity index 100% rename from project starter code/node_modules/min-document/docs.mli rename to node_modules/min-document/docs.mli diff --git a/project starter code/node_modules/min-document/document.js b/node_modules/min-document/document.js similarity index 100% rename from project starter code/node_modules/min-document/document.js rename to node_modules/min-document/document.js diff --git a/project starter code/node_modules/min-document/dom-comment.js b/node_modules/min-document/dom-comment.js similarity index 100% rename from project starter code/node_modules/min-document/dom-comment.js rename to node_modules/min-document/dom-comment.js diff --git a/project starter code/node_modules/min-document/dom-element.js b/node_modules/min-document/dom-element.js similarity index 100% rename from project starter code/node_modules/min-document/dom-element.js rename to node_modules/min-document/dom-element.js diff --git a/project starter code/node_modules/min-document/dom-fragment.js b/node_modules/min-document/dom-fragment.js similarity index 100% rename from project starter code/node_modules/min-document/dom-fragment.js rename to node_modules/min-document/dom-fragment.js diff --git a/project starter code/node_modules/min-document/dom-text.js b/node_modules/min-document/dom-text.js similarity index 100% rename from project starter code/node_modules/min-document/dom-text.js rename to node_modules/min-document/dom-text.js diff --git a/project starter code/node_modules/min-document/event.js b/node_modules/min-document/event.js similarity index 100% rename from project starter code/node_modules/min-document/event.js rename to node_modules/min-document/event.js diff --git a/project starter code/node_modules/min-document/event/add-event-listener.js b/node_modules/min-document/event/add-event-listener.js similarity index 100% rename from project starter code/node_modules/min-document/event/add-event-listener.js rename to node_modules/min-document/event/add-event-listener.js diff --git a/project starter code/node_modules/min-document/event/dispatch-event.js b/node_modules/min-document/event/dispatch-event.js similarity index 100% rename from project starter code/node_modules/min-document/event/dispatch-event.js rename to node_modules/min-document/event/dispatch-event.js diff --git a/project starter code/node_modules/min-document/event/remove-event-listener.js b/node_modules/min-document/event/remove-event-listener.js similarity index 100% rename from project starter code/node_modules/min-document/event/remove-event-listener.js rename to node_modules/min-document/event/remove-event-listener.js diff --git a/project starter code/node_modules/min-document/index.js b/node_modules/min-document/index.js similarity index 100% rename from project starter code/node_modules/min-document/index.js rename to node_modules/min-document/index.js diff --git a/project starter code/node_modules/min-document/package.json b/node_modules/min-document/package.json similarity index 100% rename from project starter code/node_modules/min-document/package.json rename to node_modules/min-document/package.json diff --git a/project starter code/node_modules/min-document/serialize.js b/node_modules/min-document/serialize.js similarity index 100% rename from project starter code/node_modules/min-document/serialize.js rename to node_modules/min-document/serialize.js diff --git a/project starter code/node_modules/min-document/test/cleanup.js b/node_modules/min-document/test/cleanup.js similarity index 100% rename from project starter code/node_modules/min-document/test/cleanup.js rename to node_modules/min-document/test/cleanup.js diff --git a/project starter code/node_modules/min-document/test/index.js b/node_modules/min-document/test/index.js similarity index 100% rename from project starter code/node_modules/min-document/test/index.js rename to node_modules/min-document/test/index.js diff --git a/project starter code/node_modules/min-document/test/static/index.html b/node_modules/min-document/test/static/index.html similarity index 100% rename from project starter code/node_modules/min-document/test/static/index.html rename to node_modules/min-document/test/static/index.html diff --git a/project starter code/node_modules/min-document/test/static/test-adapter.js b/node_modules/min-document/test/static/test-adapter.js similarity index 100% rename from project starter code/node_modules/min-document/test/static/test-adapter.js rename to node_modules/min-document/test/static/test-adapter.js diff --git a/project starter code/node_modules/min-document/test/test-document.js b/node_modules/min-document/test/test-document.js similarity index 100% rename from project starter code/node_modules/min-document/test/test-document.js rename to node_modules/min-document/test/test-document.js diff --git a/project starter code/node_modules/min-document/test/test-dom-comment.js b/node_modules/min-document/test/test-dom-comment.js similarity index 100% rename from project starter code/node_modules/min-document/test/test-dom-comment.js rename to node_modules/min-document/test/test-dom-comment.js diff --git a/project starter code/node_modules/min-document/test/test-dom-element.js b/node_modules/min-document/test/test-dom-element.js similarity index 100% rename from project starter code/node_modules/min-document/test/test-dom-element.js rename to node_modules/min-document/test/test-dom-element.js diff --git a/node_modules/minimist/.eslintrc b/node_modules/minimist/.eslintrc new file mode 100644 index 00000000..bd1a5e04 --- /dev/null +++ b/node_modules/minimist/.eslintrc @@ -0,0 +1,29 @@ +{ + "root": true, + + "extends": "@ljharb/eslint-config/node/0.4", + + "rules": { + "array-element-newline": 0, + "complexity": 0, + "func-style": [2, "declaration"], + "max-lines-per-function": 0, + "max-nested-callbacks": 1, + "max-statements-per-line": 1, + "max-statements": 0, + "multiline-comment-style": 0, + "no-continue": 1, + "no-param-reassign": 1, + "no-restricted-syntax": 1, + "object-curly-newline": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "camelcase": 0, + }, + }, + ] +} diff --git a/project starter code/node_modules/minimist/.github/FUNDING.yml b/node_modules/minimist/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/minimist/.github/FUNDING.yml rename to node_modules/minimist/.github/FUNDING.yml diff --git a/project starter code/node_modules/minimist/.nycrc b/node_modules/minimist/.nycrc similarity index 100% rename from project starter code/node_modules/minimist/.nycrc rename to node_modules/minimist/.nycrc diff --git a/node_modules/minimist/CHANGELOG.md b/node_modules/minimist/CHANGELOG.md new file mode 100644 index 00000000..c9a1e15e --- /dev/null +++ b/node_modules/minimist/CHANGELOG.md @@ -0,0 +1,298 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.8](https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] Fix long option followed by single dash [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) +- [Fix] Fix handling of short option with non-trivial equals [`#5`](https://github.com/minimistjs/minimist/issues/5) +- [Tests] Remove duplicate test [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- Merge tag 'v0.2.3' [`a026794`](https://github.com/minimistjs/minimist/commit/a0267947c7870fc5847cf2d437fbe33f392767da) +- [eslint] fix indentation and whitespace [`5368ca4`](https://github.com/minimistjs/minimist/commit/5368ca4147e974138a54cc0dc4cea8f756546b70) +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`62fde7d`](https://github.com/minimistjs/minimist/commit/62fde7d935f83417fb046741531a9e2346a36976) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`3124ed3`](https://github.com/minimistjs/minimist/commit/3124ed3e46306301ebb3c834874ce0241555c2c4) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) +- [actions] Avoid 0.6 tests due to build failures [`ba92fe6`](https://github.com/minimistjs/minimist/commit/ba92fe6ebbdc0431cca9a2ea8f27beb492f5e4ec) +- [Dev Deps] update `tape` [`950eaa7`](https://github.com/minimistjs/minimist/commit/950eaa74f112e04d23e9c606c67472c46739b473) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) +- Merge tag 'v0.2.2' [`980d7ac`](https://github.com/minimistjs/minimist/commit/980d7ac61a0b4bd552711251ac107d506b23e41f) + +## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`0ebf4eb`](https://github.com/minimistjs/minimist/commit/0ebf4ebcd5f7787a5524d31a849ef41316b83c3c) +- [actions] add reusable workflows [`e115b63`](https://github.com/minimistjs/minimist/commit/e115b63fa9d3909f33b00a2db647ff79068388de) +- [eslint] add eslint; rules to enable later are warnings [`f58745b`](https://github.com/minimistjs/minimist/commit/f58745b9bb84348e1be72af7dbba5840c7c13013) +- [Dev Deps] switch from `covert` to `nyc` [`ab03356`](https://github.com/minimistjs/minimist/commit/ab033567b9c8b31117cb026dc7f1e592ce455c65) +- [readme] rename and add badges [`236f4a0`](https://github.com/minimistjs/minimist/commit/236f4a07e4ebe5ee44f1496ec6974991ab293ffd) +- [meta] create FUNDING.yml; add `funding` in package.json [`783a49b`](https://github.com/minimistjs/minimist/commit/783a49bfd47e8335d3098a8cac75662cf71eb32a) +- [meta] use `npmignore` to autogenerate an npmignore file [`f81ece6`](https://github.com/minimistjs/minimist/commit/f81ece6aaec2fa14e69ff4f1e0407a8c4e2635a2) +- Only apps should have lockfiles [`56cad44`](https://github.com/minimistjs/minimist/commit/56cad44c7f879b9bb5ec18fcc349308024a89bfc) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`49c5f9f`](https://github.com/minimistjs/minimist/commit/49c5f9fb7e6a92db9eb340cc679de92fb3aacded) +- [Tests] add `aud` in `posttest` [`228ae93`](https://github.com/minimistjs/minimist/commit/228ae938f3cd9db9dfd8bd7458b076a7b2aef280) +- [meta] add `safe-publish-latest` [`01fc23f`](https://github.com/minimistjs/minimist/commit/01fc23f5104f85c75059972e01dd33796ab529ff) +- [meta] update repo URLs [`6b164c7`](https://github.com/minimistjs/minimist/commit/6b164c7d68e0b6bf32f894699effdfb7c63041dd) + +## [v1.2.6](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6) - 2022-03-21 + +### Commits + +- test from prototype pollution PR [`bc8ecee`](https://github.com/minimistjs/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb) +- isConstructorOrProto adapted from PR [`c2b9819`](https://github.com/minimistjs/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d) +- security notice for additional prototype pollution issue [`ef88b93`](https://github.com/minimistjs/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2) + +## [v1.2.5](https://github.com/minimistjs/minimist/compare/v1.2.4...v1.2.5) - 2020-03-12 + +## [v1.2.4](https://github.com/minimistjs/minimist/compare/v1.2.3...v1.2.4) - 2020-03-11 + +### Commits + +- security notice [`4cf1354`](https://github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11f) +- additional test for constructor prototype pollution [`1043d21`](https://github.com/minimistjs/minimist/commit/1043d212c3caaf871966e710f52cfdf02f9eea4b) + +## [v1.2.3](https://github.com/minimistjs/minimist/compare/v1.2.2...v1.2.3) - 2020-03-10 + +### Commits + +- more failing proto pollution tests [`13c01a5`](https://github.com/minimistjs/minimist/commit/13c01a5327736903704984b7f65616b8476850cc) +- even more aggressive checks for protocol pollution [`38a4d1c`](https://github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9ab) + +## [v1.2.2](https://github.com/minimistjs/minimist/compare/v1.2.1...v1.2.2) - 2020-03-10 + +### Commits + +- failing test for protocol pollution [`0efed03`](https://github.com/minimistjs/minimist/commit/0efed0340ec8433638758f7ca0c77cb20a0bfbab) +- cleanup [`67d3722`](https://github.com/minimistjs/minimist/commit/67d3722413448d00a62963d2d30c34656a92d7e2) +- console.dir -> console.log [`47acf72`](https://github.com/minimistjs/minimist/commit/47acf72c715a630bf9ea013867f47f1dd69dfc54) +- don't assign onto __proto__ [`63e7ed0`](https://github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94) + +## [v1.2.1](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.1) - 2020-03-10 + +### Merged + +- move the `opts['--']` example back where it belongs [`#63`](https://github.com/minimistjs/minimist/pull/63) + +### Commits + +- add test [`6be5dae`](https://github.com/minimistjs/minimist/commit/6be5dae35a32a987bcf4137fcd6c19c5200ee909) +- fix bad boolean regexp [`ac3fc79`](https://github.com/minimistjs/minimist/commit/ac3fc796e63b95128fdbdf67ea7fad71bd59aa76) + +## [v1.2.0](https://github.com/minimistjs/minimist/compare/v1.1.3...v1.2.0) - 2015-08-24 + +### Commits + +- failing -k=v short test [`63416b8`](https://github.com/minimistjs/minimist/commit/63416b8cd1d0d70e4714564cce465a36e4dd26d7) +- kv short fix [`6bbe145`](https://github.com/minimistjs/minimist/commit/6bbe14529166245e86424f220a2321442fe88dc3) +- failing kv short test [`f72ab7f`](https://github.com/minimistjs/minimist/commit/f72ab7f4572adc52902c9b6873cc969192f01b10) +- fixed kv test [`f5a48c3`](https://github.com/minimistjs/minimist/commit/f5a48c3e50e40ca54f00c8e84de4b4d6e9897fa8) +- enforce space between arg key and value [`86b321a`](https://github.com/minimistjs/minimist/commit/86b321affe648a8e016c095a4f0efa9d9074f502) + +## [v1.1.3](https://github.com/minimistjs/minimist/compare/v1.1.2...v1.1.3) - 2015-08-06 + +### Commits + +- add failing test - boolean alias array [`0fa3c5b`](https://github.com/minimistjs/minimist/commit/0fa3c5b3dd98551ddecf5392831b4c21211743fc) +- fix boolean values with multiple aliases [`9c0a6e7`](https://github.com/minimistjs/minimist/commit/9c0a6e7de25a273b11bbf9a7464f0bd833779795) + +## [v1.1.2](https://github.com/minimistjs/minimist/compare/v1.1.1...v1.1.2) - 2015-07-22 + +### Commits + +- Convert boolean arguments to boolean values [`8f3dc27`](https://github.com/minimistjs/minimist/commit/8f3dc27cf833f1d54671b6d0bcb55c2fe19672a9) +- use non-ancient npm, node 0.12 and iojs [`61ed1d0`](https://github.com/minimistjs/minimist/commit/61ed1d034b9ec7282764ce76f3992b1a0b4906ae) +- an older npm for 0.8 [`25cf778`](https://github.com/minimistjs/minimist/commit/25cf778b1220e7838a526832ad6972f75244054f) + +## [v1.1.1](https://github.com/minimistjs/minimist/compare/v1.1.0...v1.1.1) - 2015-03-10 + +### Commits + +- check that they type of a value is a boolean, not just that it is currently set to a boolean [`6863198`](https://github.com/minimistjs/minimist/commit/6863198e36139830ff1f20ffdceaddd93f2c1db9) +- upgrade tape, fix type issues from old tape version [`806712d`](https://github.com/minimistjs/minimist/commit/806712df91604ed02b8e39aa372b84aea659ee34) +- test for setting a boolean to a null default [`8c444fe`](https://github.com/minimistjs/minimist/commit/8c444fe89384ded7d441c120915ea60620b01dd3) +- if the previous value was a boolean, without an default (or with an alias) don't make an array either [`e5f419a`](https://github.com/minimistjs/minimist/commit/e5f419a3b5b3bc3f9e5ac71b7040621af70ed2dd) + +## [v1.1.0](https://github.com/minimistjs/minimist/compare/v1.0.0...v1.1.0) - 2014-08-10 + +### Commits + +- add support for handling "unknown" options not registered with the parser. [`6f3cc5d`](https://github.com/minimistjs/minimist/commit/6f3cc5d4e84524932a6ef2ce3592acc67cdd4383) +- reformat package.json [`02ed371`](https://github.com/minimistjs/minimist/commit/02ed37115194d3697ff358e8e25e5e66bab1d9f8) +- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df) +- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498) + +## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.3...v1.0.0) - 2014-08-10 + +### Commits + +- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9) +- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e) + +## [v0.2.3](https://github.com/minimistjs/minimist/compare/v0.2.2...v0.2.3) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) + +## [v0.2.2](https://github.com/minimistjs/minimist/compare/v0.2.1...v0.2.2) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) + +## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12 + +## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19 + +### Commits + +- support all-boolean mode [`450a97f`](https://github.com/minimistjs/minimist/commit/450a97f6e2bc85c7a4a13185c19a818d9a5ebe69) + +## [v0.1.0](https://github.com/minimistjs/minimist/compare/v0.0.10...v0.1.0) - 2014-05-12 + +### Commits + +- Provide a mechanism to segregate -- arguments [`ce4a1e6`](https://github.com/minimistjs/minimist/commit/ce4a1e63a7e8d5ab88d2a3768adefa6af98a445a) +- documented argv['--'] [`14db0e6`](https://github.com/minimistjs/minimist/commit/14db0e6dbc6d2b9e472adaa54dad7004b364634f) +- Adding a test-case for notFlags segregation [`715c1e3`](https://github.com/minimistjs/minimist/commit/715c1e3714be223f998f6c537af6b505f0236c16) + +## [v0.0.10](https://github.com/minimistjs/minimist/compare/v0.0.9...v0.0.10) - 2014-05-11 + +### Commits + +- dedicated boolean test [`46e448f`](https://github.com/minimistjs/minimist/commit/46e448f9f513cfeb2bcc8b688b9b47ba1e515c2b) +- dedicated num test [`9bf2d36`](https://github.com/minimistjs/minimist/commit/9bf2d36f1d3b8795be90b8f7de0a937f098aa394) +- aliased values treated as strings [`1ab743b`](https://github.com/minimistjs/minimist/commit/1ab743bad4484d69f1259bed42f9531de01119de) +- cover the case of already numbers, at 100% coverage [`b2bb044`](https://github.com/minimistjs/minimist/commit/b2bb04436599d77a2ce029e8e555e25b3aa55d13) +- another test for higher coverage [`3662624`](https://github.com/minimistjs/minimist/commit/3662624be976d5489d486a856849c048d13be903) + +## [v0.0.9](https://github.com/minimistjs/minimist/compare/v0.0.8...v0.0.9) - 2014-05-08 + +### Commits + +- Eliminate `longest` fn. [`824f642`](https://github.com/minimistjs/minimist/commit/824f642038d1b02ede68b6261d1d65163390929a) + +## [v0.0.8](https://github.com/minimistjs/minimist/compare/v0.0.7...v0.0.8) - 2014-02-20 + +### Commits + +- return '' if flag is string and empty [`fa63ed4`](https://github.com/minimistjs/minimist/commit/fa63ed4651a4ef4eefddce34188e0d98d745a263) +- handle joined single letters [`66c248f`](https://github.com/minimistjs/minimist/commit/66c248f0241d4d421d193b022e9e365f11178534) + +## [v0.0.7](https://github.com/minimistjs/minimist/compare/v0.0.6...v0.0.7) - 2014-02-08 + +### Commits + +- another swap of .test for .match [`d1da408`](https://github.com/minimistjs/minimist/commit/d1da40819acbe846d89a5c02721211e3c1260dde) + +## [v0.0.6](https://github.com/minimistjs/minimist/compare/v0.0.5...v0.0.6) - 2014-02-08 + +### Commits + +- use .test() instead of .match() to not crash on non-string values in the arguments array [`7e0d1ad`](https://github.com/minimistjs/minimist/commit/7e0d1add8c9e5b9b20a4d3d0f9a94d824c578da1) + +## [v0.0.5](https://github.com/minimistjs/minimist/compare/v0.0.4...v0.0.5) - 2013-09-18 + +### Commits + +- Improve '--' handling. [`b11822c`](https://github.com/minimistjs/minimist/commit/b11822c09cc9d2460f30384d12afc0b953c037a4) + +## [v0.0.4](https://github.com/minimistjs/minimist/compare/v0.0.3...v0.0.4) - 2013-09-17 + +## [v0.0.3](https://github.com/minimistjs/minimist/compare/v0.0.2...v0.0.3) - 2013-09-12 + +### Commits + +- failing test for single dash preceeding a double dash [`b465514`](https://github.com/minimistjs/minimist/commit/b465514b82c9ae28972d714facd951deb2ad762b) +- fix for the dot test [`6a095f1`](https://github.com/minimistjs/minimist/commit/6a095f1d364c8fab2d6753d2291a0649315d297a) + +## [v0.0.2](https://github.com/minimistjs/minimist/compare/v0.0.1...v0.0.2) - 2013-08-28 + +### Commits + +- allow dotted aliases & defaults [`321c33e`](https://github.com/minimistjs/minimist/commit/321c33e755485faaeb44eeb1c05d33b2e0a5a7c4) +- use a better version of ff [`e40f611`](https://github.com/minimistjs/minimist/commit/e40f61114cf7be6f7947f7b3eed345853a67dbbb) + +## [v0.0.1](https://github.com/minimistjs/minimist/compare/v0.0.0...v0.0.1) - 2013-06-25 + +### Commits + +- remove trailing commas [`6ff0fa0`](https://github.com/minimistjs/minimist/commit/6ff0fa055064f15dbe06d50b89d5173a6796e1db) + +## v0.0.0 - 2013-06-25 + +### Commits + +- half of the parse test ported [`3079326`](https://github.com/minimistjs/minimist/commit/307932601325087de6cf94188eb798ffc4f3088a) +- stripped down code and a passing test from optimist [`7cced88`](https://github.com/minimistjs/minimist/commit/7cced88d82e399d1a03ed23eb667f04d3f320d10) +- ported parse tests completely over [`9448754`](https://github.com/minimistjs/minimist/commit/944875452e0820df6830b1408c26a0f7d3e1db04) +- docs, package.json [`a5bf46a`](https://github.com/minimistjs/minimist/commit/a5bf46ac9bb3bd114a9c340276c62c1091e538d5) +- move more short tests into short.js [`503edb5`](https://github.com/minimistjs/minimist/commit/503edb5c41d89c0d40831ee517154fc13b0f18b9) +- default bool test was wrong, not the code [`1b9f5db`](https://github.com/minimistjs/minimist/commit/1b9f5db4741b49962846081b68518de824992097) +- passing long tests ripped out of parse.js [`7972c4a`](https://github.com/minimistjs/minimist/commit/7972c4aff1f4803079e1668006658e2a761a0428) +- badges [`84c0370`](https://github.com/minimistjs/minimist/commit/84c037063664d42878aace715fe6572ce01b6f3b) +- all the tests now ported, some failures [`64239ed`](https://github.com/minimistjs/minimist/commit/64239edfe92c711c4eb0da254fcdfad2a5fdb605) +- failing short test [`f8a5341`](https://github.com/minimistjs/minimist/commit/f8a534112dd1138d2fad722def56a848480c446f) +- fixed the numeric test [`6b034f3`](https://github.com/minimistjs/minimist/commit/6b034f37c79342c60083ed97fd222e16928aac51) diff --git a/project starter code/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE similarity index 100% rename from project starter code/node_modules/minimist/LICENSE rename to node_modules/minimist/LICENSE diff --git a/node_modules/minimist/README.md b/node_modules/minimist/README.md new file mode 100644 index 00000000..74da3234 --- /dev/null +++ b/node_modules/minimist/README.md @@ -0,0 +1,121 @@ +# minimist [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ + _: ['foo', 'bar', 'baz'], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' +} +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.6 or later: + +* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) +* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { + _: ['one', 'two', 'three'], + '--': ['four', 'five', '--six'] + } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT + +[package-url]: https://npmjs.org/package/minimist +[npm-version-svg]: https://versionbadg.es/minimistjs/minimist.svg +[npm-badge-png]: https://nodei.co/npm/minimist.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/minimist.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/minimist.svg +[downloads-url]: https://npm-stat.com/charts.html?package=minimist +[codecov-image]: https://codecov.io/gh/minimistjs/minimist/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/minimistjs/minimist/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/minimistjs/minimist +[actions-url]: https://github.com/minimistjs/minimist/actions diff --git a/node_modules/minimist/example/parse.js b/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..9d90ffb2 --- /dev/null +++ b/node_modules/minimist/example/parse.js @@ -0,0 +1,4 @@ +'use strict'; + +var argv = require('../')(process.argv.slice(2)); +console.log(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js new file mode 100644 index 00000000..f020f394 --- /dev/null +++ b/node_modules/minimist/index.js @@ -0,0 +1,263 @@ +'use strict'; + +function hasKey(obj, keys) { + var o = obj; + keys.slice(0, -1).forEach(function (key) { + o = o[key] || {}; + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber(x) { + if (typeof x === 'number') { return true; } + if ((/^0x[0-9a-f]+$/i).test(x)) { return true; } + return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x); +} + +function isConstructorOrProto(obj, key) { + return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__'; +} + +module.exports = function (args, opts) { + if (!opts) { opts = {}; } + + var flags = { + bools: {}, + strings: {}, + unknownFn: null, + }; + + if (typeof opts.unknown === 'function') { + flags.unknownFn = opts.unknown; + } + + if (typeof opts.boolean === 'boolean' && opts.boolean) { + flags.allBools = true; + } else { + [].concat(opts.boolean).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + [].concat(aliases[key]).forEach(function (k) { + flags.strings[k] = true; + }); + } + }); + + var defaults = opts.default || {}; + + var argv = { _: [] }; + + function argDefined(key, arg) { + return (flags.allBools && (/^--[^=]+$/).test(arg)) + || flags.strings[key] + || flags.bools[key] + || aliases[key]; + } + + function setKey(obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length - 1; i++) { + var key = keys[i]; + if (isConstructorOrProto(o, key)) { return; } + if (o[key] === undefined) { o[key] = {}; } + if ( + o[key] === Object.prototype + || o[key] === Number.prototype + || o[key] === String.prototype + ) { + o[key] = {}; + } + if (o[key] === Array.prototype) { o[key] = []; } + o = o[key]; + } + + var lastKey = keys[keys.length - 1]; + if (isConstructorOrProto(o, lastKey)) { return; } + if ( + o === Object.prototype + || o === Number.prototype + || o === String.prototype + ) { + o = {}; + } + if (o === Array.prototype) { o = []; } + if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') { + o[lastKey] = value; + } else if (Array.isArray(o[lastKey])) { + o[lastKey].push(value); + } else { + o[lastKey] = [o[lastKey], value]; + } + } + + function setArg(key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) { return; } + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) + : val; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--') + 1); + args = args.slice(0, args.indexOf('--')); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var key; + var next; + + if ((/^--.+=/).test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } else if ((/^--no-.+/).test(arg)) { + key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } else if ((/^--.+/).test(arg)) { + key = arg.match(/^--(.+)/)[1]; + next = args[i + 1]; + if ( + next !== undefined + && !(/^(-|--)[^-]/).test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, next, arg); + i += 1; + } else if ((/^(true|false)$/).test(next)) { + setArg(key, next === 'true', arg); + i += 1; + } else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } else if ((/^-[^-]+/).test(arg)) { + var letters = arg.slice(1, -1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + next = arg.slice(j + 2); + + if (next === '-') { + setArg(letters[j], next, arg); + continue; + } + + if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') { + setArg(letters[j], next.slice(1), arg); + broken = true; + break; + } + + if ( + (/[A-Za-z]/).test(letters[j]) + && (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next) + ) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j + 1] && letters[j + 1].match(/\W/)) { + setArg(letters[j], arg.slice(j + 2), arg); + broken = true; + break; + } else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if ( + args[i + 1] + && !(/^(-|--)[^-]/).test(args[i + 1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, args[i + 1], arg); + i += 1; + } else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) { + setArg(key, args[i + 1] === 'true', arg); + i += 1; + } else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg)); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (k) { + if (!hasKey(argv, k.split('.'))) { + setKey(argv, k.split('.'), defaults[k]); + + (aliases[k] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[k]); + }); + } + }); + + if (opts['--']) { + argv['--'] = notFlags.slice(); + } else { + notFlags.forEach(function (k) { + argv._.push(k); + }); + } + + return argv; +}; diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json new file mode 100644 index 00000000..c10a3344 --- /dev/null +++ b/node_modules/minimist/package.json @@ -0,0 +1,75 @@ +{ + "name": "minimist", + "version": "1.2.8", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.1", + "aud": "^2.0.2", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.3" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/minimistjs/minimist.git" + }, + "homepage": "https://github.com/minimistjs/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js new file mode 100644 index 00000000..befa0c99 --- /dev/null +++ b/node_modules/minimist/test/all_bool.js @@ -0,0 +1,34 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true, + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'], + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true, + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'], + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js new file mode 100644 index 00000000..e58d47e4 --- /dev/null +++ b/node_modules/minimist/test/bool.js @@ -0,0 +1,177 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false }, + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'], + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse(['-x', '-z', 'one', 'two', 'three'], { + boolean: ['x', 'y', 'z'], + }); + + t.deepEqual(argv, { + x: true, + y: false, + z: true, + _: ['one', 'two', 'three'], + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' }, + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' }, + }); + var expected = { + herp: true, + h: true, + _: ['derp'], + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var opts = { + alias: { h: 'herp' }, + boolean: 'herp', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + _: ['derp'], + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias array with options hash', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var alt = ['--harp', 'derp']; + var opts = { + alias: { h: ['herp', 'harp'] }, + boolean: 'h', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var altPropertyArgv = parse(alt, opts); + var expected = { + harp: true, + herp: true, + h: true, + _: ['derp'], + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.same(altPropertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = ['-h', 'true']; + var regular = ['--herp', 'true']; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + _: [], + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function (t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool', + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool', + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); + +test('boolean --boool=true', function (t) { + var parsed = parse(['--boool=true'], { + default: { + boool: false, + }, + boolean: ['boool'], + }); + + t.same(parsed.boool, true); + t.end(); +}); + +test('boolean --boool=false', function (t) { + var parsed = parse(['--boool=false'], { + default: { + boool: true, + }, + boolean: ['boool'], + }); + + t.same(parsed.boool, false); + t.end(); +}); + +test('boolean using something similar to true', function (t) { + var opts = { boolean: 'h' }; + var result = parse(['-h', 'true.txt'], opts); + var expected = { + h: true, + _: ['true.txt'], + }; + + t.same(result, expected); + t.end(); +}); diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..70788177 --- /dev/null +++ b/node_modules/minimist/test/dash.js @@ -0,0 +1,43 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(6); + t.deepEqual(parse(['-n', '-']), { n: '-', _: [] }); + t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] }); + t.deepEqual(parse(['-']), { _: ['-'] }); + t.deepEqual(parse(['-f-']), { f: '-', _: [] }); + t.deepEqual( + parse(['-b', '-'], { boolean: 'b' }), + { b: true, _: ['-'] } + ); + t.deepEqual( + parse(['-s', '-'], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(2); + t.deepEqual(parse(['-a', '--', 'b']), { a: true, _: ['b'] }); + t.deepEqual(parse(['--a', '--', 'b']), { a: true, _: ['b'] }); +}); + +test('move arguments after the -- into their own `--` array', function (t) { + t.plan(1); + t.deepEqual( + parse(['--name', 'John', 'before', '--', 'after'], { '--': true }), + { name: 'John', _: ['before'], '--': ['after'] } + ); +}); + +test('--- option value', function (t) { + // A multi-dash value is largely an edge case, but check the behaviour is as expected, + // and in particular the same for short option and long option (as made consistent in Jan 2023). + t.plan(2); + t.deepEqual(parse(['-n', '---']), { n: '---', _: [] }); + t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] }); +}); + diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..4e9f6250 --- /dev/null +++ b/node_modules/minimist/test/default_bool.js @@ -0,0 +1,37 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true }, + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false }, + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argv.maybe, null); + + var argvLong = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argvLong.maybe, true); + t.end(); +}); diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..126ff033 --- /dev/null +++ b/node_modules/minimist/test/dotted.js @@ -0,0 +1,24 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } }); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } }); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', { default: { 'a.b': 11 } }); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js new file mode 100644 index 00000000..6d1b53a7 --- /dev/null +++ b/node_modules/minimist/test/kv_short.js @@ -0,0 +1,32 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('short -k=v', function (t) { + t.plan(1); + + var argv = parse(['-b=123']); + t.deepEqual(argv, { b: 123, _: [] }); +}); + +test('multi short -k=v', function (t) { + t.plan(1); + + var argv = parse(['-a=whatever', '-b=robots']); + t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); +}); + +test('short with embedded equals -k=a=b', function (t) { + t.plan(1); + + var argv = parse(['-k=a=b']); + t.deepEqual(argv, { k: 'a=b', _: [] }); +}); + +test('short with later equals like -ab=c', function (t) { + t.plan(1); + + var argv = parse(['-ab=c']); + t.deepEqual(argv, { a: true, b: 'c', _: [] }); +}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js new file mode 100644 index 00000000..9fef51f1 --- /dev/null +++ b/node_modules/minimist/test/long.js @@ -0,0 +1,33 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse(['--bool']), + { bool: true, _: [] }, + 'long boolean' + ); + t.deepEqual( + parse(['--pow', 'xixxle']), + { pow: 'xixxle', _: [] }, + 'long capture sp' + ); + t.deepEqual( + parse(['--pow=xixxle']), + { pow: 'xixxle', _: [] }, + 'long capture eq' + ); + t.deepEqual( + parse(['--host', 'localhost', '--port', '555']), + { host: 'localhost', port: 555, _: [] }, + 'long captures sp' + ); + t.deepEqual( + parse(['--host=localhost', '--port=555']), + { host: 'localhost', port: 555, _: [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js new file mode 100644 index 00000000..074393ec --- /dev/null +++ b/node_modules/minimist/test/num.js @@ -0,0 +1,38 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789', + ]); + t.deepEqual(argv, { + x: 1234, + y: 5.67, + z: 1e7, + w: '10f', + hex: 0xdeadbeef, + _: [789], + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse(['-x', 1234, 789]); + t.deepEqual(argv, { x: 1234, _: [789] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..65d9d909 --- /dev/null +++ b/node_modules/minimist/test/parse.js @@ -0,0 +1,209 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse(['--no-moo']), + { moo: false, _: [] }, + 'no' + ); + t.deepEqual( + parse(['-v', 'a', '-v', 'b', '-v', 'c']), + { v: ['a', 'b', 'c'], _: [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek', + ]), + { + c: true, + a: true, + t: true, + s: 'woo', + h: 'awesome', + b: true, + bool: true, + key: 'value', + multi: ['quux', 'baz'], + meep: false, + name: 'meowmers', + _: ['bare', '--not-a-flag', 'eek'], + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse(['-t', 'moo'], { boolean: 't' }); + t.deepEqual(argv, { t: true, _: ['moo'] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: ['t', 'verbose'], + default: { verbose: true }, + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'], + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params', function (t) { + var args = parse(['-s', 'X\nX']); + t.deepEqual(args, { _: [], s: 'X\nX' }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse(['--s=X\nX']); + t.deepEqual(args, { _: [], s: 'X\nX' }); + t.end(); +}); + +test('strings', function (t) { + var s = parse(['-s', '0001234'], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse(['-x', '56'], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([' ', ' '], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function (t) { + var s = parse(['-s'], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse(['--str'], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse(['-art'], { + string: ['a', 't'], + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + +test('string and alias', function (t) { + var x = parse(['--str', '000123'], { + string: 's', + alias: { s: 'str' }, + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse(['-s', '000123'], { + string: 'str', + alias: { str: 's' }, + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + + var z = parse(['-s123'], { + alias: { str: ['s', 'S'] }, + string: ['str'], + }); + + t.deepEqual( + z, + { _: [], s: '123', S: '123', str: '123' }, + 'opt.string works with multiple aliases' + ); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse(['-I/foo/bar/baz']), + { I: '/foo/bar/baz', _: [] } + ); + t.same( + parse(['-xyz/foo/bar/baz']), + { x: true, y: true, z: '/foo/bar/baz', _: [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse(['-f', '11', '--zoom', '55'], { + alias: { z: 'zoom' }, + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse(['-f', '11', '--zoom', '55'], { + alias: { z: ['zm', 'zoom'] }, + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop', + ]); + + t.same(argv.foo, { + bar: 3, + baz: 4, + quux: { + quibble: 5, + o_O: true, + }, + }); + t.same(argv.beep, { boop: true }); + t.end(); +}); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..32965d13 --- /dev/null +++ b/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,11 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions', function (t) { + t.plan(1); + + var argv = parse(['-b', '123'], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/node_modules/minimist/test/proto.js b/node_modules/minimist/test/proto.js new file mode 100644 index 00000000..6e629dd3 --- /dev/null +++ b/node_modules/minimist/test/proto.js @@ -0,0 +1,64 @@ +'use strict'; + +/* eslint no-proto: 0 */ + +var parse = require('../'); +var test = require('tape'); + +test('proto pollution', function (t) { + var argv = parse(['--__proto__.x', '123']); + t.equal({}.x, undefined); + t.equal(argv.__proto__.x, undefined); + t.equal(argv.x, undefined); + t.end(); +}); + +test('proto pollution (array)', function (t) { + var argv = parse(['--x', '4', '--x', '5', '--x.__proto__.z', '789']); + t.equal({}.z, undefined); + t.deepEqual(argv.x, [4, 5]); + t.equal(argv.x.z, undefined); + t.equal(argv.x.__proto__.z, undefined); + t.end(); +}); + +test('proto pollution (number)', function (t) { + var argv = parse(['--x', '5', '--x.__proto__.z', '100']); + t.equal({}.z, undefined); + t.equal((4).z, undefined); + t.equal(argv.x, 5); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (string)', function (t) { + var argv = parse(['--x', 'abc', '--x.__proto__.z', 'def']); + t.equal({}.z, undefined); + t.equal('...'.z, undefined); + t.equal(argv.x, 'abc'); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (constructor)', function (t) { + var argv = parse(['--constructor.prototype.y', '123']); + t.equal({}.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +test('proto pollution (constructor function)', function (t) { + var argv = parse(['--_.concat.constructor.prototype.y', '123']); + function fnToBeTested() {} + t.equal(fnToBeTested.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +// powered by snyk - https://github.com/backstage/backstage/issues/10343 +test('proto pollution (constructor function) snyk', function (t) { + var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); + t.equal(function () {}.foo, undefined); + t.equal(argv.y, undefined); + t.end(); +}); diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js new file mode 100644 index 00000000..4a7b8438 --- /dev/null +++ b/node_modules/minimist/test/short.js @@ -0,0 +1,69 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse(['-n123']), { n: 123, _: [] }); + t.deepEqual( + parse(['-123', '456']), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse(['-b']), + { b: true, _: [] }, + 'short boolean' + ); + t.deepEqual( + parse(['foo', 'bar', 'baz']), + { _: ['foo', 'bar', 'baz'] }, + 'bare' + ); + t.deepEqual( + parse(['-cats']), + { c: true, a: true, t: true, s: true, _: [] }, + 'group' + ); + t.deepEqual( + parse(['-cats', 'meow']), + { c: true, a: true, t: true, s: 'meow', _: [] }, + 'short group next' + ); + t.deepEqual( + parse(['-h', 'localhost']), + { h: 'localhost', _: [] }, + 'short capture' + ); + t.deepEqual( + parse(['-h', 'localhost', '-p', '555']), + { h: 'localhost', p: 555, _: [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse(['-h', 'localhost', '-fp', '555', 'script.js']), + { + f: true, p: 555, h: 'localhost', + _: ['script.js'], + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse(['-h', 'localhost', '-fp', '555', 'script.js']), + { + f: true, p: 555, h: 'localhost', + _: ['script.js'], + } + ); + t.end(); +}); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js new file mode 100644 index 00000000..52a6a919 --- /dev/null +++ b/node_modules/minimist/test/stop_early.js @@ -0,0 +1,17 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true, + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'], + }); + + t.end(); +}); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js new file mode 100644 index 00000000..4f2e0ca4 --- /dev/null +++ b/node_modules/minimist/test/unknown.js @@ -0,0 +1,104 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'true', '--derp', 'true']; + var regular = ['--herp', 'true', '-d', 'true']; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn, + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [], + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'hello', '--derp', 'goodbye']; + var regular = ['--herp', 'hello', '-d', 'moon']; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'hello']; + var regular = ['--herp', 'hello']; + var opts = { + default: { h: 'bar' }, + alias: { h: 'herp' }, + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['--bad', '--', 'good', 'arg']; + var opts = { + '--': true, + unknown: unknownFn, + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + _: [], + }); + t.end(); +}); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..4fdaf1d3 --- /dev/null +++ b/node_modules/minimist/test/whitespace.js @@ -0,0 +1,10 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace', function (t) { + t.plan(1); + var x = parse(['-x', '\t']).x; + t.equal(x, '\t'); +}); diff --git a/project starter code/node_modules/mkdirp/LICENSE b/node_modules/mkdirp/LICENSE similarity index 100% rename from project starter code/node_modules/mkdirp/LICENSE rename to node_modules/mkdirp/LICENSE diff --git a/project starter code/node_modules/mkdirp/bin/cmd.js b/node_modules/mkdirp/bin/cmd.js similarity index 100% rename from project starter code/node_modules/mkdirp/bin/cmd.js rename to node_modules/mkdirp/bin/cmd.js diff --git a/project starter code/node_modules/mkdirp/bin/usage.txt b/node_modules/mkdirp/bin/usage.txt similarity index 100% rename from project starter code/node_modules/mkdirp/bin/usage.txt rename to node_modules/mkdirp/bin/usage.txt diff --git a/project starter code/node_modules/mkdirp/index.js b/node_modules/mkdirp/index.js similarity index 100% rename from project starter code/node_modules/mkdirp/index.js rename to node_modules/mkdirp/index.js diff --git a/project starter code/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json similarity index 100% rename from project starter code/node_modules/mkdirp/package.json rename to node_modules/mkdirp/package.json diff --git a/project starter code/node_modules/mkdirp/readme.markdown b/node_modules/mkdirp/readme.markdown similarity index 100% rename from project starter code/node_modules/mkdirp/readme.markdown rename to node_modules/mkdirp/readme.markdown diff --git a/project starter code/node_modules/ms/index.js b/node_modules/ms/index.js similarity index 100% rename from project starter code/node_modules/ms/index.js rename to node_modules/ms/index.js diff --git a/project starter code/node_modules/ms/license.md b/node_modules/ms/license.md similarity index 100% rename from project starter code/node_modules/ms/license.md rename to node_modules/ms/license.md diff --git a/project starter code/node_modules/ms/package.json b/node_modules/ms/package.json similarity index 100% rename from project starter code/node_modules/ms/package.json rename to node_modules/ms/package.json diff --git a/project starter code/node_modules/ms/readme.md b/node_modules/ms/readme.md similarity index 100% rename from project starter code/node_modules/ms/readme.md rename to node_modules/ms/readme.md diff --git a/project starter code/node_modules/negotiator/HISTORY.md b/node_modules/negotiator/HISTORY.md similarity index 100% rename from project starter code/node_modules/negotiator/HISTORY.md rename to node_modules/negotiator/HISTORY.md diff --git a/project starter code/node_modules/negotiator/LICENSE b/node_modules/negotiator/LICENSE similarity index 100% rename from project starter code/node_modules/negotiator/LICENSE rename to node_modules/negotiator/LICENSE diff --git a/project starter code/node_modules/negotiator/README.md b/node_modules/negotiator/README.md similarity index 100% rename from project starter code/node_modules/negotiator/README.md rename to node_modules/negotiator/README.md diff --git a/project starter code/node_modules/negotiator/index.js b/node_modules/negotiator/index.js similarity index 100% rename from project starter code/node_modules/negotiator/index.js rename to node_modules/negotiator/index.js diff --git a/project starter code/node_modules/negotiator/lib/charset.js b/node_modules/negotiator/lib/charset.js similarity index 100% rename from project starter code/node_modules/negotiator/lib/charset.js rename to node_modules/negotiator/lib/charset.js diff --git a/project starter code/node_modules/negotiator/lib/encoding.js b/node_modules/negotiator/lib/encoding.js similarity index 100% rename from project starter code/node_modules/negotiator/lib/encoding.js rename to node_modules/negotiator/lib/encoding.js diff --git a/project starter code/node_modules/negotiator/lib/language.js b/node_modules/negotiator/lib/language.js similarity index 100% rename from project starter code/node_modules/negotiator/lib/language.js rename to node_modules/negotiator/lib/language.js diff --git a/project starter code/node_modules/negotiator/lib/mediaType.js b/node_modules/negotiator/lib/mediaType.js similarity index 100% rename from project starter code/node_modules/negotiator/lib/mediaType.js rename to node_modules/negotiator/lib/mediaType.js diff --git a/project starter code/node_modules/negotiator/package.json b/node_modules/negotiator/package.json similarity index 100% rename from project starter code/node_modules/negotiator/package.json rename to node_modules/negotiator/package.json diff --git a/project starter code/node_modules/object-inspect/.eslintrc b/node_modules/object-inspect/.eslintrc similarity index 100% rename from project starter code/node_modules/object-inspect/.eslintrc rename to node_modules/object-inspect/.eslintrc diff --git a/project starter code/node_modules/object-inspect/.github/FUNDING.yml b/node_modules/object-inspect/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/object-inspect/.github/FUNDING.yml rename to node_modules/object-inspect/.github/FUNDING.yml diff --git a/project starter code/node_modules/object-inspect/.nycrc b/node_modules/object-inspect/.nycrc similarity index 100% rename from project starter code/node_modules/object-inspect/.nycrc rename to node_modules/object-inspect/.nycrc diff --git a/project starter code/node_modules/object-inspect/CHANGELOG.md b/node_modules/object-inspect/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/object-inspect/CHANGELOG.md rename to node_modules/object-inspect/CHANGELOG.md diff --git a/project starter code/node_modules/object-inspect/LICENSE b/node_modules/object-inspect/LICENSE similarity index 100% rename from project starter code/node_modules/object-inspect/LICENSE rename to node_modules/object-inspect/LICENSE diff --git a/project starter code/node_modules/object-inspect/example/all.js b/node_modules/object-inspect/example/all.js similarity index 100% rename from project starter code/node_modules/object-inspect/example/all.js rename to node_modules/object-inspect/example/all.js diff --git a/project starter code/node_modules/object-inspect/example/circular.js b/node_modules/object-inspect/example/circular.js similarity index 100% rename from project starter code/node_modules/object-inspect/example/circular.js rename to node_modules/object-inspect/example/circular.js diff --git a/project starter code/node_modules/object-inspect/example/fn.js b/node_modules/object-inspect/example/fn.js similarity index 100% rename from project starter code/node_modules/object-inspect/example/fn.js rename to node_modules/object-inspect/example/fn.js diff --git a/project starter code/node_modules/object-inspect/example/inspect.js b/node_modules/object-inspect/example/inspect.js similarity index 100% rename from project starter code/node_modules/object-inspect/example/inspect.js rename to node_modules/object-inspect/example/inspect.js diff --git a/project starter code/node_modules/object-inspect/index.js b/node_modules/object-inspect/index.js similarity index 100% rename from project starter code/node_modules/object-inspect/index.js rename to node_modules/object-inspect/index.js diff --git a/project starter code/node_modules/object-inspect/package-support.json b/node_modules/object-inspect/package-support.json similarity index 100% rename from project starter code/node_modules/object-inspect/package-support.json rename to node_modules/object-inspect/package-support.json diff --git a/project starter code/node_modules/object-inspect/package.json b/node_modules/object-inspect/package.json similarity index 100% rename from project starter code/node_modules/object-inspect/package.json rename to node_modules/object-inspect/package.json diff --git a/project starter code/node_modules/object-inspect/readme.markdown b/node_modules/object-inspect/readme.markdown similarity index 100% rename from project starter code/node_modules/object-inspect/readme.markdown rename to node_modules/object-inspect/readme.markdown diff --git a/project starter code/node_modules/object-inspect/test-core-js.js b/node_modules/object-inspect/test-core-js.js similarity index 100% rename from project starter code/node_modules/object-inspect/test-core-js.js rename to node_modules/object-inspect/test-core-js.js diff --git a/project starter code/node_modules/object-inspect/test/bigint.js b/node_modules/object-inspect/test/bigint.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/bigint.js rename to node_modules/object-inspect/test/bigint.js diff --git a/project starter code/node_modules/object-inspect/test/browser/dom.js b/node_modules/object-inspect/test/browser/dom.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/browser/dom.js rename to node_modules/object-inspect/test/browser/dom.js diff --git a/project starter code/node_modules/object-inspect/test/circular.js b/node_modules/object-inspect/test/circular.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/circular.js rename to node_modules/object-inspect/test/circular.js diff --git a/project starter code/node_modules/object-inspect/test/deep.js b/node_modules/object-inspect/test/deep.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/deep.js rename to node_modules/object-inspect/test/deep.js diff --git a/project starter code/node_modules/object-inspect/test/element.js b/node_modules/object-inspect/test/element.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/element.js rename to node_modules/object-inspect/test/element.js diff --git a/project starter code/node_modules/object-inspect/test/err.js b/node_modules/object-inspect/test/err.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/err.js rename to node_modules/object-inspect/test/err.js diff --git a/project starter code/node_modules/object-inspect/test/fakes.js b/node_modules/object-inspect/test/fakes.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/fakes.js rename to node_modules/object-inspect/test/fakes.js diff --git a/project starter code/node_modules/object-inspect/test/fn.js b/node_modules/object-inspect/test/fn.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/fn.js rename to node_modules/object-inspect/test/fn.js diff --git a/project starter code/node_modules/object-inspect/test/has.js b/node_modules/object-inspect/test/has.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/has.js rename to node_modules/object-inspect/test/has.js diff --git a/project starter code/node_modules/object-inspect/test/holes.js b/node_modules/object-inspect/test/holes.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/holes.js rename to node_modules/object-inspect/test/holes.js diff --git a/project starter code/node_modules/object-inspect/test/indent-option.js b/node_modules/object-inspect/test/indent-option.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/indent-option.js rename to node_modules/object-inspect/test/indent-option.js diff --git a/project starter code/node_modules/object-inspect/test/inspect.js b/node_modules/object-inspect/test/inspect.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/inspect.js rename to node_modules/object-inspect/test/inspect.js diff --git a/project starter code/node_modules/object-inspect/test/lowbyte.js b/node_modules/object-inspect/test/lowbyte.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/lowbyte.js rename to node_modules/object-inspect/test/lowbyte.js diff --git a/project starter code/node_modules/object-inspect/test/number.js b/node_modules/object-inspect/test/number.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/number.js rename to node_modules/object-inspect/test/number.js diff --git a/project starter code/node_modules/object-inspect/test/quoteStyle.js b/node_modules/object-inspect/test/quoteStyle.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/quoteStyle.js rename to node_modules/object-inspect/test/quoteStyle.js diff --git a/project starter code/node_modules/object-inspect/test/toStringTag.js b/node_modules/object-inspect/test/toStringTag.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/toStringTag.js rename to node_modules/object-inspect/test/toStringTag.js diff --git a/project starter code/node_modules/object-inspect/test/undef.js b/node_modules/object-inspect/test/undef.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/undef.js rename to node_modules/object-inspect/test/undef.js diff --git a/project starter code/node_modules/object-inspect/test/values.js b/node_modules/object-inspect/test/values.js similarity index 100% rename from project starter code/node_modules/object-inspect/test/values.js rename to node_modules/object-inspect/test/values.js diff --git a/project starter code/node_modules/object-inspect/util.inspect.js b/node_modules/object-inspect/util.inspect.js similarity index 100% rename from project starter code/node_modules/object-inspect/util.inspect.js rename to node_modules/object-inspect/util.inspect.js diff --git a/project starter code/node_modules/omggif/README b/node_modules/omggif/README similarity index 100% rename from project starter code/node_modules/omggif/README rename to node_modules/omggif/README diff --git a/project starter code/node_modules/omggif/example_node.js b/node_modules/omggif/example_node.js similarity index 100% rename from project starter code/node_modules/omggif/example_node.js rename to node_modules/omggif/example_node.js diff --git a/project starter code/node_modules/omggif/omggif.js b/node_modules/omggif/omggif.js similarity index 100% rename from project starter code/node_modules/omggif/omggif.js rename to node_modules/omggif/omggif.js diff --git a/project starter code/node_modules/omggif/package.json b/node_modules/omggif/package.json similarity index 100% rename from project starter code/node_modules/omggif/package.json rename to node_modules/omggif/package.json diff --git a/project starter code/node_modules/omggif/plask_viewer.js b/node_modules/omggif/plask_viewer.js similarity index 100% rename from project starter code/node_modules/omggif/plask_viewer.js rename to node_modules/omggif/plask_viewer.js diff --git a/project starter code/node_modules/on-finished/HISTORY.md b/node_modules/on-finished/HISTORY.md similarity index 100% rename from project starter code/node_modules/on-finished/HISTORY.md rename to node_modules/on-finished/HISTORY.md diff --git a/project starter code/node_modules/on-finished/LICENSE b/node_modules/on-finished/LICENSE similarity index 100% rename from project starter code/node_modules/on-finished/LICENSE rename to node_modules/on-finished/LICENSE diff --git a/project starter code/node_modules/on-finished/README.md b/node_modules/on-finished/README.md similarity index 100% rename from project starter code/node_modules/on-finished/README.md rename to node_modules/on-finished/README.md diff --git a/project starter code/node_modules/on-finished/index.js b/node_modules/on-finished/index.js similarity index 100% rename from project starter code/node_modules/on-finished/index.js rename to node_modules/on-finished/index.js diff --git a/project starter code/node_modules/on-finished/package.json b/node_modules/on-finished/package.json similarity index 100% rename from project starter code/node_modules/on-finished/package.json rename to node_modules/on-finished/package.json diff --git a/project starter code/node_modules/pako/CHANGELOG.md b/node_modules/pako/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/pako/CHANGELOG.md rename to node_modules/pako/CHANGELOG.md diff --git a/project starter code/node_modules/pako/LICENSE b/node_modules/pako/LICENSE similarity index 100% rename from project starter code/node_modules/pako/LICENSE rename to node_modules/pako/LICENSE diff --git a/project starter code/node_modules/pako/README.md b/node_modules/pako/README.md similarity index 100% rename from project starter code/node_modules/pako/README.md rename to node_modules/pako/README.md diff --git a/project starter code/node_modules/pako/dist/pako.js b/node_modules/pako/dist/pako.js similarity index 100% rename from project starter code/node_modules/pako/dist/pako.js rename to node_modules/pako/dist/pako.js diff --git a/project starter code/node_modules/pako/dist/pako.min.js b/node_modules/pako/dist/pako.min.js similarity index 100% rename from project starter code/node_modules/pako/dist/pako.min.js rename to node_modules/pako/dist/pako.min.js diff --git a/project starter code/node_modules/pako/dist/pako_deflate.js b/node_modules/pako/dist/pako_deflate.js similarity index 100% rename from project starter code/node_modules/pako/dist/pako_deflate.js rename to node_modules/pako/dist/pako_deflate.js diff --git a/project starter code/node_modules/pako/dist/pako_deflate.min.js b/node_modules/pako/dist/pako_deflate.min.js similarity index 100% rename from project starter code/node_modules/pako/dist/pako_deflate.min.js rename to node_modules/pako/dist/pako_deflate.min.js diff --git a/project starter code/node_modules/pako/dist/pako_inflate.js b/node_modules/pako/dist/pako_inflate.js similarity index 100% rename from project starter code/node_modules/pako/dist/pako_inflate.js rename to node_modules/pako/dist/pako_inflate.js diff --git a/project starter code/node_modules/pako/dist/pako_inflate.min.js b/node_modules/pako/dist/pako_inflate.min.js similarity index 100% rename from project starter code/node_modules/pako/dist/pako_inflate.min.js rename to node_modules/pako/dist/pako_inflate.min.js diff --git a/project starter code/node_modules/pako/index.js b/node_modules/pako/index.js similarity index 100% rename from project starter code/node_modules/pako/index.js rename to node_modules/pako/index.js diff --git a/project starter code/node_modules/pako/lib/deflate.js b/node_modules/pako/lib/deflate.js similarity index 100% rename from project starter code/node_modules/pako/lib/deflate.js rename to node_modules/pako/lib/deflate.js diff --git a/project starter code/node_modules/pako/lib/inflate.js b/node_modules/pako/lib/inflate.js similarity index 100% rename from project starter code/node_modules/pako/lib/inflate.js rename to node_modules/pako/lib/inflate.js diff --git a/project starter code/node_modules/pako/lib/utils/common.js b/node_modules/pako/lib/utils/common.js similarity index 100% rename from project starter code/node_modules/pako/lib/utils/common.js rename to node_modules/pako/lib/utils/common.js diff --git a/project starter code/node_modules/pako/lib/utils/strings.js b/node_modules/pako/lib/utils/strings.js similarity index 100% rename from project starter code/node_modules/pako/lib/utils/strings.js rename to node_modules/pako/lib/utils/strings.js diff --git a/project starter code/node_modules/pako/lib/zlib/README b/node_modules/pako/lib/zlib/README similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/README rename to node_modules/pako/lib/zlib/README diff --git a/project starter code/node_modules/pako/lib/zlib/adler32.js b/node_modules/pako/lib/zlib/adler32.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/adler32.js rename to node_modules/pako/lib/zlib/adler32.js diff --git a/project starter code/node_modules/pako/lib/zlib/constants.js b/node_modules/pako/lib/zlib/constants.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/constants.js rename to node_modules/pako/lib/zlib/constants.js diff --git a/project starter code/node_modules/pako/lib/zlib/crc32.js b/node_modules/pako/lib/zlib/crc32.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/crc32.js rename to node_modules/pako/lib/zlib/crc32.js diff --git a/project starter code/node_modules/pako/lib/zlib/deflate.js b/node_modules/pako/lib/zlib/deflate.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/deflate.js rename to node_modules/pako/lib/zlib/deflate.js diff --git a/project starter code/node_modules/pako/lib/zlib/gzheader.js b/node_modules/pako/lib/zlib/gzheader.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/gzheader.js rename to node_modules/pako/lib/zlib/gzheader.js diff --git a/project starter code/node_modules/pako/lib/zlib/inffast.js b/node_modules/pako/lib/zlib/inffast.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/inffast.js rename to node_modules/pako/lib/zlib/inffast.js diff --git a/project starter code/node_modules/pako/lib/zlib/inflate.js b/node_modules/pako/lib/zlib/inflate.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/inflate.js rename to node_modules/pako/lib/zlib/inflate.js diff --git a/project starter code/node_modules/pako/lib/zlib/inftrees.js b/node_modules/pako/lib/zlib/inftrees.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/inftrees.js rename to node_modules/pako/lib/zlib/inftrees.js diff --git a/project starter code/node_modules/pako/lib/zlib/messages.js b/node_modules/pako/lib/zlib/messages.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/messages.js rename to node_modules/pako/lib/zlib/messages.js diff --git a/project starter code/node_modules/pako/lib/zlib/trees.js b/node_modules/pako/lib/zlib/trees.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/trees.js rename to node_modules/pako/lib/zlib/trees.js diff --git a/project starter code/node_modules/pako/lib/zlib/zstream.js b/node_modules/pako/lib/zlib/zstream.js similarity index 100% rename from project starter code/node_modules/pako/lib/zlib/zstream.js rename to node_modules/pako/lib/zlib/zstream.js diff --git a/project starter code/node_modules/pako/package.json b/node_modules/pako/package.json similarity index 100% rename from project starter code/node_modules/pako/package.json rename to node_modules/pako/package.json diff --git a/project starter code/node_modules/parse-bmfont-ascii/README.md b/node_modules/parse-bmfont-ascii/README.md similarity index 100% rename from project starter code/node_modules/parse-bmfont-ascii/README.md rename to node_modules/parse-bmfont-ascii/README.md diff --git a/project starter code/node_modules/parse-bmfont-ascii/index.js b/node_modules/parse-bmfont-ascii/index.js similarity index 100% rename from project starter code/node_modules/parse-bmfont-ascii/index.js rename to node_modules/parse-bmfont-ascii/index.js diff --git a/project starter code/node_modules/parse-bmfont-ascii/package.json b/node_modules/parse-bmfont-ascii/package.json similarity index 100% rename from project starter code/node_modules/parse-bmfont-ascii/package.json rename to node_modules/parse-bmfont-ascii/package.json diff --git a/project starter code/node_modules/parse-bmfont-binary/LICENSE.md b/node_modules/parse-bmfont-binary/LICENSE.md similarity index 100% rename from project starter code/node_modules/parse-bmfont-binary/LICENSE.md rename to node_modules/parse-bmfont-binary/LICENSE.md diff --git a/project starter code/node_modules/parse-bmfont-binary/README.md b/node_modules/parse-bmfont-binary/README.md similarity index 100% rename from project starter code/node_modules/parse-bmfont-binary/README.md rename to node_modules/parse-bmfont-binary/README.md diff --git a/project starter code/node_modules/parse-bmfont-binary/index.js b/node_modules/parse-bmfont-binary/index.js similarity index 100% rename from project starter code/node_modules/parse-bmfont-binary/index.js rename to node_modules/parse-bmfont-binary/index.js diff --git a/project starter code/node_modules/parse-bmfont-binary/package.json b/node_modules/parse-bmfont-binary/package.json similarity index 100% rename from project starter code/node_modules/parse-bmfont-binary/package.json rename to node_modules/parse-bmfont-binary/package.json diff --git a/project starter code/node_modules/parse-bmfont-xml/LICENSE.md b/node_modules/parse-bmfont-xml/LICENSE.md similarity index 100% rename from project starter code/node_modules/parse-bmfont-xml/LICENSE.md rename to node_modules/parse-bmfont-xml/LICENSE.md diff --git a/project starter code/node_modules/parse-bmfont-xml/README.md b/node_modules/parse-bmfont-xml/README.md similarity index 100% rename from project starter code/node_modules/parse-bmfont-xml/README.md rename to node_modules/parse-bmfont-xml/README.md diff --git a/project starter code/node_modules/parse-bmfont-xml/lib/browser.js b/node_modules/parse-bmfont-xml/lib/browser.js similarity index 100% rename from project starter code/node_modules/parse-bmfont-xml/lib/browser.js rename to node_modules/parse-bmfont-xml/lib/browser.js diff --git a/project starter code/node_modules/parse-bmfont-xml/lib/index.js b/node_modules/parse-bmfont-xml/lib/index.js similarity index 100% rename from project starter code/node_modules/parse-bmfont-xml/lib/index.js rename to node_modules/parse-bmfont-xml/lib/index.js diff --git a/project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js b/node_modules/parse-bmfont-xml/lib/parse-attribs.js similarity index 95% rename from project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js rename to node_modules/parse-bmfont-xml/lib/parse-attribs.js index 0e72ffa1..1dfba3b6 100644 --- a/project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js +++ b/node_modules/parse-bmfont-xml/lib/parse-attribs.js @@ -5,6 +5,7 @@ var GLYPH_DESIGNER_ERROR = 'chasrset' module.exports = function parseAttributes(obj) { + obj = Object.assign({}, obj) if (GLYPH_DESIGNER_ERROR in obj) { obj['charset'] = obj[GLYPH_DESIGNER_ERROR] delete obj[GLYPH_DESIGNER_ERROR] diff --git a/node_modules/parse-bmfont-xml/package.json b/node_modules/parse-bmfont-xml/package.json new file mode 100644 index 00000000..2668e900 --- /dev/null +++ b/node_modules/parse-bmfont-xml/package.json @@ -0,0 +1,56 @@ +{ + "name": "parse-bmfont-xml", + "version": "1.1.6", + "description": "parses XML BMFont files into a JavaScript object", + "main": "lib/index.js", + "browser": "lib/browser.js", + "license": "MIT", + "author": { + "name": "Matt DesLauriers", + "email": "dave.des@gmail.com", + "url": "https://github.com/mattdesl" + }, + "dependencies": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.5.0" + }, + "devDependencies": { + "brfs": "^1.4.0", + "browserify": "^9.0.3", + "faucet": "0.0.1", + "tape": "^3.5.0", + "testling": "^1.7.1", + "xhr": "^2.0.1" + }, + "scripts": { + "test-browser": "browserify test/test-browser.js -t brfs | testling | faucet", + "test-node": "node test/test.js | faucet", + "test": "npm run test-node && npm run test-browser" + }, + "keywords": [ + "xml", + "parse", + "convert", + "bmfont", + "bm", + "bitmap", + "font", + "bitmaps", + "angel", + "angelcode", + "code", + "text", + "gl", + "sprite", + "sprites", + "stackgl" + ], + "repository": { + "type": "git", + "url": "git://github.com/mattdesl/parse-bmfont-xml.git" + }, + "homepage": "https://github.com/mattdesl/parse-bmfont-xml", + "bugs": { + "url": "https://github.com/mattdesl/parse-bmfont-xml/issues" + } +} diff --git a/project starter code/node_modules/parse-headers/.travis.yml b/node_modules/parse-headers/.travis.yml similarity index 100% rename from project starter code/node_modules/parse-headers/.travis.yml rename to node_modules/parse-headers/.travis.yml diff --git a/project starter code/node_modules/parse-headers/LICENCE b/node_modules/parse-headers/LICENCE similarity index 100% rename from project starter code/node_modules/parse-headers/LICENCE rename to node_modules/parse-headers/LICENCE diff --git a/project starter code/node_modules/parse-headers/example.js b/node_modules/parse-headers/example.js similarity index 100% rename from project starter code/node_modules/parse-headers/example.js rename to node_modules/parse-headers/example.js diff --git a/project starter code/node_modules/parse-headers/index.d.ts b/node_modules/parse-headers/index.d.ts similarity index 100% rename from project starter code/node_modules/parse-headers/index.d.ts rename to node_modules/parse-headers/index.d.ts diff --git a/project starter code/node_modules/parse-headers/package.json b/node_modules/parse-headers/package.json similarity index 100% rename from project starter code/node_modules/parse-headers/package.json rename to node_modules/parse-headers/package.json diff --git a/project starter code/node_modules/parse-headers/parse-headers.js b/node_modules/parse-headers/parse-headers.js similarity index 100% rename from project starter code/node_modules/parse-headers/parse-headers.js rename to node_modules/parse-headers/parse-headers.js diff --git a/project starter code/node_modules/parse-headers/readme.md b/node_modules/parse-headers/readme.md similarity index 100% rename from project starter code/node_modules/parse-headers/readme.md rename to node_modules/parse-headers/readme.md diff --git a/project starter code/node_modules/parse-headers/test.js b/node_modules/parse-headers/test.js similarity index 100% rename from project starter code/node_modules/parse-headers/test.js rename to node_modules/parse-headers/test.js diff --git a/project starter code/node_modules/parseurl/HISTORY.md b/node_modules/parseurl/HISTORY.md similarity index 100% rename from project starter code/node_modules/parseurl/HISTORY.md rename to node_modules/parseurl/HISTORY.md diff --git a/project starter code/node_modules/parseurl/LICENSE b/node_modules/parseurl/LICENSE similarity index 100% rename from project starter code/node_modules/parseurl/LICENSE rename to node_modules/parseurl/LICENSE diff --git a/project starter code/node_modules/parseurl/README.md b/node_modules/parseurl/README.md similarity index 100% rename from project starter code/node_modules/parseurl/README.md rename to node_modules/parseurl/README.md diff --git a/project starter code/node_modules/parseurl/index.js b/node_modules/parseurl/index.js similarity index 100% rename from project starter code/node_modules/parseurl/index.js rename to node_modules/parseurl/index.js diff --git a/project starter code/node_modules/parseurl/package.json b/node_modules/parseurl/package.json similarity index 100% rename from project starter code/node_modules/parseurl/package.json rename to node_modules/parseurl/package.json diff --git a/project starter code/node_modules/path-to-regexp/History.md b/node_modules/path-to-regexp/History.md similarity index 100% rename from project starter code/node_modules/path-to-regexp/History.md rename to node_modules/path-to-regexp/History.md diff --git a/project starter code/node_modules/path-to-regexp/LICENSE b/node_modules/path-to-regexp/LICENSE similarity index 100% rename from project starter code/node_modules/path-to-regexp/LICENSE rename to node_modules/path-to-regexp/LICENSE diff --git a/project starter code/node_modules/path-to-regexp/Readme.md b/node_modules/path-to-regexp/Readme.md similarity index 100% rename from project starter code/node_modules/path-to-regexp/Readme.md rename to node_modules/path-to-regexp/Readme.md diff --git a/project starter code/node_modules/path-to-regexp/index.js b/node_modules/path-to-regexp/index.js similarity index 100% rename from project starter code/node_modules/path-to-regexp/index.js rename to node_modules/path-to-regexp/index.js diff --git a/project starter code/node_modules/path-to-regexp/package.json b/node_modules/path-to-regexp/package.json similarity index 100% rename from project starter code/node_modules/path-to-regexp/package.json rename to node_modules/path-to-regexp/package.json diff --git a/node_modules/peek-readable/LICENSE b/node_modules/peek-readable/LICENSE new file mode 100644 index 00000000..9ba5f032 --- /dev/null +++ b/node_modules/peek-readable/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010-2017 Borewit + +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. diff --git a/node_modules/peek-readable/README.md b/node_modules/peek-readable/README.md new file mode 100644 index 00000000..72221e1e --- /dev/null +++ b/node_modules/peek-readable/README.md @@ -0,0 +1,93 @@ +![Node.js CI](https://github.com/Borewit/peek-readable/workflows/Node.js%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/peek-readable.svg)](https://npmjs.org/package/peek-readable) +[![npm downloads](http://img.shields.io/npm/dm/peek-readable.svg)](https://npmcharts.com/compare/peek-readable?start=600&interval=30) +[![Coverage Status](https://coveralls.io/repos/github/Borewit/peek-readable/badge.svg?branch=master)](https://coveralls.io/github/Borewit/peek-readable?branch=master) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d4b511481b3a4634b6ca5c0724407eb9)](https://www.codacy.com/gh/Borewit/peek-readable/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Borewit/peek-readable&utm_campaign=Badge_Grade) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/peek-readable.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/peek-readable/alerts/) +[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/peek-readable.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/peek-readable/context:javascript) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/peek-readable/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/peek-readable?targetFile=package.json) + +# peek-readable + +A promise based asynchronous stream reader, which makes reading from a stream easy. + +Allows to read and peek from a [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams) + +Note that [peek-readable](https://github.com/Borewit/peek-readable) was formally released as [then-read-stream](https://github.com/Borewit/peek-readable). + +## Usage + +### Installation + +```shell script +npm install --save peek-readable +``` + +The `peek-readable` contains one class: `StreamReader`, which reads from a [stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable). + +### Compatibility + +NPM module is compliant with [ECMAScript 2018 (ES9)](https://en.wikipedia.org/wiki/ECMAScript#9th_Edition_%E2%80%93_ECMAScript_2018). + +## Examples + +In the following example we read the first 16 bytes from a stream and store them in our buffer. +Source code of examples can be found [here](test/examples.ts). + +```js +const fs = require('fs'); +const { StreamReader } = require('peek-readable'); + +(async () => { + const readable = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg'); + const streamReader = new StreamReader(readable); + const uint8Array = new Uint8Array(16); + const bytesRead = await streamReader.read(uint8Array, 0, 16);; + // buffer contains 16 bytes, if the end-of-stream has not been reached +})(); +``` + +End-of-stream detection: +```js +(async () => { + + const fileReadStream = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg'); + const streamReader = new StreamReader(fileReadStream); + const buffer = Buffer.alloc(16); // or use: new Uint8Array(16); + + try { + await streamReader.read(buffer, 0, 16); + // buffer contains 16 bytes, if the end-of-stream has not been reached + } catch(error) { + if (error instanceof EndOfStreamError) { + console.log('End-of-stream reached'); + } + } +})(); +``` + +With peek you can read ahead: +```js +const fs = require('fs'); +const { StreamReader } = require('peek-readable'); + +const fileReadStream = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg'); +const streamReader = new StreamReader(fileReadStream); +const buffer = Buffer.alloc(20); + +(async () => { + let bytesRead = await streamReader.peek(buffer, 0, 3); + if (bytesRead === 3 && buffer[0] === 0xFF && buffer[1] === 0xD8 && buffer[2] === 0xFF) { + console.log('This is a JPEG file'); + } else { + throw Error('Expected a JPEG file'); + } + + bytesRead = await streamReader.read(buffer, 0, 20); // Read JPEG header + if (bytesRead === 20) { + console.log('Got the JPEG header'); + } else { + throw Error('Failed to read JPEG header'); + } +})(); +``` diff --git a/node_modules/peek-readable/lib/Deferred.d.ts b/node_modules/peek-readable/lib/Deferred.d.ts new file mode 100644 index 00000000..b7294492 --- /dev/null +++ b/node_modules/peek-readable/lib/Deferred.d.ts @@ -0,0 +1,6 @@ +export declare class Deferred { + promise: Promise; + resolve: (value: T) => void; + reject: (reason: any) => void; + constructor(); +} diff --git a/node_modules/peek-readable/lib/Deferred.js b/node_modules/peek-readable/lib/Deferred.js new file mode 100644 index 00000000..84c42b31 --- /dev/null +++ b/node_modules/peek-readable/lib/Deferred.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Deferred = void 0; +class Deferred { + constructor() { + this.resolve = () => null; + this.reject = () => null; + this.promise = new Promise((resolve, reject) => { + this.reject = reject; + this.resolve = resolve; + }); + } +} +exports.Deferred = Deferred; diff --git a/node_modules/peek-readable/lib/EndOfFileStream.d.ts b/node_modules/peek-readable/lib/EndOfFileStream.d.ts new file mode 100644 index 00000000..1081cb06 --- /dev/null +++ b/node_modules/peek-readable/lib/EndOfFileStream.d.ts @@ -0,0 +1,7 @@ +export declare const defaultMessages = "End-Of-Stream"; +/** + * Thrown on read operation of the end of file or stream has been reached + */ +export declare class EndOfStreamError extends Error { + constructor(); +} diff --git a/node_modules/peek-readable/lib/EndOfFileStream.js b/node_modules/peek-readable/lib/EndOfFileStream.js new file mode 100644 index 00000000..6ae832ed --- /dev/null +++ b/node_modules/peek-readable/lib/EndOfFileStream.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EndOfStreamError = exports.defaultMessages = void 0; +exports.defaultMessages = 'End-Of-Stream'; +/** + * Thrown on read operation of the end of file or stream has been reached + */ +class EndOfStreamError extends Error { + constructor() { + super(exports.defaultMessages); + } +} +exports.EndOfStreamError = EndOfStreamError; diff --git a/node_modules/peek-readable/lib/StreamReader.d.ts b/node_modules/peek-readable/lib/StreamReader.d.ts new file mode 100644 index 00000000..114c9689 --- /dev/null +++ b/node_modules/peek-readable/lib/StreamReader.d.ts @@ -0,0 +1,47 @@ +/// +import { Readable } from 'stream'; +export { EndOfStreamError } from './EndOfFileStream'; +export declare class StreamReader { + private s; + /** + * Deferred used for postponed read request (as not data is yet available to read) + */ + private deferred; + private endOfStream; + /** + * Store peeked data + * @type {Array} + */ + private peekQueue; + constructor(s: Readable); + /** + * Read ahead (peek) from stream. Subsequent read or peeks will return the same data + * @param uint8Array - Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes peeked + */ + peek(uint8Array: Uint8Array, offset: number, length: number): Promise; + /** + * Read chunk from stream + * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes read + */ + read(buffer: Uint8Array, offset: number, length: number): Promise; + /** + * Read chunk from stream + * @param buffer Target Uint8Array (or Buffer) to store data read from stream in + * @param offset Offset target + * @param length Number of bytes to read + * @returns Number of bytes read + */ + private readFromStream; + /** + * Process deferred read request + * @param request Deferred read request + */ + private readDeferred; + private reject; +} diff --git a/node_modules/peek-readable/lib/StreamReader.js b/node_modules/peek-readable/lib/StreamReader.js new file mode 100644 index 00000000..1a812624 --- /dev/null +++ b/node_modules/peek-readable/lib/StreamReader.js @@ -0,0 +1,134 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamReader = exports.EndOfStreamError = void 0; +const EndOfFileStream_1 = require("./EndOfFileStream"); +const Deferred_1 = require("./Deferred"); +var EndOfFileStream_2 = require("./EndOfFileStream"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return EndOfFileStream_2.EndOfStreamError; } }); +const maxStreamReadSize = 1 * 1024 * 1024; // Maximum request length on read-stream operation +class StreamReader { + constructor(s) { + this.s = s; + /** + * Deferred used for postponed read request (as not data is yet available to read) + */ + this.deferred = null; + this.endOfStream = false; + /** + * Store peeked data + * @type {Array} + */ + this.peekQueue = []; + if (!s.read || !s.once) { + throw new Error('Expected an instance of stream.Readable'); + } + this.s.once('end', () => this.reject(new EndOfFileStream_1.EndOfStreamError())); + this.s.once('error', err => this.reject(err)); + this.s.once('close', () => this.reject(new Error('Stream closed'))); + } + /** + * Read ahead (peek) from stream. Subsequent read or peeks will return the same data + * @param uint8Array - Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes peeked + */ + async peek(uint8Array, offset, length) { + const bytesRead = await this.read(uint8Array, offset, length); + this.peekQueue.push(uint8Array.subarray(offset, offset + bytesRead)); // Put read data back to peek buffer + return bytesRead; + } + /** + * Read chunk from stream + * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes read + */ + async read(buffer, offset, length) { + if (length === 0) { + return 0; + } + if (this.peekQueue.length === 0 && this.endOfStream) { + throw new EndOfFileStream_1.EndOfStreamError(); + } + let remaining = length; + let bytesRead = 0; + // consume peeked data first + while (this.peekQueue.length > 0 && remaining > 0) { + const peekData = this.peekQueue.pop(); // Front of queue + if (!peekData) + throw new Error('peekData should be defined'); + const lenCopy = Math.min(peekData.length, remaining); + buffer.set(peekData.subarray(0, lenCopy), offset + bytesRead); + bytesRead += lenCopy; + remaining -= lenCopy; + if (lenCopy < peekData.length) { + // remainder back to queue + this.peekQueue.push(peekData.subarray(lenCopy)); + } + } + // continue reading from stream if required + while (remaining > 0 && !this.endOfStream) { + const reqLen = Math.min(remaining, maxStreamReadSize); + const chunkLen = await this.readFromStream(buffer, offset + bytesRead, reqLen); + bytesRead += chunkLen; + if (chunkLen < reqLen) + break; + remaining -= chunkLen; + } + return bytesRead; + } + /** + * Read chunk from stream + * @param buffer Target Uint8Array (or Buffer) to store data read from stream in + * @param offset Offset target + * @param length Number of bytes to read + * @returns Number of bytes read + */ + async readFromStream(buffer, offset, length) { + const readBuffer = this.s.read(length); + if (readBuffer) { + buffer.set(readBuffer, offset); + return readBuffer.length; + } + else { + const request = { + buffer, + offset, + length, + deferred: new Deferred_1.Deferred() + }; + this.deferred = request.deferred; + this.s.once('readable', () => { + this.readDeferred(request); + }); + return request.deferred.promise; + } + } + /** + * Process deferred read request + * @param request Deferred read request + */ + readDeferred(request) { + const readBuffer = this.s.read(request.length); + if (readBuffer) { + request.buffer.set(readBuffer, request.offset); + request.deferred.resolve(readBuffer.length); + this.deferred = null; + } + else { + this.s.once('readable', () => { + this.readDeferred(request); + }); + } + } + reject(err) { + this.endOfStream = true; + if (this.deferred) { + this.deferred.reject(err); + this.deferred = null; + } + } +} +exports.StreamReader = StreamReader; diff --git a/node_modules/peek-readable/lib/index.d.ts b/node_modules/peek-readable/lib/index.d.ts new file mode 100644 index 00000000..764e4fae --- /dev/null +++ b/node_modules/peek-readable/lib/index.d.ts @@ -0,0 +1,2 @@ +export { EndOfStreamError } from './EndOfFileStream'; +export { StreamReader } from './StreamReader'; diff --git a/node_modules/peek-readable/lib/index.js b/node_modules/peek-readable/lib/index.js new file mode 100644 index 00000000..34cd7654 --- /dev/null +++ b/node_modules/peek-readable/lib/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamReader = exports.EndOfStreamError = void 0; +var EndOfFileStream_1 = require("./EndOfFileStream"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return EndOfFileStream_1.EndOfStreamError; } }); +var StreamReader_1 = require("./StreamReader"); +Object.defineProperty(exports, "StreamReader", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } }); diff --git a/node_modules/peek-readable/package.json b/node_modules/peek-readable/package.json new file mode 100644 index 00000000..d460956b --- /dev/null +++ b/node_modules/peek-readable/package.json @@ -0,0 +1,87 @@ +{ + "name": "peek-readable", + "version": "4.1.0", + "description": "Read and peek from a readable stream", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "scripts": { + "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map coverage .nyc_output", + "build": "npm run clean && npm run compile", + "compile-src": "tsc -p lib", + "compile-test": "tsc -p test", + "compile": "npm run compile-src && yarn run compile-test", + "eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts", + "lint-md": "remark -u preset-lint-recommended .", + "lint": "npm run lint-md && npm run eslint", + "test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/*.ts", + "test-coverage": "nyc npm run test", + "send-coveralls": "nyc report --reporter=text-lcov | coveralls", + "start": "npm run compile && npm run lint && npm run cover-test" + }, + "engines": { + "node": ">=8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Borewit/peek-readable" + }, + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bugs": { + "url": "https://github.com/Borewit/peek-readable/issues" + }, + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "devDependencies": { + "@types/chai": "^4.3.0", + "@types/mocha": "^9.1.0", + "@types/node": "^17.0.0", + "@typescript-eslint/eslint-plugin": "^4.33.0", + "@typescript-eslint/parser": "^4.33.0", + "add": "^2.0.6", + "chai": "^4.3.6", + "coveralls": "^3.1.1", + "del-cli": "^4.0.1", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.3.0", + "eslint-import-resolver-typescript": "^2.5.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jsdoc": "^37.7.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-unicorn": "^40.1.0", + "mocha": "^9.2.0", + "nyc": "^15.1.0", + "remark-cli": "^10.0.1", + "remark-preset-lint-recommended": "^6.1.2", + "ts-node": "^10.4.0", + "typescript": "^4.5.5" + }, + "keywords": [ + "readable", + "buffer", + "stream", + "read" + ], + "nyc": { + "check-coverage": true, + "extension": [ + ".ts" + ], + "sourceMap": true, + "instrument": true, + "reporter": [ + "lcov", + "text" + ], + "report-dir": "coverage" + } +} diff --git a/project starter code/node_modules/phin/LICENSE b/node_modules/phin/LICENSE similarity index 100% rename from project starter code/node_modules/phin/LICENSE rename to node_modules/phin/LICENSE diff --git a/project starter code/node_modules/phin/README.md b/node_modules/phin/README.md similarity index 100% rename from project starter code/node_modules/phin/README.md rename to node_modules/phin/README.md diff --git a/project starter code/node_modules/phin/lib/phin.compiled.js b/node_modules/phin/lib/phin.compiled.js similarity index 100% rename from project starter code/node_modules/phin/lib/phin.compiled.js rename to node_modules/phin/lib/phin.compiled.js diff --git a/project starter code/node_modules/phin/package.json b/node_modules/phin/package.json similarity index 100% rename from project starter code/node_modules/phin/package.json rename to node_modules/phin/package.json diff --git a/project starter code/node_modules/pixelmatch/.npmignore b/node_modules/pixelmatch/.npmignore similarity index 100% rename from project starter code/node_modules/pixelmatch/.npmignore rename to node_modules/pixelmatch/.npmignore diff --git a/project starter code/node_modules/pixelmatch/.travis.yml b/node_modules/pixelmatch/.travis.yml similarity index 100% rename from project starter code/node_modules/pixelmatch/.travis.yml rename to node_modules/pixelmatch/.travis.yml diff --git a/project starter code/node_modules/pixelmatch/LICENSE b/node_modules/pixelmatch/LICENSE similarity index 100% rename from project starter code/node_modules/pixelmatch/LICENSE rename to node_modules/pixelmatch/LICENSE diff --git a/project starter code/node_modules/pixelmatch/README.md b/node_modules/pixelmatch/README.md similarity index 100% rename from project starter code/node_modules/pixelmatch/README.md rename to node_modules/pixelmatch/README.md diff --git a/project starter code/node_modules/pixelmatch/bin/pixelmatch b/node_modules/pixelmatch/bin/pixelmatch similarity index 100% rename from project starter code/node_modules/pixelmatch/bin/pixelmatch rename to node_modules/pixelmatch/bin/pixelmatch diff --git a/project starter code/node_modules/pixelmatch/index.js b/node_modules/pixelmatch/index.js similarity index 100% rename from project starter code/node_modules/pixelmatch/index.js rename to node_modules/pixelmatch/index.js diff --git a/project starter code/node_modules/pixelmatch/package.json b/node_modules/pixelmatch/package.json similarity index 100% rename from project starter code/node_modules/pixelmatch/package.json rename to node_modules/pixelmatch/package.json diff --git a/project starter code/node_modules/pixelmatch/pixelmatch.sublime-project b/node_modules/pixelmatch/pixelmatch.sublime-project similarity index 100% rename from project starter code/node_modules/pixelmatch/pixelmatch.sublime-project rename to node_modules/pixelmatch/pixelmatch.sublime-project diff --git a/project starter code/node_modules/pixelmatch/pixelmatch.sublime-workspace b/node_modules/pixelmatch/pixelmatch.sublime-workspace similarity index 100% rename from project starter code/node_modules/pixelmatch/pixelmatch.sublime-workspace rename to node_modules/pixelmatch/pixelmatch.sublime-workspace diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/1a.png b/node_modules/pixelmatch/test/fixtures/1a.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/1a.png rename to node_modules/pixelmatch/test/fixtures/1a.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/1b.png b/node_modules/pixelmatch/test/fixtures/1b.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/1b.png rename to node_modules/pixelmatch/test/fixtures/1b.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/1diff.png b/node_modules/pixelmatch/test/fixtures/1diff.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/1diff.png rename to node_modules/pixelmatch/test/fixtures/1diff.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/2a.png b/node_modules/pixelmatch/test/fixtures/2a.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/2a.png rename to node_modules/pixelmatch/test/fixtures/2a.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/2b.png b/node_modules/pixelmatch/test/fixtures/2b.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/2b.png rename to node_modules/pixelmatch/test/fixtures/2b.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/2diff.png b/node_modules/pixelmatch/test/fixtures/2diff.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/2diff.png rename to node_modules/pixelmatch/test/fixtures/2diff.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/3a.png b/node_modules/pixelmatch/test/fixtures/3a.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/3a.png rename to node_modules/pixelmatch/test/fixtures/3a.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/3b.png b/node_modules/pixelmatch/test/fixtures/3b.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/3b.png rename to node_modules/pixelmatch/test/fixtures/3b.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/3diff.png b/node_modules/pixelmatch/test/fixtures/3diff.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/3diff.png rename to node_modules/pixelmatch/test/fixtures/3diff.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/4a.png b/node_modules/pixelmatch/test/fixtures/4a.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/4a.png rename to node_modules/pixelmatch/test/fixtures/4a.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/4b.png b/node_modules/pixelmatch/test/fixtures/4b.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/4b.png rename to node_modules/pixelmatch/test/fixtures/4b.png diff --git a/project starter code/node_modules/pixelmatch/test/fixtures/4diff.png b/node_modules/pixelmatch/test/fixtures/4diff.png similarity index 100% rename from project starter code/node_modules/pixelmatch/test/fixtures/4diff.png rename to node_modules/pixelmatch/test/fixtures/4diff.png diff --git a/project starter code/node_modules/pixelmatch/test/test.js b/node_modules/pixelmatch/test/test.js similarity index 100% rename from project starter code/node_modules/pixelmatch/test/test.js rename to node_modules/pixelmatch/test/test.js diff --git a/project starter code/node_modules/pngjs/.eslintrc.json b/node_modules/pngjs/.eslintrc.json similarity index 100% rename from project starter code/node_modules/pngjs/.eslintrc.json rename to node_modules/pngjs/.eslintrc.json diff --git a/project starter code/node_modules/pngjs/LICENSE b/node_modules/pngjs/LICENSE similarity index 100% rename from project starter code/node_modules/pngjs/LICENSE rename to node_modules/pngjs/LICENSE diff --git a/project starter code/node_modules/pngjs/README.md b/node_modules/pngjs/README.md similarity index 100% rename from project starter code/node_modules/pngjs/README.md rename to node_modules/pngjs/README.md diff --git a/project starter code/node_modules/pngjs/browser.js b/node_modules/pngjs/browser.js similarity index 100% rename from project starter code/node_modules/pngjs/browser.js rename to node_modules/pngjs/browser.js diff --git a/project starter code/node_modules/pngjs/lib/bitmapper.js b/node_modules/pngjs/lib/bitmapper.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/bitmapper.js rename to node_modules/pngjs/lib/bitmapper.js diff --git a/project starter code/node_modules/pngjs/lib/bitpacker.js b/node_modules/pngjs/lib/bitpacker.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/bitpacker.js rename to node_modules/pngjs/lib/bitpacker.js diff --git a/project starter code/node_modules/pngjs/lib/chunkstream.js b/node_modules/pngjs/lib/chunkstream.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/chunkstream.js rename to node_modules/pngjs/lib/chunkstream.js diff --git a/project starter code/node_modules/pngjs/lib/constants.js b/node_modules/pngjs/lib/constants.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/constants.js rename to node_modules/pngjs/lib/constants.js diff --git a/project starter code/node_modules/pngjs/lib/crc.js b/node_modules/pngjs/lib/crc.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/crc.js rename to node_modules/pngjs/lib/crc.js diff --git a/project starter code/node_modules/pngjs/lib/filter-pack.js b/node_modules/pngjs/lib/filter-pack.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/filter-pack.js rename to node_modules/pngjs/lib/filter-pack.js diff --git a/project starter code/node_modules/pngjs/lib/filter-parse-async.js b/node_modules/pngjs/lib/filter-parse-async.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/filter-parse-async.js rename to node_modules/pngjs/lib/filter-parse-async.js diff --git a/project starter code/node_modules/pngjs/lib/filter-parse-sync.js b/node_modules/pngjs/lib/filter-parse-sync.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/filter-parse-sync.js rename to node_modules/pngjs/lib/filter-parse-sync.js diff --git a/project starter code/node_modules/pngjs/lib/filter-parse.js b/node_modules/pngjs/lib/filter-parse.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/filter-parse.js rename to node_modules/pngjs/lib/filter-parse.js diff --git a/project starter code/node_modules/pngjs/lib/format-normaliser.js b/node_modules/pngjs/lib/format-normaliser.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/format-normaliser.js rename to node_modules/pngjs/lib/format-normaliser.js diff --git a/project starter code/node_modules/pngjs/lib/interlace.js b/node_modules/pngjs/lib/interlace.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/interlace.js rename to node_modules/pngjs/lib/interlace.js diff --git a/project starter code/node_modules/pngjs/lib/packer-async.js b/node_modules/pngjs/lib/packer-async.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/packer-async.js rename to node_modules/pngjs/lib/packer-async.js diff --git a/project starter code/node_modules/pngjs/lib/packer-sync.js b/node_modules/pngjs/lib/packer-sync.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/packer-sync.js rename to node_modules/pngjs/lib/packer-sync.js diff --git a/project starter code/node_modules/pngjs/lib/packer.js b/node_modules/pngjs/lib/packer.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/packer.js rename to node_modules/pngjs/lib/packer.js diff --git a/project starter code/node_modules/pngjs/lib/paeth-predictor.js b/node_modules/pngjs/lib/paeth-predictor.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/paeth-predictor.js rename to node_modules/pngjs/lib/paeth-predictor.js diff --git a/project starter code/node_modules/pngjs/lib/parser-async.js b/node_modules/pngjs/lib/parser-async.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/parser-async.js rename to node_modules/pngjs/lib/parser-async.js diff --git a/project starter code/node_modules/pngjs/lib/parser-sync.js b/node_modules/pngjs/lib/parser-sync.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/parser-sync.js rename to node_modules/pngjs/lib/parser-sync.js diff --git a/project starter code/node_modules/pngjs/lib/parser.js b/node_modules/pngjs/lib/parser.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/parser.js rename to node_modules/pngjs/lib/parser.js diff --git a/project starter code/node_modules/pngjs/lib/png-sync.js b/node_modules/pngjs/lib/png-sync.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/png-sync.js rename to node_modules/pngjs/lib/png-sync.js diff --git a/project starter code/node_modules/pngjs/lib/png.js b/node_modules/pngjs/lib/png.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/png.js rename to node_modules/pngjs/lib/png.js diff --git a/project starter code/node_modules/pngjs/lib/sync-inflate.js b/node_modules/pngjs/lib/sync-inflate.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/sync-inflate.js rename to node_modules/pngjs/lib/sync-inflate.js diff --git a/project starter code/node_modules/pngjs/lib/sync-reader.js b/node_modules/pngjs/lib/sync-reader.js similarity index 100% rename from project starter code/node_modules/pngjs/lib/sync-reader.js rename to node_modules/pngjs/lib/sync-reader.js diff --git a/project starter code/node_modules/pngjs/package.json b/node_modules/pngjs/package.json similarity index 100% rename from project starter code/node_modules/pngjs/package.json rename to node_modules/pngjs/package.json diff --git a/project starter code/node_modules/pngjs/yarn.lock b/node_modules/pngjs/yarn.lock similarity index 100% rename from project starter code/node_modules/pngjs/yarn.lock rename to node_modules/pngjs/yarn.lock diff --git a/project starter code/node_modules/process/.eslintrc b/node_modules/process/.eslintrc similarity index 100% rename from project starter code/node_modules/process/.eslintrc rename to node_modules/process/.eslintrc diff --git a/project starter code/node_modules/process/LICENSE b/node_modules/process/LICENSE similarity index 100% rename from project starter code/node_modules/process/LICENSE rename to node_modules/process/LICENSE diff --git a/project starter code/node_modules/process/README.md b/node_modules/process/README.md similarity index 100% rename from project starter code/node_modules/process/README.md rename to node_modules/process/README.md diff --git a/project starter code/node_modules/process/browser.js b/node_modules/process/browser.js similarity index 100% rename from project starter code/node_modules/process/browser.js rename to node_modules/process/browser.js diff --git a/project starter code/node_modules/process/index.js b/node_modules/process/index.js similarity index 100% rename from project starter code/node_modules/process/index.js rename to node_modules/process/index.js diff --git a/project starter code/node_modules/process/package.json b/node_modules/process/package.json similarity index 100% rename from project starter code/node_modules/process/package.json rename to node_modules/process/package.json diff --git a/project starter code/node_modules/process/test.js b/node_modules/process/test.js similarity index 100% rename from project starter code/node_modules/process/test.js rename to node_modules/process/test.js diff --git a/project starter code/node_modules/proxy-addr/HISTORY.md b/node_modules/proxy-addr/HISTORY.md similarity index 100% rename from project starter code/node_modules/proxy-addr/HISTORY.md rename to node_modules/proxy-addr/HISTORY.md diff --git a/project starter code/node_modules/proxy-addr/LICENSE b/node_modules/proxy-addr/LICENSE similarity index 100% rename from project starter code/node_modules/proxy-addr/LICENSE rename to node_modules/proxy-addr/LICENSE diff --git a/project starter code/node_modules/proxy-addr/README.md b/node_modules/proxy-addr/README.md similarity index 100% rename from project starter code/node_modules/proxy-addr/README.md rename to node_modules/proxy-addr/README.md diff --git a/project starter code/node_modules/proxy-addr/index.js b/node_modules/proxy-addr/index.js similarity index 100% rename from project starter code/node_modules/proxy-addr/index.js rename to node_modules/proxy-addr/index.js diff --git a/project starter code/node_modules/proxy-addr/package.json b/node_modules/proxy-addr/package.json similarity index 100% rename from project starter code/node_modules/proxy-addr/package.json rename to node_modules/proxy-addr/package.json diff --git a/node_modules/proxy-from-env/.eslintrc b/node_modules/proxy-from-env/.eslintrc new file mode 100644 index 00000000..a51449b2 --- /dev/null +++ b/node_modules/proxy-from-env/.eslintrc @@ -0,0 +1,29 @@ +{ + "env": { + "node": true + }, + "rules": { + "array-bracket-spacing": [2, "never"], + "block-scoped-var": 2, + "brace-style": [2, "1tbs"], + "camelcase": 1, + "computed-property-spacing": [2, "never"], + "curly": 2, + "eol-last": 2, + "eqeqeq": [2, "smart"], + "max-depth": [1, 3], + "max-len": [1, 80], + "max-statements": [1, 15], + "new-cap": 1, + "no-extend-native": 2, + "no-mixed-spaces-and-tabs": 2, + "no-trailing-spaces": 2, + "no-unused-vars": 1, + "no-use-before-define": [2, "nofunc"], + "object-curly-spacing": [2, "never"], + "quotes": [2, "single", "avoid-escape"], + "semi": [2, "always"], + "keyword-spacing": [2, {"before": true, "after": true}], + "space-unary-ops": 2 + } +} diff --git a/node_modules/proxy-from-env/.travis.yml b/node_modules/proxy-from-env/.travis.yml new file mode 100644 index 00000000..64a05f94 --- /dev/null +++ b/node_modules/proxy-from-env/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: + - node + - lts/* +script: + - npm run lint + # test-coverage will also run the tests, but does not print helpful output upon test failure. + # So we also run the tests separately. + - npm run test + - npm run test-coverage && cat coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf coverage diff --git a/node_modules/proxy-from-env/LICENSE b/node_modules/proxy-from-env/LICENSE new file mode 100644 index 00000000..8f25097d --- /dev/null +++ b/node_modules/proxy-from-env/LICENSE @@ -0,0 +1,20 @@ +The MIT License + +Copyright (C) 2016-2018 Rob Wu + +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. diff --git a/node_modules/proxy-from-env/README.md b/node_modules/proxy-from-env/README.md new file mode 100644 index 00000000..e82520c1 --- /dev/null +++ b/node_modules/proxy-from-env/README.md @@ -0,0 +1,131 @@ +# proxy-from-env + +[![Build Status](https://travis-ci.org/Rob--W/proxy-from-env.svg?branch=master)](https://travis-ci.org/Rob--W/proxy-from-env) +[![Coverage Status](https://coveralls.io/repos/github/Rob--W/proxy-from-env/badge.svg?branch=master)](https://coveralls.io/github/Rob--W/proxy-from-env?branch=master) + +`proxy-from-env` is a Node.js package that exports a function (`getProxyForUrl`) +that takes an input URL (a string or +[`url.parse`](https://nodejs.org/docs/latest/api/url.html#url_url_parsing)'s +return value) and returns the desired proxy URL (also a string) based on +standard proxy environment variables. If no proxy is set, an empty string is +returned. + +It is your responsibility to actually proxy the request using the given URL. + +Installation: + +```sh +npm install proxy-from-env +``` + +## Example +This example shows how the data for a URL can be fetched via the +[`http` module](https://nodejs.org/api/http.html), in a proxy-aware way. + +```javascript +var http = require('http'); +var parseUrl = require('url').parse; +var getProxyForUrl = require('proxy-from-env').getProxyForUrl; + +var some_url = 'http://example.com/something'; + +// // Example, if there is a proxy server at 10.0.0.1:1234, then setting the +// // http_proxy environment variable causes the request to go through a proxy. +// process.env.http_proxy = 'http://10.0.0.1:1234'; +// +// // But if the host to be proxied is listed in NO_PROXY, then the request is +// // not proxied (but a direct request is made). +// process.env.no_proxy = 'example.com'; + +var proxy_url = getProxyForUrl(some_url); // <-- Our magic. +if (proxy_url) { + // Should be proxied through proxy_url. + var parsed_some_url = parseUrl(some_url); + var parsed_proxy_url = parseUrl(proxy_url); + // A HTTP proxy is quite simple. It is similar to a normal request, except the + // path is an absolute URL, and the proxied URL's host is put in the header + // instead of the server's actual host. + httpOptions = { + protocol: parsed_proxy_url.protocol, + hostname: parsed_proxy_url.hostname, + port: parsed_proxy_url.port, + path: parsed_some_url.href, + headers: { + Host: parsed_some_url.host, // = host name + optional port. + }, + }; +} else { + // Direct request. + httpOptions = some_url; +} +http.get(httpOptions, function(res) { + var responses = []; + res.on('data', function(chunk) { responses.push(chunk); }); + res.on('end', function() { console.log(responses.join('')); }); +}); + +``` + +## Environment variables +The environment variables can be specified in lowercase or uppercase, with the +lowercase name having precedence over the uppercase variant. A variable that is +not set has the same meaning as a variable that is set but has no value. + +### NO\_PROXY + +`NO_PROXY` is a list of host names (optionally with a port). If the input URL +matches any of the entries in `NO_PROXY`, then the input URL should be fetched +by a direct request (i.e. without a proxy). + +Matching follows the following rules: + +- `NO_PROXY=*` disables all proxies. +- Space and commas may be used to separate the entries in the `NO_PROXY` list. +- If `NO_PROXY` does not contain any entries, then proxies are never disabled. +- If a port is added after the host name, then the ports must match. If the URL + does not have an explicit port name, the protocol's default port is used. +- Generally, the proxy is only disabled if the host name is an exact match for + an entry in the `NO_PROXY` list. The only exceptions are entries that start + with a dot or with a wildcard; then the proxy is disabled if the host name + ends with the entry. + +See `test.js` for examples of what should match and what does not. + +### \*\_PROXY + +The environment variable used for the proxy depends on the protocol of the URL. +For example, `https://example.com` uses the "https" protocol, and therefore the +proxy to be used is `HTTPS_PROXY` (_NOT_ `HTTP_PROXY`, which is _only_ used for +http:-URLs). + +The library is not limited to http(s), other schemes such as +`FTP_PROXY` (ftp:), +`WSS_PROXY` (wss:), +`WS_PROXY` (ws:) +are also supported. + +If present, `ALL_PROXY` is used as fallback if there is no other match. + + +## External resources +The exact way of parsing the environment variables is not codified in any +standard. This library is designed to be compatible with formats as expected by +existing software. +The following resources were used to determine the desired behavior: + +- cURL: + https://curl.haxx.se/docs/manpage.html#ENVIRONMENT + https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4446-L4514 + https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4608-L4638 + +- wget: + https://www.gnu.org/software/wget/manual/wget.html#Proxies + http://git.savannah.gnu.org/cgit/wget.git/tree/src/init.c?id=636a5f9a1c508aa39e35a3a8e9e54520a284d93d#n383 + http://git.savannah.gnu.org/cgit/wget.git/tree/src/retr.c?id=93c1517c4071c4288ba5a4b038e7634e4c6b5482#n1278 + +- W3: + https://www.w3.org/Daemon/User/Proxies/ProxyClients.html + +- Python's urllib: + https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L755-L782 + https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L2444-L2479 diff --git a/node_modules/proxy-from-env/index.js b/node_modules/proxy-from-env/index.js new file mode 100644 index 00000000..df75004a --- /dev/null +++ b/node_modules/proxy-from-env/index.js @@ -0,0 +1,108 @@ +'use strict'; + +var parseUrl = require('url').parse; + +var DEFAULT_PORTS = { + ftp: 21, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443, +}; + +var stringEndsWith = String.prototype.endsWith || function(s) { + return s.length <= this.length && + this.indexOf(s, this.length - s.length) !== -1; +}; + +/** + * @param {string|object} url - The URL, or the result from url.parse. + * @return {string} The URL of the proxy that should handle the request to the + * given URL. If no proxy is set, this will be an empty string. + */ +function getProxyForUrl(url) { + var parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {}; + var proto = parsedUrl.protocol; + var hostname = parsedUrl.host; + var port = parsedUrl.port; + if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') { + return ''; // Don't proxy URLs without a valid scheme or host. + } + + proto = proto.split(':', 1)[0]; + // Stripping ports in this way instead of using parsedUrl.hostname to make + // sure that the brackets around IPv6 addresses are kept. + hostname = hostname.replace(/:\d*$/, ''); + port = parseInt(port) || DEFAULT_PORTS[proto] || 0; + if (!shouldProxy(hostname, port)) { + return ''; // Don't proxy URLs that match NO_PROXY. + } + + var proxy = + getEnv('npm_config_' + proto + '_proxy') || + getEnv(proto + '_proxy') || + getEnv('npm_config_proxy') || + getEnv('all_proxy'); + if (proxy && proxy.indexOf('://') === -1) { + // Missing scheme in proxy, default to the requested URL's scheme. + proxy = proto + '://' + proxy; + } + return proxy; +} + +/** + * Determines whether a given URL should be proxied. + * + * @param {string} hostname - The host name of the URL. + * @param {number} port - The effective port of the URL. + * @returns {boolean} Whether the given URL should be proxied. + * @private + */ +function shouldProxy(hostname, port) { + var NO_PROXY = + (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase(); + if (!NO_PROXY) { + return true; // Always proxy if NO_PROXY is not set. + } + if (NO_PROXY === '*') { + return false; // Never proxy if wildcard is set. + } + + return NO_PROXY.split(/[,\s]/).every(function(proxy) { + if (!proxy) { + return true; // Skip zero-length hosts. + } + var parsedProxy = proxy.match(/^(.+):(\d+)$/); + var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy; + var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0; + if (parsedProxyPort && parsedProxyPort !== port) { + return true; // Skip if ports don't match. + } + + if (!/^[.*]/.test(parsedProxyHostname)) { + // No wildcards, so stop proxying if there is an exact match. + return hostname !== parsedProxyHostname; + } + + if (parsedProxyHostname.charAt(0) === '*') { + // Remove leading wildcard. + parsedProxyHostname = parsedProxyHostname.slice(1); + } + // Stop proxying if the hostname ends with the no_proxy host. + return !stringEndsWith.call(hostname, parsedProxyHostname); + }); +} + +/** + * Get the value for an environment variable. + * + * @param {string} key - The name of the environment variable. + * @return {string} The value of the environment variable. + * @private + */ +function getEnv(key) { + return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || ''; +} + +exports.getProxyForUrl = getProxyForUrl; diff --git a/node_modules/proxy-from-env/package.json b/node_modules/proxy-from-env/package.json new file mode 100644 index 00000000..be2b845b --- /dev/null +++ b/node_modules/proxy-from-env/package.json @@ -0,0 +1,34 @@ +{ + "name": "proxy-from-env", + "version": "1.1.0", + "description": "Offers getProxyForUrl to get the proxy URL for a URL, respecting the *_PROXY (e.g. HTTP_PROXY) and NO_PROXY environment variables.", + "main": "index.js", + "scripts": { + "lint": "eslint *.js", + "test": "mocha ./test.js --reporter spec", + "test-coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec" + }, + "repository": { + "type": "git", + "url": "https://github.com/Rob--W/proxy-from-env.git" + }, + "keywords": [ + "proxy", + "http_proxy", + "https_proxy", + "no_proxy", + "environment" + ], + "author": "Rob Wu (https://robwu.nl/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/Rob--W/proxy-from-env/issues" + }, + "homepage": "https://github.com/Rob--W/proxy-from-env#readme", + "devDependencies": { + "coveralls": "^3.0.9", + "eslint": "^6.8.0", + "istanbul": "^0.4.5", + "mocha": "^7.1.0" + } +} diff --git a/node_modules/proxy-from-env/test.js b/node_modules/proxy-from-env/test.js new file mode 100644 index 00000000..abf65423 --- /dev/null +++ b/node_modules/proxy-from-env/test.js @@ -0,0 +1,483 @@ +/* eslint max-statements:0 */ +'use strict'; + +var assert = require('assert'); +var parseUrl = require('url').parse; + +var getProxyForUrl = require('./').getProxyForUrl; + +// Runs the callback with process.env temporarily set to env. +function runWithEnv(env, callback) { + var originalEnv = process.env; + process.env = env; + try { + callback(); + } finally { + process.env = originalEnv; + } +} + +// Defines a test case that checks whether getProxyForUrl(input) === expected. +function testProxyUrl(env, expected, input) { + assert(typeof env === 'object' && env !== null); + // Copy object to make sure that the in param does not get modified between + // the call of this function and the use of it below. + env = JSON.parse(JSON.stringify(env)); + + var title = 'getProxyForUrl(' + JSON.stringify(input) + ')' + + ' === ' + JSON.stringify(expected); + + // Save call stack for later use. + var stack = {}; + Error.captureStackTrace(stack, testProxyUrl); + // Only use the last stack frame because that shows where this function is + // called, and that is sufficient for our purpose. No need to flood the logs + // with an uninteresting stack trace. + stack = stack.stack.split('\n', 2)[1]; + + it(title, function() { + var actual; + runWithEnv(env, function() { + actual = getProxyForUrl(input); + }); + if (expected === actual) { + return; // Good! + } + try { + assert.strictEqual(expected, actual); // Create a formatted error message. + // Should not happen because previously we determined expected !== actual. + throw new Error('assert.strictEqual passed. This is impossible!'); + } catch (e) { + // Use the original stack trace, so we can see a helpful line number. + e.stack = e.message + stack; + throw e; + } + }); +} + +describe('getProxyForUrl', function() { + describe('No proxy variables', function() { + var env = {}; + testProxyUrl(env, '', 'http://example.com'); + testProxyUrl(env, '', 'https://example.com'); + testProxyUrl(env, '', 'ftp://example.com'); + }); + + describe('Invalid URLs', function() { + var env = {}; + env.ALL_PROXY = 'http://unexpected.proxy'; + testProxyUrl(env, '', 'bogus'); + testProxyUrl(env, '', '//example.com'); + testProxyUrl(env, '', '://example.com'); + testProxyUrl(env, '', '://'); + testProxyUrl(env, '', '/path'); + testProxyUrl(env, '', ''); + testProxyUrl(env, '', 'http:'); + testProxyUrl(env, '', 'http:/'); + testProxyUrl(env, '', 'http://'); + testProxyUrl(env, '', 'prototype://'); + testProxyUrl(env, '', 'hasOwnProperty://'); + testProxyUrl(env, '', '__proto__://'); + testProxyUrl(env, '', undefined); + testProxyUrl(env, '', null); + testProxyUrl(env, '', {}); + testProxyUrl(env, '', {host: 'x', protocol: 1}); + testProxyUrl(env, '', {host: 1, protocol: 'x'}); + }); + + describe('http_proxy and HTTP_PROXY', function() { + var env = {}; + env.HTTP_PROXY = 'http://http-proxy'; + + testProxyUrl(env, '', 'https://example'); + testProxyUrl(env, 'http://http-proxy', 'http://example'); + testProxyUrl(env, 'http://http-proxy', parseUrl('http://example')); + + // eslint-disable-next-line camelcase + env.http_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'http://example'); + }); + + describe('http_proxy with non-sensical value', function() { + var env = {}; + // Crazy values should be passed as-is. It is the responsibility of the + // one who launches the application that the value makes sense. + // TODO: Should we be stricter and perform validation? + env.HTTP_PROXY = 'Crazy \n!() { ::// }'; + testProxyUrl(env, 'Crazy \n!() { ::// }', 'http://wow'); + + // The implementation assumes that the HTTP_PROXY environment variable is + // somewhat reasonable, and if the scheme is missing, it is added. + // Garbage in, garbage out some would say... + env.HTTP_PROXY = 'crazy without colon slash slash'; + testProxyUrl(env, 'http://crazy without colon slash slash', 'http://wow'); + }); + + describe('https_proxy and HTTPS_PROXY', function() { + var env = {}; + // Assert that there is no fall back to http_proxy + env.HTTP_PROXY = 'http://unexpected.proxy'; + testProxyUrl(env, '', 'https://example'); + + env.HTTPS_PROXY = 'http://https-proxy'; + testProxyUrl(env, 'http://https-proxy', 'https://example'); + + // eslint-disable-next-line camelcase + env.https_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'https://example'); + }); + + describe('ftp_proxy', function() { + var env = {}; + // Something else than http_proxy / https, as a sanity check. + env.FTP_PROXY = 'http://ftp-proxy'; + + testProxyUrl(env, 'http://ftp-proxy', 'ftp://example'); + testProxyUrl(env, '', 'ftps://example'); + }); + + describe('all_proxy', function() { + var env = {}; + env.ALL_PROXY = 'http://catch-all'; + testProxyUrl(env, 'http://catch-all', 'https://example'); + + // eslint-disable-next-line camelcase + env.all_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'https://example'); + }); + + describe('all_proxy without scheme', function() { + var env = {}; + env.ALL_PROXY = 'noscheme'; + testProxyUrl(env, 'http://noscheme', 'http://example'); + testProxyUrl(env, 'https://noscheme', 'https://example'); + + // The module does not impose restrictions on the scheme. + testProxyUrl(env, 'bogus-scheme://noscheme', 'bogus-scheme://example'); + + // But the URL should still be valid. + testProxyUrl(env, '', 'bogus'); + }); + + describe('no_proxy empty', function() { + var env = {}; + env.HTTPS_PROXY = 'http://proxy'; + + // NO_PROXY set but empty. + env.NO_PROXY = ''; + testProxyUrl(env, 'http://proxy', 'https://example'); + + // No entries in NO_PROXY (comma). + env.NO_PROXY = ','; + testProxyUrl(env, 'http://proxy', 'https://example'); + + // No entries in NO_PROXY (whitespace). + env.NO_PROXY = ' '; + testProxyUrl(env, 'http://proxy', 'https://example'); + + // No entries in NO_PROXY (multiple whitespace / commas). + env.NO_PROXY = ',\t,,,\n, ,\r'; + testProxyUrl(env, 'http://proxy', 'https://example'); + }); + + describe('no_proxy=example (single host)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = 'example'; + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, '', 'http://example:80'); + testProxyUrl(env, '', 'http://example:0'); + testProxyUrl(env, '', 'http://example:1337'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, 'http://proxy', 'http://a.b.example'); + testProxyUrl(env, 'http://proxy', 'http://host/example'); + }); + + describe('no_proxy=sub.example (subdomain)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = 'sub.example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://example:80'); + testProxyUrl(env, 'http://proxy', 'http://example:0'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://no.sub.example'); + testProxyUrl(env, 'http://proxy', 'http://sub-example'); + testProxyUrl(env, 'http://proxy', 'http://example.sub'); + }); + + describe('no_proxy=example:80 (host + port)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = 'example:80'; + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, '', 'http://example:80'); + testProxyUrl(env, '', 'http://example:0'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, 'http://proxy', 'http://a.b.example'); + }); + + describe('no_proxy=.example (host suffix)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '.example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://example:80'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, '', 'http://sub.example:80'); + testProxyUrl(env, '', 'http://sub.example:1337'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, '', 'http://a.b.example'); + }); + + describe('no_proxy=*', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + env.NO_PROXY = '*'; + testProxyUrl(env, '', 'http://example.com'); + }); + + describe('no_proxy=*.example (host suffix with *.)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '*.example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://example:80'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, '', 'http://sub.example:80'); + testProxyUrl(env, '', 'http://sub.example:1337'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, '', 'http://a.b.example'); + }); + + describe('no_proxy=*example (substring suffix)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '*example'; + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, '', 'http://example:80'); + testProxyUrl(env, '', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, '', 'http://sub.example:80'); + testProxyUrl(env, '', 'http://sub.example:1337'); + testProxyUrl(env, '', 'http://prefexample'); + testProxyUrl(env, '', 'http://a.b.example'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, 'http://proxy', 'http://host/example'); + }); + + describe('no_proxy=.*example (arbitrary wildcards are NOT supported)', + function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '.*example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://x.prefexample'); + testProxyUrl(env, 'http://proxy', 'http://a.b.example'); + }); + + describe('no_proxy=[::1],[::2]:80,10.0.0.1,10.0.0.2:80 (IP addresses)', + function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '[::1],[::2]:80,10.0.0.1,10.0.0.2:80'; + testProxyUrl(env, '', 'http://[::1]/'); + testProxyUrl(env, '', 'http://[::1]:80/'); + testProxyUrl(env, '', 'http://[::1]:1337/'); + + testProxyUrl(env, '', 'http://[::2]/'); + testProxyUrl(env, '', 'http://[::2]:80/'); + testProxyUrl(env, 'http://proxy', 'http://[::2]:1337/'); + + testProxyUrl(env, '', 'http://10.0.0.1/'); + testProxyUrl(env, '', 'http://10.0.0.1:80/'); + testProxyUrl(env, '', 'http://10.0.0.1:1337/'); + + testProxyUrl(env, '', 'http://10.0.0.2/'); + testProxyUrl(env, '', 'http://10.0.0.2:80/'); + testProxyUrl(env, 'http://proxy', 'http://10.0.0.2:1337/'); + }); + + describe('no_proxy=127.0.0.1/32 (CIDR is NOT supported)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '127.0.0.1/32'; + testProxyUrl(env, 'http://proxy', 'http://127.0.0.1'); + testProxyUrl(env, 'http://proxy', 'http://127.0.0.1/32'); + }); + + describe('no_proxy=127.0.0.1 does NOT match localhost', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '127.0.0.1'; + testProxyUrl(env, '', 'http://127.0.0.1'); + // We're not performing DNS queries, so this shouldn't match. + testProxyUrl(env, 'http://proxy', 'http://localhost'); + }); + + describe('no_proxy with protocols that have a default port', function() { + var env = {}; + env.WS_PROXY = 'http://ws'; + env.WSS_PROXY = 'http://wss'; + env.HTTP_PROXY = 'http://http'; + env.HTTPS_PROXY = 'http://https'; + env.GOPHER_PROXY = 'http://gopher'; + env.FTP_PROXY = 'http://ftp'; + env.ALL_PROXY = 'http://all'; + + env.NO_PROXY = 'xxx:21,xxx:70,xxx:80,xxx:443'; + + testProxyUrl(env, '', 'http://xxx'); + testProxyUrl(env, '', 'http://xxx:80'); + testProxyUrl(env, 'http://http', 'http://xxx:1337'); + + testProxyUrl(env, '', 'ws://xxx'); + testProxyUrl(env, '', 'ws://xxx:80'); + testProxyUrl(env, 'http://ws', 'ws://xxx:1337'); + + testProxyUrl(env, '', 'https://xxx'); + testProxyUrl(env, '', 'https://xxx:443'); + testProxyUrl(env, 'http://https', 'https://xxx:1337'); + + testProxyUrl(env, '', 'wss://xxx'); + testProxyUrl(env, '', 'wss://xxx:443'); + testProxyUrl(env, 'http://wss', 'wss://xxx:1337'); + + testProxyUrl(env, '', 'gopher://xxx'); + testProxyUrl(env, '', 'gopher://xxx:70'); + testProxyUrl(env, 'http://gopher', 'gopher://xxx:1337'); + + testProxyUrl(env, '', 'ftp://xxx'); + testProxyUrl(env, '', 'ftp://xxx:21'); + testProxyUrl(env, 'http://ftp', 'ftp://xxx:1337'); + }); + + describe('no_proxy should not be case-sensitive', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + env.NO_PROXY = 'XXX,YYY,ZzZ'; + + testProxyUrl(env, '', 'http://xxx'); + testProxyUrl(env, '', 'http://XXX'); + testProxyUrl(env, '', 'http://yyy'); + testProxyUrl(env, '', 'http://YYY'); + testProxyUrl(env, '', 'http://ZzZ'); + testProxyUrl(env, '', 'http://zZz'); + }); + + describe('NPM proxy configuration', function() { + describe('npm_config_http_proxy should work', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://http-proxy'; + + testProxyUrl(env, '', 'https://example'); + testProxyUrl(env, 'http://http-proxy', 'http://example'); + + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'http://example'); + }); + // eslint-disable-next-line max-len + describe('npm_config_http_proxy should take precedence over HTTP_PROXY and npm_config_proxy', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://http-proxy'; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://unexpected-proxy'; + env.HTTP_PROXY = 'http://unexpected-proxy'; + + testProxyUrl(env, 'http://http-proxy', 'http://example'); + }); + describe('npm_config_https_proxy should work', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://unexpected.proxy'; + testProxyUrl(env, '', 'https://example'); + + // eslint-disable-next-line camelcase + env.npm_config_https_proxy = 'http://https-proxy'; + testProxyUrl(env, 'http://https-proxy', 'https://example'); + + // eslint-disable-next-line camelcase + env.npm_config_https_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'https://example'); + }); + // eslint-disable-next-line max-len + describe('npm_config_https_proxy should take precedence over HTTPS_PROXY and npm_config_proxy', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_https_proxy = 'http://https-proxy'; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://unexpected-proxy'; + env.HTTPS_PROXY = 'http://unexpected-proxy'; + + testProxyUrl(env, 'http://https-proxy', 'https://example'); + }); + describe('npm_config_proxy should work', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://http-proxy'; + testProxyUrl(env, 'http://http-proxy', 'http://example'); + testProxyUrl(env, 'http://http-proxy', 'https://example'); + + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'http://example'); + testProxyUrl(env, 'http://priority', 'https://example'); + }); + // eslint-disable-next-line max-len + describe('HTTP_PROXY and HTTPS_PROXY should take precedence over npm_config_proxy', function() { + var env = {}; + env.HTTP_PROXY = 'http://http-proxy'; + env.HTTPS_PROXY = 'http://https-proxy'; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://unexpected-proxy'; + testProxyUrl(env, 'http://http-proxy', 'http://example'); + testProxyUrl(env, 'http://https-proxy', 'https://example'); + }); + describe('npm_config_no_proxy should work', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + // eslint-disable-next-line camelcase + env.npm_config_no_proxy = 'example'; + + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://otherwebsite'); + }); + // eslint-disable-next-line max-len + describe('npm_config_no_proxy should take precedence over NO_PROXY', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + env.NO_PROXY = 'otherwebsite'; + // eslint-disable-next-line camelcase + env.npm_config_no_proxy = 'example'; + + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://otherwebsite'); + }); + }); +}); diff --git a/project starter code/node_modules/qs/.editorconfig b/node_modules/qs/.editorconfig similarity index 100% rename from project starter code/node_modules/qs/.editorconfig rename to node_modules/qs/.editorconfig diff --git a/project starter code/node_modules/qs/.eslintrc b/node_modules/qs/.eslintrc similarity index 100% rename from project starter code/node_modules/qs/.eslintrc rename to node_modules/qs/.eslintrc diff --git a/project starter code/node_modules/qs/.github/FUNDING.yml b/node_modules/qs/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/qs/.github/FUNDING.yml rename to node_modules/qs/.github/FUNDING.yml diff --git a/project starter code/node_modules/qs/.nycrc b/node_modules/qs/.nycrc similarity index 100% rename from project starter code/node_modules/qs/.nycrc rename to node_modules/qs/.nycrc diff --git a/project starter code/node_modules/qs/CHANGELOG.md b/node_modules/qs/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/qs/CHANGELOG.md rename to node_modules/qs/CHANGELOG.md diff --git a/project starter code/node_modules/qs/LICENSE.md b/node_modules/qs/LICENSE.md similarity index 100% rename from project starter code/node_modules/qs/LICENSE.md rename to node_modules/qs/LICENSE.md diff --git a/project starter code/node_modules/qs/README.md b/node_modules/qs/README.md similarity index 100% rename from project starter code/node_modules/qs/README.md rename to node_modules/qs/README.md diff --git a/project starter code/node_modules/qs/dist/qs.js b/node_modules/qs/dist/qs.js similarity index 100% rename from project starter code/node_modules/qs/dist/qs.js rename to node_modules/qs/dist/qs.js diff --git a/project starter code/node_modules/qs/lib/formats.js b/node_modules/qs/lib/formats.js similarity index 100% rename from project starter code/node_modules/qs/lib/formats.js rename to node_modules/qs/lib/formats.js diff --git a/project starter code/node_modules/qs/lib/index.js b/node_modules/qs/lib/index.js similarity index 100% rename from project starter code/node_modules/qs/lib/index.js rename to node_modules/qs/lib/index.js diff --git a/project starter code/node_modules/qs/lib/parse.js b/node_modules/qs/lib/parse.js similarity index 100% rename from project starter code/node_modules/qs/lib/parse.js rename to node_modules/qs/lib/parse.js diff --git a/project starter code/node_modules/qs/lib/stringify.js b/node_modules/qs/lib/stringify.js similarity index 100% rename from project starter code/node_modules/qs/lib/stringify.js rename to node_modules/qs/lib/stringify.js diff --git a/project starter code/node_modules/qs/lib/utils.js b/node_modules/qs/lib/utils.js similarity index 100% rename from project starter code/node_modules/qs/lib/utils.js rename to node_modules/qs/lib/utils.js diff --git a/project starter code/node_modules/qs/package.json b/node_modules/qs/package.json similarity index 100% rename from project starter code/node_modules/qs/package.json rename to node_modules/qs/package.json diff --git a/project starter code/node_modules/qs/test/parse.js b/node_modules/qs/test/parse.js similarity index 100% rename from project starter code/node_modules/qs/test/parse.js rename to node_modules/qs/test/parse.js diff --git a/project starter code/node_modules/qs/test/stringify.js b/node_modules/qs/test/stringify.js similarity index 100% rename from project starter code/node_modules/qs/test/stringify.js rename to node_modules/qs/test/stringify.js diff --git a/project starter code/node_modules/qs/test/utils.js b/node_modules/qs/test/utils.js similarity index 100% rename from project starter code/node_modules/qs/test/utils.js rename to node_modules/qs/test/utils.js diff --git a/project starter code/node_modules/range-parser/HISTORY.md b/node_modules/range-parser/HISTORY.md similarity index 100% rename from project starter code/node_modules/range-parser/HISTORY.md rename to node_modules/range-parser/HISTORY.md diff --git a/project starter code/node_modules/range-parser/LICENSE b/node_modules/range-parser/LICENSE similarity index 100% rename from project starter code/node_modules/range-parser/LICENSE rename to node_modules/range-parser/LICENSE diff --git a/project starter code/node_modules/range-parser/README.md b/node_modules/range-parser/README.md similarity index 100% rename from project starter code/node_modules/range-parser/README.md rename to node_modules/range-parser/README.md diff --git a/project starter code/node_modules/range-parser/index.js b/node_modules/range-parser/index.js similarity index 100% rename from project starter code/node_modules/range-parser/index.js rename to node_modules/range-parser/index.js diff --git a/project starter code/node_modules/range-parser/package.json b/node_modules/range-parser/package.json similarity index 100% rename from project starter code/node_modules/range-parser/package.json rename to node_modules/range-parser/package.json diff --git a/node_modules/raw-body/HISTORY.md b/node_modules/raw-body/HISTORY.md new file mode 100644 index 00000000..baf0e2d8 --- /dev/null +++ b/node_modules/raw-body/HISTORY.md @@ -0,0 +1,308 @@ +2.5.2 / 2023-02-21 +================== + + * Fix error message for non-stream argument + +2.5.1 / 2022-02-28 +================== + + * Fix error on early async hooks implementations + +2.5.0 / 2022-02-21 +================== + + * Prevent loss of async hooks context + * Prevent hanging when stream is not readable + * deps: http-errors@2.0.0 + - deps: depd@2.0.0 + - deps: statuses@2.0.1 + +2.4.3 / 2022-02-14 +================== + + * deps: bytes@3.1.2 + +2.4.2 / 2021-11-16 +================== + + * deps: bytes@3.1.1 + * deps: http-errors@1.8.1 + - deps: setprototypeof@1.2.0 + - deps: toidentifier@1.0.1 + +2.4.1 / 2019-06-25 +================== + + * deps: http-errors@1.7.3 + - deps: inherits@2.0.4 + +2.4.0 / 2019-04-17 +================== + + * deps: bytes@3.1.0 + - Add petabyte (`pb`) support + * deps: http-errors@1.7.2 + - Set constructor name when possible + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: iconv-lite@0.4.24 + - Added encoding MIK + +2.3.3 / 2018-05-08 +================== + + * deps: http-errors@1.6.3 + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.0 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.23 + - Fix loading encoding with year appended + - Fix deprecation warnings on Node.js 10+ + +2.3.2 / 2017-09-09 +================== + + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + +2.3.1 / 2017-09-07 +================== + + * deps: bytes@3.0.0 + * deps: http-errors@1.6.2 + - deps: depd@1.1.1 + * perf: skip buffer decoding on overage chunk + +2.3.0 / 2017-08-04 +================== + + * Add TypeScript definitions + * Use `http-errors` for standard emitted errors + * deps: bytes@2.5.0 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + +2.2.0 / 2017-01-02 +================== + + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + +2.1.7 / 2016-06-19 +================== + + * deps: bytes@2.4.0 + * perf: remove double-cleanup on happy path + +2.1.6 / 2016-03-07 +================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + +2.1.5 / 2015-11-30 +================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + +2.1.4 / 2015-09-27 +================== + + * Fix masking critical errors from `iconv-lite` + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + +2.1.3 / 2015-09-12 +================== + + * Fix sync callback when attaching data listener causes sync read + - Node.js 0.10 compatibility issue + +2.1.2 / 2015-07-05 +================== + + * Fix error stack traces to skip `makeError` + * deps: iconv-lite@0.4.11 + - Add encoding CESU-8 + +2.1.1 / 2015-06-14 +================== + + * Use `unpipe` module for unpiping requests + +2.1.0 / 2015-05-28 +================== + + * deps: iconv-lite@0.4.10 + - Improved UTF-16 endianness detection + - Leading BOM is now removed when decoding + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + +2.0.2 / 2015-05-21 +================== + + * deps: bytes@2.1.0 + - Slight optimizations + +2.0.1 / 2015-05-10 +================== + + * Fix a false-positive when unpiping in Node.js 0.8 + +2.0.0 / 2015-05-08 +================== + + * Return a promise without callback instead of thunk + * deps: bytes@2.0.1 + - units no longer case sensitive when parsing + +1.3.4 / 2015-04-15 +================== + + * Fix hanging callback if request aborts during read + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + +1.3.3 / 2015-02-08 +================== + + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + +1.3.2 / 2015-01-20 +================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + +1.3.1 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + +1.3.0 / 2014-07-20 +================== + + * Fully unpipe the stream on error + - Fixes `Cannot switch to old mode now` error on Node.js 0.10+ + +1.2.3 / 2014-07-20 +================== + + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + +1.2.2 / 2014-06-19 +================== + + * Send invalid encoding error to callback + +1.2.1 / 2014-06-15 +================== + + * deps: iconv-lite@0.4.3 + - Added encodings UTF-16BE and UTF-16 with BOM + +1.2.0 / 2014-06-13 +================== + + * Passing string as `options` interpreted as encoding + * Support all encodings from `iconv-lite` + +1.1.7 / 2014-06-12 +================== + + * use `string_decoder` module from npm + +1.1.6 / 2014-05-27 +================== + + * check encoding for old streams1 + * support node.js < 0.10.6 + +1.1.5 / 2014-05-14 +================== + + * bump bytes + +1.1.4 / 2014-04-19 +================== + + * allow true as an option + * bump bytes + +1.1.3 / 2014-03-02 +================== + + * fix case when length=null + +1.1.2 / 2013-12-01 +================== + + * be less strict on state.encoding check + +1.1.1 / 2013-11-27 +================== + + * add engines + +1.1.0 / 2013-11-27 +================== + + * add err.statusCode and err.type + * allow for encoding option to be true + * pause the stream instead of dumping on error + * throw if the stream's encoding is set + +1.0.1 / 2013-11-19 +================== + + * dont support streams1, throw if dev set encoding + +1.0.0 / 2013-11-17 +================== + + * rename `expected` option to `length` + +0.2.0 / 2013-11-15 +================== + + * republish + +0.1.1 / 2013-11-15 +================== + + * use bytes + +0.1.0 / 2013-11-11 +================== + + * generator support + +0.0.3 / 2013-10-10 +================== + + * update repo + +0.0.2 / 2013-09-14 +================== + + * dump stream on bad headers + * listen to events after defining received and buffers + +0.0.1 / 2013-09-14 +================== + + * Initial release diff --git a/project starter code/node_modules/raw-body/LICENSE b/node_modules/raw-body/LICENSE similarity index 100% rename from project starter code/node_modules/raw-body/LICENSE rename to node_modules/raw-body/LICENSE diff --git a/node_modules/raw-body/README.md b/node_modules/raw-body/README.md new file mode 100644 index 00000000..d9b36d61 --- /dev/null +++ b/node_modules/raw-body/README.md @@ -0,0 +1,223 @@ +# raw-body + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build status][github-actions-ci-image]][github-actions-ci-url] +[![Test coverage][coveralls-image]][coveralls-url] + +Gets the entire buffer of a stream either as a `Buffer` or a string. +Validates the stream's length against an expected length and maximum limit. +Ideal for parsing request bodies. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install raw-body +``` + +### TypeScript + +This module includes a [TypeScript](https://www.typescriptlang.org/) +declaration file to enable auto complete in compatible editors and type +information for TypeScript projects. This module depends on the Node.js +types, so install `@types/node`: + +```sh +$ npm install @types/node +``` + +## API + +```js +var getRawBody = require('raw-body') +``` + +### getRawBody(stream, [options], [callback]) + +**Returns a promise if no callback specified and global `Promise` exists.** + +Options: + +- `length` - The length of the stream. + If the contents of the stream do not add up to this length, + an `400` error code is returned. +- `limit` - The byte limit of the body. + This is the number of bytes or any string format supported by + [bytes](https://www.npmjs.com/package/bytes), + for example `1000`, `'500kb'` or `'3mb'`. + If the body ends up being larger than this limit, + a `413` error code is returned. +- `encoding` - The encoding to use to decode the body into a string. + By default, a `Buffer` instance will be returned when no encoding is specified. + Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`. + You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme). + +You can also pass a string in place of options to just specify the encoding. + +If an error occurs, the stream will be paused, everything unpiped, +and you are responsible for correctly disposing the stream. +For HTTP requests, you may need to finish consuming the stream if +you want to keep the socket open for future requests. For streams +that use file descriptors, you should `stream.destroy()` or +`stream.close()` to prevent leaks. + +## Errors + +This module creates errors depending on the error condition during reading. +The error may be an error from the underlying Node.js implementation, but is +otherwise an error created by this module, which has the following attributes: + + * `limit` - the limit in bytes + * `length` and `expected` - the expected length of the stream + * `received` - the received bytes + * `encoding` - the invalid encoding + * `status` and `statusCode` - the corresponding status code for the error + * `type` - the error type + +### Types + +The errors from this module have a `type` property which allows for the programmatic +determination of the type of error returned. + +#### encoding.unsupported + +This error will occur when the `encoding` option is specified, but the value does +not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme) +module. + +#### entity.too.large + +This error will occur when the `limit` option is specified, but the stream has +an entity that is larger. + +#### request.aborted + +This error will occur when the request stream is aborted by the client before +reading the body has finished. + +#### request.size.invalid + +This error will occur when the `length` option is specified, but the stream has +emitted more bytes. + +#### stream.encoding.set + +This error will occur when the given stream has an encoding set on it, making it +a decoded stream. The stream should not have an encoding set and is expected to +emit `Buffer` objects. + +#### stream.not.readable + +This error will occur when the given stream is not readable. + +## Examples + +### Simple Express example + +```js +var contentType = require('content-type') +var express = require('express') +var getRawBody = require('raw-body') + +var app = express() + +app.use(function (req, res, next) { + getRawBody(req, { + length: req.headers['content-length'], + limit: '1mb', + encoding: contentType.parse(req).parameters.charset + }, function (err, string) { + if (err) return next(err) + req.text = string + next() + }) +}) + +// now access req.text +``` + +### Simple Koa example + +```js +var contentType = require('content-type') +var getRawBody = require('raw-body') +var koa = require('koa') + +var app = koa() + +app.use(function * (next) { + this.text = yield getRawBody(this.req, { + length: this.req.headers['content-length'], + limit: '1mb', + encoding: contentType.parse(this.req).parameters.charset + }) + yield next +}) + +// now access this.text +``` + +### Using as a promise + +To use this library as a promise, simply omit the `callback` and a promise is +returned, provided that a global `Promise` is defined. + +```js +var getRawBody = require('raw-body') +var http = require('http') + +var server = http.createServer(function (req, res) { + getRawBody(req) + .then(function (buf) { + res.statusCode = 200 + res.end(buf.length + ' bytes submitted') + }) + .catch(function (err) { + res.statusCode = 500 + res.end(err.message) + }) +}) + +server.listen(3000) +``` + +### Using with TypeScript + +```ts +import * as getRawBody from 'raw-body'; +import * as http from 'http'; + +const server = http.createServer((req, res) => { + getRawBody(req) + .then((buf) => { + res.statusCode = 200; + res.end(buf.length + ' bytes submitted'); + }) + .catch((err) => { + res.statusCode = err.statusCode; + res.end(err.message); + }); +}); + +server.listen(3000); +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/raw-body.svg +[npm-url]: https://npmjs.org/package/raw-body +[node-version-image]: https://img.shields.io/node/v/raw-body.svg +[node-version-url]: https://nodejs.org/en/download/ +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg +[coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master +[downloads-image]: https://img.shields.io/npm/dm/raw-body.svg +[downloads-url]: https://npmjs.org/package/raw-body +[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/stream-utils/raw-body/ci.yml?branch=master&label=ci +[github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci diff --git a/project starter code/node_modules/raw-body/SECURITY.md b/node_modules/raw-body/SECURITY.md similarity index 100% rename from project starter code/node_modules/raw-body/SECURITY.md rename to node_modules/raw-body/SECURITY.md diff --git a/project starter code/node_modules/raw-body/index.d.ts b/node_modules/raw-body/index.d.ts similarity index 100% rename from project starter code/node_modules/raw-body/index.d.ts rename to node_modules/raw-body/index.d.ts diff --git a/node_modules/raw-body/index.js b/node_modules/raw-body/index.js new file mode 100644 index 00000000..9cdcd122 --- /dev/null +++ b/node_modules/raw-body/index.js @@ -0,0 +1,336 @@ +/*! + * raw-body + * Copyright(c) 2013-2014 Jonathan Ong + * Copyright(c) 2014-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var asyncHooks = tryRequireAsyncHooks() +var bytes = require('bytes') +var createError = require('http-errors') +var iconv = require('iconv-lite') +var unpipe = require('unpipe') + +/** + * Module exports. + * @public + */ + +module.exports = getRawBody + +/** + * Module variables. + * @private + */ + +var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: / + +/** + * Get the decoder for a given encoding. + * + * @param {string} encoding + * @private + */ + +function getDecoder (encoding) { + if (!encoding) return null + + try { + return iconv.getDecoder(encoding) + } catch (e) { + // error getting decoder + if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e + + // the encoding was not found + throw createError(415, 'specified encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } +} + +/** + * Get the raw body of a stream (typically HTTP). + * + * @param {object} stream + * @param {object|string|function} [options] + * @param {function} [callback] + * @public + */ + +function getRawBody (stream, options, callback) { + var done = callback + var opts = options || {} + + // light validation + if (stream === undefined) { + throw new TypeError('argument stream is required') + } else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') { + throw new TypeError('argument stream must be a stream') + } + + if (options === true || typeof options === 'string') { + // short cut for encoding + opts = { + encoding: options + } + } + + if (typeof options === 'function') { + done = options + opts = {} + } + + // validate callback is a function, if provided + if (done !== undefined && typeof done !== 'function') { + throw new TypeError('argument callback must be a function') + } + + // require the callback without promises + if (!done && !global.Promise) { + throw new TypeError('argument callback is required') + } + + // get encoding + var encoding = opts.encoding !== true + ? opts.encoding + : 'utf-8' + + // convert the limit to an integer + var limit = bytes.parse(opts.limit) + + // convert the expected length to an integer + var length = opts.length != null && !isNaN(opts.length) + ? parseInt(opts.length, 10) + : null + + if (done) { + // classic callback style + return readStream(stream, encoding, length, limit, wrap(done)) + } + + return new Promise(function executor (resolve, reject) { + readStream(stream, encoding, length, limit, function onRead (err, buf) { + if (err) return reject(err) + resolve(buf) + }) + }) +} + +/** + * Halt a stream. + * + * @param {Object} stream + * @private + */ + +function halt (stream) { + // unpipe everything from the stream + unpipe(stream) + + // pause stream + if (typeof stream.pause === 'function') { + stream.pause() + } +} + +/** + * Read the data from the stream. + * + * @param {object} stream + * @param {string} encoding + * @param {number} length + * @param {number} limit + * @param {function} callback + * @public + */ + +function readStream (stream, encoding, length, limit, callback) { + var complete = false + var sync = true + + // check the length and limit options. + // note: we intentionally leave the stream paused, + // so users should handle the stream themselves. + if (limit !== null && length !== null && length > limit) { + return done(createError(413, 'request entity too large', { + expected: length, + length: length, + limit: limit, + type: 'entity.too.large' + })) + } + + // streams1: assert request encoding is buffer. + // streams2+: assert the stream encoding is buffer. + // stream._decoder: streams1 + // state.encoding: streams2 + // state.decoder: streams2, specifically < 0.10.6 + var state = stream._readableState + if (stream._decoder || (state && (state.encoding || state.decoder))) { + // developer error + return done(createError(500, 'stream encoding should not be set', { + type: 'stream.encoding.set' + })) + } + + if (typeof stream.readable !== 'undefined' && !stream.readable) { + return done(createError(500, 'stream is not readable', { + type: 'stream.not.readable' + })) + } + + var received = 0 + var decoder + + try { + decoder = getDecoder(encoding) + } catch (err) { + return done(err) + } + + var buffer = decoder + ? '' + : [] + + // attach listeners + stream.on('aborted', onAborted) + stream.on('close', cleanup) + stream.on('data', onData) + stream.on('end', onEnd) + stream.on('error', onEnd) + + // mark sync section complete + sync = false + + function done () { + var args = new Array(arguments.length) + + // copy arguments + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + // mark complete + complete = true + + if (sync) { + process.nextTick(invokeCallback) + } else { + invokeCallback() + } + + function invokeCallback () { + cleanup() + + if (args[0]) { + // halt the stream on error + halt(stream) + } + + callback.apply(null, args) + } + } + + function onAborted () { + if (complete) return + + done(createError(400, 'request aborted', { + code: 'ECONNABORTED', + expected: length, + length: length, + received: received, + type: 'request.aborted' + })) + } + + function onData (chunk) { + if (complete) return + + received += chunk.length + + if (limit !== null && received > limit) { + done(createError(413, 'request entity too large', { + limit: limit, + received: received, + type: 'entity.too.large' + })) + } else if (decoder) { + buffer += decoder.write(chunk) + } else { + buffer.push(chunk) + } + } + + function onEnd (err) { + if (complete) return + if (err) return done(err) + + if (length !== null && received !== length) { + done(createError(400, 'request size did not match content length', { + expected: length, + length: length, + received: received, + type: 'request.size.invalid' + })) + } else { + var string = decoder + ? buffer + (decoder.end() || '') + : Buffer.concat(buffer) + done(null, string) + } + } + + function cleanup () { + buffer = null + + stream.removeListener('aborted', onAborted) + stream.removeListener('data', onData) + stream.removeListener('end', onEnd) + stream.removeListener('error', onEnd) + stream.removeListener('close', cleanup) + } +} + +/** + * Try to require async_hooks + * @private + */ + +function tryRequireAsyncHooks () { + try { + return require('async_hooks') + } catch (e) { + return {} + } +} + +/** + * Wrap function with async resource, if possible. + * AsyncResource.bind static method backported. + * @private + */ + +function wrap (fn) { + var res + + // create anonymous resource + if (asyncHooks.AsyncResource) { + res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn') + } + + // incompatible node.js + if (!res || !res.runInAsyncScope) { + return fn + } + + // return bound function + return res.runInAsyncScope.bind(res, fn, null) +} diff --git a/node_modules/raw-body/package.json b/node_modules/raw-body/package.json new file mode 100644 index 00000000..aabb1c36 --- /dev/null +++ b/node_modules/raw-body/package.json @@ -0,0 +1,49 @@ +{ + "name": "raw-body", + "description": "Get and validate the raw body of a readable stream.", + "version": "2.5.2", + "author": "Jonathan Ong (http://jongleberry.com)", + "contributors": [ + "Douglas Christopher Wilson ", + "Raynos " + ], + "license": "MIT", + "repository": "stream-utils/raw-body", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "devDependencies": { + "bluebird": "3.7.2", + "eslint": "8.34.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "SECURITY.md", + "index.d.ts", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/readable-stream/CONTRIBUTING.md new file mode 100644 index 00000000..f478d58d --- /dev/null +++ b/node_modules/readable-stream/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Moderation Policy + +The [Node.js Moderation Policy] applies to this WG. + +## Code of Conduct + +The [Node.js Code of Conduct][] applies to this WG. + +[Node.js Code of Conduct]: +https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md +[Node.js Moderation Policy]: +https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/node_modules/readable-stream/GOVERNANCE.md b/node_modules/readable-stream/GOVERNANCE.md new file mode 100644 index 00000000..16ffb93f --- /dev/null +++ b/node_modules/readable-stream/GOVERNANCE.md @@ -0,0 +1,136 @@ +### Streams Working Group + +The Node.js Streams is jointly governed by a Working Group +(WG) +that is responsible for high-level guidance of the project. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Conduct guidelines +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project +[README.md](./README.md#current-project-team-members). + +### Collaborators + +The readable-stream GitHub repository is +maintained by the WG and additional Collaborators who are added by the +WG on an ongoing basis. + +Individuals making significant and valuable contributions are made +Collaborators and given commit-access to the project. These +individuals are identified by the WG and their addition as +Collaborators is discussed during the WG meeting. + +_Note:_ If you make a significant contribution and are not considered +for commit-access log an issue or contact a WG member directly and it +will be brought up in the next WG meeting. + +Modifications of the contents of the readable-stream repository are +made on +a collaborative basis. Anybody with a GitHub account may propose a +modification via pull request and it will be considered by the project +Collaborators. All pull requests must be reviewed and accepted by a +Collaborator with sufficient expertise who is able to take full +responsibility for the change. In the case of pull requests proposed +by an existing Collaborator, an additional Collaborator is required +for sign-off. Consensus should be sought if additional Collaborators +participate and there is disagreement around a particular +modification. See _Consensus Seeking Process_ below for further detail +on the consensus model used for governance. + +Collaborators may opt to elevate significant or controversial +modifications, or modifications that have not found consensus to the +WG for discussion by assigning the ***WG-agenda*** tag to a pull +request or issue. The WG should serve as the final arbiter where +required. + +For the current list of Collaborators, see the project +[README.md](./README.md#members). + +### WG Membership + +WG seats are not time-limited. There is no fixed size of the WG. +However, the expected target is between 6 and 12, to ensure adequate +coverage of important areas of expertise, balanced with the ability to +make decisions efficiently. + +There is no specific set of requirements or qualifications for WG +membership beyond these rules. + +The WG may add additional members to the WG by unanimous consensus. + +A WG member may be removed from the WG by voluntary resignation, or by +unanimous consensus of all other WG members. + +Changes to WG membership should be posted in the agenda, and may be +suggested as any other agenda item (see "WG Meetings" below). + +If an addition or removal is proposed during a meeting, and the full +WG is not in attendance to participate, then the addition or removal +is added to the agenda for the subsequent meeting. This is to ensure +that all members are given the opportunity to participate in all +membership decisions. If a WG member is unable to attend a meeting +where a planned membership decision is being made, then their consent +is assumed. + +No more than 1/3 of the WG members may be affiliated with the same +employer. If removal or resignation of a WG member, or a change of +employment by a WG member, creates a situation where more than 1/3 of +the WG membership shares an employer, then the situation must be +immediately remedied by the resignation or removal of one or more WG +members affiliated with the over-represented employer(s). + +### WG Meetings + +The WG meets occasionally on a Google Hangout On Air. A designated moderator +approved by the WG runs the meeting. Each meeting should be +published to YouTube. + +Items are added to the WG agenda that are considered contentious or +are modifications of governance, contribution policy, WG membership, +or release process. + +The intention of the agenda is not to approve or review all patches; +that should happen continuously on GitHub and be handled by the larger +group of Collaborators. + +Any community member or contributor can ask that something be added to +the next meeting's agenda by logging a GitHub Issue. Any Collaborator, +WG member or the moderator can add the item to the agenda by adding +the ***WG-agenda*** tag to the issue. + +Prior to each WG meeting the moderator will share the Agenda with +members of the WG. WG members can add any items they like to the +agenda at the beginning of each meeting. The moderator and the WG +cannot veto or remove items. + +The WG may invite persons or representatives from certain projects to +participate in a non-voting capacity. + +The moderator is responsible for summarizing the discussion of each +agenda item and sends it as a pull request after the meeting. + +### Consensus Seeking Process + +The WG follows a +[Consensus +Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) +decision-making model. + +When an agenda item has appeared to reach a consensus the moderator +will ask "Does anyone object?" as a final call for dissent from the +consensus. + +If an agenda item cannot reach a consensus a WG member can call for +either a closing vote or a vote to table the issue to the next +meeting. The call for a vote must be seconded by a majority of the WG +or else the discussion will continue. Simple majority wins. + +Note that changes to WG membership require a majority consensus. See +"WG Membership" above. diff --git a/node_modules/readable-stream/LICENSE b/node_modules/readable-stream/LICENSE new file mode 100644 index 00000000..2873b3b2 --- /dev/null +++ b/node_modules/readable-stream/LICENSE @@ -0,0 +1,47 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +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. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +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. +""" diff --git a/node_modules/readable-stream/README.md b/node_modules/readable-stream/README.md new file mode 100644 index 00000000..19117c1a --- /dev/null +++ b/node_modules/readable-stream/README.md @@ -0,0 +1,106 @@ +# readable-stream + +***Node.js core streams for userland*** [![Build Status](https://travis-ci.com/nodejs/readable-stream.svg?branch=master)](https://travis-ci.com/nodejs/readable-stream) + + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/readabe-stream.svg)](https://saucelabs.com/u/readabe-stream) + +```bash +npm install --save readable-stream +``` + +This package is a mirror of the streams implementations in Node.js. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.18.1/docs/api/stream.html). + +If you want to guarantee a stable streams base, regardless of what version of +Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). + +As of version 2.0.0 **readable-stream** uses semantic versioning. + +## Version 3.x.x + +v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows: + +1. Error codes: https://github.com/nodejs/node/pull/13310, + https://github.com/nodejs/node/pull/13291, + https://github.com/nodejs/node/pull/16589, + https://github.com/nodejs/node/pull/15042, + https://github.com/nodejs/node/pull/15665, + https://github.com/nodejs/readable-stream/pull/344 +2. 'readable' have precedence over flowing + https://github.com/nodejs/node/pull/18994 +3. make virtual methods errors consistent + https://github.com/nodejs/node/pull/18813 +4. updated streams error handling + https://github.com/nodejs/node/pull/18438 +5. writable.end should return this. + https://github.com/nodejs/node/pull/18780 +6. readable continues to read when push('') + https://github.com/nodejs/node/pull/18211 +7. add custom inspect to BufferList + https://github.com/nodejs/node/pull/17907 +8. always defer 'readable' with nextTick + https://github.com/nodejs/node/pull/17979 + +## Version 2.x.x +v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11. + +### Big Thanks + +Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce] + +# Usage + +You can swap your `require('stream')` with `require('readable-stream')` +without any changes, if you are just using one of the main classes and +functions. + +```js +const { + Readable, + Writable, + Transform, + Duplex, + pipeline, + finished +} = require('readable-stream') +```` + +Note that `require('stream')` will return `Stream`, while +`require('readable-stream')` will return `Readable`. We discourage using +whatever is exported directly, but rather use one of the properties as +shown in the example above. + +# Streams Working Group + +`readable-stream` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + + +## Team Members + +* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> + - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 +* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> +* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> + - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E +* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> +* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com> + +[sauce]: https://saucelabs.com diff --git a/node_modules/readable-stream/errors-browser.js b/node_modules/readable-stream/errors-browser.js new file mode 100644 index 00000000..fb8e73e1 --- /dev/null +++ b/node_modules/readable-stream/errors-browser.js @@ -0,0 +1,127 @@ +'use strict'; + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; diff --git a/node_modules/readable-stream/errors.js b/node_modules/readable-stream/errors.js new file mode 100644 index 00000000..8471526d --- /dev/null +++ b/node_modules/readable-stream/errors.js @@ -0,0 +1,116 @@ +'use strict'; + +const codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error + } + + function getMessage (arg1, arg2, arg3) { + if (typeof message === 'string') { + return message + } else { + return message(arg1, arg2, arg3) + } + } + + class NodeError extends Base { + constructor (arg1, arg2, arg3) { + super(getMessage(arg1, arg2, arg3)); + } + } + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + const len = expected.length; + expected = expected.map((i) => String(i)); + if (len > 2) { + return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + + expected[len - 1]; + } else if (len === 2) { + return `one of ${thing} ${expected[0]} or ${expected[1]}`; + } else { + return `of ${thing} ${expected[0]}`; + } + } else { + return `of ${thing} ${String(expected)}`; + } +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"' +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + let msg; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; + } else { + const type = includes(name, '.') ? 'property' : 'argument'; + msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; + } + + msg += `. Received type ${typeof actual}`; + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented' +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); + +module.exports.codes = codes; diff --git a/node_modules/readable-stream/experimentalWarning.js b/node_modules/readable-stream/experimentalWarning.js new file mode 100644 index 00000000..78e84149 --- /dev/null +++ b/node_modules/readable-stream/experimentalWarning.js @@ -0,0 +1,17 @@ +'use strict' + +var experimentalWarnings = new Set(); + +function emitExperimentalWarning(feature) { + if (experimentalWarnings.has(feature)) return; + var msg = feature + ' is an experimental feature. This feature could ' + + 'change at any time'; + experimentalWarnings.add(feature); + process.emitWarning(msg, 'ExperimentalWarning'); +} + +function noop() {} + +module.exports.emitExperimentalWarning = process.emitWarning + ? emitExperimentalWarning + : noop; diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 00000000..19abfa60 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,126 @@ +// 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. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); +require('inherits')(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 00000000..24a6bdde --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,37 @@ +// 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. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; +var Transform = require('./_stream_transform'); +require('inherits')(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 00000000..df1f608d --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1027 @@ +// 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. + +'use strict'; + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +var Buffer = require('buffer').Buffer; +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = require('util'); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = require('./internal/streams/buffer_list'); +var destroyImpl = require('./internal/streams/destroy'); +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +require('inherits')(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 00000000..1ccb7157 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,190 @@ +// 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. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = require('./_stream_duplex'); +require('inherits')(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 00000000..292415e2 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,641 @@ +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +var Buffer = require('buffer').Buffer; +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = require('./internal/streams/destroy'); +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +require('inherits')(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/node_modules/readable-stream/lib/internal/streams/async_iterator.js new file mode 100644 index 00000000..742c5a46 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/async_iterator.js @@ -0,0 +1,180 @@ +'use strict'; + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = require('./end-of-stream'); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/node_modules/readable-stream/lib/internal/streams/buffer_list.js new file mode 100644 index 00000000..69bda497 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/buffer_list.js @@ -0,0 +1,183 @@ +'use strict'; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = require('buffer'), + Buffer = _require.Buffer; +var _require2 = require('util'), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/readable-stream/lib/internal/streams/destroy.js new file mode 100644 index 00000000..31a17c4d --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -0,0 +1,96 @@ +'use strict'; + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/node_modules/readable-stream/lib/internal/streams/end-of-stream.js new file mode 100644 index 00000000..59c671b5 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/end-of-stream.js @@ -0,0 +1,86 @@ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/from-browser.js b/node_modules/readable-stream/lib/internal/streams/from-browser.js new file mode 100644 index 00000000..a4ce56f3 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/from-browser.js @@ -0,0 +1,3 @@ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; diff --git a/node_modules/readable-stream/lib/internal/streams/from.js b/node_modules/readable-stream/lib/internal/streams/from.js new file mode 100644 index 00000000..0a34ee92 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/from.js @@ -0,0 +1,52 @@ +'use strict'; + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE; +function from(Readable, iterable, opts) { + var iterator; + if (iterable && typeof iterable.next === 'function') { + iterator = iterable; + } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + var readable = new Readable(_objectSpread({ + objectMode: true + }, opts)); + // Reading boolean to protect against _read + // being called before last iteration completion. + var reading = false; + readable._read = function () { + if (!reading) { + reading = true; + next(); + } + }; + function next() { + return _next2.apply(this, arguments); + } + function _next2() { + _next2 = _asyncToGenerator(function* () { + try { + var _yield$iterator$next = yield iterator.next(), + value = _yield$iterator$next.value, + done = _yield$iterator$next.done; + if (done) { + readable.push(null); + } else if (readable.push(yield value)) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + }); + return _next2.apply(this, arguments); + } + return readable; +} +module.exports = from; diff --git a/node_modules/readable-stream/lib/internal/streams/pipeline.js b/node_modules/readable-stream/lib/internal/streams/pipeline.js new file mode 100644 index 00000000..e6f39241 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/pipeline.js @@ -0,0 +1,86 @@ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + +'use strict'; + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/state.js b/node_modules/readable-stream/lib/internal/streams/state.js new file mode 100644 index 00000000..3fbf8927 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/state.js @@ -0,0 +1,22 @@ +'use strict'; + +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/readable-stream/lib/internal/streams/stream-browser.js new file mode 100644 index 00000000..9332a3fd --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/stream-browser.js @@ -0,0 +1 @@ +module.exports = require('events').EventEmitter; diff --git a/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/readable-stream/lib/internal/streams/stream.js new file mode 100644 index 00000000..ce2ad5b6 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/stream.js @@ -0,0 +1 @@ +module.exports = require('stream'); diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json new file mode 100644 index 00000000..ade59e71 --- /dev/null +++ b/node_modules/readable-stream/package.json @@ -0,0 +1,68 @@ +{ + "name": "readable-stream", + "version": "3.6.2", + "description": "Streams3, a user-land copy of the stream library from Node.js", + "main": "readable.js", + "engines": { + "node": ">= 6" + }, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "devDependencies": { + "@babel/cli": "^7.2.0", + "@babel/core": "^7.2.0", + "@babel/polyfill": "^7.0.0", + "@babel/preset-env": "^7.2.0", + "airtap": "0.0.9", + "assert": "^1.4.0", + "bl": "^2.0.0", + "deep-strict-equal": "^0.2.0", + "events.once": "^2.0.2", + "glob": "^7.1.2", + "gunzip-maybe": "^1.4.1", + "hyperquest": "^2.1.3", + "lolex": "^2.6.0", + "nyc": "^11.0.0", + "pump": "^3.0.0", + "rimraf": "^2.6.2", + "tap": "^12.0.0", + "tape": "^4.9.0", + "tar-fs": "^1.16.2", + "util-promisify": "^2.1.0" + }, + "scripts": { + "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js", + "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap", + "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js", + "test-browser-local": "airtap --open --local -- test/browser.js", + "cover": "nyc npm test", + "report": "nyc report --reporter=lcov", + "update-browser-errors": "babel -o errors-browser.js errors.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false, + "worker_threads": false, + "./errors": "./errors-browser.js", + "./readable.js": "./readable-browser.js", + "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js", + "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" + }, + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "license": "MIT" +} diff --git a/node_modules/readable-stream/readable-browser.js b/node_modules/readable-stream/readable-browser.js new file mode 100644 index 00000000..adbf60de --- /dev/null +++ b/node_modules/readable-stream/readable-browser.js @@ -0,0 +1,9 @@ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +exports.finished = require('./lib/internal/streams/end-of-stream.js'); +exports.pipeline = require('./lib/internal/streams/pipeline.js'); diff --git a/node_modules/readable-stream/readable.js b/node_modules/readable-stream/readable.js new file mode 100644 index 00000000..9e0ca120 --- /dev/null +++ b/node_modules/readable-stream/readable.js @@ -0,0 +1,16 @@ +var Stream = require('stream'); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream.Readable; + Object.assign(module.exports, Stream); + module.exports.Stream = Stream; +} else { + exports = module.exports = require('./lib/_stream_readable.js'); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = require('./lib/_stream_writable.js'); + exports.Duplex = require('./lib/_stream_duplex.js'); + exports.Transform = require('./lib/_stream_transform.js'); + exports.PassThrough = require('./lib/_stream_passthrough.js'); + exports.finished = require('./lib/internal/streams/end-of-stream.js'); + exports.pipeline = require('./lib/internal/streams/pipeline.js'); +} diff --git a/node_modules/readable-web-to-node-stream/README.md b/node_modules/readable-web-to-node-stream/README.md new file mode 100644 index 00000000..4a717d86 --- /dev/null +++ b/node_modules/readable-web-to-node-stream/README.md @@ -0,0 +1,71 @@ +![Karma CI](https://github.com/Borewit/readable-web-to-node-stream/workflows/Karma%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/readable-web-to-node-stream.svg)](https://npmjs.org/package/readable-web-to-node-stream) +[![npm downloads](http://img.shields.io/npm/dm/readable-web-to-node-stream.svg)](https://npmcharts.com/compare/readable-web-to-node-stream) +[![dependencies Status](https://david-dm.org/Borewit/readable-web-to-node-stream/status.svg)](https://david-dm.org/Borewit/readable-web-to-node-stream) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/readable-web-to-node-stream/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/readable-web-to-node-stream?targetFile=package.json) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d4b511481b3a4634b6ca5c0724407eb9)](https://www.codacy.com/gh/Borewit/peek-readable/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Borewit/peek-readable&utm_campaign=Badge_Grade) +[![Coverage Status](https://coveralls.io/repos/github/Borewit/readable-web-to-node-stream/badge.svg?branch=master)](https://coveralls.io/github/Borewit/readable-web-to-node-stream?branch=master) +[![Minified size](https://badgen.net/bundlephobia/min/readable-web-to-node-stream)](https://bundlephobia.com/result?p=readable-web-to-node-stream) + +# readable-web-to-node-stream + +Converts a [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) into a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams). + +## Installation +Install via [npm](http://npmjs.org/): + +```bash +npm install readable-web-to-node-stream +``` +or or [yarn](https://yarnpkg.com/): +```bash +yarn add readable-web-to-node-stream +``` + +## Compatibility + +Source is written in TypeScript and compiled to ECMAScript 2017 (ES8). + +Unit tests are performed on the following browsers: + +* Google Chrome 74.0 +* Firefox 68.0 +* Safari 12.0 +* Opera 60.0 + +## Example + +Import readable-web-stream-to-node in JavaScript: +```js +const {ReadableWebToNodeStream} = require('readable-web-to-node-stream'); + +async function download(url) { + const response = await fetch(url); + const readableWebStream = response.body; + const nodeStream = new ReadableWebToNodeStream(readableWebStream); +} +``` + +## API + +**constructor(stream: ReadableStream): Promise** + +`stream: ReadableStream`: the [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader). + +**close(): Promise** +Will cancel close the Readable-node stream, and will release Web-API-readable-stream. + +**waitForReadToComplete(): Promise** +If there is no unresolved read call to Web-API Readable​Stream immediately returns, otherwise it will wait until the read is resolved. + +## Licence + +(The MIT License) + +Copyright (c) 2019 Borewit + +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. diff --git a/node_modules/readable-web-to-node-stream/lib/index.d.ts b/node_modules/readable-web-to-node-stream/lib/index.d.ts new file mode 100644 index 00000000..7d7145bd --- /dev/null +++ b/node_modules/readable-web-to-node-stream/lib/index.d.ts @@ -0,0 +1,39 @@ +import { Readable } from 'readable-stream'; +/** + * Converts a Web-API stream into Node stream.Readable class + * Node stream readable: https://nodejs.org/api/stream.html#stream_readable_streams + * Web API readable-stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + * Node readable stream: https://nodejs.org/api/stream.html#stream_readable_streams + */ +export declare class ReadableWebToNodeStream extends Readable { + bytesRead: number; + released: boolean; + /** + * Default web API stream reader + * https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader + */ + private reader; + private pendingRead; + /** + * + * @param stream Readable​Stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + */ + constructor(stream: ReadableStream); + /** + * Implementation of readable._read(size). + * When readable._read() is called, if data is available from the resource, + * the implementation should begin pushing that data into the read queue + * https://nodejs.org/api/stream.html#stream_readable_read_size_1 + */ + _read(): Promise; + /** + * If there is no unresolved read call to Web-API Readable​Stream immediately returns; + * otherwise will wait until the read is resolved. + */ + waitForReadToComplete(): Promise; + /** + * Close wrapper + */ + close(): Promise; + private syncAndRelease; +} diff --git a/node_modules/readable-web-to-node-stream/lib/index.js b/node_modules/readable-web-to-node-stream/lib/index.js new file mode 100644 index 00000000..1efaea17 --- /dev/null +++ b/node_modules/readable-web-to-node-stream/lib/index.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadableWebToNodeStream = void 0; +const readable_stream_1 = require("readable-stream"); +/** + * Converts a Web-API stream into Node stream.Readable class + * Node stream readable: https://nodejs.org/api/stream.html#stream_readable_streams + * Web API readable-stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + * Node readable stream: https://nodejs.org/api/stream.html#stream_readable_streams + */ +class ReadableWebToNodeStream extends readable_stream_1.Readable { + /** + * + * @param stream Readable​Stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + */ + constructor(stream) { + super(); + this.bytesRead = 0; + this.released = false; + this.reader = stream.getReader(); + } + /** + * Implementation of readable._read(size). + * When readable._read() is called, if data is available from the resource, + * the implementation should begin pushing that data into the read queue + * https://nodejs.org/api/stream.html#stream_readable_read_size_1 + */ + async _read() { + // Should start pushing data into the queue + // Read data from the underlying Web-API-readable-stream + if (this.released) { + this.push(null); // Signal EOF + return; + } + this.pendingRead = this.reader.read(); + const data = await this.pendingRead; + // clear the promise before pushing pushing new data to the queue and allow sequential calls to _read() + delete this.pendingRead; + if (data.done || this.released) { + this.push(null); // Signal EOF + } + else { + this.bytesRead += data.value.length; + this.push(data.value); // Push new data to the queue + } + } + /** + * If there is no unresolved read call to Web-API Readable​Stream immediately returns; + * otherwise will wait until the read is resolved. + */ + async waitForReadToComplete() { + if (this.pendingRead) { + await this.pendingRead; + } + } + /** + * Close wrapper + */ + async close() { + await this.syncAndRelease(); + } + async syncAndRelease() { + this.released = true; + await this.waitForReadToComplete(); + await this.reader.releaseLock(); + } +} +exports.ReadableWebToNodeStream = ReadableWebToNodeStream; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/readable-web-to-node-stream/lib/index.spec.js b/node_modules/readable-web-to-node-stream/lib/index.spec.js new file mode 100644 index 00000000..98ddd4e5 --- /dev/null +++ b/node_modules/readable-web-to-node-stream/lib/index.spec.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseReadableStream = void 0; +localStorage.debug = 'readable-web-to-node-stream'; +const assert = require("assert"); +const mmb = require("music-metadata-browser"); +const index_1 = require("./index"); +async function httpGetByUrl(url) { + const response = await fetch(url); + const headers = []; + response.headers.forEach(header => { + headers.push(header); + }); + assert.ok(response.ok, `HTTP error status=${response.status}: ${response.statusText}`); + assert.ok(response.body, 'HTTP-stream'); + return response; +} +async function parseReadableStream(stream, fileInfo, options) { + const ns = new index_1.ReadableWebToNodeStream(stream); + const res = await mmb.parseNodeStream(ns, fileInfo, options); + await ns.close(); + return res; +} +exports.parseReadableStream = parseReadableStream; +const tiuqottigeloot_vol24_Tracks = [ + { + url: '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3', + duration: 322.612245, + metaData: { + title: 'Heroines', + artist: 'Diablo Swing Orchestra' + } + }, + { + url: '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/02%20-%20Eclectek%20-%20We%20Are%20Going%20To%20Eclecfunk%20Your%20Ass.mp3', + duration: 190.093061, + metaData: { + title: 'We Are Going to Eclecfunk Your Ass', + artist: 'Eclectek' + } + } /* , + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/03%20-%20Auto-Pilot%20-%20Seventeen.mp3', + duration: 214.622041, + metaData: { + title: 'Seventeen', + artist: 'Auto-Pilot' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/04%20-%20Muha%20-%20Microphone.mp3', + duration: 181.838367, + metaData: { + title: 'Microphone', + artist: 'Muha' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/05%20-%20Just%20Plain%20Ant%20-%20Stumble.mp3', + duration: 86.047347, + metaData: { + title: 'Stumble', + artist: 'Just Plain Ant' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/06%20-%20Sleaze%20-%20God%20Damn.mp3', + duration: 226.795102, + metaData: { + title: 'God Damn', + artist: 'Sleaze' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/07%20-%20Juanitos%20-%20Hola%20Hola%20Bossa%20Nova.mp3', + duration: 207.072653, + metaData: { + title: 'Hola Hola Bossa Nova', + artist: 'Juanitos' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/08%20-%20Entertainment%20For%20The%20Braindead%20-%20Resolutions%20(Chris%20Summer%20Remix).mp3', + duration: 314.331429, + metaData: { + title: 'Resolutions (Chris Summer remix)', + artist: 'Entertainment for the Braindead' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/09%20-%20Nobara%20Hayakawa%20-%20Trail.mp3', + duration: 204.042449, + metaData: { + title: 'Trail', + artist: 'Nobara Hayakawa' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/10%20-%20Paper%20Navy%20-%20Tongue%20Tied.mp3', + duration: 201.116735, + metaData: { + title: 'Tongue Tied', + artist: 'Paper Navy' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/11%20-%2060%20Tigres%20-%20Garage.mp3', + duration: 245.394286, + metaData: { + title: 'Garage', + artist: '60 Tigres' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/12%20-%20CM%20aka%20Creative%20-%20The%20Cycle%20(Featuring%20Mista%20Mista).mp3', + duration: 221.44, + metaData: { + title: 'The Cycle (feat. Mista Mista)', + artist: 'CM aka Creative' + } + } */ +]; +describe('Parse WebAmp tracks', () => { + tiuqottigeloot_vol24_Tracks.forEach(track => { + it(`track ${track.metaData.artist} - ${track.metaData.title}`, async () => { + const url = 'https://raw.githubusercontent.com/Borewit/test-audio/958e057' + track.url; + const response = await httpGetByUrl(url); + const metadata = await parseReadableStream(response.body, { + size: parseInt(response.headers.get('Content-Length'), 10), + mimeType: response.headers.get('Content-Type') + }); + expect(metadata.common.artist).toEqual(track.metaData.artist); + expect(metadata.common.title).toEqual(track.metaData.title); + }, 20000); + }); +}); +//# sourceMappingURL=index.spec.js.map \ No newline at end of file diff --git a/node_modules/readable-web-to-node-stream/package.json b/node_modules/readable-web-to-node-stream/package.json new file mode 100644 index 00000000..057c39f8 --- /dev/null +++ b/node_modules/readable-web-to-node-stream/package.json @@ -0,0 +1,84 @@ +{ + "name": "readable-web-to-node-stream", + "version": "3.0.2", + "description": "Converts a Web-API readable-stream into a Node readable-stream.", + "main": "lib/index.js", + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "engines": { + "node": ">=8" + }, + "types": "lib/index.d.ts", + "scripts": { + "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts coverage", + "compile-lib": "tsc -p lib/tsconfig.json", + "compile-test": "tsc -p lib/tsconfig.spec.json", + "prepublishOnly": "yarn run build", + "build": "npm run compile-lib && npm run compile-test", + "tslint": "tslint 'lib/**/*.ts' --exclude 'lib/**/*.d.ts'", + "eslint": "eslint karma.conf.js", + "lint": "npm run tslint && npm run eslint", + "test": "karma start --single-run", + "karma": "karma start", + "karma-firefox": "karma start --browsers Firefox", + "karma-once": "karma start --browsers Chrome --single-run", + "travis-karma": "karma start --browsers Firefox --single-run --reporters coverage-istanbul,spec", + "browserstack": "karma start --browsers bs_win_chrome,bs_win_firefox,bs_osx_safari --single-run --reporters coverage-istanbul,spec", + "travis-karma-browserstack": "karma start --browsers bs_win_chrome,bs_win_firefox,bs_osx_safari --single-run --reporters coverage-istanbul,spec,BrowserStack", + "post-coveralls": "coveralls < coverage/lcov.info", + "post-codacy": " codacy-coverage < coverage/lcov.info" + }, + "keywords": [ + "stream.readable", + "web", + "node", + "browser", + "stream", + "covert", + "coverter", + "readable", + "readablestream" + ], + "repository": "https://github.com/Borewit/readable-web-to-node-stream.git", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/Borewit/readable-web-to-node-stream/issues" + }, + "dependencies": { + "readable-stream": "^3.6.0" + }, + "devDependencies": { + "@types/jasmine": "^3.8.1", + "@types/node": "^16.3.1", + "@types/readable-stream": "^2.3.9", + "coveralls": "^3.1.0", + "del-cli": "^3.0.1", + "eslint": "^7.18.0", + "istanbul-instrumenter-loader": "^3.0.1", + "jasmine-core": "^3.8.0", + "karma": "^6.3.4", + "karma-browserstack-launcher": "^1.6.0", + "karma-chrome-launcher": "^3.1.0", + "karma-coverage-istanbul-reporter": "^3.0.3", + "karma-firefox-launcher": "^2.1.0", + "karma-jasmine": "^4.0.1", + "karma-jasmine-html-reporter": "^1.7.0", + "karma-spec-reporter": "^0.0.32", + "karma-webpack": "^5.0.0", + "music-metadata-browser": "^2.2.7", + "ts-loader": "^8.0.14", + "tslint": "^6.1.3", + "typescript": "^4.3.5", + "webpack": "^4.46.0" + } +} diff --git a/node_modules/regenerator-runtime/LICENSE b/node_modules/regenerator-runtime/LICENSE new file mode 100644 index 00000000..cde61b6c --- /dev/null +++ b/node_modules/regenerator-runtime/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2014-present, Facebook, Inc. + +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. diff --git a/node_modules/regenerator-runtime/README.md b/node_modules/regenerator-runtime/README.md new file mode 100644 index 00000000..e8702bab --- /dev/null +++ b/node_modules/regenerator-runtime/README.md @@ -0,0 +1,31 @@ +# regenerator-runtime + +Standalone runtime for +[Regenerator](https://github.com/facebook/regenerator)-compiled generator +and `async` functions. + +To import the runtime as a module (recommended), either of the following +import styles will work: +```js +// CommonJS +const regeneratorRuntime = require("regenerator-runtime"); + +// ECMAScript 2015 +import regeneratorRuntime from "regenerator-runtime"; +``` + +To ensure that `regeneratorRuntime` is defined globally, either of the +following styles will work: +```js +// CommonJS +require("regenerator-runtime/runtime"); + +// ECMAScript 2015 +import "regenerator-runtime/runtime.js"; +``` + +To get the absolute file system path of `runtime.js`, evaluate the +following expression: +```js +require("regenerator-runtime/path").path +``` diff --git a/project starter code/node_modules/regenerator-runtime/package.json b/node_modules/regenerator-runtime/package.json similarity index 100% rename from project starter code/node_modules/regenerator-runtime/package.json rename to node_modules/regenerator-runtime/package.json diff --git a/node_modules/regenerator-runtime/path.js b/node_modules/regenerator-runtime/path.js new file mode 100644 index 00000000..ced878b8 --- /dev/null +++ b/node_modules/regenerator-runtime/path.js @@ -0,0 +1,11 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +exports.path = require("path").join( + __dirname, + "runtime.js" +); diff --git a/project starter code/node_modules/regenerator-runtime/runtime.js b/node_modules/regenerator-runtime/runtime.js similarity index 100% rename from project starter code/node_modules/regenerator-runtime/runtime.js rename to node_modules/regenerator-runtime/runtime.js diff --git a/project starter code/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE similarity index 100% rename from project starter code/node_modules/safe-buffer/LICENSE rename to node_modules/safe-buffer/LICENSE diff --git a/project starter code/node_modules/safe-buffer/README.md b/node_modules/safe-buffer/README.md similarity index 100% rename from project starter code/node_modules/safe-buffer/README.md rename to node_modules/safe-buffer/README.md diff --git a/project starter code/node_modules/safe-buffer/index.d.ts b/node_modules/safe-buffer/index.d.ts similarity index 100% rename from project starter code/node_modules/safe-buffer/index.d.ts rename to node_modules/safe-buffer/index.d.ts diff --git a/project starter code/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js similarity index 100% rename from project starter code/node_modules/safe-buffer/index.js rename to node_modules/safe-buffer/index.js diff --git a/project starter code/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json similarity index 100% rename from project starter code/node_modules/safe-buffer/package.json rename to node_modules/safe-buffer/package.json diff --git a/project starter code/node_modules/safer-buffer/LICENSE b/node_modules/safer-buffer/LICENSE similarity index 100% rename from project starter code/node_modules/safer-buffer/LICENSE rename to node_modules/safer-buffer/LICENSE diff --git a/project starter code/node_modules/safer-buffer/Porting-Buffer.md b/node_modules/safer-buffer/Porting-Buffer.md similarity index 100% rename from project starter code/node_modules/safer-buffer/Porting-Buffer.md rename to node_modules/safer-buffer/Porting-Buffer.md diff --git a/project starter code/node_modules/safer-buffer/Readme.md b/node_modules/safer-buffer/Readme.md similarity index 100% rename from project starter code/node_modules/safer-buffer/Readme.md rename to node_modules/safer-buffer/Readme.md diff --git a/project starter code/node_modules/safer-buffer/dangerous.js b/node_modules/safer-buffer/dangerous.js similarity index 100% rename from project starter code/node_modules/safer-buffer/dangerous.js rename to node_modules/safer-buffer/dangerous.js diff --git a/project starter code/node_modules/safer-buffer/package.json b/node_modules/safer-buffer/package.json similarity index 100% rename from project starter code/node_modules/safer-buffer/package.json rename to node_modules/safer-buffer/package.json diff --git a/project starter code/node_modules/safer-buffer/safer.js b/node_modules/safer-buffer/safer.js similarity index 100% rename from project starter code/node_modules/safer-buffer/safer.js rename to node_modules/safer-buffer/safer.js diff --git a/project starter code/node_modules/safer-buffer/tests.js b/node_modules/safer-buffer/tests.js similarity index 100% rename from project starter code/node_modules/safer-buffer/tests.js rename to node_modules/safer-buffer/tests.js diff --git a/node_modules/sax/LICENSE b/node_modules/sax/LICENSE new file mode 100644 index 00000000..1ccceb0b --- /dev/null +++ b/node_modules/sax/LICENSE @@ -0,0 +1,41 @@ +The ISC License + +Copyright (c) 2010-2024 Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +==== + +`String.fromCodePoint` by Mathias Bynens used according to terms of MIT +License, as follows: + +Copyright (c) 2010-2024 Mathias Bynens + + 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. diff --git a/node_modules/sax/README.md b/node_modules/sax/README.md new file mode 100644 index 00000000..c974b0f7 --- /dev/null +++ b/node_modules/sax/README.md @@ -0,0 +1,228 @@ +# sax js + +A sax-style parser for XML and HTML. + +Designed with [node](http://nodejs.org/) in mind, but should work fine in +the browser or other CommonJS implementations. + +## What This Is + +* A very simple tool to parse through an XML string. +* A stepping stone to a streaming HTML parser. +* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML + docs. + +## What This Is (probably) Not + +* An HTML Parser - That's a fine goal, but this isn't it. It's just + XML. +* A DOM Builder - You can use it to build an object model out of XML, + but it doesn't do that out of the box. +* XSLT - No DOM = no querying. +* 100% Compliant with (some other SAX implementation) - Most SAX + implementations are in Java and do a lot more than this does. +* An XML Validator - It does a little validation when in strict mode, but + not much. +* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic + masochism. +* A DTD-aware Thing - Fetching DTDs is a much bigger job. + +## Regarding `Hello, world!').close(); + +// stream usage +// takes the same options as the parser +var saxStream = require("sax").createStream(strict, options) +saxStream.on("error", function (e) { + // unhandled errors will throw, since this is a proper node + // event emitter. + console.error("error!", e) + // clear the error + this._parser.error = null + this._parser.resume() +}) +saxStream.on("opentag", function (node) { + // same object as above +}) +// pipe is supported, and it's readable/writable +// same chunks coming in also go out. +fs.createReadStream("file.xml") + .pipe(saxStream) + .pipe(fs.createWriteStream("file-copy.xml")) +``` + + +## Arguments + +Pass the following arguments to the parser function. All are optional. + +`strict` - Boolean. Whether or not to be a jerk. Default: `false`. + +`opt` - Object bag of settings regarding string formatting. All default to `false`. + +Settings supported: + +* `trim` - Boolean. Whether or not to trim text and comment nodes. +* `normalize` - Boolean. If true, then turn any whitespace into a single + space. +* `lowercase` - Boolean. If true, then lowercase tag names and attribute names + in loose mode, rather than uppercasing them. +* `xmlns` - Boolean. If true, then namespaces are supported. +* `position` - Boolean. If false, then don't track line/col/position. +* `strictEntities` - Boolean. If true, only parse [predefined XML + entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent) + (`&`, `'`, `>`, `<`, and `"`) +* `unquotedAttributeValues` - Boolean. If true, then unquoted + attribute values are allowed. Defaults to `false` when `strict` + is true, `true` otherwise. + +## Methods + +`write` - Write bytes onto the stream. You don't have to do this all at +once. You can keep writing as much as you want. + +`close` - Close the stream. Once closed, no more data may be written until +it is done processing the buffer, which is signaled by the `end` event. + +`resume` - To gracefully handle errors, assign a listener to the `error` +event. Then, when the error is taken care of, you can call `resume` to +continue parsing. Otherwise, the parser will not continue while in an error +state. + +## Members + +At all times, the parser object will have the following members: + +`line`, `column`, `position` - Indications of the position in the XML +document where the parser currently is looking. + +`startTagPosition` - Indicates the position where the current tag starts. + +`closed` - Boolean indicating whether or not the parser can be written to. +If it's `true`, then wait for the `ready` event to write again. + +`strict` - Boolean indicating whether or not the parser is a jerk. + +`opt` - Any options passed into the constructor. + +`tag` - The current tag being dealt with. + +And a bunch of other stuff that you probably shouldn't touch. + +## Events + +All events emit with a single argument. To listen to an event, assign a +function to `on`. Functions get executed in the this-context of +the parser object. The list of supported events are also in the exported +`EVENTS` array. + +When using the stream interface, assign handlers using the EventEmitter +`on` function in the normal fashion. + +`error` - Indication that something bad happened. The error will be hanging +out on `parser.error`, and must be deleted before parsing can continue. By +listening to this event, you can keep an eye on that kind of stuff. Note: +this happens *much* more in strict mode. Argument: instance of `Error`. + +`text` - Text node. Argument: string of text. + +`doctype` - The ``. Argument: +object with `name` and `body` members. Attributes are not parsed, as +processing instructions have implementation dependent semantics. + +`sgmldeclaration` - Random SGML declarations. Stuff like `` +would trigger this kind of event. This is a weird thing to support, so it +might go away at some point. SAX isn't intended to be used to parse SGML, +after all. + +`opentagstart` - Emitted immediately when the tag name is available, +but before any attributes are encountered. Argument: object with a +`name` field and an empty `attributes` set. Note that this is the +same object that will later be emitted in the `opentag` event. + +`opentag` - An opening tag. Argument: object with `name` and `attributes`. +In non-strict mode, tag names are uppercased, unless the `lowercase` +option is set. If the `xmlns` option is set, then it will contain +namespace binding information on the `ns` member, and will have a +`local`, `prefix`, and `uri` member. + +`closetag` - A closing tag. In loose mode, tags are auto-closed if their +parent closes. In strict mode, well-formedness is enforced. Note that +self-closing tags will have `closeTag` emitted immediately after `openTag`. +Argument: tag name. + +`attribute` - An attribute node. Argument: object with `name` and `value`. +In non-strict mode, attribute names are uppercased, unless the `lowercase` +option is set. If the `xmlns` option is set, it will also contains namespace +information. + +`comment` - A comment node. Argument: the string of the comment. + +`opencdata` - The opening tag of a ``) of a `` tags trigger a `"script"` +event, and their contents are not checked for special xml characters. +If you pass `noscript: true`, then this behavior is suppressed. + +## Reporting Problems + +It's best to write a failing test if you find an issue. I will always +accept pull requests with failing tests if they demonstrate intended +behavior, but it is very hard to figure out what issue you're describing +without a test. Writing a test is also the best way for you yourself +to figure out if you really understand the issue you think you have with +sax-js. diff --git a/project starter code/node_modules/sax/lib/sax.js b/node_modules/sax/lib/sax.js similarity index 96% rename from project starter code/node_modules/sax/lib/sax.js rename to node_modules/sax/lib/sax.js index 795d607e..122ad8e5 100644 --- a/project starter code/node_modules/sax/lib/sax.js +++ b/node_modules/sax/lib/sax.js @@ -71,6 +71,12 @@ parser.ns = Object.create(rootNS) } + // disallow unquoted attribute values if not otherwise configured + // and strict mode is true + if (parser.opt.unquotedAttributeValues === undefined) { + parser.opt.unquotedAttributeValues = !strict; + } + // mostly just for error reporting parser.trackPosition = parser.opt.position !== false if (parser.trackPosition) { @@ -164,6 +170,7 @@ } catch (ex) { Stream = function () {} } + if (!Stream) Stream = function () {} var streamWraps = sax.EVENTS.filter(function (ev) { return ev !== 'error' && ev !== 'end' @@ -1089,15 +1096,22 @@ continue case S.SGML_DECL: - if ((parser.sgmlDecl + c).toUpperCase() === CDATA) { + if (parser.sgmlDecl + c === '--') { + parser.state = S.COMMENT + parser.comment = '' + parser.sgmlDecl = '' + continue; + } + + if (parser.doctype && parser.doctype !== true && parser.sgmlDecl) { + parser.state = S.DOCTYPE_DTD + parser.doctype += ' (http://blog.izs.me/)", + "version": "1.4.1", + "main": "lib/sax.js", + "license": "ISC", + "scripts": { + "test": "tap test/*.js --cov -j4", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "repository": "git://github.com/isaacs/sax-js.git", + "files": [ + "lib/sax.js", + "LICENSE", + "README.md" + ], + "devDependencies": { + "tap": "^15.1.6" + }, + "tap": { + "statements": 79, + "branches": 75, + "functions": 80, + "lines": 79 + } +} diff --git a/project starter code/node_modules/send/HISTORY.md b/node_modules/send/HISTORY.md similarity index 100% rename from project starter code/node_modules/send/HISTORY.md rename to node_modules/send/HISTORY.md diff --git a/project starter code/node_modules/send/LICENSE b/node_modules/send/LICENSE similarity index 100% rename from project starter code/node_modules/send/LICENSE rename to node_modules/send/LICENSE diff --git a/project starter code/node_modules/send/README.md b/node_modules/send/README.md similarity index 100% rename from project starter code/node_modules/send/README.md rename to node_modules/send/README.md diff --git a/project starter code/node_modules/send/SECURITY.md b/node_modules/send/SECURITY.md similarity index 100% rename from project starter code/node_modules/send/SECURITY.md rename to node_modules/send/SECURITY.md diff --git a/project starter code/node_modules/send/index.js b/node_modules/send/index.js similarity index 100% rename from project starter code/node_modules/send/index.js rename to node_modules/send/index.js diff --git a/project starter code/node_modules/send/node_modules/ms/index.js b/node_modules/send/node_modules/ms/index.js similarity index 100% rename from project starter code/node_modules/send/node_modules/ms/index.js rename to node_modules/send/node_modules/ms/index.js diff --git a/project starter code/node_modules/send/node_modules/ms/license.md b/node_modules/send/node_modules/ms/license.md similarity index 100% rename from project starter code/node_modules/send/node_modules/ms/license.md rename to node_modules/send/node_modules/ms/license.md diff --git a/project starter code/node_modules/send/node_modules/ms/package.json b/node_modules/send/node_modules/ms/package.json similarity index 100% rename from project starter code/node_modules/send/node_modules/ms/package.json rename to node_modules/send/node_modules/ms/package.json diff --git a/project starter code/node_modules/send/node_modules/ms/readme.md b/node_modules/send/node_modules/ms/readme.md similarity index 100% rename from project starter code/node_modules/send/node_modules/ms/readme.md rename to node_modules/send/node_modules/ms/readme.md diff --git a/project starter code/node_modules/send/package.json b/node_modules/send/package.json similarity index 100% rename from project starter code/node_modules/send/package.json rename to node_modules/send/package.json diff --git a/project starter code/node_modules/serve-static/HISTORY.md b/node_modules/serve-static/HISTORY.md similarity index 100% rename from project starter code/node_modules/serve-static/HISTORY.md rename to node_modules/serve-static/HISTORY.md diff --git a/project starter code/node_modules/serve-static/LICENSE b/node_modules/serve-static/LICENSE similarity index 100% rename from project starter code/node_modules/serve-static/LICENSE rename to node_modules/serve-static/LICENSE diff --git a/project starter code/node_modules/serve-static/README.md b/node_modules/serve-static/README.md similarity index 100% rename from project starter code/node_modules/serve-static/README.md rename to node_modules/serve-static/README.md diff --git a/project starter code/node_modules/serve-static/index.js b/node_modules/serve-static/index.js similarity index 100% rename from project starter code/node_modules/serve-static/index.js rename to node_modules/serve-static/index.js diff --git a/project starter code/node_modules/serve-static/package.json b/node_modules/serve-static/package.json similarity index 100% rename from project starter code/node_modules/serve-static/package.json rename to node_modules/serve-static/package.json diff --git a/project starter code/node_modules/setprototypeof/LICENSE b/node_modules/setprototypeof/LICENSE similarity index 100% rename from project starter code/node_modules/setprototypeof/LICENSE rename to node_modules/setprototypeof/LICENSE diff --git a/project starter code/node_modules/setprototypeof/README.md b/node_modules/setprototypeof/README.md similarity index 100% rename from project starter code/node_modules/setprototypeof/README.md rename to node_modules/setprototypeof/README.md diff --git a/project starter code/node_modules/setprototypeof/index.d.ts b/node_modules/setprototypeof/index.d.ts similarity index 100% rename from project starter code/node_modules/setprototypeof/index.d.ts rename to node_modules/setprototypeof/index.d.ts diff --git a/project starter code/node_modules/setprototypeof/index.js b/node_modules/setprototypeof/index.js similarity index 100% rename from project starter code/node_modules/setprototypeof/index.js rename to node_modules/setprototypeof/index.js diff --git a/project starter code/node_modules/setprototypeof/package.json b/node_modules/setprototypeof/package.json similarity index 100% rename from project starter code/node_modules/setprototypeof/package.json rename to node_modules/setprototypeof/package.json diff --git a/project starter code/node_modules/setprototypeof/test/index.js b/node_modules/setprototypeof/test/index.js similarity index 100% rename from project starter code/node_modules/setprototypeof/test/index.js rename to node_modules/setprototypeof/test/index.js diff --git a/project starter code/node_modules/side-channel/.eslintignore b/node_modules/side-channel/.eslintignore similarity index 100% rename from project starter code/node_modules/side-channel/.eslintignore rename to node_modules/side-channel/.eslintignore diff --git a/project starter code/node_modules/side-channel/.eslintrc b/node_modules/side-channel/.eslintrc similarity index 100% rename from project starter code/node_modules/side-channel/.eslintrc rename to node_modules/side-channel/.eslintrc diff --git a/project starter code/node_modules/side-channel/.github/FUNDING.yml b/node_modules/side-channel/.github/FUNDING.yml similarity index 100% rename from project starter code/node_modules/side-channel/.github/FUNDING.yml rename to node_modules/side-channel/.github/FUNDING.yml diff --git a/project starter code/node_modules/side-channel/.nycrc b/node_modules/side-channel/.nycrc similarity index 100% rename from project starter code/node_modules/side-channel/.nycrc rename to node_modules/side-channel/.nycrc diff --git a/project starter code/node_modules/side-channel/CHANGELOG.md b/node_modules/side-channel/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/side-channel/CHANGELOG.md rename to node_modules/side-channel/CHANGELOG.md diff --git a/project starter code/node_modules/side-channel/LICENSE b/node_modules/side-channel/LICENSE similarity index 100% rename from project starter code/node_modules/side-channel/LICENSE rename to node_modules/side-channel/LICENSE diff --git a/project starter code/node_modules/side-channel/README.md b/node_modules/side-channel/README.md similarity index 100% rename from project starter code/node_modules/side-channel/README.md rename to node_modules/side-channel/README.md diff --git a/project starter code/node_modules/side-channel/index.js b/node_modules/side-channel/index.js similarity index 100% rename from project starter code/node_modules/side-channel/index.js rename to node_modules/side-channel/index.js diff --git a/project starter code/node_modules/side-channel/package.json b/node_modules/side-channel/package.json similarity index 100% rename from project starter code/node_modules/side-channel/package.json rename to node_modules/side-channel/package.json diff --git a/project starter code/node_modules/side-channel/test/index.js b/node_modules/side-channel/test/index.js similarity index 100% rename from project starter code/node_modules/side-channel/test/index.js rename to node_modules/side-channel/test/index.js diff --git a/project starter code/node_modules/statuses/HISTORY.md b/node_modules/statuses/HISTORY.md similarity index 100% rename from project starter code/node_modules/statuses/HISTORY.md rename to node_modules/statuses/HISTORY.md diff --git a/project starter code/node_modules/statuses/LICENSE b/node_modules/statuses/LICENSE similarity index 100% rename from project starter code/node_modules/statuses/LICENSE rename to node_modules/statuses/LICENSE diff --git a/project starter code/node_modules/statuses/README.md b/node_modules/statuses/README.md similarity index 100% rename from project starter code/node_modules/statuses/README.md rename to node_modules/statuses/README.md diff --git a/project starter code/node_modules/statuses/codes.json b/node_modules/statuses/codes.json similarity index 100% rename from project starter code/node_modules/statuses/codes.json rename to node_modules/statuses/codes.json diff --git a/project starter code/node_modules/statuses/index.js b/node_modules/statuses/index.js similarity index 100% rename from project starter code/node_modules/statuses/index.js rename to node_modules/statuses/index.js diff --git a/project starter code/node_modules/statuses/package.json b/node_modules/statuses/package.json similarity index 100% rename from project starter code/node_modules/statuses/package.json rename to node_modules/statuses/package.json diff --git a/node_modules/string_decoder/LICENSE b/node_modules/string_decoder/LICENSE new file mode 100644 index 00000000..778edb20 --- /dev/null +++ b/node_modules/string_decoder/LICENSE @@ -0,0 +1,48 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +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. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +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. +""" + diff --git a/node_modules/string_decoder/README.md b/node_modules/string_decoder/README.md new file mode 100644 index 00000000..5fd58315 --- /dev/null +++ b/node_modules/string_decoder/README.md @@ -0,0 +1,47 @@ +# string_decoder + +***Node-core v8.9.4 string_decoder for userland*** + + +[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/) +[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/) + + +```bash +npm install --save string_decoder +``` + +***Node-core string_decoder for userland*** + +This package is a mirror of the string_decoder implementation in Node-core. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/). + +As of version 1.0.0 **string_decoder** uses semantic versioning. + +## Previous versions + +Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. + +## Update + +The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. + +## Streams Working Group + +`string_decoder` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + +See [readable-stream](https://github.com/nodejs/readable-stream) for +more details. diff --git a/node_modules/string_decoder/lib/string_decoder.js b/node_modules/string_decoder/lib/string_decoder.js new file mode 100644 index 00000000..2e89e63f --- /dev/null +++ b/node_modules/string_decoder/lib/string_decoder.js @@ -0,0 +1,296 @@ +// 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. + +'use strict'; + +/**/ + +var Buffer = require('safe-buffer').Buffer; +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} \ No newline at end of file diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json new file mode 100644 index 00000000..b2bb1411 --- /dev/null +++ b/node_modules/string_decoder/package.json @@ -0,0 +1,34 @@ +{ + "name": "string_decoder", + "version": "1.3.0", + "description": "The string_decoder module from Node core", + "main": "lib/string_decoder.js", + "files": [ + "lib" + ], + "dependencies": { + "safe-buffer": "~5.2.0" + }, + "devDependencies": { + "babel-polyfill": "^6.23.0", + "core-util-is": "^1.0.2", + "inherits": "^2.0.3", + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/parallel/*.js && node test/verify-dependencies", + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/string_decoder.git" + }, + "homepage": "https://github.com/nodejs/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT" +} diff --git a/node_modules/strtok3/LICENSE b/node_modules/strtok3/LICENSE new file mode 100644 index 00000000..c85ef2c1 --- /dev/null +++ b/node_modules/strtok3/LICENSE @@ -0,0 +1,15 @@ +Copyright (c) 2017, Borewit +All rights reserved. + +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. \ No newline at end of file diff --git a/node_modules/strtok3/README.md b/node_modules/strtok3/README.md new file mode 100644 index 00000000..f45a723a --- /dev/null +++ b/node_modules/strtok3/README.md @@ -0,0 +1,304 @@ +![Node.js CI](https://github.com/Borewit/strtok3/workflows/Node.js%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/strtok3.svg)](https://npmjs.org/package/strtok3) +[![npm downloads](http://img.shields.io/npm/dm/strtok3.svg)](https://npmcharts.com/compare/strtok3,token-types?start=1200&interval=30) +[![DeepScan grade](https://deepscan.io/api/teams/5165/projects/8526/branches/103329/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=8526&bid=103329) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/strtok3/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/strtok3?targetFile=package.json) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/strtok3.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/strtok3/alerts/) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/strtok3?utm_source=github.com&utm_medium=referral&utm_content=Borewit/strtok3&utm_campaign=Badge_Grade) +[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/strtok3.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/strtok3/context:javascript) +# strtok3 + +A promise based streaming [*tokenizer*](#tokenizer) for [Node.js](http://nodejs.org) and browsers. +This node module is a successor of [strtok2](https://github.com/Borewit/strtok2). + +The `strtok3` contains a few methods to turn different input into a [*tokenizer*](#tokenizer). Designed to +* Support a streaming environment +* Decoding of binary data, strings and numbers in mind +* Read [predefined](https://github.com/Borewit/token-types) or custom tokens. +* Optimized [*tokenizers*](#tokenizer) for reading from [file](#method-strtok3fromfile), [stream](#method-strtok3fromstream) or [buffer](#method-strtok3frombuffer). + +It can read from: +* A file (taking a file path as an input) +* A Node.js [stream](https://nodejs.org/api/stream.html). +* A [Buffer](https://nodejs.org/api/buffer.html) or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) +* HTTP chunked transfer provided by [@tokenizer/http](https://github.com/Borewit/tokenizer-http). +* Chunked [Amazon S3](https://aws.amazon.com/s3) access provided by [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3). + +## Installation + +```sh +npm install strtok3 +``` + +### Compatibility + +NPM module is compliant with [ECMAScript 2018 (ES9)](https://en.wikipedia.org/wiki/ECMAScript#9th_Edition_%E2%80%93_ECMAScript_2018). + +## API + +Use one of the methods to instantiate an [*abstract tokenizer*](#tokenizer): +* [strtok3.fromFile](#method-strtok3fromfile) +* [strtok3.fromStream](#method-strtok3fromstream) +* [strtok3.fromBuffer](#method-strtok3fromBuffer) +* [strtok3.fromUint8Array](#method-strtok3fromUint8Array) + +### strtok3 methods + +All of the strtok3 methods return a [*tokenizer*](#tokenizer), either directly or via a promise. + +#### Method `strtok3.fromFile()` + +| Parameter | Type | Description | +|-----------|-----------------------|----------------------------| +| path | Path to file (string) | Path to file to read from | + +> __Note__: that [file-information](#file-information) is automatically added. + +Returns, via a promise, a [*tokenizer*](#tokenizer) which can be used to parse a file. + +```js +const strtok3 = require('strtok3'); +const Token = require('token-types'); + +(async () => { + + const tokenizer = await strtok3.fromFile("somefile.bin"); + try { + const myNumber = await tokenizer.readToken(Token.UINT8); + console.log(`My number: ${myNumber}`); + } finally { + tokenizer.close(); // Close the file + } +})(); + +``` + +#### Method `strtok3.fromStream()` + +Create [*tokenizer*](#tokenizer) from a node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). + +| Parameter | Optional | Type | Description | +|-----------|-----------|-----------------------------------------------------------------------------|--------------------------| +| stream | no | [Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) | Stream to read from | +| fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information | + +Returns a [*tokenizer*](#tokenizer), via a Promise, which can be used to parse a buffer. + +```js +const strtok3 = require('strtok3'); +const Token = require('token-types'); + +strtok3.fromStream(stream).then(tokenizer => { + return tokenizer.readToken(Token.UINT8).then(myUint8Number => { + console.log(`My number: ${myUint8Number}`); + }); +}); +``` + +#### Method `strtok3.fromBuffer()` + +| Parameter | Optional | Type | Description | +|------------|----------|--------------------------------------------------|----------------------------------------| +| uint8Array | no | [Uint8Array](https://nodejs.org/api/buffer.html) | Uint8Array or Buffer to read from | +| fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information | + +Returns a [*tokenizer*](#tokenizer) which can be used to parse the provided buffer. + +```js +const strtok3 = require('strtok3'); + +const tokenizer = strtok3.fromBuffer(buffer); + +tokenizer.readToken(Token.UINT8).then(myUint8Number => { + console.log(`My number: ${myUint8Number}`); +}); +``` + +## Tokenizer +The tokenizer allows us to *read* or *peek* from the *tokenizer-stream*. The *tokenizer-stream* is an abstraction of a [stream](https://nodejs.org/api/stream.html), file or [Buffer](https://nodejs.org/api/buffer.html). +It can also be translated in chunked reads, as done in [@tokenizer/http](https://github.com/Borewit/tokenizer-http); + +What is the difference with Nodejs.js stream? +* The *tokenizer-stream* supports jumping / seeking in a the *tokenizer-stream* using [`tokenizer.ignore()`](#method-tokenizerignore) +* In addition to *read* methods, it has *peek* methods, to read a ahead and check what is coming. + +The [tokenizer.position](#attribute-tokenizerposition) keeps tracks of the read position. + +### strtok3 attributes + +#### Attribute `tokenizer.fileInfo` +Optional attribute describing the file information, see [IFileInfo](#IFileInfo) + +#### Attribute `tokenizer.position` +Pointer to the current position in the [*tokenizer*](#tokenizer) stream. +If a *position* is provided to a *read* or *peek* method, is should be, at least, equal or greater than this value. + +### Tokenizer methods + +There are two kind of methods: +1. *read* methods: used to read a *token* of [Buffer](https://nodejs.org/api/buffer.html) from the [*tokenizer*](#tokenizer). The position of the *tokenizer-stream* will advance with the size of the token. +2. *peek* methods: same as the read, but it will *not* advance the pointer. It allows to read (peek) ahead. + +#### Method `tokenizer.readBuffer()` + +Read buffer from stream. +`readBuffer(buffer, options?)` + +| Parameter | Type | Description | +|------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| buffer | [Buffer](https://nodejs.org/api/buffer.html) | Uint8Array | Target buffer to write the data read to | +| options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read | + +Return value `Promise` Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set. + +#### Method `tokenizer.peekBuffer()` + +Peek (read ahead) buffer from [*tokenizer*](#tokenizer) +`peekBuffer(buffer, options?)` + +| Parameter | Type | Description | +|------------|-----------------------------------------|-----------------------------------------------------| +| buffer | Buffer | Uint8Array | Target buffer to write the data read (peeked) to. | +| options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read. | | + +Return value `Promise` Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set. + +#### Method `tokenizer.readToken()` + +Read a *token* from the tokenizer-stream. +`readToken(token, position?)` + +| Parameter | Type | Description | +|------------|-------------------------|---------------------------------------------------------------------------------------------------------------------- | +| token | [IGetToken](#IGetToken) | Token to read from the tokenizer-stream. | +| position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. | + +Return value `Promise`. Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set. + +#### Method `tokenizer.peekToken()` + +Peek a *token* from the [*tokenizer*](#tokenizer). +`peekToken(token, position?)` + +| Parameter | Type | Description | +|------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------| +| token | [IGetToken](#IGetToken) | Token to read from the tokenizer-stream. | +| position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. | + +Return value `Promise` Promise with token value peeked from the [*tokenizer*](#tokenizer). + +#### Method `tokenizer.readNumber()` + +Peek a numeric [*token*](#token) from the [*tokenizer*](#tokenizer). +`readNumber(token)` + +| Parameter | Type | Description | +|------------|---------------------------------|----------------------------------------------------| +| token | [IGetToken](#IGetToken) | Numeric token to read from the tokenizer-stream. | + +Return value `Promise` Promise with number peeked from the *tokenizer-stream*. + +#### Method `tokenizer.ignore()` + +Advanse the offset pointer with the number of bytes provided. +`ignore(length)` + +| Parameter | Type | Description | +|------------|--------|----------------------------------------------------------------------| +| ignore | number | Numeric of bytes to ignore. Will advance the `tokenizer.position` | + +Return value `Promise` Promise with number peeked from the *tokenizer-stream*. + +#### Method `tokenizer.close()` +Clean up resources, such as closing a file pointer if applicable. + +### IReadChunkOptions + +Each attribute is optional: + +| Attribute | Type | Description | +|-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| offset | number | The offset in the buffer to start writing at; if not provided, start at 0 | +| length | number | Requested number of bytes to read. | +| position | number | Position where to peek from the file. If position is null, data will be read from the [current file position](#attribute-tokenizerposition). Position may not be less then [tokenizer.position](#attribute-tokenizerposition) | +| mayBeLess | boolean | If and only if set, will not throw an EOF error if less then the requested *mayBeLess* could be read. | + +Example: +```js + tokenizer.peekBuffer(buffer, {mayBeLess: true}); +``` + +## IFileInfo + +File information interface which describes the underlying file, each attribute is optional. + +| Attribute | Type | Description | +|-----------|---------|---------------------------------------------------------------------------------------------------| +| size | number | File size in bytes | +| mimeType | number | [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of file. | +| path | number | File path | +| url | boolean | File URL | + +## Token + +The *token* is basically a description what to read form the [*tokenizer-stream*](#tokenizer). +A basic set of *token types* can be found here: [*token-types*](https://github.com/Borewit/token-types). + +A token is something which implements the following interface: +```ts +export interface IGetToken { + + /** + * Length in bytes of encoded value + */ + len: number; + + /** + * Decode value from buffer at offset + * @param buf Buffer to read the decoded value from + * @param off Decode offset + */ + get(buf: Buffer, off: number): T; +} +``` +The *tokenizer* reads `token.len` bytes from the *tokenizer-stream* into a Buffer. +The `token.get` will be called with the Buffer. `token.get` is responsible for conversion from the buffer to the desired output type. + +## Browser compatibility +To exclude fs based dependencies, you can use a submodule-import from 'strtok3/lib/core'. + +| function | 'strtok3' | 'strtok3/lib/core' | +| ----------------------| --------------------|---------------------| +| `parseBuffer` | ✓ | ✓ | +| `parseStream` | ✓ | ✓ | +| `fromFile` | ✓ | | + +### Working with Web-API readable stream +To convert a [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) into a [Node.js readable stream]((https://nodejs.org/api/stream.html#stream_readable_streams)), you can use [readable-web-to-node-stream](https://github.com/Borewit/readable-web-to-node-stream) to convert one in another. + +Example submodule-import: +```js +const strtok3core = require('strtok3/lib/core'); // Submodule-import to prevent Node.js specific dependencies +const {ReadableWebToNodeStream} = require('readable-web-to-node-stream'); + +(async () => { + + const response = await fetch(url); + const readableWebStream = response.body; // Web-API readable stream + const nodeStream = new ReadableWebToNodeStream(readableWebStream); // convert to Node.js readable stream + + const tokenizer = strtok3core.fromStream(nodeStream); // And we now have tokenizer in a web environment +})(); +``` + +## Licence + +(The MIT License) + +Copyright (c) 2020 Borewit + +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. diff --git a/node_modules/strtok3/lib/AbstractTokenizer.d.ts b/node_modules/strtok3/lib/AbstractTokenizer.d.ts new file mode 100644 index 00000000..bf4d42c7 --- /dev/null +++ b/node_modules/strtok3/lib/AbstractTokenizer.d.ts @@ -0,0 +1,69 @@ +import { ITokenizer, IFileInfo, IReadChunkOptions } from './types'; +import { IGetToken, IToken } from '@tokenizer/token'; +interface INormalizedReadChunkOptions extends IReadChunkOptions { + offset: number; + length: number; + position: number; + mayBeLess?: boolean; +} +/** + * Core tokenizer + */ +export declare abstract class AbstractTokenizer implements ITokenizer { + fileInfo: IFileInfo; + protected constructor(fileInfo?: IFileInfo); + /** + * Tokenizer-stream position + */ + position: number; + private numBuffer; + /** + * Read buffer from tokenizer + * @param buffer - Target buffer to fill with data read from the tokenizer-stream + * @param options - Additional read options + * @returns Promise with number of bytes read + */ + abstract readBuffer(buffer: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array- Target buffer to fill with data peek from the tokenizer-stream + * @param options - Peek behaviour options + * @returns Promise with number of bytes read + */ + abstract peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Read a token from the tokenizer-stream + * @param token - The token to read + * @param position - If provided, the desired position in the tokenizer-stream + * @returns Promise with token data + */ + readToken(token: IGetToken, position?: number): Promise; + /** + * Peek a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + * @returns Promise with token data + */ + peekToken(token: IGetToken, position?: number): Promise; + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + readNumber(token: IToken): Promise; + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + peekNumber(token: IToken): Promise; + /** + * Ignore number of bytes, advances the pointer in under tokenizer-stream. + * @param length - Number of bytes to ignore + * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available + */ + ignore(length: number): Promise; + close(): Promise; + protected normalizeOptions(uint8Array: Uint8Array, options?: IReadChunkOptions): INormalizedReadChunkOptions; +} +export {}; diff --git a/node_modules/strtok3/lib/AbstractTokenizer.js b/node_modules/strtok3/lib/AbstractTokenizer.js new file mode 100644 index 00000000..6683b323 --- /dev/null +++ b/node_modules/strtok3/lib/AbstractTokenizer.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AbstractTokenizer = void 0; +const peek_readable_1 = require("peek-readable"); +/** + * Core tokenizer + */ +class AbstractTokenizer { + constructor(fileInfo) { + /** + * Tokenizer-stream position + */ + this.position = 0; + this.numBuffer = new Uint8Array(8); + this.fileInfo = fileInfo ? fileInfo : {}; + } + /** + * Read a token from the tokenizer-stream + * @param token - The token to read + * @param position - If provided, the desired position in the tokenizer-stream + * @returns Promise with token data + */ + async readToken(token, position = this.position) { + const uint8Array = Buffer.alloc(token.len); + const len = await this.readBuffer(uint8Array, { position }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(uint8Array, 0); + } + /** + * Peek a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + * @returns Promise with token data + */ + async peekToken(token, position = this.position) { + const uint8Array = Buffer.alloc(token.len); + const len = await this.peekBuffer(uint8Array, { position }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(uint8Array, 0); + } + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + async readNumber(token) { + const len = await this.readBuffer(this.numBuffer, { length: token.len }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(this.numBuffer, 0); + } + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + async peekNumber(token) { + const len = await this.peekBuffer(this.numBuffer, { length: token.len }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(this.numBuffer, 0); + } + /** + * Ignore number of bytes, advances the pointer in under tokenizer-stream. + * @param length - Number of bytes to ignore + * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available + */ + async ignore(length) { + if (this.fileInfo.size !== undefined) { + const bytesLeft = this.fileInfo.size - this.position; + if (length > bytesLeft) { + this.position += bytesLeft; + return bytesLeft; + } + } + this.position += length; + return length; + } + async close() { + // empty + } + normalizeOptions(uint8Array, options) { + if (options && options.position !== undefined && options.position < this.position) { + throw new Error('`options.position` must be equal or greater than `tokenizer.position`'); + } + if (options) { + return { + mayBeLess: options.mayBeLess === true, + offset: options.offset ? options.offset : 0, + length: options.length ? options.length : (uint8Array.length - (options.offset ? options.offset : 0)), + position: options.position ? options.position : this.position + }; + } + return { + mayBeLess: false, + offset: 0, + length: uint8Array.length, + position: this.position + }; + } +} +exports.AbstractTokenizer = AbstractTokenizer; diff --git a/node_modules/strtok3/lib/BufferTokenizer.d.ts b/node_modules/strtok3/lib/BufferTokenizer.d.ts new file mode 100644 index 00000000..534e31bc --- /dev/null +++ b/node_modules/strtok3/lib/BufferTokenizer.d.ts @@ -0,0 +1,26 @@ +import { IFileInfo, IReadChunkOptions } from './types'; +import { AbstractTokenizer } from './AbstractTokenizer'; +export declare class BufferTokenizer extends AbstractTokenizer { + private uint8Array; + /** + * Construct BufferTokenizer + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + */ + constructor(uint8Array: Uint8Array, fileInfo?: IFileInfo); + /** + * Read buffer from tokenizer + * @param uint8Array - Uint8Array to tokenize + * @param options - Read behaviour options + * @returns {Promise} + */ + readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array + * @param options - Read behaviour options + * @returns {Promise} + */ + peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + close(): Promise; +} diff --git a/node_modules/strtok3/lib/BufferTokenizer.js b/node_modules/strtok3/lib/BufferTokenizer.js new file mode 100644 index 00000000..33d8b1fb --- /dev/null +++ b/node_modules/strtok3/lib/BufferTokenizer.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BufferTokenizer = void 0; +const peek_readable_1 = require("peek-readable"); +const AbstractTokenizer_1 = require("./AbstractTokenizer"); +class BufferTokenizer extends AbstractTokenizer_1.AbstractTokenizer { + /** + * Construct BufferTokenizer + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + */ + constructor(uint8Array, fileInfo) { + super(fileInfo); + this.uint8Array = uint8Array; + this.fileInfo.size = this.fileInfo.size ? this.fileInfo.size : uint8Array.length; + } + /** + * Read buffer from tokenizer + * @param uint8Array - Uint8Array to tokenize + * @param options - Read behaviour options + * @returns {Promise} + */ + async readBuffer(uint8Array, options) { + if (options && options.position) { + if (options.position < this.position) { + throw new Error('`options.position` must be equal or greater than `tokenizer.position`'); + } + this.position = options.position; + } + const bytesRead = await this.peekBuffer(uint8Array, options); + this.position += bytesRead; + return bytesRead; + } + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array + * @param options - Read behaviour options + * @returns {Promise} + */ + async peekBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + const bytes2read = Math.min(this.uint8Array.length - normOptions.position, normOptions.length); + if ((!normOptions.mayBeLess) && bytes2read < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + else { + uint8Array.set(this.uint8Array.subarray(normOptions.position, normOptions.position + bytes2read), normOptions.offset); + return bytes2read; + } + } + async close() { + // empty + } +} +exports.BufferTokenizer = BufferTokenizer; diff --git a/node_modules/strtok3/lib/FileTokenizer.d.ts b/node_modules/strtok3/lib/FileTokenizer.d.ts new file mode 100644 index 00000000..3d940594 --- /dev/null +++ b/node_modules/strtok3/lib/FileTokenizer.d.ts @@ -0,0 +1,22 @@ +import { AbstractTokenizer } from './AbstractTokenizer'; +import { IFileInfo, IReadChunkOptions } from './types'; +export declare class FileTokenizer extends AbstractTokenizer { + private fd; + constructor(fd: number, fileInfo: IFileInfo); + /** + * Read buffer from file + * @param uint8Array - Uint8Array to write result to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek buffer from file + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + close(): Promise; +} +export declare function fromFile(sourceFilePath: string): Promise; diff --git a/node_modules/strtok3/lib/FileTokenizer.js b/node_modules/strtok3/lib/FileTokenizer.js new file mode 100644 index 00000000..b6fd31fa --- /dev/null +++ b/node_modules/strtok3/lib/FileTokenizer.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromFile = exports.FileTokenizer = void 0; +const AbstractTokenizer_1 = require("./AbstractTokenizer"); +const peek_readable_1 = require("peek-readable"); +const fs = require("./FsPromise"); +class FileTokenizer extends AbstractTokenizer_1.AbstractTokenizer { + constructor(fd, fileInfo) { + super(fileInfo); + this.fd = fd; + } + /** + * Read buffer from file + * @param uint8Array - Uint8Array to write result to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + async readBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + this.position = normOptions.position; + const res = await fs.read(this.fd, uint8Array, normOptions.offset, normOptions.length, normOptions.position); + this.position += res.bytesRead; + if (res.bytesRead < normOptions.length && (!options || !options.mayBeLess)) { + throw new peek_readable_1.EndOfStreamError(); + } + return res.bytesRead; + } + /** + * Peek buffer from file + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + async peekBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + const res = await fs.read(this.fd, uint8Array, normOptions.offset, normOptions.length, normOptions.position); + if ((!normOptions.mayBeLess) && res.bytesRead < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + return res.bytesRead; + } + async close() { + return fs.close(this.fd); + } +} +exports.FileTokenizer = FileTokenizer; +async function fromFile(sourceFilePath) { + const stat = await fs.stat(sourceFilePath); + if (!stat.isFile) { + throw new Error(`File not a file: ${sourceFilePath}`); + } + const fd = await fs.open(sourceFilePath, 'r'); + return new FileTokenizer(fd, { path: sourceFilePath, size: stat.size }); +} +exports.fromFile = fromFile; diff --git a/node_modules/strtok3/lib/FsPromise.d.ts b/node_modules/strtok3/lib/FsPromise.d.ts new file mode 100644 index 00000000..cd2fb0fd --- /dev/null +++ b/node_modules/strtok3/lib/FsPromise.d.ts @@ -0,0 +1,18 @@ +/** + * Module convert fs functions to promise based functions + */ +/// +import * as fs from 'fs'; +export interface IReadResult { + bytesRead: number; + buffer: Uint8Array; +} +export declare const pathExists: typeof fs.existsSync; +export declare const createReadStream: typeof fs.createReadStream; +export declare function stat(path: fs.PathLike): Promise; +export declare function close(fd: number): Promise; +export declare function open(path: fs.PathLike, mode: fs.Mode): Promise; +export declare function read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): Promise; +export declare function writeFile(path: fs.PathLike, data: Buffer | string): Promise; +export declare function writeFileSync(path: fs.PathLike, data: Buffer | string): void; +export declare function readFile(path: fs.PathLike): Promise; diff --git a/node_modules/strtok3/lib/FsPromise.js b/node_modules/strtok3/lib/FsPromise.js new file mode 100644 index 00000000..690a5e2b --- /dev/null +++ b/node_modules/strtok3/lib/FsPromise.js @@ -0,0 +1,79 @@ +"use strict"; +/** + * Module convert fs functions to promise based functions + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readFile = exports.writeFileSync = exports.writeFile = exports.read = exports.open = exports.close = exports.stat = exports.createReadStream = exports.pathExists = void 0; +const fs = require("fs"); +exports.pathExists = fs.existsSync; +exports.createReadStream = fs.createReadStream; +async function stat(path) { + return new Promise((resolve, reject) => { + fs.stat(path, (err, stats) => { + if (err) + reject(err); + else + resolve(stats); + }); + }); +} +exports.stat = stat; +async function close(fd) { + return new Promise((resolve, reject) => { + fs.close(fd, err => { + if (err) + reject(err); + else + resolve(); + }); + }); +} +exports.close = close; +async function open(path, mode) { + return new Promise((resolve, reject) => { + fs.open(path, mode, (err, fd) => { + if (err) + reject(err); + else + resolve(fd); + }); + }); +} +exports.open = open; +async function read(fd, buffer, offset, length, position) { + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, _buffer) => { + if (err) + reject(err); + else + resolve({ bytesRead, buffer: _buffer }); + }); + }); +} +exports.read = read; +async function writeFile(path, data) { + return new Promise((resolve, reject) => { + fs.writeFile(path, data, err => { + if (err) + reject(err); + else + resolve(); + }); + }); +} +exports.writeFile = writeFile; +function writeFileSync(path, data) { + fs.writeFileSync(path, data); +} +exports.writeFileSync = writeFileSync; +async function readFile(path) { + return new Promise((resolve, reject) => { + fs.readFile(path, (err, buffer) => { + if (err) + reject(err); + else + resolve(buffer); + }); + }); +} +exports.readFile = readFile; diff --git a/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts b/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts new file mode 100644 index 00000000..18252c39 --- /dev/null +++ b/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts @@ -0,0 +1,28 @@ +/// +import { AbstractTokenizer } from './AbstractTokenizer'; +import { Readable } from 'stream'; +import { IFileInfo, IReadChunkOptions } from './types'; +export declare class ReadStreamTokenizer extends AbstractTokenizer { + private streamReader; + constructor(stream: Readable, fileInfo?: IFileInfo); + /** + * Get file information, an HTTP-client may implement this doing a HEAD request + * @return Promise with file information + */ + getFileInfo(): Promise; + /** + * Read buffer from tokenizer + * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream + * @param options - Read behaviour options + * @returns Promise with number of bytes read + */ + readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise with number of bytes peeked + */ + peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + ignore(length: number): Promise; +} diff --git a/node_modules/strtok3/lib/ReadStreamTokenizer.js b/node_modules/strtok3/lib/ReadStreamTokenizer.js new file mode 100644 index 00000000..0270b4d9 --- /dev/null +++ b/node_modules/strtok3/lib/ReadStreamTokenizer.js @@ -0,0 +1,98 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadStreamTokenizer = void 0; +const AbstractTokenizer_1 = require("./AbstractTokenizer"); +const peek_readable_1 = require("peek-readable"); +const maxBufferSize = 256000; +class ReadStreamTokenizer extends AbstractTokenizer_1.AbstractTokenizer { + constructor(stream, fileInfo) { + super(fileInfo); + this.streamReader = new peek_readable_1.StreamReader(stream); + } + /** + * Get file information, an HTTP-client may implement this doing a HEAD request + * @return Promise with file information + */ + async getFileInfo() { + return this.fileInfo; + } + /** + * Read buffer from tokenizer + * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream + * @param options - Read behaviour options + * @returns Promise with number of bytes read + */ + async readBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + const skipBytes = normOptions.position - this.position; + if (skipBytes > 0) { + await this.ignore(skipBytes); + return this.readBuffer(uint8Array, options); + } + else if (skipBytes < 0) { + throw new Error('`options.position` must be equal or greater than `tokenizer.position`'); + } + if (normOptions.length === 0) { + return 0; + } + const bytesRead = await this.streamReader.read(uint8Array, normOptions.offset, normOptions.length); + this.position += bytesRead; + if ((!options || !options.mayBeLess) && bytesRead < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + return bytesRead; + } + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise with number of bytes peeked + */ + async peekBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + let bytesRead = 0; + if (normOptions.position) { + const skipBytes = normOptions.position - this.position; + if (skipBytes > 0) { + const skipBuffer = new Uint8Array(normOptions.length + skipBytes); + bytesRead = await this.peekBuffer(skipBuffer, { mayBeLess: normOptions.mayBeLess }); + uint8Array.set(skipBuffer.subarray(skipBytes), normOptions.offset); + return bytesRead - skipBytes; + } + else if (skipBytes < 0) { + throw new Error('Cannot peek from a negative offset in a stream'); + } + } + if (normOptions.length > 0) { + try { + bytesRead = await this.streamReader.peek(uint8Array, normOptions.offset, normOptions.length); + } + catch (err) { + if (options && options.mayBeLess && err instanceof peek_readable_1.EndOfStreamError) { + return 0; + } + throw err; + } + if ((!normOptions.mayBeLess) && bytesRead < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + } + return bytesRead; + } + async ignore(length) { + // debug(`ignore ${this.position}...${this.position + length - 1}`); + const bufSize = Math.min(maxBufferSize, length); + const buf = new Uint8Array(bufSize); + let totBytesRead = 0; + while (totBytesRead < length) { + const remaining = length - totBytesRead; + const bytesRead = await this.readBuffer(buf, { length: Math.min(bufSize, remaining) }); + if (bytesRead < 0) { + return bytesRead; + } + totBytesRead += bytesRead; + } + return totBytesRead; + } +} +exports.ReadStreamTokenizer = ReadStreamTokenizer; diff --git a/node_modules/strtok3/lib/core.d.ts b/node_modules/strtok3/lib/core.d.ts new file mode 100644 index 00000000..04ec5b24 --- /dev/null +++ b/node_modules/strtok3/lib/core.d.ts @@ -0,0 +1,23 @@ +/// +import { ReadStreamTokenizer } from './ReadStreamTokenizer'; +import { Readable } from 'stream'; +import { BufferTokenizer } from './BufferTokenizer'; +import { IFileInfo } from './types'; +export { EndOfStreamError } from 'peek-readable'; +export { ITokenizer, IFileInfo } from './types'; +export { IToken, IGetToken } from '@tokenizer/token'; +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property/ + * @param stream - Read from Node.js Stream.Readable + * @param fileInfo - Pass the file information, like size and MIME-type of the corresponding stream. + * @returns ReadStreamTokenizer + */ +export declare function fromStream(stream: Readable, fileInfo?: IFileInfo): ReadStreamTokenizer; +/** + * Construct ReadStreamTokenizer from given Buffer. + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + * @returns BufferTokenizer + */ +export declare function fromBuffer(uint8Array: Uint8Array, fileInfo?: IFileInfo): BufferTokenizer; diff --git a/node_modules/strtok3/lib/core.js b/node_modules/strtok3/lib/core.js new file mode 100644 index 00000000..fb92aa72 --- /dev/null +++ b/node_modules/strtok3/lib/core.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromBuffer = exports.fromStream = exports.EndOfStreamError = void 0; +const ReadStreamTokenizer_1 = require("./ReadStreamTokenizer"); +const BufferTokenizer_1 = require("./BufferTokenizer"); +var peek_readable_1 = require("peek-readable"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return peek_readable_1.EndOfStreamError; } }); +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property/ + * @param stream - Read from Node.js Stream.Readable + * @param fileInfo - Pass the file information, like size and MIME-type of the corresponding stream. + * @returns ReadStreamTokenizer + */ +function fromStream(stream, fileInfo) { + fileInfo = fileInfo ? fileInfo : {}; + return new ReadStreamTokenizer_1.ReadStreamTokenizer(stream, fileInfo); +} +exports.fromStream = fromStream; +/** + * Construct ReadStreamTokenizer from given Buffer. + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + * @returns BufferTokenizer + */ +function fromBuffer(uint8Array, fileInfo) { + return new BufferTokenizer_1.BufferTokenizer(uint8Array, fileInfo); +} +exports.fromBuffer = fromBuffer; diff --git a/node_modules/strtok3/lib/index.d.ts b/node_modules/strtok3/lib/index.d.ts new file mode 100644 index 00000000..c4bd267c --- /dev/null +++ b/node_modules/strtok3/lib/index.d.ts @@ -0,0 +1,15 @@ +/// +import { Readable } from 'stream'; +import { ReadStreamTokenizer } from './ReadStreamTokenizer'; +import * as core from './core'; +export { fromFile } from './FileTokenizer'; +export { ITokenizer, EndOfStreamError, fromBuffer, IFileInfo } from './core'; +export { IToken, IGetToken } from '@tokenizer/token'; +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property. + * @param stream - Node.js Stream.Readable + * @param fileInfo - Pass additional file information to the tokenizer + * @returns Tokenizer + */ +export declare function fromStream(stream: Readable, fileInfo?: core.IFileInfo): Promise; diff --git a/node_modules/strtok3/lib/index.js b/node_modules/strtok3/lib/index.js new file mode 100644 index 00000000..030e750f --- /dev/null +++ b/node_modules/strtok3/lib/index.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromStream = exports.fromBuffer = exports.EndOfStreamError = exports.fromFile = void 0; +const fs = require("./FsPromise"); +const core = require("./core"); +var FileTokenizer_1 = require("./FileTokenizer"); +Object.defineProperty(exports, "fromFile", { enumerable: true, get: function () { return FileTokenizer_1.fromFile; } }); +var core_1 = require("./core"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return core_1.EndOfStreamError; } }); +Object.defineProperty(exports, "fromBuffer", { enumerable: true, get: function () { return core_1.fromBuffer; } }); +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property. + * @param stream - Node.js Stream.Readable + * @param fileInfo - Pass additional file information to the tokenizer + * @returns Tokenizer + */ +async function fromStream(stream, fileInfo) { + fileInfo = fileInfo ? fileInfo : {}; + if (stream.path) { + const stat = await fs.stat(stream.path); + fileInfo.path = stream.path; + fileInfo.size = stat.size; + } + return core.fromStream(stream, fileInfo); +} +exports.fromStream = fromStream; diff --git a/node_modules/strtok3/lib/types.d.ts b/node_modules/strtok3/lib/types.d.ts new file mode 100644 index 00000000..93895dfd --- /dev/null +++ b/node_modules/strtok3/lib/types.d.ts @@ -0,0 +1,103 @@ +/// +import { IGetToken } from '@tokenizer/token'; +export interface IFileInfo { + /** + * File size in bytes + */ + size?: number; + /** + * MIME-type of file + */ + mimeType?: string; + /** + * File path + */ + path?: string; + /** + * File URL + */ + url?: string; +} +export interface IReadChunkOptions { + /** + * The offset in the buffer to start writing at; default is 0 + */ + offset?: number; + /** + * Number of bytes to read. + */ + length?: number; + /** + * Position where to begin reading from the file. + * Default it is `tokenizer.position`. + * Position may not be less then `tokenizer.position`. + */ + position?: number; + /** + * If set, will not throw an EOF error if not all of the requested data could be read + */ + mayBeLess?: boolean; +} +/** + * The tokenizer allows us to read or peek from the tokenizer-stream. + * The tokenizer-stream is an abstraction of a stream, file or Buffer. + */ +export interface ITokenizer { + /** + * Provide access to information of the underlying information stream or file. + */ + fileInfo: IFileInfo; + /** + * Offset in bytes (= number of bytes read) since beginning of file or stream + */ + position: number; + /** + * Peek (read ahead) buffer from tokenizer + * @param buffer - Target buffer to fill with data peek from the tokenizer-stream + * @param options - Read behaviour options + * @returns Promise with number of bytes read + */ + peekBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param buffer - Target buffer to fill with data peeked from the tokenizer-stream + * @param options - Additional read options + * @returns Promise with number of bytes read + */ + readBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise; + /** + * Peek a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + * @param maybeless - If set, will not throw an EOF error if the less then the requested length could be read. + */ + peekToken(token: IGetToken, position?: number | null, maybeless?: boolean): Promise; + /** + * Read a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + */ + readToken(token: IGetToken, position?: number): Promise; + /** + * Peek a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + peekNumber(token: IGetToken): Promise; + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + readNumber(token: IGetToken): Promise; + /** + * Ignore given number of bytes + * @param length - Number of bytes ignored + */ + ignore(length: number): Promise; + /** + * Clean up resources. + * It does not close the stream for StreamReader, but is does close the file-descriptor. + */ + close(): Promise; +} diff --git a/node_modules/strtok3/lib/types.js b/node_modules/strtok3/lib/types.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/strtok3/lib/types.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/strtok3/package.json b/node_modules/strtok3/package.json new file mode 100644 index 00000000..1f864d38 --- /dev/null +++ b/node_modules/strtok3/package.json @@ -0,0 +1,103 @@ +{ + "name": "strtok3", + "version": "6.3.0", + "description": "A promise based streaming tokenizer", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "scripts": { + "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map", + "compile-src": "tsc -p lib", + "compile-test": "tsc -p test", + "compile": "npm run compile-src && npm run compile-test", + "build": "npm run clean && npm run compile", + "eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts", + "lint-md": "remark -u preset-lint-recommended .", + "lint": "npm run lint-md && npm run eslint", + "fix": "eslint lib test --ext .ts --ignore-pattern *.d.ts --fix", + "test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/test.ts", + "test-coverage": "nyc npm run test", + "send-coveralls": "nyc report --reporter=text-lcov | coveralls", + "send-codacy": "nyc report --reporter=text-lcov | codacy-coverage", + "start": "npm run compile && npm run lint && npm run cover-test" + }, + "engines": { + "node": ">=10" + }, + "repository": { + "type": "git", + "url": "https://github.com/Borewit/strtok3.git" + }, + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "bugs": { + "url": "https://github.com/Borewit/strtok3/issues" + }, + "devDependencies": { + "@types/chai": "^4.3.0", + "@types/debug": "^4.1.7", + "@types/mocha": "^9.1.0", + "@types/node": "^17.0.14", + "@typescript-eslint/eslint-plugin": "^5.10.2", + "@typescript-eslint/parser": "^5.10.2", + "chai": "^4.3.6", + "coveralls": "^3.1.1", + "del-cli": "^4.0.1", + "eslint": "^8.8.0", + "eslint-config-prettier": "^8.3.0", + "eslint-import-resolver-typescript": "^2.5.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jsdoc": "^37.7.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-unicorn": "^40.1.0", + "mocha": "^9.2.0", + "nyc": "^15.1.0", + "remark-cli": "^10.0.1", + "remark-preset-lint-recommended": "^6.1.2", + "source-map-support": "^0.5.21", + "token-types": "^4.1.1", + "ts-node": "^10.4.0", + "typescript": "^4.5.5" + }, + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + }, + "keywords": [ + "tokenizer", + "reader", + "token", + "async", + "promise", + "parser", + "decoder", + "binary", + "endian", + "uint", + "stream", + "streaming" + ], + "nyc": { + "check-coverage": false, + "extension": [ + ".ts" + ], + "sourceMap": true, + "instrument": true, + "reporter": [ + "lcov", + "text" + ], + "report-dir": "coverage" + } +} diff --git a/project starter code/node_modules/timm/.eslintrc.yaml b/node_modules/timm/.eslintrc.yaml similarity index 100% rename from project starter code/node_modules/timm/.eslintrc.yaml rename to node_modules/timm/.eslintrc.yaml diff --git a/project starter code/node_modules/timm/.flowconfig b/node_modules/timm/.flowconfig similarity index 100% rename from project starter code/node_modules/timm/.flowconfig rename to node_modules/timm/.flowconfig diff --git a/project starter code/node_modules/timm/.github/workflows/run-tests.yml b/node_modules/timm/.github/workflows/run-tests.yml similarity index 100% rename from project starter code/node_modules/timm/.github/workflows/run-tests.yml rename to node_modules/timm/.github/workflows/run-tests.yml diff --git a/project starter code/node_modules/timm/.prettierignore b/node_modules/timm/.prettierignore similarity index 100% rename from project starter code/node_modules/timm/.prettierignore rename to node_modules/timm/.prettierignore diff --git a/project starter code/node_modules/timm/.prettierrc b/node_modules/timm/.prettierrc similarity index 100% rename from project starter code/node_modules/timm/.prettierrc rename to node_modules/timm/.prettierrc diff --git a/project starter code/node_modules/timm/CHANGELOG.md b/node_modules/timm/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/timm/CHANGELOG.md rename to node_modules/timm/CHANGELOG.md diff --git a/project starter code/node_modules/timm/LICENSE b/node_modules/timm/LICENSE similarity index 100% rename from project starter code/node_modules/timm/LICENSE rename to node_modules/timm/LICENSE diff --git a/project starter code/node_modules/timm/README.md b/node_modules/timm/README.md similarity index 100% rename from project starter code/node_modules/timm/README.md rename to node_modules/timm/README.md diff --git a/project starter code/node_modules/timm/_config.yml b/node_modules/timm/_config.yml similarity index 100% rename from project starter code/node_modules/timm/_config.yml rename to node_modules/timm/_config.yml diff --git a/project starter code/node_modules/timm/babel.config.js b/node_modules/timm/babel.config.js similarity index 100% rename from project starter code/node_modules/timm/babel.config.js rename to node_modules/timm/babel.config.js diff --git a/project starter code/node_modules/timm/lib/timm.d.ts b/node_modules/timm/lib/timm.d.ts similarity index 100% rename from project starter code/node_modules/timm/lib/timm.d.ts rename to node_modules/timm/lib/timm.d.ts diff --git a/project starter code/node_modules/timm/lib/timm.js b/node_modules/timm/lib/timm.js similarity index 100% rename from project starter code/node_modules/timm/lib/timm.js rename to node_modules/timm/lib/timm.js diff --git a/project starter code/node_modules/timm/package.json b/node_modules/timm/package.json similarity index 100% rename from project starter code/node_modules/timm/package.json rename to node_modules/timm/package.json diff --git a/project starter code/node_modules/timm/src/timm.ts b/node_modules/timm/src/timm.ts similarity index 100% rename from project starter code/node_modules/timm/src/timm.ts rename to node_modules/timm/src/timm.ts diff --git a/project starter code/node_modules/timm/tsconfig.json b/node_modules/timm/tsconfig.json similarity index 100% rename from project starter code/node_modules/timm/tsconfig.json rename to node_modules/timm/tsconfig.json diff --git a/project starter code/node_modules/tinycolor2/LICENSE b/node_modules/tinycolor2/LICENSE similarity index 100% rename from project starter code/node_modules/tinycolor2/LICENSE rename to node_modules/tinycolor2/LICENSE diff --git a/node_modules/tinycolor2/README.md b/node_modules/tinycolor2/README.md new file mode 100644 index 00000000..71b6d767 --- /dev/null +++ b/node_modules/tinycolor2/README.md @@ -0,0 +1,492 @@ +# TinyColor + +## JavaScript color tooling + +TinyColor is a small, fast library for color manipulation and conversion in JavaScript. It allows many forms of input, while providing color conversions and other color utility functions. It has no dependencies. + +## Including in node + +`tinycolor` can be installed from npm: + + npm install tinycolor2 + +Then it can be used in your script like so: + +```js +var tinycolor = require("tinycolor2"); +var color = tinycolor("red"); +``` + +Or in a module like so: + +```js +import tinycolor from "tinycolor2"; +var color = tinycolor("red"); +``` + +## Including in a browser + +The package can be bundled from npm, but if you prefer to download it locally you have two choices: + +### ESM + +It can be used as a module by downloading [npm/esm/tinycolor.js](https://github.com/bgrins/TinyColor/blob/master/npm/esm/tinycolor.js) or using https://esm.sh/tinycolor2. + +```html + +``` + +### UMD + +You can use it directly in a script tag by downloading the UMD file from [npm/cjs/tinycolor.js](https://github.com/bgrins/TinyColor/blob/master/npm/cjs/tinycolor.js): + +```html + + +``` + +## Usage + +Call `tinycolor(input)` or `new tinycolor(input)`, and you will have an object with the following properties. See Accepted String Input and Accepted Object Input below for more information about what is accepted. + +## Accepted String Input + +The string parsing is very permissive. It is meant to make typing a color as input as easy as possible. All commas, percentages, parenthesis are optional, and most input allow either 0-1, 0%-100%, or 0-n (where n is either 100, 255, or 360 depending on the value). + +HSL and HSV both require either 0%-100% or 0-1 for the `S`/`L`/`V` properties. The `H` (hue) can have values between 0%-100% or 0-360. + +RGB input requires either 0-255 or 0%-100%. + +If you call `tinycolor.fromRatio`, RGB and Hue input can also accept 0-1. + +Here are some examples of string input: + +### Hex, 8-digit (RGBA) Hex +```js +tinycolor("#000"); +tinycolor("000"); +tinycolor("#369C"); +tinycolor("369C"); +tinycolor("#f0f0f6"); +tinycolor("f0f0f6"); +tinycolor("#f0f0f688"); +tinycolor("f0f0f688"); +``` +### RGB, RGBA +```js +tinycolor("rgb (255, 0, 0)"); +tinycolor("rgb 255 0 0"); +tinycolor("rgba (255, 0, 0, .5)"); +tinycolor({ r: 255, g: 0, b: 0 }); +tinycolor.fromRatio({ r: 1, g: 0, b: 0 }); +tinycolor.fromRatio({ r: .5, g: .5, b: .5 }); +``` +### HSL, HSLA +```js +tinycolor("hsl(0, 100%, 50%)"); +tinycolor("hsla(0, 100%, 50%, .5)"); +tinycolor("hsl(0, 100%, 50%)"); +tinycolor("hsl 0 1.0 0.5"); +tinycolor({ h: 0, s: 1, l: .5 }); +tinycolor.fromRatio({ h: 1, s: 0, l: 0 }); +tinycolor.fromRatio({ h: .5, s: .5, l: .5 }); +``` +### HSV, HSVA +```js +tinycolor("hsv(0, 100%, 100%)"); +tinycolor("hsva(0, 100%, 100%, .5)"); +tinycolor("hsv (0 100% 100%)"); +tinycolor("hsv 0 1 1"); +tinycolor({ h: 0, s: 100, v: 100 }); +tinycolor.fromRatio({ h: 1, s: 0, v: 0 }); +tinycolor.fromRatio({ h: .5, s: .5, v: .5 }); +``` +### Named + +Case insenstive names are accepted, using the [list of colors in the CSS spec](https://www.w3.org/TR/css-color-4/#named-colors). + +```js +tinycolor("RED"); +tinycolor("blanchedalmond"); +tinycolor("darkblue"); +``` +### Accepted Object Input + +If you are calling this from code, you may want to use object input. Here are some examples of the different types of accepted object inputs: + + { r: 255, g: 0, b: 0 } + { r: 255, g: 0, b: 0, a: .5 } + { h: 0, s: 100, l: 50 } + { h: 0, s: 100, v: 100 } + +## Methods + +### getFormat + +Returns the format used to create the tinycolor instance +```js +var color = tinycolor("red"); +color.getFormat(); // "name" +color = tinycolor({r:255, g:255, b:255}); +color.getFormat(); // "rgb" +``` + +### getOriginalInput + +Returns the input passed into the constructor used to create the tinycolor instance +```js +var color = tinycolor("red"); +color.getOriginalInput(); // "red" +color = tinycolor({r:255, g:255, b:255}); +color.getOriginalInput(); // "{r: 255, g: 255, b: 255}" +``` + +### isValid + +Return a boolean indicating whether the color was successfully parsed. Note: if the color is not valid then it will act like `black` when being used with other methods. +```js +var color1 = tinycolor("red"); +color1.isValid(); // true +color1.toHexString(); // "#ff0000" + +var color2 = tinycolor("not a color"); +color2.isValid(); // false +color2.toString(); // "#000000" +``` +### getBrightness + +Returns the perceived brightness of a color, from `0-255`, as defined by [Web Content Accessibility Guidelines (Version 1.0)](http://www.w3.org/TR/AERT#color-contrast). +```js +var color1 = tinycolor("#fff"); +color1.getBrightness(); // 255 + +var color2 = tinycolor("#000"); +color2.getBrightness(); // 0 +``` +### isLight + +Return a boolean indicating whether the color's perceived brightness is light. +```js +var color1 = tinycolor("#fff"); +color1.isLight(); // true + +var color2 = tinycolor("#000"); +color2.isLight(); // false +``` +### isDark + +Return a boolean indicating whether the color's perceived brightness is dark. +```js +var color1 = tinycolor("#fff"); +color1.isDark(); // false + +var color2 = tinycolor("#000"); +color2.isDark(); // true +``` +### getLuminance + +Returns the perceived luminance of a color, from `0-1` as defined by [Web Content Accessibility Guidelines (Version 2.0).](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef) +```js +var color1 = tinycolor("#fff"); +color1.getLuminance(); // 1 + +var color2 = tinycolor("#000"); +color2.getLuminance(); // 0 +``` +### getAlpha + +Returns the alpha value of a color, from `0-1`. +```js +var color1 = tinycolor("rgba(255, 0, 0, .5)"); +color1.getAlpha(); // 0.5 + +var color2 = tinycolor("rgb(255, 0, 0)"); +color2.getAlpha(); // 1 + +var color3 = tinycolor("transparent"); +color3.getAlpha(); // 0 +``` +### setAlpha + +Sets the alpha value on a current color. Accepted range is in between `0-1`. +```js +var color = tinycolor("red"); +color.getAlpha(); // 1 +color.setAlpha(.5); +color.getAlpha(); // .5 +color.toRgbString(); // "rgba(255, 0, 0, .5)" +``` +### String Representations + +The following methods will return a property for the `alpha` value, which can be ignored: `toHsv`, `toHsl`, `toRgb` + +### toHsv +```js +var color = tinycolor("red"); +color.toHsv(); // { h: 0, s: 1, v: 1, a: 1 } +``` +### toHsvString +```js +var color = tinycolor("red"); +color.toHsvString(); // "hsv(0, 100%, 100%)" +color.setAlpha(0.5); +color.toHsvString(); // "hsva(0, 100%, 100%, 0.5)" +``` +### toHsl +```js +var color = tinycolor("red"); +color.toHsl(); // { h: 0, s: 1, l: 0.5, a: 1 } +``` +### toHslString +```js +var color = tinycolor("red"); +color.toHslString(); // "hsl(0, 100%, 50%)" +color.setAlpha(0.5); +color.toHslString(); // "hsla(0, 100%, 50%, 0.5)" +``` +### toHex +```js +var color = tinycolor("red"); +color.toHex(); // "ff0000" +``` +### toHexString +```js +var color = tinycolor("red"); +color.toHexString(); // "#ff0000" +``` +### toHex8 +```js +var color = tinycolor("red"); +color.toHex8(); // "ff0000ff" +``` +### toHex8String +```js +var color = tinycolor("red"); +color.toHex8String(); // "#ff0000ff" +``` +### toRgb +```js +var color = tinycolor("red"); +color.toRgb(); // { r: 255, g: 0, b: 0, a: 1 } +``` +### toRgbString +```js +var color = tinycolor("red"); +color.toRgbString(); // "rgb(255, 0, 0)" +color.setAlpha(0.5); +color.toRgbString(); // "rgba(255, 0, 0, 0.5)" +``` +### toPercentageRgb +```js +var color = tinycolor("red"); +color.toPercentageRgb() // { r: "100%", g: "0%", b: "0%", a: 1 } +``` +### toPercentageRgbString +```js +var color = tinycolor("red"); +color.toPercentageRgbString(); // "rgb(100%, 0%, 0%)" +color.setAlpha(0.5); +color.toPercentageRgbString(); // "rgba(100%, 0%, 0%, 0.5)" +``` +### toName +```js +var color = tinycolor("red"); +color.toName(); // "red" +``` +### toFilter +``` +var color = tinycolor("red"); +color.toFilter(); // "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)" +``` +### toString + +Print to a string, depending on the input format. You can also override this by passing one of `"rgb", "prgb", "hex6", "hex3", "hex8", "name", "hsl", "hsv"` into the function. +```js +var color1 = tinycolor("red"); +color1.toString(); // "red" +color1.toString("hsv"); // "hsv(0, 100%, 100%)" + +var color2 = tinycolor("rgb(255, 0, 0)"); +color2.toString(); // "rgb(255, 0, 0)" +color2.setAlpha(.5); +color2.toString(); // "rgba(255, 0, 0, 0.5)" +``` +### Color Modification + +These methods manipulate the current color, and return it for chaining. For instance: +```js +tinycolor("red").lighten().desaturate().toHexString() // "#f53d3d" +``` +### lighten + +`lighten: function(amount = 10) -> TinyColor`. Lighten the color a given amount, from 0 to 100. Providing 100 will always return white. +```js +tinycolor("#f00").lighten().toString(); // "#ff3333" +tinycolor("#f00").lighten(100).toString(); // "#ffffff" +``` +### brighten + +`brighten: function(amount = 10) -> TinyColor`. Brighten the color a given amount, from 0 to 100. +```js +tinycolor("#f00").brighten().toString(); // "#ff1919" +``` +### darken + +`darken: function(amount = 10) -> TinyColor`. Darken the color a given amount, from 0 to 100. Providing 100 will always return black. +```js +tinycolor("#f00").darken().toString(); // "#cc0000" +tinycolor("#f00").darken(100).toString(); // "#000000" +``` +### desaturate + +`desaturate: function(amount = 10) -> TinyColor`. Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling `greyscale`. +```js +tinycolor("#f00").desaturate().toString(); // "#f20d0d" +tinycolor("#f00").desaturate(100).toString(); // "#808080" +``` +### saturate + +`saturate: function(amount = 10) -> TinyColor`. Saturate the color a given amount, from 0 to 100. +```js +tinycolor("hsl(0, 10%, 50%)").saturate().toString(); // "hsl(0, 20%, 50%)" +``` +### greyscale + +`greyscale: function() -> TinyColor`. Completely desaturates a color into greyscale. Same as calling `desaturate(100)`. +```js +tinycolor("#f00").greyscale().toString(); // "#808080" +``` +### spin + +`spin: function(amount = 0) -> TinyColor`. Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing (since it sets the hue back to what it was before). +```js +tinycolor("#f00").spin(180).toString(); // "#00ffff" +tinycolor("#f00").spin(-90).toString(); // "#7f00ff" +tinycolor("#f00").spin(90).toString(); // "#80ff00" + +// spin(0) and spin(360) do nothing +tinycolor("#f00").spin(0).toString(); // "#ff0000" +tinycolor("#f00").spin(360).toString(); // "#ff0000" +``` +### Color Combinations + +Combination functions return an array of TinyColor objects unless otherwise noted. + +### analogous + +`analogous: function(, results = 6, slices = 30) -> array`. +```js +var colors = tinycolor("#f00").analogous(); + +colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#ff0066", "#ff0033", "#ff0000", "#ff3300", "#ff6600" ] +``` +### monochromatic + +`monochromatic: function(, results = 6) -> array`. +```js +var colors = tinycolor("#f00").monochromatic(); + +colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#2a0000", "#550000", "#800000", "#aa0000", "#d40000" ] +``` +### splitcomplement + +`splitcomplement: function() -> array`. +```js +var colors = tinycolor("#f00").splitcomplement(); + +colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#ccff00", "#0066ff" ] +``` +### triad + +`triad: function() -> array`. +```js +var colors = tinycolor("#f00").triad(); + +colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#00ff00", "#0000ff" ] +``` +### tetrad + +`tetrad: function() -> array`. +```js +var colors = tinycolor("#f00").tetrad(); + +colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#80ff00", "#00ffff", "#7f00ff" ] + +``` +### complement + +`complement: function() -> TinyColor`. +```js +tinycolor("#f00").complement().toHexString(); // "#00ffff" +``` +## Color Utilities +```js +tinycolor.equals(color1, color2) +tinycolor.mix(color1, color2, amount = 50) +``` +### random + +Returns a random color. +```js +var color = tinycolor.random(); +color.toRgb(); // "{r: 145, g: 40, b: 198, a: 1}" +``` + +### Readability + +TinyColor assesses readability based on the [Web Content Accessibility Guidelines (Version 2.0)](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef). + +#### readability + +`readability: function(TinyColor, TinyColor) -> Object`. +Returns the contrast ratio between two colors. +```js +tinycolor.readability("#000", "#000"); // 1 +tinycolor.readability("#000", "#111"); // 1.1121078324840545 +tinycolor.readability("#000", "#fff"); // 21 +``` +Use the values in your own calculations, or use one of the convenience functions below. + +#### isReadable + +`isReadable: function(TinyColor, TinyColor, Object) -> Boolean`. Ensure that foreground and background color combinations meet WCAG guidelines. `Object` is optional, defaulting to `{level: "AA",size: "small"}`. `level` can be `"AA"` or "AAA" and `size` can be `"small"` or `"large"`. + +Here are links to read more about the [AA](http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html) and [AAA](http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast7.html) requirements. +```js +tinycolor.isReadable("#000", "#111", {}); // false +tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"small"}); //false +tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"large"}), //true +``` +#### mostReadable + +`mostReadable: function(TinyColor, [TinyColor, Tinycolor ...], Object) -> Boolean`. +Given a base color and a list of possible foreground or background colors for that base, returns the most readable color. +If none of the colors in the list is readable, `mostReadable` will return the better of black or white if `includeFallbackColors:true`. +```js +tinycolor.mostReadable("#000", ["#f00", "#0f0", "#00f"]).toHexString(); // "#00ff00" +tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" +tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" +tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString() // "#2e0c3a", +tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString() // "#000000", +``` +See [index.html](https://github.com/bgrins/TinyColor/blob/master/index.html) in the project for a demo. + +## Common operations + +### clone + +`clone: function() -> TinyColor`. +Instantiate a new TinyColor object with the same color. Any changes to the new one won't affect the old one. +```js +var color1 = tinycolor("#F00"); +var color2 = color1.clone(); +color2.setAlpha(.5); + +color1.toString(); // "#ff0000" +color2.toString(); // "rgba(255, 0, 0, 0.5)" +``` diff --git a/node_modules/tinycolor2/cjs/package.json b/node_modules/tinycolor2/cjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/tinycolor2/cjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/tinycolor2/cjs/test.js b/node_modules/tinycolor2/cjs/test.js new file mode 100644 index 00000000..40be5fdd --- /dev/null +++ b/node_modules/tinycolor2/cjs/test.js @@ -0,0 +1,2191 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +const tinycolor = require("./tinycolor.js"); +const { Deno, testDefinitions } = require("@deno/shim-deno-test"); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} +(async () => { + const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" + ); + + // TEST_BEGINS_HERE + +Deno.test("TinyColor initialization", function () { + assert( + typeof tinycolor != "undefined", + "tinycolor is initialized on the page" + ); + assert( + typeof tinycolor("red") == "object", + "tinycolor is able to be instantiated" + ); + + var r = tinycolor("red"); + assert( + tinycolor(r) === r, + "when given a tinycolor instance, tinycolor() returns it" + ); + assert( + new tinycolor(r) === r, + "when given a tinycolor instance, new tinycolor() returns it" + ); + assertEquals( + tinycolor("red", { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + + var obj = { h: 180, s: 0.5, l: 0.5 }; + var color = tinycolor(obj); + assert( + obj.s === 0.5, + "when given an object, the original object is not modified" + ); +}); + +Deno.test("Original input", function () { + var colorRgbUp = "RGB(39, 39, 39)"; + var colorRgbLow = "rgb(39, 39, 39)"; + var colorRgbMix = "RgB(39, 39, 39)"; + var tinycolorObj = tinycolor(colorRgbMix); + var inputObj = { r: 100, g: 100, b: 100 }; + var r = tinycolor("red"); + + assert( + tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, + "original lowercase input is returned" + ); + assert( + tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, + "original uppercase input is returned" + ); + assert( + tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, + "original mixed input is returned" + ); + assert( + tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, + "when given a tinycolor instance, the color string is returned" + ); + assert( + tinycolor(inputObj).getOriginalInput() === inputObj, + "when given an object, the object is returned" + ); + assert( + new tinycolor("").getOriginalInput() === "", + "when given an empty string, an empty string is returned" + ); + assert( + new tinycolor(null).getOriginalInput() === "", + "when given a null value, an empty string is returned" + ); +}); + +Deno.test("Cloning color", function () { + var originalColor = tinycolor("red"); + var originalColorRgbString = originalColor.toRgbString(); + + var clonedColor = originalColor.clone(); + assert( + clonedColor.toRgbString() === originalColor.toRgbString(), + "cloned color is identical" + ); + + clonedColor.setAlpha(0.5); + assert( + clonedColor.toRgbString() !== originalColor.toRgbString(), + "cloned color is changing independently from original color" + ); + assert( + originalColorRgbString === originalColor.toRgbString(), + "original color was not changed by cloned color change" + ); +}); +Deno.test("Random color", function () { + var randomColor = tinycolor.random(); + assertEquals(randomColor.getAlpha(), 1); + assertEquals(randomColor.getFormat(), "prgb"); + + randomColor.setAlpha(0.5); + assertEquals(randomColor.toHex8String().slice(-2), "80"); +}); + +// Taken from convertWikipediaColors.html +var conversions = [ + { + hex: "#FFFFFF", + hex8: "#FFFFFFFF", + rgb: { r: "100.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "0", s: "0.000", v: "1.000" }, + hsl: { h: "0", s: "0.000", l: "1.000" }, + }, + { + hex: "#808080", + hex8: "#808080FF", + rgb: { r: "050.0%", g: "050.0%", b: "050.0%" }, + hsv: { h: "0", s: "0.000", v: "0.500" }, + hsl: { h: "0", s: "0.000", l: "0.500" }, + }, + { + hex: "#000000", + hex8: "#000000FF", + rgb: { r: "000.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0", s: "0.000", v: "0.000" }, + hsl: { h: "0", s: "0.000", l: "0.000" }, + }, + { + hex: "#FF0000", + hex8: "#FF0000FF", + rgb: { r: "100.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0.0", s: "1.000", v: "1.000" }, + hsl: { h: "0.0", s: "1.000", l: "0.500" }, + }, + { + hex: "#BFBF00", + hex8: "#BFBF00FF", + rgb: { r: "075.0%", g: "075.0%", b: "000.0%" }, + hsv: { h: "60.0", s: "1.000", v: "0.750" }, + hsl: { h: "60.0", s: "1.000", l: "0.375" }, + }, + { + hex: "#008000", + hex8: "#008000FF", + rgb: { r: "000.0%", g: "050.0%", b: "000.0%" }, + hsv: { h: "120.0", s: "1.000", v: "0.500" }, + hsl: { h: "120.0", s: "1.000", l: "0.250" }, + }, + { + hex: "#80FFFF", + hex8: "#80FFFFFF", + rgb: { r: "050.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "180.0", s: "0.500", v: "1.000" }, + hsl: { h: "180.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#8080FF", + hex8: "#8080FFFF", + rgb: { r: "050.0%", g: "050.0%", b: "100.0%" }, + hsv: { h: "240.0", s: "0.500", v: "1.000" }, + hsl: { h: "240.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#BF40BF", + hex8: "#BF40BFFF", + rgb: { r: "075.0%", g: "025.0%", b: "075.0%" }, + hsv: { h: "300.0", s: "0.667", v: "0.750" }, + hsl: { h: "300.0", s: "0.500", l: "0.500" }, + }, + { + hex: "#A0A424", + hex8: "#A0A424FF", + rgb: { r: "062.8%", g: "064.3%", b: "014.2%" }, + hsv: { h: "61.8", s: "0.779", v: "0.643" }, + hsl: { h: "61.8", s: "0.638", l: "0.393" }, + }, + { + hex: "#1EAC41", + hex8: "#1EAC41FF", + rgb: { r: "011.6%", g: "067.5%", b: "025.5%" }, + hsv: { h: "134.9", s: "0.828", v: "0.675" }, + hsl: { h: "134.9", s: "0.707", l: "0.396" }, + }, + { + hex: "#B430E5", + hex8: "#B430E5FF", + rgb: { r: "070.4%", g: "018.7%", b: "089.7%" }, + hsv: { h: "283.7", s: "0.792", v: "0.897" }, + hsl: { h: "283.7", s: "0.775", l: "0.542" }, + }, + { + hex: "#FEF888", + hex8: "#FEF888FF", + rgb: { r: "099.8%", g: "097.4%", b: "053.2%" }, + hsv: { h: "56.9", s: "0.467", v: "0.998" }, + hsl: { h: "56.9", s: "0.991", l: "0.765" }, + }, + { + hex: "#19CB97", + hex8: "#19CB97FF", + rgb: { r: "009.9%", g: "079.5%", b: "059.1%" }, + hsv: { h: "162.4", s: "0.875", v: "0.795" }, + hsl: { h: "162.4", s: "0.779", l: "0.447" }, + }, + { + hex: "#362698", + hex8: "#362698FF", + rgb: { r: "021.1%", g: "014.9%", b: "059.7%" }, + hsv: { h: "248.3", s: "0.750", v: "0.597" }, + hsl: { h: "248.3", s: "0.601", l: "0.373" }, + }, + { + hex: "#7E7EB8", + hex8: "#7E7EB8FF", + rgb: { r: "049.5%", g: "049.3%", b: "072.1%" }, + hsv: { h: "240.5", s: "0.316", v: "0.721" }, + hsl: { h: "240.5", s: "0.290", l: "0.607" }, + }, +]; + +Deno.test("Color Equality", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + + assert(true, tiny.isValid()); + assert( + true, + "Testing " + + c.hex + + ": " + + tiny.toRgbString() + + " " + + tiny.toPercentageRgbString() + + " " + + tiny.toHsvString() + + " " + + tiny.toHslString() + + " " + + tiny.toHexString() + + "Original: " + + JSON.stringify(c.rgb) + + " " + + JSON.stringify(c.hsv) + + " " + + JSON.stringify(c.hsl) + ); + assert(tinycolor.equals(c.rgb, c.hex), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hex8), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsl), "RGB equals HSL " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsv), "RGB equals HSV " + c.hex); + assert(tinycolor.equals(c.rgb, c.rgb), "RGB equals RGB " + c.hex); + + assert(tinycolor.equals(c.hex, c.hex), "hex equals hex " + c.hex); + assert(tinycolor.equals(c.hex, c.hex8), "hex equals hex8 " + c.hex); + assert(tinycolor.equals(c.hex, c.hsl), "hex equals HSL " + c.hex); + assert(tinycolor.equals(c.hex, c.hsv), "hex equals HSV " + c.hex); + + assert(tinycolor.equals(c.hsl, c.hsv), "HSL equals HSV " + c.hex); + } +}); + +Deno.test("With Ratio", function () { + assertEquals( + tinycolor.fromRatio({ r: 1, g: 1, b: 1 }).toHexString(), + "#ffffff", + "white" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 0.5 }).toRgbString(), + "rgba(255, 0, 0, 0.5)", + "alpha works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha = 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 10 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha > 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: -1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha < 1 works when ratio is parsed" + ); +}); + +Deno.test("Without Ratio", function () { + assertEquals( + tinycolor({ r: 1, g: 1, b: 1 }).toHexString(), + "#010101", + "010101" + ); + assertEquals( + tinycolor({ r: 0.1, g: 0.1, b: 0.1 }).toHexString(), + "#000000", + "000000" + ); + assertEquals(tinycolor("rgb .1 .1 .1").toHexString(), "#000000", "000000"); +}); + +Deno.test("RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 255 0 0").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert( + tinycolor.equals({ r: 200, g: 100, b: 0, a: 0.4 }, "rgba 200 100 0 .4") + ); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgba 200 100 0 1")); + + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb(200, 100, 0)") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); +}); + +Deno.test("Percentage RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 100% 0% 0%").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert( + tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert( + tinycolor.equals( + { r: "90%", g: "45%", b: "0%", a: 0.4 }, + "rgba 90% 45% 0% .4" + ) + ); + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgba 90% 45% 0% 1") + ); + + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb(90%, 45%, 0%)" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); +}); + +Deno.test("HSL parsing", function () { + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38, a: 0.5 }).toHslString(), + "hsla(251, 100%, 38%, 0.5)", + "to hsla" + ); + assertEquals( + tinycolor("hsl(251, 100, 38)").toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor("hsl 100 20 10").toHslString(), + "hsl(100, 20%, 10%)", + "problematic hsl" + ); +}); + +Deno.test("Hex Parsing", function () { + assertEquals(tinycolor("rgb 255 0 0").toHexString(), "#ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHexString(true), "#f00"); + + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8String(), "#ff000080"); + assertEquals(tinycolor("rgba 255 0 0 0").toHex8String(), "#ff000000"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(), "#ff0000ff"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(true), "#f00f"); + + assertEquals(tinycolor("rgb 255 0 0").toHex(), "ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHex(true), "f00"); + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8(), "ff000080"); +}); + +Deno.test("HSV Parsing", function () { + assertEquals( + tinycolor("hsv 251.1 0.887 .918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsv 251.1 0.887 0.918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsva 251.1 0.887 0.918 0.5").toHsvString(), + "hsva(251, 89%, 92%, 0.5)" + ); +}); + +Deno.test("Invalid Parsing", function () { + var invalidColor = tinycolor("this is not a color"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("#red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" #red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" ##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ r: "invalid", g: "invalid", b: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", l: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", v: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); +}); + +Deno.test("Named colors", function () { + assertEquals(tinycolor("aliceblue").toHex(), "f0f8ff"); + assertEquals(tinycolor("antiquewhite").toHex(), "faebd7"); + assertEquals(tinycolor("aqua").toHex(), "00ffff"); + assertEquals(tinycolor("aquamarine").toHex(), "7fffd4"); + assertEquals(tinycolor("azure").toHex(), "f0ffff"); + assertEquals(tinycolor("beige").toHex(), "f5f5dc"); + assertEquals(tinycolor("bisque").toHex(), "ffe4c4"); + assertEquals(tinycolor("black").toHex(), "000000"); + assertEquals(tinycolor("blanchedalmond").toHex(), "ffebcd"); + assertEquals(tinycolor("blue").toHex(), "0000ff"); + assertEquals(tinycolor("blueviolet").toHex(), "8a2be2"); + assertEquals(tinycolor("brown").toHex(), "a52a2a"); + assertEquals(tinycolor("burlywood").toHex(), "deb887"); + assertEquals(tinycolor("cadetblue").toHex(), "5f9ea0"); + assertEquals(tinycolor("chartreuse").toHex(), "7fff00"); + assertEquals(tinycolor("chocolate").toHex(), "d2691e"); + assertEquals(tinycolor("coral").toHex(), "ff7f50"); + assertEquals(tinycolor("cornflowerblue").toHex(), "6495ed"); + assertEquals(tinycolor("cornsilk").toHex(), "fff8dc"); + assertEquals(tinycolor("crimson").toHex(), "dc143c"); + assertEquals(tinycolor("cyan").toHex(), "00ffff"); + assertEquals(tinycolor("darkblue").toHex(), "00008b"); + assertEquals(tinycolor("darkcyan").toHex(), "008b8b"); + assertEquals(tinycolor("darkgoldenrod").toHex(), "b8860b"); + assertEquals(tinycolor("darkgray").toHex(), "a9a9a9"); + assertEquals(tinycolor("darkgreen").toHex(), "006400"); + assertEquals(tinycolor("darkkhaki").toHex(), "bdb76b"); + assertEquals(tinycolor("darkmagenta").toHex(), "8b008b"); + assertEquals(tinycolor("darkolivegreen").toHex(), "556b2f"); + assertEquals(tinycolor("darkorange").toHex(), "ff8c00"); + assertEquals(tinycolor("darkorchid").toHex(), "9932cc"); + assertEquals(tinycolor("darkred").toHex(), "8b0000"); + assertEquals(tinycolor("darksalmon").toHex(), "e9967a"); + assertEquals(tinycolor("darkseagreen").toHex(), "8fbc8f"); + assertEquals(tinycolor("darkslateblue").toHex(), "483d8b"); + assertEquals(tinycolor("darkslategray").toHex(), "2f4f4f"); + assertEquals(tinycolor("darkturquoise").toHex(), "00ced1"); + assertEquals(tinycolor("darkviolet").toHex(), "9400d3"); + assertEquals(tinycolor("deeppink").toHex(), "ff1493"); + assertEquals(tinycolor("deepskyblue").toHex(), "00bfff"); + assertEquals(tinycolor("dimgray").toHex(), "696969"); + assertEquals(tinycolor("dodgerblue").toHex(), "1e90ff"); + assertEquals(tinycolor("firebrick").toHex(), "b22222"); + assertEquals(tinycolor("floralwhite").toHex(), "fffaf0"); + assertEquals(tinycolor("forestgreen").toHex(), "228b22"); + assertEquals(tinycolor("fuchsia").toHex(), "ff00ff"); + assertEquals(tinycolor("gainsboro").toHex(), "dcdcdc"); + assertEquals(tinycolor("ghostwhite").toHex(), "f8f8ff"); + assertEquals(tinycolor("gold").toHex(), "ffd700"); + assertEquals(tinycolor("goldenrod").toHex(), "daa520"); + assertEquals(tinycolor("gray").toHex(), "808080"); + assertEquals(tinycolor("grey").toHex(), "808080"); + assertEquals(tinycolor("green").toHex(), "008000"); + assertEquals(tinycolor("greenyellow").toHex(), "adff2f"); + assertEquals(tinycolor("honeydew").toHex(), "f0fff0"); + assertEquals(tinycolor("hotpink").toHex(), "ff69b4"); + assertEquals(tinycolor("indianred ").toHex(), "cd5c5c"); + assertEquals(tinycolor("indigo ").toHex(), "4b0082"); + assertEquals(tinycolor("ivory").toHex(), "fffff0"); + assertEquals(tinycolor("khaki").toHex(), "f0e68c"); + assertEquals(tinycolor("lavender").toHex(), "e6e6fa"); + assertEquals(tinycolor("lavenderblush").toHex(), "fff0f5"); + assertEquals(tinycolor("lawngreen").toHex(), "7cfc00"); + assertEquals(tinycolor("lemonchiffon").toHex(), "fffacd"); + assertEquals(tinycolor("lightblue").toHex(), "add8e6"); + assertEquals(tinycolor("lightcoral").toHex(), "f08080"); + assertEquals(tinycolor("lightcyan").toHex(), "e0ffff"); + assertEquals(tinycolor("lightgoldenrodyellow").toHex(), "fafad2"); + assertEquals(tinycolor("lightgrey").toHex(), "d3d3d3"); + assertEquals(tinycolor("lightgreen").toHex(), "90ee90"); + assertEquals(tinycolor("lightpink").toHex(), "ffb6c1"); + assertEquals(tinycolor("lightsalmon").toHex(), "ffa07a"); + assertEquals(tinycolor("lightseagreen").toHex(), "20b2aa"); + assertEquals(tinycolor("lightskyblue").toHex(), "87cefa"); + assertEquals(tinycolor("lightslategray").toHex(), "778899"); + assertEquals(tinycolor("lightsteelblue").toHex(), "b0c4de"); + assertEquals(tinycolor("lightyellow").toHex(), "ffffe0"); + assertEquals(tinycolor("lime").toHex(), "00ff00"); + assertEquals(tinycolor("limegreen").toHex(), "32cd32"); + assertEquals(tinycolor("linen").toHex(), "faf0e6"); + assertEquals(tinycolor("magenta").toHex(), "ff00ff"); + assertEquals(tinycolor("maroon").toHex(), "800000"); + assertEquals(tinycolor("mediumaquamarine").toHex(), "66cdaa"); + assertEquals(tinycolor("mediumblue").toHex(), "0000cd"); + assertEquals(tinycolor("mediumorchid").toHex(), "ba55d3"); + assertEquals(tinycolor("mediumpurple").toHex(), "9370db"); + assertEquals(tinycolor("mediumseagreen").toHex(), "3cb371"); + assertEquals(tinycolor("mediumslateblue").toHex(), "7b68ee"); + assertEquals(tinycolor("mediumspringgreen").toHex(), "00fa9a"); + assertEquals(tinycolor("mediumturquoise").toHex(), "48d1cc"); + assertEquals(tinycolor("mediumvioletred").toHex(), "c71585"); + assertEquals(tinycolor("midnightblue").toHex(), "191970"); + assertEquals(tinycolor("mintcream").toHex(), "f5fffa"); + assertEquals(tinycolor("mistyrose").toHex(), "ffe4e1"); + assertEquals(tinycolor("moccasin").toHex(), "ffe4b5"); + assertEquals(tinycolor("navajowhite").toHex(), "ffdead"); + assertEquals(tinycolor("navy").toHex(), "000080"); + assertEquals(tinycolor("oldlace").toHex(), "fdf5e6"); + assertEquals(tinycolor("olive").toHex(), "808000"); + assertEquals(tinycolor("olivedrab").toHex(), "6b8e23"); + assertEquals(tinycolor("orange").toHex(), "ffa500"); + assertEquals(tinycolor("orangered").toHex(), "ff4500"); + assertEquals(tinycolor("orchid").toHex(), "da70d6"); + assertEquals(tinycolor("palegoldenrod").toHex(), "eee8aa"); + assertEquals(tinycolor("palegreen").toHex(), "98fb98"); + assertEquals(tinycolor("paleturquoise").toHex(), "afeeee"); + assertEquals(tinycolor("palevioletred").toHex(), "db7093"); + assertEquals(tinycolor("papayawhip").toHex(), "ffefd5"); + assertEquals(tinycolor("peachpuff").toHex(), "ffdab9"); + assertEquals(tinycolor("peru").toHex(), "cd853f"); + assertEquals(tinycolor("pink").toHex(), "ffc0cb"); + assertEquals(tinycolor("plum").toHex(), "dda0dd"); + assertEquals(tinycolor("powderblue").toHex(), "b0e0e6"); + assertEquals(tinycolor("purple").toHex(), "800080"); + assertEquals(tinycolor("rebeccapurple").toHex(), "663399"); + assertEquals(tinycolor("red").toHex(), "ff0000"); + assertEquals(tinycolor("rosybrown").toHex(), "bc8f8f"); + assertEquals(tinycolor("royalblue").toHex(), "4169e1"); + assertEquals(tinycolor("saddlebrown").toHex(), "8b4513"); + assertEquals(tinycolor("salmon").toHex(), "fa8072"); + assertEquals(tinycolor("sandybrown").toHex(), "f4a460"); + assertEquals(tinycolor("seagreen").toHex(), "2e8b57"); + assertEquals(tinycolor("seashell").toHex(), "fff5ee"); + assertEquals(tinycolor("sienna").toHex(), "a0522d"); + assertEquals(tinycolor("silver").toHex(), "c0c0c0"); + assertEquals(tinycolor("skyblue").toHex(), "87ceeb"); + assertEquals(tinycolor("slateblue").toHex(), "6a5acd"); + assertEquals(tinycolor("slategray").toHex(), "708090"); + assertEquals(tinycolor("snow").toHex(), "fffafa"); + assertEquals(tinycolor("springgreen").toHex(), "00ff7f"); + assertEquals(tinycolor("steelblue").toHex(), "4682b4"); + assertEquals(tinycolor("tan").toHex(), "d2b48c"); + assertEquals(tinycolor("teal").toHex(), "008080"); + assertEquals(tinycolor("thistle").toHex(), "d8bfd8"); + assertEquals(tinycolor("tomato").toHex(), "ff6347"); + assertEquals(tinycolor("turquoise").toHex(), "40e0d0"); + assertEquals(tinycolor("violet").toHex(), "ee82ee"); + assertEquals(tinycolor("wheat").toHex(), "f5deb3"); + assertEquals(tinycolor("white").toHex(), "ffffff"); + assertEquals(tinycolor("whitesmoke").toHex(), "f5f5f5"); + assertEquals(tinycolor("yellow").toHex(), "ffff00"); + assertEquals(tinycolor("yellowgreen").toHex(), "9acd32"); + + assertEquals(tinycolor("#f00").toName(), "red"); + assertEquals(tinycolor("#fa0a0a").toName(), false); +}); + +Deno.test("Invalid alpha should normalize to 1", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -1 }).toRgbString(), + "rgb(255, 20, 10)", + "Negative value" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "Negative 0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0.5 }).toRgbString(), + "rgba(255, 20, 10, 0.5)", + ".5" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 1 }).toRgbString(), + "rgb(255, 20, 10)", + "1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 100 }).toRgbString(), + "rgb(255, 20, 10)", + "Greater than 1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: "asdfasd" }).toRgbString(), + "rgb(255, 20, 10)", + "Non Numeric" + ); + + assertEquals( + tinycolor("#fff").toRgbString(), + "rgb(255, 255, 255)", + "Hex should be 1" + ); + assertEquals( + tinycolor("rgba 255 0 0 100").toRgbString(), + "rgb(255, 0, 0)", + "Greater than 1 in string parsing" + ); +}); + +Deno.test("toString() with alpha set", function () { + var redNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.6 }, + { + format: "name", + } + ); + var transparentNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0 }, + { + format: "name", + } + ); + var redHex = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.4 }, + { + format: "hex", + } + ); + + assertEquals(redNamed.getFormat(), "name", "getFormat() is correct"); + assertEquals(redHex.getFormat(), "hex", "getFormat() is correct"); + + assertEquals( + redNamed.toString(), + "rgba(255, 0, 0, 0.6)", + "Names should default to rgba if alpha is < 1" + ); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + + assertEquals( + redNamed.toString("hex"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex6"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex3"), + "#f00", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex8"), + "#ff000099", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex4"), + "#f009", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("name"), + "#ff0000", + "Semi transparent names should return hex in toString() if name format is specified" + ); + + assertEquals( + redNamed.toName(), + false, + "Semi transparent names should be false in toName()" + ); + + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + assertEquals( + transparentNamed.toString(), + "transparent", + "Named color should equal transparent if alpha == 0" + ); + + redHex.setAlpha(0); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0)", + "Hex should default to rgba if alpha is = 0" + ); +}); + +Deno.test("setting alpha", function () { + var hexSetter = tinycolor("rgba(255, 0, 0, 1)"); + assertEquals(hexSetter.getAlpha(), 1, "Alpha should start as 1"); + var returnedFromSetAlpha = hexSetter.setAlpha(0.9); + assertEquals( + returnedFromSetAlpha, + hexSetter, + "setAlpha return value should be the color." + ); + assertEquals(hexSetter.getAlpha(), 0.9, "setAlpha should change alpha value"); + hexSetter.setAlpha(0.5); + assertEquals(hexSetter.getAlpha(), 0.5, "setAlpha should change alpha value"); + hexSetter.setAlpha(0); + assertEquals(hexSetter.getAlpha(), 0, "setAlpha should change alpha value"); + hexSetter.setAlpha(-1); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value < 0 should be bound to 1" + ); + hexSetter.setAlpha(2); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value > 1 should be bound to 1" + ); + hexSetter.setAlpha(); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha(null); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha("test"); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); +}); + +Deno.test("Alpha = 0 should act differently on toName()", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toName(), + "transparent", + "0" + ); + assertEquals( + tinycolor("transparent").toString(), + "transparent", + "toString when passed" + ); + assertEquals(tinycolor("transparent").toHex(), "000000", "toHex"); +}); + +Deno.test("getBrightness", function () { + assertEquals(tinycolor("#000").getBrightness(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getBrightness(), 255, "returns 255 for #fff"); +}); + +Deno.test("getLuminance", function () { + assertEquals(tinycolor("#000").getLuminance(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getLuminance(), 1, "returns 1 for #fff"); +}); + +Deno.test("isDark returns true/false for dark/light colors", function () { + assertEquals(tinycolor("#000").isDark(), true, "#000 is dark"); + assertEquals(tinycolor("#111").isDark(), true, "#111 is dark"); + assertEquals(tinycolor("#222").isDark(), true, "#222 is dark"); + assertEquals(tinycolor("#333").isDark(), true, "#333 is dark"); + assertEquals(tinycolor("#444").isDark(), true, "#444 is dark"); + assertEquals(tinycolor("#555").isDark(), true, "#555 is dark"); + assertEquals(tinycolor("#666").isDark(), true, "#666 is dark"); + assertEquals(tinycolor("#777").isDark(), true, "#777 is dark"); + assertEquals(tinycolor("#888").isDark(), false, "#888 is not dark"); + assertEquals(tinycolor("#999").isDark(), false, "#999 is not dark"); + assertEquals(tinycolor("#aaa").isDark(), false, "#aaa is not dark"); + assertEquals(tinycolor("#bbb").isDark(), false, "#bbb is not dark"); + assertEquals(tinycolor("#ccc").isDark(), false, "#ccc is not dark"); + assertEquals(tinycolor("#ddd").isDark(), false, "#ddd is not dark"); + assertEquals(tinycolor("#eee").isDark(), false, "#eee is not dark"); + assertEquals(tinycolor("#fff").isDark(), false, "#fff is not dark"); +}); + +Deno.test("isLight returns true/false for light/dark colors", function () { + assertEquals(tinycolor("#000").isLight(), false, "#000 is not light"); + assertEquals(tinycolor("#111").isLight(), false, "#111 is not light"); + assertEquals(tinycolor("#222").isLight(), false, "#222 is not light"); + assertEquals(tinycolor("#333").isLight(), false, "#333 is not light"); + assertEquals(tinycolor("#444").isLight(), false, "#444 is not light"); + assertEquals(tinycolor("#555").isLight(), false, "#555 is not light"); + assertEquals(tinycolor("#666").isLight(), false, "#666 is not light"); + assertEquals(tinycolor("#777").isLight(), false, "#777 is not light"); + assertEquals(tinycolor("#888").isLight(), true, "#888 is light"); + assertEquals(tinycolor("#999").isLight(), true, "#999 is light"); + assertEquals(tinycolor("#aaa").isLight(), true, "#aaa is light"); + assertEquals(tinycolor("#bbb").isLight(), true, "#bbb is light"); + assertEquals(tinycolor("#ccc").isLight(), true, "#ccc is light"); + assertEquals(tinycolor("#ddd").isLight(), true, "#ddd is light"); + assertEquals(tinycolor("#eee").isLight(), true, "#eee is light"); + assertEquals(tinycolor("#fff").isLight(), true, "#fff is light"); +}); + +Deno.test("HSL Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsl()).toHexString(), + "HSL Object" + ); + } +}); + +Deno.test("HSL String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHslString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHslString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHslString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHslString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHsvString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHsvString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHsvString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHsvString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsv()).toHexString(), + "HSV Object" + ); + } +}); + +Deno.test("RGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgb()).toHexString(), + "RGB Object" + ); + } +}); + +Deno.test("RGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgbString()).toHexString(), + "RGB String" + ); + } +}); + +Deno.test("PRGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgb()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("PRGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgbString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals(tiny.toHexString(), tinycolor(tiny).toHexString(), "Object"); + } +}); + +Deno.test("Color equality", function () { + assert(tinycolor.equals("#ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#ff0000", "rgb(255, 0, 0)"), "Same alphas"); + assert( + !tinycolor.equals("#ff0000", "rgba(255, 0, 0, .1)"), + "Different alphas" + ); + assert(tinycolor.equals("#ff000066", "rgba(255, 0, 0, .4)"), "Same alphas"); + assert(tinycolor.equals("#f009", "rgba(255, 0, 0, .6)"), "Same alphas"); + assert(tinycolor.equals("#336699CC", "369C"), "Same hex"); + assert(tinycolor.equals("ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("f00", "#ff0000"), "Same hex"); + assertEquals(tinycolor("010101").toHexString(), "#010101"); + assert(!tinycolor.equals("#ff0000", "#00ff00"), "Different hex"); + assert( + tinycolor.equals("#ff8000", "rgb(100%, 50%, 0%)"), + "Percentage bounds checking" + ); +}); + +Deno.test("isReadable", function () { + // "#ff0088", "#8822aa" (values used in old WCAG1 tests) + assert( + tinycolor.isReadable("#000000", "#ffffff", { level: "AA", size: "small" }), + "white/black is readable" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", {}), + "not readable - empty wcag2 object" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "large" }), + "not readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // values derived from and validated using the calculators at http://www.dasplankton.de/ContrastA/ + // and http://webaim.org/resources/contrastchecker/ + + // "#ff0088", "#5c1a72": contrast ratio 3.04 + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // "#ff0088", "#2e0c3a": contrast ratio 4.56 + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#2e0c3a", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); + + // "#db91b8", "#2e0c3a": contrast ratio 7.12 + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "small" }), + "readable - AAA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); +}); + +Deno.test("readability", function () { + // check return values from readability function. See isReadable above for standards tests. + assertEquals( + tinycolor.readability("#000", "#000"), + 1, + "Readability function test 0" + ); + assertEquals( + tinycolor.readability("#000", "#111"), + 1.1121078324840545, + "Readability function test 1" + ); + assertEquals( + tinycolor.readability("#000", "#fff"), + 21, + "Readability function test 2" + ); +}); + +Deno.test("mostReadable", function () { + assertEquals( + tinycolor + .mostReadable("#000", ["#111", "#222", { wcag2: {} }]) + .toHexString(), + "#222222", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#f00", ["#d00", "#0d0"], { wcag2: {} }) + .toHexString(), + "#00dd00", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { wcag2: {} }) + .toHexString(), + "#ffffff", + "no different color in list" + ); + //includeFallbackColors + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { + includeFallbackColors: true, + }) + .toHexString(), + "#000000", + "no different color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: false, + }) + .toHexString(), + "#112255", + "no readable color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: true, + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#000000", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#2e0c3a", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#000000", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#a9acb6", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); +}); + +Deno.test("Filters", function () { + assertEquals( + tinycolor("red").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)" + ); + assertEquals( + tinycolor("red").toFilter("blue"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ff0000ff)" + ); + + assertEquals( + tinycolor("transparent").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#00000000)" + ); + assertEquals( + tinycolor("transparent").toFilter("red"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ffff0000)" + ); + + assertEquals( + tinycolor("#f0f0f0dd").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ddf0f0f0,endColorstr=#ddf0f0f0)" + ); + assertEquals( + tinycolor("rgba(0, 0, 255, .5").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#800000ff,endColorstr=#800000ff)" + ); +}); + +/* Originally generated with: +var results = []; +for (var i = 0; i <= 100; i++) results.push( tinycolor.saturate("red", i).toHex() ) +console.log(JSON.stringify(results)) +*/ +var DESATURATIONS = [ + "ff0000", + "fe0101", + "fc0303", + "fb0404", + "fa0505", + "f90606", + "f70808", + "f60909", + "f50a0a", + "f40b0b", + "f20d0d", + "f10e0e", + "f00f0f", + "ee1111", + "ed1212", + "ec1313", + "eb1414", + "e91616", + "e81717", + "e71818", + "e61919", + "e41b1b", + "e31c1c", + "e21d1d", + "e01f1f", + "df2020", + "de2121", + "dd2222", + "db2424", + "da2525", + "d92626", + "d72828", + "d62929", + "d52a2a", + "d42b2b", + "d22d2d", + "d12e2e", + "d02f2f", + "cf3030", + "cd3232", + "cc3333", + "cb3434", + "c93636", + "c83737", + "c73838", + "c63939", + "c43b3b", + "c33c3c", + "c23d3d", + "c13e3e", + "bf4040", + "be4141", + "bd4242", + "bb4444", + "ba4545", + "b94646", + "b84747", + "b64949", + "b54a4a", + "b44b4b", + "b34d4d", + "b14e4e", + "b04f4f", + "af5050", + "ad5252", + "ac5353", + "ab5454", + "aa5555", + "a85757", + "a75858", + "a65959", + "a45b5b", + "a35c5c", + "a25d5d", + "a15e5e", + "9f6060", + "9e6161", + "9d6262", + "9c6363", + "9a6565", + "996666", + "986767", + "966969", + "956a6a", + "946b6b", + "936c6c", + "916e6e", + "906f6f", + "8f7070", + "8e7171", + "8c7373", + "8b7474", + "8a7575", + "887777", + "877878", + "867979", + "857a7a", + "837c7c", + "827d7d", + "817e7e", + "808080", +]; +var SATURATIONS = [ + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", +]; +var LIGHTENS = [ + "ff0000", + "ff0505", + "ff0a0a", + "ff0f0f", + "ff1414", + "ff1a1a", + "ff1f1f", + "ff2424", + "ff2929", + "ff2e2e", + "ff3333", + "ff3838", + "ff3d3d", + "ff4242", + "ff4747", + "ff4d4d", + "ff5252", + "ff5757", + "ff5c5c", + "ff6161", + "ff6666", + "ff6b6b", + "ff7070", + "ff7575", + "ff7a7a", + "ff8080", + "ff8585", + "ff8a8a", + "ff8f8f", + "ff9494", + "ff9999", + "ff9e9e", + "ffa3a3", + "ffa8a8", + "ffadad", + "ffb3b3", + "ffb8b8", + "ffbdbd", + "ffc2c2", + "ffc7c7", + "ffcccc", + "ffd1d1", + "ffd6d6", + "ffdbdb", + "ffe0e0", + "ffe5e5", + "ffebeb", + "fff0f0", + "fff5f5", + "fffafa", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", +]; +var BRIGHTENS = [ + "ff0000", + "ff0303", + "ff0505", + "ff0808", + "ff0a0a", + "ff0d0d", + "ff0f0f", + "ff1212", + "ff1414", + "ff1717", + "ff1919", + "ff1c1c", + "ff1f1f", + "ff2121", + "ff2424", + "ff2626", + "ff2929", + "ff2b2b", + "ff2e2e", + "ff3030", + "ff3333", + "ff3636", + "ff3838", + "ff3b3b", + "ff3d3d", + "ff4040", + "ff4242", + "ff4545", + "ff4747", + "ff4a4a", + "ff4c4c", + "ff4f4f", + "ff5252", + "ff5454", + "ff5757", + "ff5959", + "ff5c5c", + "ff5e5e", + "ff6161", + "ff6363", + "ff6666", + "ff6969", + "ff6b6b", + "ff6e6e", + "ff7070", + "ff7373", + "ff7575", + "ff7878", + "ff7a7a", + "ff7d7d", + "ff7f7f", + "ff8282", + "ff8585", + "ff8787", + "ff8a8a", + "ff8c8c", + "ff8f8f", + "ff9191", + "ff9494", + "ff9696", + "ff9999", + "ff9c9c", + "ff9e9e", + "ffa1a1", + "ffa3a3", + "ffa6a6", + "ffa8a8", + "ffabab", + "ffadad", + "ffb0b0", + "ffb2b2", + "ffb5b5", + "ffb8b8", + "ffbaba", + "ffbdbd", + "ffbfbf", + "ffc2c2", + "ffc4c4", + "ffc7c7", + "ffc9c9", + "ffcccc", + "ffcfcf", + "ffd1d1", + "ffd4d4", + "ffd6d6", + "ffd9d9", + "ffdbdb", + "ffdede", + "ffe0e0", + "ffe3e3", + "ffe5e5", + "ffe8e8", + "ffebeb", + "ffeded", + "fff0f0", + "fff2f2", + "fff5f5", + "fff7f7", + "fffafa", + "fffcfc", + "ffffff", +]; +var DARKENS = [ + "ff0000", + "fa0000", + "f50000", + "f00000", + "eb0000", + "e60000", + "e00000", + "db0000", + "d60000", + "d10000", + "cc0000", + "c70000", + "c20000", + "bd0000", + "b80000", + "b30000", + "ad0000", + "a80000", + "a30000", + "9e0000", + "990000", + "940000", + "8f0000", + "8a0000", + "850000", + "800000", + "7a0000", + "750000", + "700000", + "6b0000", + "660000", + "610000", + "5c0000", + "570000", + "520000", + "4d0000", + "470000", + "420000", + "3d0000", + "380000", + "330000", + "2e0000", + "290000", + "240000", + "1f0000", + "190000", + "140000", + "0f0000", + "0a0000", + "050000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", +]; + +Deno.test("Modifications", function () { + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").desaturate(i).toHex(), + DESATURATIONS[i], + "Desaturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").saturate(i).toHex(), + SATURATIONS[i], + "Saturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").lighten(i).toHex(), + LIGHTENS[i], + "Lighten " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").brighten(i).toHex(), + BRIGHTENS[i], + "Brighter " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").darken(i).toHex(), + DARKENS[i], + "Darken " + i + " works" + ); + } + + assertEquals( + tinycolor("red").greyscale().toHex(), + "808080", + "Greyscale works" + ); +}); + +Deno.test("Spin", function () { + assertEquals( + Math.round(tinycolor("#f00").spin(-1234).toHsl().h), + 206, + "Spinning -1234 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-360).toHsl().h), + 0, + "Spinning -360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-120).toHsl().h), + 240, + "Spinning -120 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(0).toHsl().h), + 0, + "Spinning 0 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(10).toHsl().h), + 10, + "Spinning 10 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(360).toHsl().h), + 0, + "Spinning 360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(2345).toHsl().h), + 185, + "Spinning 2345 works" + ); + + [-360, 0, 360].forEach(function (delta) { + Object.keys(tinycolor.names).forEach(function (name) { + assertEquals( + tinycolor(name).toHex(), + tinycolor(name).spin(delta).toHex(), + "Spinning " + delta.toString() + " has no effect" + ); + }); + }); +}); + +Deno.test("Mix", function () { + // amount 0 or none + assertEquals( + tinycolor.mix("#000", "#fff").toHsl().l, + 0.5, + "Mixing without amount works" + ); + assertEquals( + tinycolor.mix("#f00", "#000", 0).toHex(), + "ff0000", + "Mixing with 0 amount works" + ); + // This case checks the the problem with floating point numbers (eg 255/90) + assertEquals( + tinycolor.mix("#fff", "#000", 90).toHex(), + "1a1a1a", + "Mixing with 90 amount works correctly" + ); + + // black and white + for (var i = 0; i < 100; i++) { + assertEquals( + Math.round(tinycolor.mix("#000", "#fff", i).toHsl().l * 100) / 100, + i / 100, + "Mixing black and white with " + i + " amount works" + ); + } + + // with colors + for (var i = 0; i < 100; i++) { + var new_hex = Math.round((255 * (100 - i)) / 100).toString(16); + + if (new_hex.length === 1) { + new_hex = "0" + new_hex; + } + + assertEquals( + tinycolor.mix("#f00", "#000", i).toHex(), + new_hex + "0000", + "Mixing " + i + " (red channel)" + ); + assertEquals( + tinycolor.mix("#0f0", "#000", i).toHex(), + "00" + new_hex + "00", + "Mixing " + i + " (green channel)" + ); + assertEquals( + tinycolor.mix("#00f", "#000", i).toHex(), + "0000" + new_hex, + "Mixing " + i + " (blue channel)" + ); + assertEquals( + tinycolor.mix(tinycolor("transparent"), "#000", i).toRgb().a, + i / 100, + "Mixing " + i + " (alpha channel)" + ); + } +}); + +// The combination tests need to be expanded furthe + +function colorsToHexString(colors) { + return colors + .map(function (c) { + return c.toHex(); + }) + .join(","); +} + +Deno.test("complement", function () { + var complementDoesntModifyInstance = tinycolor("red"); + assertEquals( + complementDoesntModifyInstance.complement().toHex(), + "00ffff", + "Complement works" + ); + assertEquals( + complementDoesntModifyInstance.toHex(), + "ff0000", + "Complement did not modify this color" + ); +}); + +Deno.test("analogous", function () { + var combination = tinycolor("red").analogous(); + assertEquals( + colorsToHexString(combination), + "ff0000,ff0066,ff0033,ff0000,ff3300,ff6600", + "Correct Combination" + ); +}); + +Deno.test("monochromatic", function () { + var combination = tinycolor("red").monochromatic(); + assertEquals( + colorsToHexString(combination), + "ff0000,2a0000,550000,800000,aa0000,d40000", + "Correct Combination" + ); +}); + +Deno.test("splitcomplement", function () { + var combination = tinycolor("red").splitcomplement(); + assertEquals( + colorsToHexString(combination), + "ff0000,ccff00,0066ff", + "Correct Combination" + ); +}); + +Deno.test("triad", function () { + var combination = tinycolor("red").triad(); + assertEquals( + colorsToHexString(combination), + "ff0000,00ff00,0000ff", + "Correct Combination" + ); +}); + +Deno.test("tetrad", function () { + var combination = tinycolor("red").tetrad(); + assertEquals( + colorsToHexString(combination), + "ff0000,80ff00,00ffff,7f00ff", + "Correct Combination" + ); +}); + +Deno.test({ + name: "polyad", + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + ignore: true, + fn: function () { + assertThrows(() => { + tinycolor("red").polyad(); + }); + assertThrows(() => { + tinycolor("red").polyad(-1); + }); + assertThrows(() => { + tinycolor("red").polyad("invalid"); + }); + assertEquals(colorsToHexString(tinycolor("red").polyad(1)), "ff0000"); + assertEquals(colorsToHexString(tinycolor("red").polyad("1")), "ff0000"); + assertEquals( + colorsToHexString(tinycolor("red").polyad(2)), + "ff0000,00ffff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(3)), + "ff0000,00ff00,0000ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(4)), + "ff0000,80ff00,00ffff,7f00ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(5)), + "ff0000,ccff00,00ff66,0066ff,cc00ff" + ); + }, +}); + + runDenoTests(); +})(); diff --git a/node_modules/tinycolor2/cjs/test_template.js b/node_modules/tinycolor2/cjs/test_template.js new file mode 100644 index 00000000..d170c2cd --- /dev/null +++ b/node_modules/tinycolor2/cjs/test_template.js @@ -0,0 +1,26 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +const tinycolor = require("./tinycolor.js"); +const { Deno, testDefinitions } = require("@deno/shim-deno-test"); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} +(async () => { + const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" + ); + + // CONTENT_GOES_HERE + + runDenoTests(); +})(); diff --git a/node_modules/tinycolor2/cjs/tinycolor.js b/node_modules/tinycolor2/cjs/tinycolor.js new file mode 100644 index 00000000..4f584cab --- /dev/null +++ b/node_modules/tinycolor2/cjs/tinycolor.js @@ -0,0 +1,1188 @@ +// This file is autogenerated. It's used to publish CJS to npm. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory()); +})(this, (function () { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + // https://github.com/bgrins/TinyColor + // Brian Grinstead, MIT License + + var trimLeft = /^\s+/; + var trimRight = /\s+$/; + function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; + + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) { + return color; + } + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) { + return new tinycolor(color, opts); + } + var rgb = inputToRGB(color); + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); + this._ok = rgb.ok; + } + tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; + }, + isLight: function isLight() { + return !this.isDark(); + }, + isValid: function isValid() { + return this._ok; + }, + getOriginalInput: function getOriginalInput() { + return this._originalInput; + }, + getFormat: function getFormat() { + return this._format; + }, + getAlpha: function getAlpha() { + return this._a; + }, + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + }, + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; + }, + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; + }, + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), + s = Math.round(hsv.s * 100), + v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; + }, + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; + }, + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), + s = Math.round(hsl.s * 100), + l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; + }, + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); + }, + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); + }, + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; + }, + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; + }, + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function toName() { + if (this._a === 0) { + return "transparent"; + } + if (this._a < 1) { + return false; + } + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; + }, + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); + } + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + return formattedString || this.toHexString(); + }, + clone: function clone() { + return tinycolor(this.toString()); + }, + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [this].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; + }, + lighten: function lighten() { + return this._applyModification(_lighten, arguments); + }, + brighten: function brighten() { + return this._applyModification(_brighten, arguments); + }, + darken: function darken() { + return this._applyModification(_darken, arguments); + }, + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); + }, + saturate: function saturate() { + return this._applyModification(_saturate, arguments); + }, + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); + }, + spin: function spin() { + return this._applyModification(_spin, arguments); + }, + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); + }, + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); + }, + complement: function complement() { + return this._applyCombination(_complement, arguments); + }, + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); + }, + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); + }, + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [3]); + }, + tetrad: function tetrad() { + return this._applyCombination(polyad, [4]); + } + }; + + // If input is an object, force 1 into "1.0" to handle ratios properly + // String input requires "1.0" as input, so 1 will be treated as 1 + tinycolor.fromRatio = function (color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + return tinycolor(color, opts); + }; + + // Given a string or object, convert that input to RGB + // Possible string inputs: + // + // "red" + // "#f00" or "f00" + // "#ff0000" or "ff0000" + // "#ff000000" or "ff000000" + // "rgb 255 0 0" or "rgb (255, 0, 0)" + // "rgb 1.0 0 0" or "rgb (1, 0, 0)" + // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" + // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" + // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" + // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" + // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" + // + function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; + if (typeof color == "string") { + color = stringInputToObject(color); + } + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + a = boundAlpha(a); + return { + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a + }; + } + + // Conversion Functions + // -------------------- + + // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: + // + + // `rgbToRgb` + // Handle bounds / percentage checking to conform to CSS color spec + // + // *Assumes:* r, g, b in [0, 255] or [0, 1] + // *Returns:* { r, g, b } in [0, 255] + function rgbToRgb(r, g, b) { + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; + } + + // `rgbToHsl` + // Converts an RGB color value to HSL. + // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] + // *Returns:* { h, s, l } in [0,1] + function rgbToHsl(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + l = (max + min) / 2; + if (max == min) { + h = s = 0; // achromatic + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + l: l + }; + } + + // `hslToRgb` + // Converts an HSL color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hslToRgb(h, s, l) { + var r, g, b; + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + + // `rgbToHsv` + // Converts an RGB color value to HSV + // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] + // *Returns:* { h, s, v } in [0,1] + function rgbToHsv(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + v = max; + var d = max - min; + s = max === 0 ? 0 : d / max; + if (max == min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + v: v + }; + } + + // `hsvToRgb` + // Converts an HSV color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + var i = Math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + + // `rgbToHex` + // Converts an RGB color to hex + // Assumes r, g, and b are contained in the set [0, 255] + // Returns a 3 or 6 character hex + function rgbToHex(r, g, b, allow3Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + return hex.join(""); + } + + // `rgbaToHex` + // Converts an RGBA color plus alpha transparency to hex + // Assumes r, g, b are contained in the set [0, 255] and + // a in [0, 1]. Returns a 4 or 8 character rgba hex + function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; + + // Return a 4 character hex if possible + if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + } + return hex.join(""); + } + + // `rgbaToArgbHex` + // Converts an RGBA color to an ARGB Hex8 string + // Rarely used, but required for "toFilter()" + function rgbaToArgbHex(r, g, b, a) { + var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + return hex.join(""); + } + + // `equals` + // Can be called with any tinycolor input + tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) return false; + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); + }; + tinycolor.random = function () { + return tinycolor.fromRatio({ + r: Math.random(), + g: Math.random(), + b: Math.random() + }); + }; + + // Modification Functions + // ---------------------- + // Thanks to less.js for some of the basics here + // + + function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _greyscale(color) { + return tinycolor(color).desaturate(100); + } + function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var rgb = tinycolor(color).toRgb(); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); + return tinycolor(rgb); + } + function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + + // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. + // Values outside of this range will be wrapped into this range. + function _spin(color, amount) { + var hsl = tinycolor(color).toHsl(); + var hue = (hsl.h + amount) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return tinycolor(hsl); + } + + // Combination Functions + // --------------------- + // Thanks to jQuery xColor for some of the ideas behind these + // + + function _complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); + } + function polyad(color, number) { + if (isNaN(number) || number <= 0) { + throw new Error("Argument to polyad must be a positive number"); + } + var hsl = tinycolor(color).toHsl(); + var result = [tinycolor(color)]; + var step = 360 / number; + for (var i = 1; i < number; i++) { + result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + } + return result; + } + function _splitcomplement(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [tinycolor(color), tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + })]; + } + function _analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; + } + function _monochromatic(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, + s = hsv.s, + v = hsv.v; + var ret = []; + var modification = 1 / results; + while (results--) { + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; + } + return ret; + } + + // Utility Functions + // --------------------- + + tinycolor.mix = function (color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; + var rgb1 = tinycolor(color1).toRgb(); + var rgb2 = tinycolor(color2).toRgb(); + var p = amount / 100; + var rgba = { + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a + }; + return tinycolor(rgba); + }; + + // Readability Functions + // --------------------- + // false + // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false + tinycolor.isReadable = function (color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; + out = false; + wcag2Parms = validateWCAG2Parms(wcag2); + switch (wcag2Parms.level + wcag2Parms.size) { + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; + } + return out; + }; + + // `mostReadable` + // Given a base color and a list of possible foreground or background + // colors for that base, returns the most readable color. + // Optionally returns Black or White if the most readable color is unreadable. + // *Example* + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" + tinycolor.mostReadable = function (baseColor, colorList, args) { + var bestColor = null; + var bestScore = 0; + var readability; + var includeFallbackColors, level, size; + args = args || {}; + includeFallbackColors = args.includeFallbackColors; + level = args.level; + size = args.size; + for (var i = 0; i < colorList.length; i++) { + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } + } + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) { + return bestColor; + } else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); + } + }; + + // Big List of Colors + // ------------------ + // + var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + rebeccapurple: "663399", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" + }; + + // Make it easy to access colors via `hexNames[hex]` + var hexNames = tinycolor.hexNames = flip(names); + + // Utilities + // --------- + + // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` + function flip(o) { + var flipped = {}; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; + } + + // Return a valid alpha value [0,1] with all invalid values being set to 1 + function boundAlpha(a) { + a = parseFloat(a); + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + return a; + } + + // Take input from [0, n] and return it as [0, 1] + function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; + var processPercent = isPercentage(n); + n = Math.min(max, Math.max(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if (Math.abs(n - max) < 0.000001) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return n % max / parseFloat(max); + } + + // Force a number between 0 and 1 + function clamp01(val) { + return Math.min(1, Math.max(0, val)); + } + + // Parse a base-16 hex value into a base-10 integer + function parseIntFromHex(val) { + return parseInt(val, 16); + } + + // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 + // + function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; + } + + // Check to see if string passed in is a percentage + function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; + } + + // Force a hex value to have 2 characters + function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; + } + + // Replace a decimal with it's percentage value + function convertToPercentage(n) { + if (n <= 1) { + n = n * 100 + "%"; + } + return n; + } + + // Converts a decimal to a hex value + function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); + } + // Converts a hex value to a decimal + function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; + } + var matchers = function () { + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + return { + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; + }(); + + // `isValidCSSUnit` + // Take in a single string / number and check to see if it looks like a CSS unit + // (see `matchers` above for definition). + function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); + } + + // `stringInputToObject` + // Permissive string parsing. Take in a number of formats, and output an object + // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` + function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } else if (color == "transparent") { + return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if (match = matchers.rgb.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3] + }; + } + if (match = matchers.rgba.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; + } + if (match = matchers.hsl.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3] + }; + } + if (match = matchers.hsla.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; + } + if (match = matchers.hsv.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3] + }; + } + if (match = matchers.hsva.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; + } + if (match = matchers.hex8.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex6.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; + } + if (match = matchers.hex4.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex3.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; + } + return false; + } + function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + var level, size; + parms = parms || { + level: "AA", + size: "small" + }; + level = (parms.level || "AA").toUpperCase(); + size = (parms.size || "small").toLowerCase(); + if (level !== "AA" && level !== "AAA") { + level = "AA"; + } + if (size !== "small" && size !== "large") { + size = "small"; + } + return { + level: level, + size: size + }; + } + + return tinycolor; + +})); diff --git a/node_modules/tinycolor2/deno_asserts@0.168.0.mjs b/node_modules/tinycolor2/deno_asserts@0.168.0.mjs new file mode 100644 index 00000000..685fdd20 --- /dev/null +++ b/node_modules/tinycolor2/deno_asserts@0.168.0.mjs @@ -0,0 +1,807 @@ +// deno-fmt-ignore-file +// deno-lint-ignore-file +// This code was bundled using `deno bundle` and it's not recommended to edit it manually +// Using `deno bundle https://deno.land/std@0.168.0/testing/asserts.ts > npm/deno_asserts@0.168.0.mjs` + +const { Deno } = globalThis; +const noColor = typeof Deno?.noColor === "boolean" ? Deno.noColor : true; +let enabled = !noColor; +function code(open, close) { + return { + open: `\x1b[${open.join(";")}m`, + close: `\x1b[${close}m`, + regexp: new RegExp(`\\x1b\\[${close}m`, "g") + }; +} +function run(str, code) { + return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str; +} +function bold(str) { + return run(str, code([ + 1 + ], 22)); +} +function red(str) { + return run(str, code([ + 31 + ], 39)); +} +function green(str) { + return run(str, code([ + 32 + ], 39)); +} +function white(str) { + return run(str, code([ + 37 + ], 39)); +} +function gray(str) { + return brightBlack(str); +} +function brightBlack(str) { + return run(str, code([ + 90 + ], 39)); +} +function bgRed(str) { + return run(str, code([ + 41 + ], 49)); +} +function bgGreen(str) { + return run(str, code([ + 42 + ], 49)); +} +const ANSI_PATTERN = new RegExp([ + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))" +].join("|"), "g"); +function stripColor(string) { + return string.replace(ANSI_PATTERN, ""); +} +var DiffType; +(function(DiffType) { + DiffType["removed"] = "removed"; + DiffType["common"] = "common"; + DiffType["added"] = "added"; +})(DiffType || (DiffType = {})); +const REMOVED = 1; +const COMMON = 2; +const ADDED = 3; +function createCommon(A, B, reverse) { + const common = []; + if (A.length === 0 || B.length === 0) return []; + for(let i = 0; i < Math.min(A.length, B.length); i += 1){ + if (A[reverse ? A.length - i - 1 : i] === B[reverse ? B.length - i - 1 : i]) { + common.push(A[reverse ? A.length - i - 1 : i]); + } else { + return common; + } + } + return common; +} +function diff(A, B) { + const prefixCommon = createCommon(A, B); + const suffixCommon = createCommon(A.slice(prefixCommon.length), B.slice(prefixCommon.length), true).reverse(); + A = suffixCommon.length ? A.slice(prefixCommon.length, -suffixCommon.length) : A.slice(prefixCommon.length); + B = suffixCommon.length ? B.slice(prefixCommon.length, -suffixCommon.length) : B.slice(prefixCommon.length); + const swapped = B.length > A.length; + [A, B] = swapped ? [ + B, + A + ] : [ + A, + B + ]; + const M = A.length; + const N = B.length; + if (!M && !N && !suffixCommon.length && !prefixCommon.length) return []; + if (!N) { + return [ + ...prefixCommon.map((c)=>({ + type: DiffType.common, + value: c + })), + ...A.map((a)=>({ + type: swapped ? DiffType.added : DiffType.removed, + value: a + })), + ...suffixCommon.map((c)=>({ + type: DiffType.common, + value: c + })) + ]; + } + const offset = N; + const delta = M - N; + const size = M + N + 1; + const fp = Array.from({ + length: size + }, ()=>({ + y: -1, + id: -1 + })); + const routes = new Uint32Array((M * N + size + 1) * 2); + const diffTypesPtrOffset = routes.length / 2; + let ptr = 0; + let p = -1; + function backTrace(A, B, current, swapped) { + const M = A.length; + const N = B.length; + const result = []; + let a = M - 1; + let b = N - 1; + let j = routes[current.id]; + let type = routes[current.id + diffTypesPtrOffset]; + while(true){ + if (!j && !type) break; + const prev = j; + if (type === 1) { + result.unshift({ + type: swapped ? DiffType.removed : DiffType.added, + value: B[b] + }); + b -= 1; + } else if (type === 3) { + result.unshift({ + type: swapped ? DiffType.added : DiffType.removed, + value: A[a] + }); + a -= 1; + } else { + result.unshift({ + type: DiffType.common, + value: A[a] + }); + a -= 1; + b -= 1; + } + j = routes[prev]; + type = routes[prev + diffTypesPtrOffset]; + } + return result; + } + function createFP(slide, down, k, M) { + if (slide && slide.y === -1 && down && down.y === -1) { + return { + y: 0, + id: 0 + }; + } + if (down && down.y === -1 || k === M || (slide && slide.y) > (down && down.y) + 1) { + const prev = slide.id; + ptr++; + routes[ptr] = prev; + routes[ptr + diffTypesPtrOffset] = ADDED; + return { + y: slide.y, + id: ptr + }; + } else { + const prev1 = down.id; + ptr++; + routes[ptr] = prev1; + routes[ptr + diffTypesPtrOffset] = REMOVED; + return { + y: down.y + 1, + id: ptr + }; + } + } + function snake(k, slide, down, _offset, A, B) { + const M = A.length; + const N = B.length; + if (k < -N || M < k) return { + y: -1, + id: -1 + }; + const fp = createFP(slide, down, k, M); + while(fp.y + k < M && fp.y < N && A[fp.y + k] === B[fp.y]){ + const prev = fp.id; + ptr++; + fp.id = ptr; + fp.y += 1; + routes[ptr] = prev; + routes[ptr + diffTypesPtrOffset] = COMMON; + } + return fp; + } + while(fp[delta + offset].y < N){ + p = p + 1; + for(let k = -p; k < delta; ++k){ + fp[k + offset] = snake(k, fp[k - 1 + offset], fp[k + 1 + offset], offset, A, B); + } + for(let k1 = delta + p; k1 > delta; --k1){ + fp[k1 + offset] = snake(k1, fp[k1 - 1 + offset], fp[k1 + 1 + offset], offset, A, B); + } + fp[delta + offset] = snake(delta, fp[delta - 1 + offset], fp[delta + 1 + offset], offset, A, B); + } + return [ + ...prefixCommon.map((c)=>({ + type: DiffType.common, + value: c + })), + ...backTrace(A, B, fp[delta + offset], swapped), + ...suffixCommon.map((c)=>({ + type: DiffType.common, + value: c + })) + ]; +} +function diffstr(A, B) { + function unescape(string) { + return string.replaceAll("\b", "\\b").replaceAll("\f", "\\f").replaceAll("\t", "\\t").replaceAll("\v", "\\v").replaceAll(/\r\n|\r|\n/g, (str)=>str === "\r" ? "\\r" : str === "\n" ? "\\n\n" : "\\r\\n\r\n"); + } + function tokenize(string, { wordDiff =false } = {}) { + if (wordDiff) { + const tokens = string.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); + const words = /^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u; + for(let i = 0; i < tokens.length - 1; i++){ + if (!tokens[i + 1] && tokens[i + 2] && words.test(tokens[i]) && words.test(tokens[i + 2])) { + tokens[i] += tokens[i + 2]; + tokens.splice(i + 1, 2); + i--; + } + } + return tokens.filter((token)=>token); + } else { + const tokens1 = [], lines = string.split(/(\n|\r\n)/); + if (!lines[lines.length - 1]) { + lines.pop(); + } + for(let i1 = 0; i1 < lines.length; i1++){ + if (i1 % 2) { + tokens1[tokens1.length - 1] += lines[i1]; + } else { + tokens1.push(lines[i1]); + } + } + return tokens1; + } + } + function createDetails(line, tokens) { + return tokens.filter(({ type })=>type === line.type || type === DiffType.common).map((result, i, t)=>{ + if (result.type === DiffType.common && t[i - 1] && t[i - 1]?.type === t[i + 1]?.type && /\s+/.test(result.value)) { + result.type = t[i - 1].type; + } + return result; + }); + } + const diffResult = diff(tokenize(`${unescape(A)}\n`), tokenize(`${unescape(B)}\n`)); + const added = [], removed = []; + for (const result of diffResult){ + if (result.type === DiffType.added) { + added.push(result); + } + if (result.type === DiffType.removed) { + removed.push(result); + } + } + const aLines = added.length < removed.length ? added : removed; + const bLines = aLines === removed ? added : removed; + for (const a of aLines){ + let tokens = [], b; + while(bLines.length){ + b = bLines.shift(); + tokens = diff(tokenize(a.value, { + wordDiff: true + }), tokenize(b?.value ?? "", { + wordDiff: true + })); + if (tokens.some(({ type , value })=>type === DiffType.common && value.trim().length)) { + break; + } + } + a.details = createDetails(a, tokens); + if (b) { + b.details = createDetails(b, tokens); + } + } + return diffResult; +} +function createColor(diffType, { background =false } = {}) { + background = false; + switch(diffType){ + case DiffType.added: + return (s)=>background ? bgGreen(white(s)) : green(bold(s)); + case DiffType.removed: + return (s)=>background ? bgRed(white(s)) : red(bold(s)); + default: + return white; + } +} +function createSign(diffType) { + switch(diffType){ + case DiffType.added: + return "+ "; + case DiffType.removed: + return "- "; + default: + return " "; + } +} +function buildMessage(diffResult, { stringDiff =false } = {}) { + const messages = [], diffMessages = []; + messages.push(""); + messages.push(""); + messages.push(` ${gray(bold("[Diff]"))} ${red(bold("Actual"))} / ${green(bold("Expected"))}`); + messages.push(""); + messages.push(""); + diffResult.forEach((result)=>{ + const c = createColor(result.type); + const line = result.details?.map((detail)=>detail.type !== DiffType.common ? createColor(detail.type, { + background: true + })(detail.value) : detail.value).join("") ?? result.value; + diffMessages.push(c(`${createSign(result.type)}${line}`)); + }); + messages.push(...stringDiff ? [ + diffMessages.join("") + ] : diffMessages); + messages.push(""); + return messages; +} +function format(v) { + const { Deno } = globalThis; + return typeof Deno?.inspect === "function" ? Deno.inspect(v, { + depth: Infinity, + sorted: true, + trailingComma: true, + compact: false, + iterableLimit: Infinity, + getters: true + }) : `"${String(v).replace(/(?=["\\])/g, "\\")}"`; +} +const CAN_NOT_DISPLAY = "[Cannot display]"; +class AssertionError extends Error { + name = "AssertionError"; + constructor(message){ + super(message); + } +} +function isKeyedCollection(x) { + return [ + Symbol.iterator, + "size" + ].every((k)=>k in x); +} +function equal(c, d) { + const seen = new Map(); + return function compare(a, b) { + if (a && b && (a instanceof RegExp && b instanceof RegExp || a instanceof URL && b instanceof URL)) { + return String(a) === String(b); + } + if (a instanceof Date && b instanceof Date) { + const aTime = a.getTime(); + const bTime = b.getTime(); + if (Number.isNaN(aTime) && Number.isNaN(bTime)) { + return true; + } + return aTime === bTime; + } + if (typeof a === "number" && typeof b === "number") { + return Number.isNaN(a) && Number.isNaN(b) || a === b; + } + if (Object.is(a, b)) { + return true; + } + if (a && typeof a === "object" && b && typeof b === "object") { + if (a && b && !constructorsEqual(a, b)) { + return false; + } + if (a instanceof WeakMap || b instanceof WeakMap) { + if (!(a instanceof WeakMap && b instanceof WeakMap)) return false; + throw new TypeError("cannot compare WeakMap instances"); + } + if (a instanceof WeakSet || b instanceof WeakSet) { + if (!(a instanceof WeakSet && b instanceof WeakSet)) return false; + throw new TypeError("cannot compare WeakSet instances"); + } + if (seen.get(a) === b) { + return true; + } + if (Object.keys(a || {}).length !== Object.keys(b || {}).length) { + return false; + } + seen.set(a, b); + if (isKeyedCollection(a) && isKeyedCollection(b)) { + if (a.size !== b.size) { + return false; + } + let unmatchedEntries = a.size; + for (const [aKey, aValue] of a.entries()){ + for (const [bKey, bValue] of b.entries()){ + if (aKey === aValue && bKey === bValue && compare(aKey, bKey) || compare(aKey, bKey) && compare(aValue, bValue)) { + unmatchedEntries--; + break; + } + } + } + return unmatchedEntries === 0; + } + const merged = { + ...a, + ...b + }; + for (const key of [ + ...Object.getOwnPropertyNames(merged), + ...Object.getOwnPropertySymbols(merged) + ]){ + if (!compare(a && a[key], b && b[key])) { + return false; + } + if (key in a && !(key in b) || key in b && !(key in a)) { + return false; + } + } + if (a instanceof WeakRef || b instanceof WeakRef) { + if (!(a instanceof WeakRef && b instanceof WeakRef)) return false; + return compare(a.deref(), b.deref()); + } + return true; + } + return false; + }(c, d); +} +function constructorsEqual(a, b) { + return a.constructor === b.constructor || a.constructor === Object && !b.constructor || !a.constructor && b.constructor === Object; +} +function assert(expr, msg = "") { + if (!expr) { + throw new AssertionError(msg); + } +} +function assertFalse(expr, msg = "") { + if (expr) { + throw new AssertionError(msg); + } +} +function assertEquals(actual, expected, msg) { + if (equal(actual, expected)) { + return; + } + let message = ""; + const actualString = format(actual); + const expectedString = format(expected); + try { + const stringDiff = typeof actual === "string" && typeof expected === "string"; + const diffResult = stringDiff ? diffstr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")); + const diffMsg = buildMessage(diffResult, { + stringDiff + }).join("\n"); + message = `Values are not equal:\n${diffMsg}`; + } catch { + message = `\n${red(CAN_NOT_DISPLAY)} + \n\n`; + } + if (msg) { + message = msg; + } + throw new AssertionError(message); +} +function assertNotEquals(actual, expected, msg) { + if (!equal(actual, expected)) { + return; + } + let actualString; + let expectedString; + try { + actualString = String(actual); + } catch { + actualString = "[Cannot display]"; + } + try { + expectedString = String(expected); + } catch { + expectedString = "[Cannot display]"; + } + if (!msg) { + msg = `actual: ${actualString} expected not to be: ${expectedString}`; + } + throw new AssertionError(msg); +} +function assertStrictEquals(actual, expected, msg) { + if (Object.is(actual, expected)) { + return; + } + let message; + if (msg) { + message = msg; + } else { + const actualString = format(actual); + const expectedString = format(expected); + if (actualString === expectedString) { + const withOffset = actualString.split("\n").map((l)=>` ${l}`).join("\n"); + message = `Values have the same structure but are not reference-equal:\n\n${red(withOffset)}\n`; + } else { + try { + const stringDiff = typeof actual === "string" && typeof expected === "string"; + const diffResult = stringDiff ? diffstr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")); + const diffMsg = buildMessage(diffResult, { + stringDiff + }).join("\n"); + message = `Values are not strictly equal:\n${diffMsg}`; + } catch { + message = `\n${red(CAN_NOT_DISPLAY)} + \n\n`; + } + } + } + throw new AssertionError(message); +} +function assertNotStrictEquals(actual, expected, msg) { + if (!Object.is(actual, expected)) { + return; + } + throw new AssertionError(msg ?? `Expected "actual" to be strictly unequal to: ${format(actual)}\n`); +} +function assertAlmostEquals(actual, expected, tolerance = 1e-7, msg) { + if (Object.is(actual, expected)) { + return; + } + const delta = Math.abs(expected - actual); + if (delta <= tolerance) { + return; + } + const f = (n)=>Number.isInteger(n) ? n : n.toExponential(); + throw new AssertionError(msg ?? `actual: "${f(actual)}" expected to be close to "${f(expected)}": \ +delta "${f(delta)}" is greater than "${f(tolerance)}"`); +} +function assertInstanceOf(actual, expectedType, msg = "") { + if (!msg) { + const expectedTypeStr = expectedType.name; + let actualTypeStr = ""; + if (actual === null) { + actualTypeStr = "null"; + } else if (actual === undefined) { + actualTypeStr = "undefined"; + } else if (typeof actual === "object") { + actualTypeStr = actual.constructor?.name ?? "Object"; + } else { + actualTypeStr = typeof actual; + } + if (expectedTypeStr == actualTypeStr) { + msg = `Expected object to be an instance of "${expectedTypeStr}".`; + } else if (actualTypeStr == "function") { + msg = `Expected object to be an instance of "${expectedTypeStr}" but was not an instanced object.`; + } else { + msg = `Expected object to be an instance of "${expectedTypeStr}" but was "${actualTypeStr}".`; + } + } + assert(actual instanceof expectedType, msg); +} +function assertNotInstanceOf(actual, unexpectedType, msg = `Expected object to not be an instance of "${typeof unexpectedType}"`) { + assertFalse(actual instanceof unexpectedType, msg); +} +function assertExists(actual, msg) { + if (actual === undefined || actual === null) { + if (!msg) { + msg = `actual: "${actual}" expected to not be null or undefined`; + } + throw new AssertionError(msg); + } +} +function assertStringIncludes(actual, expected, msg) { + if (!actual.includes(expected)) { + if (!msg) { + msg = `actual: "${actual}" expected to contain: "${expected}"`; + } + throw new AssertionError(msg); + } +} +function assertArrayIncludes(actual, expected, msg) { + const missing = []; + for(let i = 0; i < expected.length; i++){ + let found = false; + for(let j = 0; j < actual.length; j++){ + if (equal(expected[i], actual[j])) { + found = true; + break; + } + } + if (!found) { + missing.push(expected[i]); + } + } + if (missing.length === 0) { + return; + } + if (!msg) { + msg = `actual: "${format(actual)}" expected to include: "${format(expected)}"\nmissing: ${format(missing)}`; + } + throw new AssertionError(msg); +} +function assertMatch(actual, expected, msg) { + if (!expected.test(actual)) { + if (!msg) { + msg = `actual: "${actual}" expected to match: "${expected}"`; + } + throw new AssertionError(msg); + } +} +function assertNotMatch(actual, expected, msg) { + if (expected.test(actual)) { + if (!msg) { + msg = `actual: "${actual}" expected to not match: "${expected}"`; + } + throw new AssertionError(msg); + } +} +function assertObjectMatch(actual, expected) { + function filter(a, b) { + const seen = new WeakMap(); + return fn(a, b); + function fn(a, b) { + if (seen.has(a) && seen.get(a) === b) { + return a; + } + seen.set(a, b); + const filtered = {}; + const entries = [ + ...Object.getOwnPropertyNames(a), + ...Object.getOwnPropertySymbols(a) + ].filter((key)=>key in b).map((key)=>[ + key, + a[key] + ]); + for (const [key, value] of entries){ + if (Array.isArray(value)) { + const subset = b[key]; + if (Array.isArray(subset)) { + filtered[key] = fn({ + ...value + }, { + ...subset + }); + continue; + } + } else if (value instanceof RegExp) { + filtered[key] = value; + continue; + } else if (typeof value === "object") { + const subset1 = b[key]; + if (typeof subset1 === "object" && subset1) { + if (value instanceof Map && subset1 instanceof Map) { + filtered[key] = new Map([ + ...value + ].filter(([k])=>subset1.has(k)).map(([k, v])=>[ + k, + typeof v === "object" ? fn(v, subset1.get(k)) : v + ])); + continue; + } + if (value instanceof Set && subset1 instanceof Set) { + filtered[key] = new Set([ + ...value + ].filter((v)=>subset1.has(v))); + continue; + } + filtered[key] = fn(value, subset1); + continue; + } + } + filtered[key] = value; + } + return filtered; + } + } + return assertEquals(filter(actual, expected), filter(expected, expected)); +} +function fail(msg) { + assert(false, `Failed assertion${msg ? `: ${msg}` : "."}`); +} +function assertIsError(error, ErrorClass, msgIncludes, msg) { + if (error instanceof Error === false) { + throw new AssertionError(`Expected "error" to be an Error object.`); + } + if (ErrorClass && !(error instanceof ErrorClass)) { + msg = `Expected error to be instance of "${ErrorClass.name}", but was "${typeof error === "object" ? error?.constructor?.name : "[not an object]"}"${msg ? `: ${msg}` : "."}`; + throw new AssertionError(msg); + } + if (msgIncludes && (!(error instanceof Error) || !stripColor(error.message).includes(stripColor(msgIncludes)))) { + msg = `Expected error message to include "${msgIncludes}", but got "${error instanceof Error ? error.message : "[not an Error]"}"${msg ? `: ${msg}` : "."}`; + throw new AssertionError(msg); + } +} +function assertThrows(fn, errorClassOrMsg, msgIncludesOrMsg, msg) { + let ErrorClass = undefined; + let msgIncludes = undefined; + let err; + if (typeof errorClassOrMsg !== "string") { + if (errorClassOrMsg === undefined || errorClassOrMsg.prototype instanceof Error || errorClassOrMsg.prototype === Error.prototype) { + ErrorClass = errorClassOrMsg; + msgIncludes = msgIncludesOrMsg; + } else { + msg = msgIncludesOrMsg; + } + } else { + msg = errorClassOrMsg; + } + let doesThrow = false; + const msgToAppendToError = msg ? `: ${msg}` : "."; + try { + fn(); + } catch (error) { + if (ErrorClass) { + if (error instanceof Error === false) { + throw new AssertionError("A non-Error object was thrown."); + } + assertIsError(error, ErrorClass, msgIncludes, msg); + } + err = error; + doesThrow = true; + } + if (!doesThrow) { + msg = `Expected function to throw${msgToAppendToError}`; + throw new AssertionError(msg); + } + return err; +} +async function assertRejects(fn, errorClassOrMsg, msgIncludesOrMsg, msg) { + let ErrorClass = undefined; + let msgIncludes = undefined; + let err; + if (typeof errorClassOrMsg !== "string") { + if (errorClassOrMsg === undefined || errorClassOrMsg.prototype instanceof Error || errorClassOrMsg.prototype === Error.prototype) { + ErrorClass = errorClassOrMsg; + msgIncludes = msgIncludesOrMsg; + } + } else { + msg = errorClassOrMsg; + } + let doesThrow = false; + let isPromiseReturned = false; + const msgToAppendToError = msg ? `: ${msg}` : "."; + try { + const possiblePromise = fn(); + if (possiblePromise && typeof possiblePromise === "object" && typeof possiblePromise.then === "function") { + isPromiseReturned = true; + await possiblePromise; + } + } catch (error) { + if (!isPromiseReturned) { + throw new AssertionError(`Function throws when expected to reject${msgToAppendToError}`); + } + if (ErrorClass) { + if (error instanceof Error === false) { + throw new AssertionError("A non-Error object was rejected."); + } + assertIsError(error, ErrorClass, msgIncludes, msg); + } + err = error; + doesThrow = true; + } + if (!doesThrow) { + throw new AssertionError(`Expected function to reject${msgToAppendToError}`); + } + return err; +} +function unimplemented(msg) { + throw new AssertionError(msg || "unimplemented"); +} +function unreachable() { + throw new AssertionError("unreachable"); +} +export { AssertionError as AssertionError }; +export { equal as equal }; +export { assert as assert }; +export { assertFalse as assertFalse }; +export { assertEquals as assertEquals }; +export { assertNotEquals as assertNotEquals }; +export { assertStrictEquals as assertStrictEquals }; +export { assertNotStrictEquals as assertNotStrictEquals }; +export { assertAlmostEquals as assertAlmostEquals }; +export { assertInstanceOf as assertInstanceOf }; +export { assertNotInstanceOf as assertNotInstanceOf }; +export { assertExists as assertExists }; +export { assertStringIncludes as assertStringIncludes }; +export { assertArrayIncludes as assertArrayIncludes }; +export { assertMatch as assertMatch }; +export { assertNotMatch as assertNotMatch }; +export { assertObjectMatch as assertObjectMatch }; +export { fail as fail }; +export { assertIsError as assertIsError }; +export { assertThrows as assertThrows }; +export { assertRejects as assertRejects }; +export { unimplemented as unimplemented }; +export { unreachable as unreachable }; + diff --git a/node_modules/tinycolor2/dist/tinycolor-min.js b/node_modules/tinycolor2/dist/tinycolor-min.js new file mode 100644 index 00000000..14389aa1 --- /dev/null +++ b/node_modules/tinycolor2/dist/tinycolor-min.js @@ -0,0 +1,5 @@ +// This file is autogenerated. +// It's here at this path for backwards compatibility for links to it +// but the npm package now exports both CJS and ESM. +// See https://github.com/bgrins/TinyColor/ for instructions. + !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).tinycolor=r()}(this,(function(){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/,e=/\s+$/;function n(a,i){if(i=i||{},(a=a||"")instanceof n)return a;if(!(this instanceof n))return new n(a,i);var o=function(n){var a={r:0,g:0,b:0},i=1,o=null,h=null,s=null,f=!1,u=!1;"string"==typeof n&&(n=function(t){t=t.replace(r,"").replace(e,"").toLowerCase();var n,a=!1;if(y[t])t=y[t],a=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(n=T.rgb.exec(t))return{r:n[1],g:n[2],b:n[3]};if(n=T.rgba.exec(t))return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=T.hsl.exec(t))return{h:n[1],s:n[2],l:n[3]};if(n=T.hsla.exec(t))return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=T.hsv.exec(t))return{h:n[1],s:n[2],v:n[3]};if(n=T.hsva.exec(t))return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=T.hex8.exec(t))return{r:w(n[1]),g:w(n[2]),b:w(n[3]),a:F(n[4]),format:a?"name":"hex8"};if(n=T.hex6.exec(t))return{r:w(n[1]),g:w(n[2]),b:w(n[3]),format:a?"name":"hex"};if(n=T.hex4.exec(t))return{r:w(n[1]+""+n[1]),g:w(n[2]+""+n[2]),b:w(n[3]+""+n[3]),a:F(n[4]+""+n[4]),format:a?"name":"hex8"};if(n=T.hex3.exec(t))return{r:w(n[1]+""+n[1]),g:w(n[2]+""+n[2]),b:w(n[3]+""+n[3]),format:a?"name":"hex"};return!1}(n));"object"==t(n)&&(E(n.r)&&E(n.g)&&E(n.b)?(l=n.r,c=n.g,d=n.b,a={r:255*A(l,255),g:255*A(c,255),b:255*A(d,255)},f=!0,u="%"===String(n.r).substr(-1)?"prgb":"rgb"):E(n.h)&&E(n.s)&&E(n.v)?(o=H(n.s),h=H(n.v),a=function(t,r,e){t=6*A(t,360),r=A(r,100),e=A(e,100);var n=Math.floor(t),a=t-n,i=e*(1-r),o=e*(1-a*r),h=e*(1-(1-a)*r),s=n%6,f=[e,o,i,i,h,e][s],u=[h,e,e,o,i,i][s],l=[i,i,h,e,e,o][s];return{r:255*f,g:255*u,b:255*l}}(n.h,o,h),f=!0,u="hsv"):E(n.h)&&E(n.s)&&E(n.l)&&(o=H(n.s),s=H(n.l),a=function(t,r,e){var n,a,i;function o(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=A(t,360),r=A(r,100),e=A(e,100),0===r)n=a=i=e;else{var h=e<.5?e*(1+r):e+r-e*r,s=2*e-h;n=o(s,h,t+1/3),a=o(s,h,t),i=o(s,h,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(n.h,o,s),f=!0,u="hsl"),n.hasOwnProperty("a")&&(i=n.a));var l,c,d;return i=x(i),{ok:f,format:n.format||u,r:Math.min(255,Math.max(a.r,0)),g:Math.min(255,Math.max(a.g,0)),b:Math.min(255,Math.max(a.b,0)),a:i}}(a);this._originalInput=a,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=i.format||o.format,this._gradientType=i.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function a(t,r,e){t=A(t,255),r=A(r,255),e=A(e,255);var n,a,i=Math.max(t,r,e),o=Math.min(t,r,e),h=(i+o)/2;if(i==o)n=a=0;else{var s=i-o;switch(a=h>.5?s/(2-i-o):s/(i+o),i){case t:n=(r-e)/s+(r>1)+720)%360;--r;)a.h=(a.h+i)%360,o.push(n(a));return o}function v(t,r){r=r||6;for(var e=n(t).toHsv(),a=e.h,i=e.s,o=e.v,h=[],s=1/r;r--;)h.push(n({h:a,s:i,v:o})),o=(o+s)%1;return h}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,n=this.toRgb();return t=n.r/255,r=n.g/255,e=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=x(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+n+"%)":"hsva("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=a(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,n,a){var i=[S(Math.round(t).toString(16)),S(Math.round(r).toString(16)),S(Math.round(e).toString(16)),S(R(n))];if(a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*A(this._r,255))+"%",g:Math.round(100*A(this._g,255))+"%",b:Math.round(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*A(this._r,255))+"%, "+Math.round(100*A(this._g,255))+"%, "+Math.round(100*A(this._b,255))+"%)":"rgba("+Math.round(100*A(this._r,255))+"%, "+Math.round(100*A(this._g,255))+"%, "+Math.round(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(M[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+h(this._r,this._g,this._b,this._a),e=r,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);e="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+r+",endColorstr="+e+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,n=this._a<1&&this._a>=0;return r||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(l,arguments)},brighten:function(){return this._applyModification(c,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(u,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(_,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(p,arguments)},triad:function(){return this._applyCombination(m,[3])},tetrad:function(){return this._applyCombination(m,[4])}},n.fromRatio=function(r,e){if("object"==t(r)){var a={};for(var i in r)r.hasOwnProperty(i)&&(a[i]="a"===i?r[i]:H(r[i]));r=a}return n(r,e)},n.equals=function(t,r){return!(!t||!r)&&n(t).toRgbString()==n(r).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},n.mix=function(t,r,e){e=0===e?0:e||50;var a=n(t).toRgb(),i=n(r).toRgb(),o=e/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var e=n(t),a=n(r);return(Math.max(e.getLuminance(),a.getLuminance())+.05)/(Math.min(e.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,r,e){var a,i,o=n.readability(t,r);switch(i=!1,(a=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(e)).level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,r,e){var a,i,o,h,s=null,f=0;i=(e=e||{}).includeFallbackColors,o=e.level,h=e.size;for(var u=0;uf&&(f=a,s=n(r[u]));return n.isReadable(t,s,{level:o,size:h})||!i?s:(e.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],e))};var y=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},M=n.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(y);function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function A(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function k(t){return Math.min(1,Math.max(0,t))}function w(t){return parseInt(t,16)}function S(t){return 1==t.length?"0"+t:""+t}function H(t){return t<=1&&(t=100*t+"%"),t}function R(t){return Math.round(255*parseFloat(t)).toString(16)}function F(t){return w(t)/255}var C,q,N,T=(q="[\\s|\\(]+("+(C="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+C+")[,|\\s]+("+C+")\\s*\\)?",N="[\\s|\\(]+("+C+")[,|\\s]+("+C+")[,|\\s]+("+C+")[,|\\s]+("+C+")\\s*\\)?",{CSS_UNIT:new RegExp(C),rgb:new RegExp("rgb"+q),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+q),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+q),hsva:new RegExp("hsva"+N),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function E(t){return!!T.CSS_UNIT.exec(t)}return n})); \ No newline at end of file diff --git a/node_modules/tinycolor2/esm/package.json b/node_modules/tinycolor2/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/tinycolor2/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/tinycolor2/esm/test.js b/node_modules/tinycolor2/esm/test.js new file mode 100644 index 00000000..4f02b0ce --- /dev/null +++ b/node_modules/tinycolor2/esm/test.js @@ -0,0 +1,2189 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +import tinycolor from "./tinycolor.js"; +import { Deno, testDefinitions } from "@deno/shim-deno-test"; +const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" +); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} + +// TEST_BEGINS_HERE + +Deno.test("TinyColor initialization", function () { + assert( + typeof tinycolor != "undefined", + "tinycolor is initialized on the page" + ); + assert( + typeof tinycolor("red") == "object", + "tinycolor is able to be instantiated" + ); + + var r = tinycolor("red"); + assert( + tinycolor(r) === r, + "when given a tinycolor instance, tinycolor() returns it" + ); + assert( + new tinycolor(r) === r, + "when given a tinycolor instance, new tinycolor() returns it" + ); + assertEquals( + tinycolor("red", { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + + var obj = { h: 180, s: 0.5, l: 0.5 }; + var color = tinycolor(obj); + assert( + obj.s === 0.5, + "when given an object, the original object is not modified" + ); +}); + +Deno.test("Original input", function () { + var colorRgbUp = "RGB(39, 39, 39)"; + var colorRgbLow = "rgb(39, 39, 39)"; + var colorRgbMix = "RgB(39, 39, 39)"; + var tinycolorObj = tinycolor(colorRgbMix); + var inputObj = { r: 100, g: 100, b: 100 }; + var r = tinycolor("red"); + + assert( + tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, + "original lowercase input is returned" + ); + assert( + tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, + "original uppercase input is returned" + ); + assert( + tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, + "original mixed input is returned" + ); + assert( + tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, + "when given a tinycolor instance, the color string is returned" + ); + assert( + tinycolor(inputObj).getOriginalInput() === inputObj, + "when given an object, the object is returned" + ); + assert( + new tinycolor("").getOriginalInput() === "", + "when given an empty string, an empty string is returned" + ); + assert( + new tinycolor(null).getOriginalInput() === "", + "when given a null value, an empty string is returned" + ); +}); + +Deno.test("Cloning color", function () { + var originalColor = tinycolor("red"); + var originalColorRgbString = originalColor.toRgbString(); + + var clonedColor = originalColor.clone(); + assert( + clonedColor.toRgbString() === originalColor.toRgbString(), + "cloned color is identical" + ); + + clonedColor.setAlpha(0.5); + assert( + clonedColor.toRgbString() !== originalColor.toRgbString(), + "cloned color is changing independently from original color" + ); + assert( + originalColorRgbString === originalColor.toRgbString(), + "original color was not changed by cloned color change" + ); +}); +Deno.test("Random color", function () { + var randomColor = tinycolor.random(); + assertEquals(randomColor.getAlpha(), 1); + assertEquals(randomColor.getFormat(), "prgb"); + + randomColor.setAlpha(0.5); + assertEquals(randomColor.toHex8String().slice(-2), "80"); +}); + +// Taken from convertWikipediaColors.html +var conversions = [ + { + hex: "#FFFFFF", + hex8: "#FFFFFFFF", + rgb: { r: "100.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "0", s: "0.000", v: "1.000" }, + hsl: { h: "0", s: "0.000", l: "1.000" }, + }, + { + hex: "#808080", + hex8: "#808080FF", + rgb: { r: "050.0%", g: "050.0%", b: "050.0%" }, + hsv: { h: "0", s: "0.000", v: "0.500" }, + hsl: { h: "0", s: "0.000", l: "0.500" }, + }, + { + hex: "#000000", + hex8: "#000000FF", + rgb: { r: "000.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0", s: "0.000", v: "0.000" }, + hsl: { h: "0", s: "0.000", l: "0.000" }, + }, + { + hex: "#FF0000", + hex8: "#FF0000FF", + rgb: { r: "100.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0.0", s: "1.000", v: "1.000" }, + hsl: { h: "0.0", s: "1.000", l: "0.500" }, + }, + { + hex: "#BFBF00", + hex8: "#BFBF00FF", + rgb: { r: "075.0%", g: "075.0%", b: "000.0%" }, + hsv: { h: "60.0", s: "1.000", v: "0.750" }, + hsl: { h: "60.0", s: "1.000", l: "0.375" }, + }, + { + hex: "#008000", + hex8: "#008000FF", + rgb: { r: "000.0%", g: "050.0%", b: "000.0%" }, + hsv: { h: "120.0", s: "1.000", v: "0.500" }, + hsl: { h: "120.0", s: "1.000", l: "0.250" }, + }, + { + hex: "#80FFFF", + hex8: "#80FFFFFF", + rgb: { r: "050.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "180.0", s: "0.500", v: "1.000" }, + hsl: { h: "180.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#8080FF", + hex8: "#8080FFFF", + rgb: { r: "050.0%", g: "050.0%", b: "100.0%" }, + hsv: { h: "240.0", s: "0.500", v: "1.000" }, + hsl: { h: "240.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#BF40BF", + hex8: "#BF40BFFF", + rgb: { r: "075.0%", g: "025.0%", b: "075.0%" }, + hsv: { h: "300.0", s: "0.667", v: "0.750" }, + hsl: { h: "300.0", s: "0.500", l: "0.500" }, + }, + { + hex: "#A0A424", + hex8: "#A0A424FF", + rgb: { r: "062.8%", g: "064.3%", b: "014.2%" }, + hsv: { h: "61.8", s: "0.779", v: "0.643" }, + hsl: { h: "61.8", s: "0.638", l: "0.393" }, + }, + { + hex: "#1EAC41", + hex8: "#1EAC41FF", + rgb: { r: "011.6%", g: "067.5%", b: "025.5%" }, + hsv: { h: "134.9", s: "0.828", v: "0.675" }, + hsl: { h: "134.9", s: "0.707", l: "0.396" }, + }, + { + hex: "#B430E5", + hex8: "#B430E5FF", + rgb: { r: "070.4%", g: "018.7%", b: "089.7%" }, + hsv: { h: "283.7", s: "0.792", v: "0.897" }, + hsl: { h: "283.7", s: "0.775", l: "0.542" }, + }, + { + hex: "#FEF888", + hex8: "#FEF888FF", + rgb: { r: "099.8%", g: "097.4%", b: "053.2%" }, + hsv: { h: "56.9", s: "0.467", v: "0.998" }, + hsl: { h: "56.9", s: "0.991", l: "0.765" }, + }, + { + hex: "#19CB97", + hex8: "#19CB97FF", + rgb: { r: "009.9%", g: "079.5%", b: "059.1%" }, + hsv: { h: "162.4", s: "0.875", v: "0.795" }, + hsl: { h: "162.4", s: "0.779", l: "0.447" }, + }, + { + hex: "#362698", + hex8: "#362698FF", + rgb: { r: "021.1%", g: "014.9%", b: "059.7%" }, + hsv: { h: "248.3", s: "0.750", v: "0.597" }, + hsl: { h: "248.3", s: "0.601", l: "0.373" }, + }, + { + hex: "#7E7EB8", + hex8: "#7E7EB8FF", + rgb: { r: "049.5%", g: "049.3%", b: "072.1%" }, + hsv: { h: "240.5", s: "0.316", v: "0.721" }, + hsl: { h: "240.5", s: "0.290", l: "0.607" }, + }, +]; + +Deno.test("Color Equality", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + + assert(true, tiny.isValid()); + assert( + true, + "Testing " + + c.hex + + ": " + + tiny.toRgbString() + + " " + + tiny.toPercentageRgbString() + + " " + + tiny.toHsvString() + + " " + + tiny.toHslString() + + " " + + tiny.toHexString() + + "Original: " + + JSON.stringify(c.rgb) + + " " + + JSON.stringify(c.hsv) + + " " + + JSON.stringify(c.hsl) + ); + assert(tinycolor.equals(c.rgb, c.hex), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hex8), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsl), "RGB equals HSL " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsv), "RGB equals HSV " + c.hex); + assert(tinycolor.equals(c.rgb, c.rgb), "RGB equals RGB " + c.hex); + + assert(tinycolor.equals(c.hex, c.hex), "hex equals hex " + c.hex); + assert(tinycolor.equals(c.hex, c.hex8), "hex equals hex8 " + c.hex); + assert(tinycolor.equals(c.hex, c.hsl), "hex equals HSL " + c.hex); + assert(tinycolor.equals(c.hex, c.hsv), "hex equals HSV " + c.hex); + + assert(tinycolor.equals(c.hsl, c.hsv), "HSL equals HSV " + c.hex); + } +}); + +Deno.test("With Ratio", function () { + assertEquals( + tinycolor.fromRatio({ r: 1, g: 1, b: 1 }).toHexString(), + "#ffffff", + "white" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 0.5 }).toRgbString(), + "rgba(255, 0, 0, 0.5)", + "alpha works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha = 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 10 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha > 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: -1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha < 1 works when ratio is parsed" + ); +}); + +Deno.test("Without Ratio", function () { + assertEquals( + tinycolor({ r: 1, g: 1, b: 1 }).toHexString(), + "#010101", + "010101" + ); + assertEquals( + tinycolor({ r: 0.1, g: 0.1, b: 0.1 }).toHexString(), + "#000000", + "000000" + ); + assertEquals(tinycolor("rgb .1 .1 .1").toHexString(), "#000000", "000000"); +}); + +Deno.test("RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 255 0 0").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert( + tinycolor.equals({ r: 200, g: 100, b: 0, a: 0.4 }, "rgba 200 100 0 .4") + ); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgba 200 100 0 1")); + + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb(200, 100, 0)") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); +}); + +Deno.test("Percentage RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 100% 0% 0%").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert( + tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert( + tinycolor.equals( + { r: "90%", g: "45%", b: "0%", a: 0.4 }, + "rgba 90% 45% 0% .4" + ) + ); + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgba 90% 45% 0% 1") + ); + + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb(90%, 45%, 0%)" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); +}); + +Deno.test("HSL parsing", function () { + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38, a: 0.5 }).toHslString(), + "hsla(251, 100%, 38%, 0.5)", + "to hsla" + ); + assertEquals( + tinycolor("hsl(251, 100, 38)").toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor("hsl 100 20 10").toHslString(), + "hsl(100, 20%, 10%)", + "problematic hsl" + ); +}); + +Deno.test("Hex Parsing", function () { + assertEquals(tinycolor("rgb 255 0 0").toHexString(), "#ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHexString(true), "#f00"); + + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8String(), "#ff000080"); + assertEquals(tinycolor("rgba 255 0 0 0").toHex8String(), "#ff000000"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(), "#ff0000ff"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(true), "#f00f"); + + assertEquals(tinycolor("rgb 255 0 0").toHex(), "ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHex(true), "f00"); + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8(), "ff000080"); +}); + +Deno.test("HSV Parsing", function () { + assertEquals( + tinycolor("hsv 251.1 0.887 .918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsv 251.1 0.887 0.918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsva 251.1 0.887 0.918 0.5").toHsvString(), + "hsva(251, 89%, 92%, 0.5)" + ); +}); + +Deno.test("Invalid Parsing", function () { + var invalidColor = tinycolor("this is not a color"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("#red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" #red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" ##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ r: "invalid", g: "invalid", b: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", l: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", v: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); +}); + +Deno.test("Named colors", function () { + assertEquals(tinycolor("aliceblue").toHex(), "f0f8ff"); + assertEquals(tinycolor("antiquewhite").toHex(), "faebd7"); + assertEquals(tinycolor("aqua").toHex(), "00ffff"); + assertEquals(tinycolor("aquamarine").toHex(), "7fffd4"); + assertEquals(tinycolor("azure").toHex(), "f0ffff"); + assertEquals(tinycolor("beige").toHex(), "f5f5dc"); + assertEquals(tinycolor("bisque").toHex(), "ffe4c4"); + assertEquals(tinycolor("black").toHex(), "000000"); + assertEquals(tinycolor("blanchedalmond").toHex(), "ffebcd"); + assertEquals(tinycolor("blue").toHex(), "0000ff"); + assertEquals(tinycolor("blueviolet").toHex(), "8a2be2"); + assertEquals(tinycolor("brown").toHex(), "a52a2a"); + assertEquals(tinycolor("burlywood").toHex(), "deb887"); + assertEquals(tinycolor("cadetblue").toHex(), "5f9ea0"); + assertEquals(tinycolor("chartreuse").toHex(), "7fff00"); + assertEquals(tinycolor("chocolate").toHex(), "d2691e"); + assertEquals(tinycolor("coral").toHex(), "ff7f50"); + assertEquals(tinycolor("cornflowerblue").toHex(), "6495ed"); + assertEquals(tinycolor("cornsilk").toHex(), "fff8dc"); + assertEquals(tinycolor("crimson").toHex(), "dc143c"); + assertEquals(tinycolor("cyan").toHex(), "00ffff"); + assertEquals(tinycolor("darkblue").toHex(), "00008b"); + assertEquals(tinycolor("darkcyan").toHex(), "008b8b"); + assertEquals(tinycolor("darkgoldenrod").toHex(), "b8860b"); + assertEquals(tinycolor("darkgray").toHex(), "a9a9a9"); + assertEquals(tinycolor("darkgreen").toHex(), "006400"); + assertEquals(tinycolor("darkkhaki").toHex(), "bdb76b"); + assertEquals(tinycolor("darkmagenta").toHex(), "8b008b"); + assertEquals(tinycolor("darkolivegreen").toHex(), "556b2f"); + assertEquals(tinycolor("darkorange").toHex(), "ff8c00"); + assertEquals(tinycolor("darkorchid").toHex(), "9932cc"); + assertEquals(tinycolor("darkred").toHex(), "8b0000"); + assertEquals(tinycolor("darksalmon").toHex(), "e9967a"); + assertEquals(tinycolor("darkseagreen").toHex(), "8fbc8f"); + assertEquals(tinycolor("darkslateblue").toHex(), "483d8b"); + assertEquals(tinycolor("darkslategray").toHex(), "2f4f4f"); + assertEquals(tinycolor("darkturquoise").toHex(), "00ced1"); + assertEquals(tinycolor("darkviolet").toHex(), "9400d3"); + assertEquals(tinycolor("deeppink").toHex(), "ff1493"); + assertEquals(tinycolor("deepskyblue").toHex(), "00bfff"); + assertEquals(tinycolor("dimgray").toHex(), "696969"); + assertEquals(tinycolor("dodgerblue").toHex(), "1e90ff"); + assertEquals(tinycolor("firebrick").toHex(), "b22222"); + assertEquals(tinycolor("floralwhite").toHex(), "fffaf0"); + assertEquals(tinycolor("forestgreen").toHex(), "228b22"); + assertEquals(tinycolor("fuchsia").toHex(), "ff00ff"); + assertEquals(tinycolor("gainsboro").toHex(), "dcdcdc"); + assertEquals(tinycolor("ghostwhite").toHex(), "f8f8ff"); + assertEquals(tinycolor("gold").toHex(), "ffd700"); + assertEquals(tinycolor("goldenrod").toHex(), "daa520"); + assertEquals(tinycolor("gray").toHex(), "808080"); + assertEquals(tinycolor("grey").toHex(), "808080"); + assertEquals(tinycolor("green").toHex(), "008000"); + assertEquals(tinycolor("greenyellow").toHex(), "adff2f"); + assertEquals(tinycolor("honeydew").toHex(), "f0fff0"); + assertEquals(tinycolor("hotpink").toHex(), "ff69b4"); + assertEquals(tinycolor("indianred ").toHex(), "cd5c5c"); + assertEquals(tinycolor("indigo ").toHex(), "4b0082"); + assertEquals(tinycolor("ivory").toHex(), "fffff0"); + assertEquals(tinycolor("khaki").toHex(), "f0e68c"); + assertEquals(tinycolor("lavender").toHex(), "e6e6fa"); + assertEquals(tinycolor("lavenderblush").toHex(), "fff0f5"); + assertEquals(tinycolor("lawngreen").toHex(), "7cfc00"); + assertEquals(tinycolor("lemonchiffon").toHex(), "fffacd"); + assertEquals(tinycolor("lightblue").toHex(), "add8e6"); + assertEquals(tinycolor("lightcoral").toHex(), "f08080"); + assertEquals(tinycolor("lightcyan").toHex(), "e0ffff"); + assertEquals(tinycolor("lightgoldenrodyellow").toHex(), "fafad2"); + assertEquals(tinycolor("lightgrey").toHex(), "d3d3d3"); + assertEquals(tinycolor("lightgreen").toHex(), "90ee90"); + assertEquals(tinycolor("lightpink").toHex(), "ffb6c1"); + assertEquals(tinycolor("lightsalmon").toHex(), "ffa07a"); + assertEquals(tinycolor("lightseagreen").toHex(), "20b2aa"); + assertEquals(tinycolor("lightskyblue").toHex(), "87cefa"); + assertEquals(tinycolor("lightslategray").toHex(), "778899"); + assertEquals(tinycolor("lightsteelblue").toHex(), "b0c4de"); + assertEquals(tinycolor("lightyellow").toHex(), "ffffe0"); + assertEquals(tinycolor("lime").toHex(), "00ff00"); + assertEquals(tinycolor("limegreen").toHex(), "32cd32"); + assertEquals(tinycolor("linen").toHex(), "faf0e6"); + assertEquals(tinycolor("magenta").toHex(), "ff00ff"); + assertEquals(tinycolor("maroon").toHex(), "800000"); + assertEquals(tinycolor("mediumaquamarine").toHex(), "66cdaa"); + assertEquals(tinycolor("mediumblue").toHex(), "0000cd"); + assertEquals(tinycolor("mediumorchid").toHex(), "ba55d3"); + assertEquals(tinycolor("mediumpurple").toHex(), "9370db"); + assertEquals(tinycolor("mediumseagreen").toHex(), "3cb371"); + assertEquals(tinycolor("mediumslateblue").toHex(), "7b68ee"); + assertEquals(tinycolor("mediumspringgreen").toHex(), "00fa9a"); + assertEquals(tinycolor("mediumturquoise").toHex(), "48d1cc"); + assertEquals(tinycolor("mediumvioletred").toHex(), "c71585"); + assertEquals(tinycolor("midnightblue").toHex(), "191970"); + assertEquals(tinycolor("mintcream").toHex(), "f5fffa"); + assertEquals(tinycolor("mistyrose").toHex(), "ffe4e1"); + assertEquals(tinycolor("moccasin").toHex(), "ffe4b5"); + assertEquals(tinycolor("navajowhite").toHex(), "ffdead"); + assertEquals(tinycolor("navy").toHex(), "000080"); + assertEquals(tinycolor("oldlace").toHex(), "fdf5e6"); + assertEquals(tinycolor("olive").toHex(), "808000"); + assertEquals(tinycolor("olivedrab").toHex(), "6b8e23"); + assertEquals(tinycolor("orange").toHex(), "ffa500"); + assertEquals(tinycolor("orangered").toHex(), "ff4500"); + assertEquals(tinycolor("orchid").toHex(), "da70d6"); + assertEquals(tinycolor("palegoldenrod").toHex(), "eee8aa"); + assertEquals(tinycolor("palegreen").toHex(), "98fb98"); + assertEquals(tinycolor("paleturquoise").toHex(), "afeeee"); + assertEquals(tinycolor("palevioletred").toHex(), "db7093"); + assertEquals(tinycolor("papayawhip").toHex(), "ffefd5"); + assertEquals(tinycolor("peachpuff").toHex(), "ffdab9"); + assertEquals(tinycolor("peru").toHex(), "cd853f"); + assertEquals(tinycolor("pink").toHex(), "ffc0cb"); + assertEquals(tinycolor("plum").toHex(), "dda0dd"); + assertEquals(tinycolor("powderblue").toHex(), "b0e0e6"); + assertEquals(tinycolor("purple").toHex(), "800080"); + assertEquals(tinycolor("rebeccapurple").toHex(), "663399"); + assertEquals(tinycolor("red").toHex(), "ff0000"); + assertEquals(tinycolor("rosybrown").toHex(), "bc8f8f"); + assertEquals(tinycolor("royalblue").toHex(), "4169e1"); + assertEquals(tinycolor("saddlebrown").toHex(), "8b4513"); + assertEquals(tinycolor("salmon").toHex(), "fa8072"); + assertEquals(tinycolor("sandybrown").toHex(), "f4a460"); + assertEquals(tinycolor("seagreen").toHex(), "2e8b57"); + assertEquals(tinycolor("seashell").toHex(), "fff5ee"); + assertEquals(tinycolor("sienna").toHex(), "a0522d"); + assertEquals(tinycolor("silver").toHex(), "c0c0c0"); + assertEquals(tinycolor("skyblue").toHex(), "87ceeb"); + assertEquals(tinycolor("slateblue").toHex(), "6a5acd"); + assertEquals(tinycolor("slategray").toHex(), "708090"); + assertEquals(tinycolor("snow").toHex(), "fffafa"); + assertEquals(tinycolor("springgreen").toHex(), "00ff7f"); + assertEquals(tinycolor("steelblue").toHex(), "4682b4"); + assertEquals(tinycolor("tan").toHex(), "d2b48c"); + assertEquals(tinycolor("teal").toHex(), "008080"); + assertEquals(tinycolor("thistle").toHex(), "d8bfd8"); + assertEquals(tinycolor("tomato").toHex(), "ff6347"); + assertEquals(tinycolor("turquoise").toHex(), "40e0d0"); + assertEquals(tinycolor("violet").toHex(), "ee82ee"); + assertEquals(tinycolor("wheat").toHex(), "f5deb3"); + assertEquals(tinycolor("white").toHex(), "ffffff"); + assertEquals(tinycolor("whitesmoke").toHex(), "f5f5f5"); + assertEquals(tinycolor("yellow").toHex(), "ffff00"); + assertEquals(tinycolor("yellowgreen").toHex(), "9acd32"); + + assertEquals(tinycolor("#f00").toName(), "red"); + assertEquals(tinycolor("#fa0a0a").toName(), false); +}); + +Deno.test("Invalid alpha should normalize to 1", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -1 }).toRgbString(), + "rgb(255, 20, 10)", + "Negative value" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "Negative 0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0.5 }).toRgbString(), + "rgba(255, 20, 10, 0.5)", + ".5" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 1 }).toRgbString(), + "rgb(255, 20, 10)", + "1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 100 }).toRgbString(), + "rgb(255, 20, 10)", + "Greater than 1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: "asdfasd" }).toRgbString(), + "rgb(255, 20, 10)", + "Non Numeric" + ); + + assertEquals( + tinycolor("#fff").toRgbString(), + "rgb(255, 255, 255)", + "Hex should be 1" + ); + assertEquals( + tinycolor("rgba 255 0 0 100").toRgbString(), + "rgb(255, 0, 0)", + "Greater than 1 in string parsing" + ); +}); + +Deno.test("toString() with alpha set", function () { + var redNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.6 }, + { + format: "name", + } + ); + var transparentNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0 }, + { + format: "name", + } + ); + var redHex = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.4 }, + { + format: "hex", + } + ); + + assertEquals(redNamed.getFormat(), "name", "getFormat() is correct"); + assertEquals(redHex.getFormat(), "hex", "getFormat() is correct"); + + assertEquals( + redNamed.toString(), + "rgba(255, 0, 0, 0.6)", + "Names should default to rgba if alpha is < 1" + ); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + + assertEquals( + redNamed.toString("hex"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex6"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex3"), + "#f00", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex8"), + "#ff000099", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex4"), + "#f009", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("name"), + "#ff0000", + "Semi transparent names should return hex in toString() if name format is specified" + ); + + assertEquals( + redNamed.toName(), + false, + "Semi transparent names should be false in toName()" + ); + + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + assertEquals( + transparentNamed.toString(), + "transparent", + "Named color should equal transparent if alpha == 0" + ); + + redHex.setAlpha(0); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0)", + "Hex should default to rgba if alpha is = 0" + ); +}); + +Deno.test("setting alpha", function () { + var hexSetter = tinycolor("rgba(255, 0, 0, 1)"); + assertEquals(hexSetter.getAlpha(), 1, "Alpha should start as 1"); + var returnedFromSetAlpha = hexSetter.setAlpha(0.9); + assertEquals( + returnedFromSetAlpha, + hexSetter, + "setAlpha return value should be the color." + ); + assertEquals(hexSetter.getAlpha(), 0.9, "setAlpha should change alpha value"); + hexSetter.setAlpha(0.5); + assertEquals(hexSetter.getAlpha(), 0.5, "setAlpha should change alpha value"); + hexSetter.setAlpha(0); + assertEquals(hexSetter.getAlpha(), 0, "setAlpha should change alpha value"); + hexSetter.setAlpha(-1); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value < 0 should be bound to 1" + ); + hexSetter.setAlpha(2); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value > 1 should be bound to 1" + ); + hexSetter.setAlpha(); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha(null); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha("test"); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); +}); + +Deno.test("Alpha = 0 should act differently on toName()", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toName(), + "transparent", + "0" + ); + assertEquals( + tinycolor("transparent").toString(), + "transparent", + "toString when passed" + ); + assertEquals(tinycolor("transparent").toHex(), "000000", "toHex"); +}); + +Deno.test("getBrightness", function () { + assertEquals(tinycolor("#000").getBrightness(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getBrightness(), 255, "returns 255 for #fff"); +}); + +Deno.test("getLuminance", function () { + assertEquals(tinycolor("#000").getLuminance(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getLuminance(), 1, "returns 1 for #fff"); +}); + +Deno.test("isDark returns true/false for dark/light colors", function () { + assertEquals(tinycolor("#000").isDark(), true, "#000 is dark"); + assertEquals(tinycolor("#111").isDark(), true, "#111 is dark"); + assertEquals(tinycolor("#222").isDark(), true, "#222 is dark"); + assertEquals(tinycolor("#333").isDark(), true, "#333 is dark"); + assertEquals(tinycolor("#444").isDark(), true, "#444 is dark"); + assertEquals(tinycolor("#555").isDark(), true, "#555 is dark"); + assertEquals(tinycolor("#666").isDark(), true, "#666 is dark"); + assertEquals(tinycolor("#777").isDark(), true, "#777 is dark"); + assertEquals(tinycolor("#888").isDark(), false, "#888 is not dark"); + assertEquals(tinycolor("#999").isDark(), false, "#999 is not dark"); + assertEquals(tinycolor("#aaa").isDark(), false, "#aaa is not dark"); + assertEquals(tinycolor("#bbb").isDark(), false, "#bbb is not dark"); + assertEquals(tinycolor("#ccc").isDark(), false, "#ccc is not dark"); + assertEquals(tinycolor("#ddd").isDark(), false, "#ddd is not dark"); + assertEquals(tinycolor("#eee").isDark(), false, "#eee is not dark"); + assertEquals(tinycolor("#fff").isDark(), false, "#fff is not dark"); +}); + +Deno.test("isLight returns true/false for light/dark colors", function () { + assertEquals(tinycolor("#000").isLight(), false, "#000 is not light"); + assertEquals(tinycolor("#111").isLight(), false, "#111 is not light"); + assertEquals(tinycolor("#222").isLight(), false, "#222 is not light"); + assertEquals(tinycolor("#333").isLight(), false, "#333 is not light"); + assertEquals(tinycolor("#444").isLight(), false, "#444 is not light"); + assertEquals(tinycolor("#555").isLight(), false, "#555 is not light"); + assertEquals(tinycolor("#666").isLight(), false, "#666 is not light"); + assertEquals(tinycolor("#777").isLight(), false, "#777 is not light"); + assertEquals(tinycolor("#888").isLight(), true, "#888 is light"); + assertEquals(tinycolor("#999").isLight(), true, "#999 is light"); + assertEquals(tinycolor("#aaa").isLight(), true, "#aaa is light"); + assertEquals(tinycolor("#bbb").isLight(), true, "#bbb is light"); + assertEquals(tinycolor("#ccc").isLight(), true, "#ccc is light"); + assertEquals(tinycolor("#ddd").isLight(), true, "#ddd is light"); + assertEquals(tinycolor("#eee").isLight(), true, "#eee is light"); + assertEquals(tinycolor("#fff").isLight(), true, "#fff is light"); +}); + +Deno.test("HSL Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsl()).toHexString(), + "HSL Object" + ); + } +}); + +Deno.test("HSL String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHslString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHslString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHslString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHslString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHsvString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHsvString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHsvString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHsvString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsv()).toHexString(), + "HSV Object" + ); + } +}); + +Deno.test("RGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgb()).toHexString(), + "RGB Object" + ); + } +}); + +Deno.test("RGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgbString()).toHexString(), + "RGB String" + ); + } +}); + +Deno.test("PRGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgb()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("PRGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgbString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals(tiny.toHexString(), tinycolor(tiny).toHexString(), "Object"); + } +}); + +Deno.test("Color equality", function () { + assert(tinycolor.equals("#ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#ff0000", "rgb(255, 0, 0)"), "Same alphas"); + assert( + !tinycolor.equals("#ff0000", "rgba(255, 0, 0, .1)"), + "Different alphas" + ); + assert(tinycolor.equals("#ff000066", "rgba(255, 0, 0, .4)"), "Same alphas"); + assert(tinycolor.equals("#f009", "rgba(255, 0, 0, .6)"), "Same alphas"); + assert(tinycolor.equals("#336699CC", "369C"), "Same hex"); + assert(tinycolor.equals("ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("f00", "#ff0000"), "Same hex"); + assertEquals(tinycolor("010101").toHexString(), "#010101"); + assert(!tinycolor.equals("#ff0000", "#00ff00"), "Different hex"); + assert( + tinycolor.equals("#ff8000", "rgb(100%, 50%, 0%)"), + "Percentage bounds checking" + ); +}); + +Deno.test("isReadable", function () { + // "#ff0088", "#8822aa" (values used in old WCAG1 tests) + assert( + tinycolor.isReadable("#000000", "#ffffff", { level: "AA", size: "small" }), + "white/black is readable" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", {}), + "not readable - empty wcag2 object" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "large" }), + "not readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // values derived from and validated using the calculators at http://www.dasplankton.de/ContrastA/ + // and http://webaim.org/resources/contrastchecker/ + + // "#ff0088", "#5c1a72": contrast ratio 3.04 + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // "#ff0088", "#2e0c3a": contrast ratio 4.56 + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#2e0c3a", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); + + // "#db91b8", "#2e0c3a": contrast ratio 7.12 + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "small" }), + "readable - AAA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); +}); + +Deno.test("readability", function () { + // check return values from readability function. See isReadable above for standards tests. + assertEquals( + tinycolor.readability("#000", "#000"), + 1, + "Readability function test 0" + ); + assertEquals( + tinycolor.readability("#000", "#111"), + 1.1121078324840545, + "Readability function test 1" + ); + assertEquals( + tinycolor.readability("#000", "#fff"), + 21, + "Readability function test 2" + ); +}); + +Deno.test("mostReadable", function () { + assertEquals( + tinycolor + .mostReadable("#000", ["#111", "#222", { wcag2: {} }]) + .toHexString(), + "#222222", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#f00", ["#d00", "#0d0"], { wcag2: {} }) + .toHexString(), + "#00dd00", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { wcag2: {} }) + .toHexString(), + "#ffffff", + "no different color in list" + ); + //includeFallbackColors + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { + includeFallbackColors: true, + }) + .toHexString(), + "#000000", + "no different color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: false, + }) + .toHexString(), + "#112255", + "no readable color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: true, + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#000000", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#2e0c3a", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#000000", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#a9acb6", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); +}); + +Deno.test("Filters", function () { + assertEquals( + tinycolor("red").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)" + ); + assertEquals( + tinycolor("red").toFilter("blue"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ff0000ff)" + ); + + assertEquals( + tinycolor("transparent").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#00000000)" + ); + assertEquals( + tinycolor("transparent").toFilter("red"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ffff0000)" + ); + + assertEquals( + tinycolor("#f0f0f0dd").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ddf0f0f0,endColorstr=#ddf0f0f0)" + ); + assertEquals( + tinycolor("rgba(0, 0, 255, .5").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#800000ff,endColorstr=#800000ff)" + ); +}); + +/* Originally generated with: +var results = []; +for (var i = 0; i <= 100; i++) results.push( tinycolor.saturate("red", i).toHex() ) +console.log(JSON.stringify(results)) +*/ +var DESATURATIONS = [ + "ff0000", + "fe0101", + "fc0303", + "fb0404", + "fa0505", + "f90606", + "f70808", + "f60909", + "f50a0a", + "f40b0b", + "f20d0d", + "f10e0e", + "f00f0f", + "ee1111", + "ed1212", + "ec1313", + "eb1414", + "e91616", + "e81717", + "e71818", + "e61919", + "e41b1b", + "e31c1c", + "e21d1d", + "e01f1f", + "df2020", + "de2121", + "dd2222", + "db2424", + "da2525", + "d92626", + "d72828", + "d62929", + "d52a2a", + "d42b2b", + "d22d2d", + "d12e2e", + "d02f2f", + "cf3030", + "cd3232", + "cc3333", + "cb3434", + "c93636", + "c83737", + "c73838", + "c63939", + "c43b3b", + "c33c3c", + "c23d3d", + "c13e3e", + "bf4040", + "be4141", + "bd4242", + "bb4444", + "ba4545", + "b94646", + "b84747", + "b64949", + "b54a4a", + "b44b4b", + "b34d4d", + "b14e4e", + "b04f4f", + "af5050", + "ad5252", + "ac5353", + "ab5454", + "aa5555", + "a85757", + "a75858", + "a65959", + "a45b5b", + "a35c5c", + "a25d5d", + "a15e5e", + "9f6060", + "9e6161", + "9d6262", + "9c6363", + "9a6565", + "996666", + "986767", + "966969", + "956a6a", + "946b6b", + "936c6c", + "916e6e", + "906f6f", + "8f7070", + "8e7171", + "8c7373", + "8b7474", + "8a7575", + "887777", + "877878", + "867979", + "857a7a", + "837c7c", + "827d7d", + "817e7e", + "808080", +]; +var SATURATIONS = [ + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", +]; +var LIGHTENS = [ + "ff0000", + "ff0505", + "ff0a0a", + "ff0f0f", + "ff1414", + "ff1a1a", + "ff1f1f", + "ff2424", + "ff2929", + "ff2e2e", + "ff3333", + "ff3838", + "ff3d3d", + "ff4242", + "ff4747", + "ff4d4d", + "ff5252", + "ff5757", + "ff5c5c", + "ff6161", + "ff6666", + "ff6b6b", + "ff7070", + "ff7575", + "ff7a7a", + "ff8080", + "ff8585", + "ff8a8a", + "ff8f8f", + "ff9494", + "ff9999", + "ff9e9e", + "ffa3a3", + "ffa8a8", + "ffadad", + "ffb3b3", + "ffb8b8", + "ffbdbd", + "ffc2c2", + "ffc7c7", + "ffcccc", + "ffd1d1", + "ffd6d6", + "ffdbdb", + "ffe0e0", + "ffe5e5", + "ffebeb", + "fff0f0", + "fff5f5", + "fffafa", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", +]; +var BRIGHTENS = [ + "ff0000", + "ff0303", + "ff0505", + "ff0808", + "ff0a0a", + "ff0d0d", + "ff0f0f", + "ff1212", + "ff1414", + "ff1717", + "ff1919", + "ff1c1c", + "ff1f1f", + "ff2121", + "ff2424", + "ff2626", + "ff2929", + "ff2b2b", + "ff2e2e", + "ff3030", + "ff3333", + "ff3636", + "ff3838", + "ff3b3b", + "ff3d3d", + "ff4040", + "ff4242", + "ff4545", + "ff4747", + "ff4a4a", + "ff4c4c", + "ff4f4f", + "ff5252", + "ff5454", + "ff5757", + "ff5959", + "ff5c5c", + "ff5e5e", + "ff6161", + "ff6363", + "ff6666", + "ff6969", + "ff6b6b", + "ff6e6e", + "ff7070", + "ff7373", + "ff7575", + "ff7878", + "ff7a7a", + "ff7d7d", + "ff7f7f", + "ff8282", + "ff8585", + "ff8787", + "ff8a8a", + "ff8c8c", + "ff8f8f", + "ff9191", + "ff9494", + "ff9696", + "ff9999", + "ff9c9c", + "ff9e9e", + "ffa1a1", + "ffa3a3", + "ffa6a6", + "ffa8a8", + "ffabab", + "ffadad", + "ffb0b0", + "ffb2b2", + "ffb5b5", + "ffb8b8", + "ffbaba", + "ffbdbd", + "ffbfbf", + "ffc2c2", + "ffc4c4", + "ffc7c7", + "ffc9c9", + "ffcccc", + "ffcfcf", + "ffd1d1", + "ffd4d4", + "ffd6d6", + "ffd9d9", + "ffdbdb", + "ffdede", + "ffe0e0", + "ffe3e3", + "ffe5e5", + "ffe8e8", + "ffebeb", + "ffeded", + "fff0f0", + "fff2f2", + "fff5f5", + "fff7f7", + "fffafa", + "fffcfc", + "ffffff", +]; +var DARKENS = [ + "ff0000", + "fa0000", + "f50000", + "f00000", + "eb0000", + "e60000", + "e00000", + "db0000", + "d60000", + "d10000", + "cc0000", + "c70000", + "c20000", + "bd0000", + "b80000", + "b30000", + "ad0000", + "a80000", + "a30000", + "9e0000", + "990000", + "940000", + "8f0000", + "8a0000", + "850000", + "800000", + "7a0000", + "750000", + "700000", + "6b0000", + "660000", + "610000", + "5c0000", + "570000", + "520000", + "4d0000", + "470000", + "420000", + "3d0000", + "380000", + "330000", + "2e0000", + "290000", + "240000", + "1f0000", + "190000", + "140000", + "0f0000", + "0a0000", + "050000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", +]; + +Deno.test("Modifications", function () { + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").desaturate(i).toHex(), + DESATURATIONS[i], + "Desaturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").saturate(i).toHex(), + SATURATIONS[i], + "Saturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").lighten(i).toHex(), + LIGHTENS[i], + "Lighten " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").brighten(i).toHex(), + BRIGHTENS[i], + "Brighter " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").darken(i).toHex(), + DARKENS[i], + "Darken " + i + " works" + ); + } + + assertEquals( + tinycolor("red").greyscale().toHex(), + "808080", + "Greyscale works" + ); +}); + +Deno.test("Spin", function () { + assertEquals( + Math.round(tinycolor("#f00").spin(-1234).toHsl().h), + 206, + "Spinning -1234 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-360).toHsl().h), + 0, + "Spinning -360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-120).toHsl().h), + 240, + "Spinning -120 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(0).toHsl().h), + 0, + "Spinning 0 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(10).toHsl().h), + 10, + "Spinning 10 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(360).toHsl().h), + 0, + "Spinning 360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(2345).toHsl().h), + 185, + "Spinning 2345 works" + ); + + [-360, 0, 360].forEach(function (delta) { + Object.keys(tinycolor.names).forEach(function (name) { + assertEquals( + tinycolor(name).toHex(), + tinycolor(name).spin(delta).toHex(), + "Spinning " + delta.toString() + " has no effect" + ); + }); + }); +}); + +Deno.test("Mix", function () { + // amount 0 or none + assertEquals( + tinycolor.mix("#000", "#fff").toHsl().l, + 0.5, + "Mixing without amount works" + ); + assertEquals( + tinycolor.mix("#f00", "#000", 0).toHex(), + "ff0000", + "Mixing with 0 amount works" + ); + // This case checks the the problem with floating point numbers (eg 255/90) + assertEquals( + tinycolor.mix("#fff", "#000", 90).toHex(), + "1a1a1a", + "Mixing with 90 amount works correctly" + ); + + // black and white + for (var i = 0; i < 100; i++) { + assertEquals( + Math.round(tinycolor.mix("#000", "#fff", i).toHsl().l * 100) / 100, + i / 100, + "Mixing black and white with " + i + " amount works" + ); + } + + // with colors + for (var i = 0; i < 100; i++) { + var new_hex = Math.round((255 * (100 - i)) / 100).toString(16); + + if (new_hex.length === 1) { + new_hex = "0" + new_hex; + } + + assertEquals( + tinycolor.mix("#f00", "#000", i).toHex(), + new_hex + "0000", + "Mixing " + i + " (red channel)" + ); + assertEquals( + tinycolor.mix("#0f0", "#000", i).toHex(), + "00" + new_hex + "00", + "Mixing " + i + " (green channel)" + ); + assertEquals( + tinycolor.mix("#00f", "#000", i).toHex(), + "0000" + new_hex, + "Mixing " + i + " (blue channel)" + ); + assertEquals( + tinycolor.mix(tinycolor("transparent"), "#000", i).toRgb().a, + i / 100, + "Mixing " + i + " (alpha channel)" + ); + } +}); + +// The combination tests need to be expanded furthe + +function colorsToHexString(colors) { + return colors + .map(function (c) { + return c.toHex(); + }) + .join(","); +} + +Deno.test("complement", function () { + var complementDoesntModifyInstance = tinycolor("red"); + assertEquals( + complementDoesntModifyInstance.complement().toHex(), + "00ffff", + "Complement works" + ); + assertEquals( + complementDoesntModifyInstance.toHex(), + "ff0000", + "Complement did not modify this color" + ); +}); + +Deno.test("analogous", function () { + var combination = tinycolor("red").analogous(); + assertEquals( + colorsToHexString(combination), + "ff0000,ff0066,ff0033,ff0000,ff3300,ff6600", + "Correct Combination" + ); +}); + +Deno.test("monochromatic", function () { + var combination = tinycolor("red").monochromatic(); + assertEquals( + colorsToHexString(combination), + "ff0000,2a0000,550000,800000,aa0000,d40000", + "Correct Combination" + ); +}); + +Deno.test("splitcomplement", function () { + var combination = tinycolor("red").splitcomplement(); + assertEquals( + colorsToHexString(combination), + "ff0000,ccff00,0066ff", + "Correct Combination" + ); +}); + +Deno.test("triad", function () { + var combination = tinycolor("red").triad(); + assertEquals( + colorsToHexString(combination), + "ff0000,00ff00,0000ff", + "Correct Combination" + ); +}); + +Deno.test("tetrad", function () { + var combination = tinycolor("red").tetrad(); + assertEquals( + colorsToHexString(combination), + "ff0000,80ff00,00ffff,7f00ff", + "Correct Combination" + ); +}); + +Deno.test({ + name: "polyad", + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + ignore: true, + fn: function () { + assertThrows(() => { + tinycolor("red").polyad(); + }); + assertThrows(() => { + tinycolor("red").polyad(-1); + }); + assertThrows(() => { + tinycolor("red").polyad("invalid"); + }); + assertEquals(colorsToHexString(tinycolor("red").polyad(1)), "ff0000"); + assertEquals(colorsToHexString(tinycolor("red").polyad("1")), "ff0000"); + assertEquals( + colorsToHexString(tinycolor("red").polyad(2)), + "ff0000,00ffff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(3)), + "ff0000,00ff00,0000ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(4)), + "ff0000,80ff00,00ffff,7f00ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(5)), + "ff0000,ccff00,00ff66,0066ff,cc00ff" + ); + }, +}); + +runDenoTests(); diff --git a/node_modules/tinycolor2/esm/test_template.js b/node_modules/tinycolor2/esm/test_template.js new file mode 100644 index 00000000..84914f76 --- /dev/null +++ b/node_modules/tinycolor2/esm/test_template.js @@ -0,0 +1,24 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +import tinycolor from "./tinycolor.js"; +import { Deno, testDefinitions } from "@deno/shim-deno-test"; +const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" +); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} + +// CONTENT_GOES_HERE + +runDenoTests(); diff --git a/node_modules/tinycolor2/esm/tinycolor.js b/node_modules/tinycolor2/esm/tinycolor.js new file mode 100644 index 00000000..374f5ea9 --- /dev/null +++ b/node_modules/tinycolor2/esm/tinycolor.js @@ -0,0 +1,1180 @@ +// This file is autogenerated. It's used to publish ESM to npm. +function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} + +// https://github.com/bgrins/TinyColor +// Brian Grinstead, MIT License + +var trimLeft = /^\s+/; +var trimRight = /\s+$/; +function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; + + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) { + return color; + } + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) { + return new tinycolor(color, opts); + } + var rgb = inputToRGB(color); + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); + this._ok = rgb.ok; +} +tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; + }, + isLight: function isLight() { + return !this.isDark(); + }, + isValid: function isValid() { + return this._ok; + }, + getOriginalInput: function getOriginalInput() { + return this._originalInput; + }, + getFormat: function getFormat() { + return this._format; + }, + getAlpha: function getAlpha() { + return this._a; + }, + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + }, + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; + }, + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; + }, + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), + s = Math.round(hsv.s * 100), + v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; + }, + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; + }, + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), + s = Math.round(hsl.s * 100), + l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; + }, + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); + }, + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); + }, + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; + }, + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; + }, + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function toName() { + if (this._a === 0) { + return "transparent"; + } + if (this._a < 1) { + return false; + } + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; + }, + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); + } + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + return formattedString || this.toHexString(); + }, + clone: function clone() { + return tinycolor(this.toString()); + }, + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [this].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; + }, + lighten: function lighten() { + return this._applyModification(_lighten, arguments); + }, + brighten: function brighten() { + return this._applyModification(_brighten, arguments); + }, + darken: function darken() { + return this._applyModification(_darken, arguments); + }, + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); + }, + saturate: function saturate() { + return this._applyModification(_saturate, arguments); + }, + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); + }, + spin: function spin() { + return this._applyModification(_spin, arguments); + }, + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); + }, + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); + }, + complement: function complement() { + return this._applyCombination(_complement, arguments); + }, + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); + }, + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); + }, + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [3]); + }, + tetrad: function tetrad() { + return this._applyCombination(polyad, [4]); + } +}; + +// If input is an object, force 1 into "1.0" to handle ratios properly +// String input requires "1.0" as input, so 1 will be treated as 1 +tinycolor.fromRatio = function (color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + return tinycolor(color, opts); +}; + +// Given a string or object, convert that input to RGB +// Possible string inputs: +// +// "red" +// "#f00" or "f00" +// "#ff0000" or "ff0000" +// "#ff000000" or "ff000000" +// "rgb 255 0 0" or "rgb (255, 0, 0)" +// "rgb 1.0 0 0" or "rgb (1, 0, 0)" +// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" +// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" +// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" +// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" +// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" +// +function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; + if (typeof color == "string") { + color = stringInputToObject(color); + } + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + a = boundAlpha(a); + return { + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a + }; +} + +// Conversion Functions +// -------------------- + +// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: +// + +// `rgbToRgb` +// Handle bounds / percentage checking to conform to CSS color spec +// +// *Assumes:* r, g, b in [0, 255] or [0, 1] +// *Returns:* { r, g, b } in [0, 255] +function rgbToRgb(r, g, b) { + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; +} + +// `rgbToHsl` +// Converts an RGB color value to HSL. +// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] +// *Returns:* { h, s, l } in [0,1] +function rgbToHsl(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + l = (max + min) / 2; + if (max == min) { + h = s = 0; // achromatic + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + l: l + }; +} + +// `hslToRgb` +// Converts an HSL color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] +function hslToRgb(h, s, l) { + var r, g, b; + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; +} + +// `rgbToHsv` +// Converts an RGB color value to HSV +// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] +// *Returns:* { h, s, v } in [0,1] +function rgbToHsv(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + v = max; + var d = max - min; + s = max === 0 ? 0 : d / max; + if (max == min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + v: v + }; +} + +// `hsvToRgb` +// Converts an HSV color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] +function hsvToRgb(h, s, v) { + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + var i = Math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; +} + +// `rgbToHex` +// Converts an RGB color to hex +// Assumes r, g, and b are contained in the set [0, 255] +// Returns a 3 or 6 character hex +function rgbToHex(r, g, b, allow3Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + return hex.join(""); +} + +// `rgbaToHex` +// Converts an RGBA color plus alpha transparency to hex +// Assumes r, g, b are contained in the set [0, 255] and +// a in [0, 1]. Returns a 4 or 8 character rgba hex +function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; + + // Return a 4 character hex if possible + if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + } + return hex.join(""); +} + +// `rgbaToArgbHex` +// Converts an RGBA color to an ARGB Hex8 string +// Rarely used, but required for "toFilter()" +function rgbaToArgbHex(r, g, b, a) { + var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + return hex.join(""); +} + +// `equals` +// Can be called with any tinycolor input +tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) return false; + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); +}; +tinycolor.random = function () { + return tinycolor.fromRatio({ + r: Math.random(), + g: Math.random(), + b: Math.random() + }); +}; + +// Modification Functions +// ---------------------- +// Thanks to less.js for some of the basics here +// + +function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); +} +function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); +} +function _greyscale(color) { + return tinycolor(color).desaturate(100); +} +function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); +} +function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var rgb = tinycolor(color).toRgb(); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); + return tinycolor(rgb); +} +function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); +} + +// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. +// Values outside of this range will be wrapped into this range. +function _spin(color, amount) { + var hsl = tinycolor(color).toHsl(); + var hue = (hsl.h + amount) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return tinycolor(hsl); +} + +// Combination Functions +// --------------------- +// Thanks to jQuery xColor for some of the ideas behind these +// + +function _complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); +} +function polyad(color, number) { + if (isNaN(number) || number <= 0) { + throw new Error("Argument to polyad must be a positive number"); + } + var hsl = tinycolor(color).toHsl(); + var result = [tinycolor(color)]; + var step = 360 / number; + for (var i = 1; i < number; i++) { + result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + } + return result; +} +function _splitcomplement(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [tinycolor(color), tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + })]; +} +function _analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; +} +function _monochromatic(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, + s = hsv.s, + v = hsv.v; + var ret = []; + var modification = 1 / results; + while (results--) { + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; + } + return ret; +} + +// Utility Functions +// --------------------- + +tinycolor.mix = function (color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; + var rgb1 = tinycolor(color1).toRgb(); + var rgb2 = tinycolor(color2).toRgb(); + var p = amount / 100; + var rgba = { + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a + }; + return tinycolor(rgba); +}; + +// Readability Functions +// --------------------- +// false +// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false +tinycolor.isReadable = function (color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; + out = false; + wcag2Parms = validateWCAG2Parms(wcag2); + switch (wcag2Parms.level + wcag2Parms.size) { + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; + } + return out; +}; + +// `mostReadable` +// Given a base color and a list of possible foreground or background +// colors for that base, returns the most readable color. +// Optionally returns Black or White if the most readable color is unreadable. +// *Example* +// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" +// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" +// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" +// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" +tinycolor.mostReadable = function (baseColor, colorList, args) { + var bestColor = null; + var bestScore = 0; + var readability; + var includeFallbackColors, level, size; + args = args || {}; + includeFallbackColors = args.includeFallbackColors; + level = args.level; + size = args.size; + for (var i = 0; i < colorList.length; i++) { + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } + } + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) { + return bestColor; + } else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); + } +}; + +// Big List of Colors +// ------------------ +// +var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + rebeccapurple: "663399", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" +}; + +// Make it easy to access colors via `hexNames[hex]` +var hexNames = tinycolor.hexNames = flip(names); + +// Utilities +// --------- + +// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` +function flip(o) { + var flipped = {}; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; +} + +// Return a valid alpha value [0,1] with all invalid values being set to 1 +function boundAlpha(a) { + a = parseFloat(a); + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + return a; +} + +// Take input from [0, n] and return it as [0, 1] +function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; + var processPercent = isPercentage(n); + n = Math.min(max, Math.max(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if (Math.abs(n - max) < 0.000001) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return n % max / parseFloat(max); +} + +// Force a number between 0 and 1 +function clamp01(val) { + return Math.min(1, Math.max(0, val)); +} + +// Parse a base-16 hex value into a base-10 integer +function parseIntFromHex(val) { + return parseInt(val, 16); +} + +// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 +// +function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; +} + +// Check to see if string passed in is a percentage +function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; +} + +// Force a hex value to have 2 characters +function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; +} + +// Replace a decimal with it's percentage value +function convertToPercentage(n) { + if (n <= 1) { + n = n * 100 + "%"; + } + return n; +} + +// Converts a decimal to a hex value +function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); +} +// Converts a hex value to a decimal +function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; +} +var matchers = function () { + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + return { + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; +}(); + +// `isValidCSSUnit` +// Take in a single string / number and check to see if it looks like a CSS unit +// (see `matchers` above for definition). +function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); +} + +// `stringInputToObject` +// Permissive string parsing. Take in a number of formats, and output an object +// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` +function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } else if (color == "transparent") { + return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if (match = matchers.rgb.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3] + }; + } + if (match = matchers.rgba.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; + } + if (match = matchers.hsl.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3] + }; + } + if (match = matchers.hsla.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; + } + if (match = matchers.hsv.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3] + }; + } + if (match = matchers.hsva.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; + } + if (match = matchers.hex8.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex6.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; + } + if (match = matchers.hex4.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex3.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; + } + return false; +} +function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + var level, size; + parms = parms || { + level: "AA", + size: "small" + }; + level = (parms.level || "AA").toUpperCase(); + size = (parms.size || "small").toLowerCase(); + if (level !== "AA" && level !== "AAA") { + level = "AA"; + } + if (size !== "small" && size !== "large") { + size = "small"; + } + return { + level: level, + size: size + }; +} + +export { tinycolor as default }; diff --git a/node_modules/tinycolor2/package.json b/node_modules/tinycolor2/package.json new file mode 100644 index 00000000..5eb8c35d --- /dev/null +++ b/node_modules/tinycolor2/package.json @@ -0,0 +1,35 @@ +{ + "version": "1.6.0", + "name": "tinycolor2", + "description": "Fast Color Parsing and Manipulation", + "url": "http://bgrins.github.com/TinyColor", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/bgrins/TinyColor.git" + }, + "keywords": [ + "color", + "parser", + "tinycolor" + ], + "author": "Brian Grinstead (http://briangrinstead.com)", + "bugs": { + "url": "https://github.com/bgrins/TinyColor/issues" + }, + "module": "./esm/tinycolor.js", + "main": "./cjs/tinycolor.js", + "browser": "./cjs/tinycolor.js", + "exports": { + ".": { + "import": "./esm/tinycolor.js", + "require": "./cjs/tinycolor.js" + } + }, + "scripts": { + "test": "node cjs/test.js && node esm/test.js" + }, + "devDependencies": { + "@deno/shim-deno-test": "^0.4.0" + } +} diff --git a/node_modules/tinycolor2/tinycolor.js b/node_modules/tinycolor2/tinycolor.js new file mode 100644 index 00000000..52601dfe --- /dev/null +++ b/node_modules/tinycolor2/tinycolor.js @@ -0,0 +1,1191 @@ +// This file is autogenerated. +// It's here at this path for backwards compatibility for links to it +// but the npm package now exports both CJS and ESM. +// See https://github.com/bgrins/TinyColor/ for instructions. + (function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory()); +})(this, (function () { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + // https://github.com/bgrins/TinyColor + // Brian Grinstead, MIT License + + var trimLeft = /^\s+/; + var trimRight = /\s+$/; + function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; + + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) { + return color; + } + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) { + return new tinycolor(color, opts); + } + var rgb = inputToRGB(color); + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); + this._ok = rgb.ok; + } + tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; + }, + isLight: function isLight() { + return !this.isDark(); + }, + isValid: function isValid() { + return this._ok; + }, + getOriginalInput: function getOriginalInput() { + return this._originalInput; + }, + getFormat: function getFormat() { + return this._format; + }, + getAlpha: function getAlpha() { + return this._a; + }, + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + }, + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; + }, + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; + }, + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), + s = Math.round(hsv.s * 100), + v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; + }, + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; + }, + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), + s = Math.round(hsl.s * 100), + l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; + }, + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); + }, + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); + }, + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; + }, + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; + }, + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function toName() { + if (this._a === 0) { + return "transparent"; + } + if (this._a < 1) { + return false; + } + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; + }, + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); + } + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + return formattedString || this.toHexString(); + }, + clone: function clone() { + return tinycolor(this.toString()); + }, + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [this].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; + }, + lighten: function lighten() { + return this._applyModification(_lighten, arguments); + }, + brighten: function brighten() { + return this._applyModification(_brighten, arguments); + }, + darken: function darken() { + return this._applyModification(_darken, arguments); + }, + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); + }, + saturate: function saturate() { + return this._applyModification(_saturate, arguments); + }, + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); + }, + spin: function spin() { + return this._applyModification(_spin, arguments); + }, + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); + }, + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); + }, + complement: function complement() { + return this._applyCombination(_complement, arguments); + }, + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); + }, + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); + }, + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [3]); + }, + tetrad: function tetrad() { + return this._applyCombination(polyad, [4]); + } + }; + + // If input is an object, force 1 into "1.0" to handle ratios properly + // String input requires "1.0" as input, so 1 will be treated as 1 + tinycolor.fromRatio = function (color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + return tinycolor(color, opts); + }; + + // Given a string or object, convert that input to RGB + // Possible string inputs: + // + // "red" + // "#f00" or "f00" + // "#ff0000" or "ff0000" + // "#ff000000" or "ff000000" + // "rgb 255 0 0" or "rgb (255, 0, 0)" + // "rgb 1.0 0 0" or "rgb (1, 0, 0)" + // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" + // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" + // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" + // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" + // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" + // + function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; + if (typeof color == "string") { + color = stringInputToObject(color); + } + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + a = boundAlpha(a); + return { + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a + }; + } + + // Conversion Functions + // -------------------- + + // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: + // + + // `rgbToRgb` + // Handle bounds / percentage checking to conform to CSS color spec + // + // *Assumes:* r, g, b in [0, 255] or [0, 1] + // *Returns:* { r, g, b } in [0, 255] + function rgbToRgb(r, g, b) { + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; + } + + // `rgbToHsl` + // Converts an RGB color value to HSL. + // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] + // *Returns:* { h, s, l } in [0,1] + function rgbToHsl(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + l = (max + min) / 2; + if (max == min) { + h = s = 0; // achromatic + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + l: l + }; + } + + // `hslToRgb` + // Converts an HSL color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hslToRgb(h, s, l) { + var r, g, b; + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + + // `rgbToHsv` + // Converts an RGB color value to HSV + // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] + // *Returns:* { h, s, v } in [0,1] + function rgbToHsv(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + v = max; + var d = max - min; + s = max === 0 ? 0 : d / max; + if (max == min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + v: v + }; + } + + // `hsvToRgb` + // Converts an HSV color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + var i = Math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + + // `rgbToHex` + // Converts an RGB color to hex + // Assumes r, g, and b are contained in the set [0, 255] + // Returns a 3 or 6 character hex + function rgbToHex(r, g, b, allow3Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + return hex.join(""); + } + + // `rgbaToHex` + // Converts an RGBA color plus alpha transparency to hex + // Assumes r, g, b are contained in the set [0, 255] and + // a in [0, 1]. Returns a 4 or 8 character rgba hex + function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; + + // Return a 4 character hex if possible + if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + } + return hex.join(""); + } + + // `rgbaToArgbHex` + // Converts an RGBA color to an ARGB Hex8 string + // Rarely used, but required for "toFilter()" + function rgbaToArgbHex(r, g, b, a) { + var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + return hex.join(""); + } + + // `equals` + // Can be called with any tinycolor input + tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) return false; + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); + }; + tinycolor.random = function () { + return tinycolor.fromRatio({ + r: Math.random(), + g: Math.random(), + b: Math.random() + }); + }; + + // Modification Functions + // ---------------------- + // Thanks to less.js for some of the basics here + // + + function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _greyscale(color) { + return tinycolor(color).desaturate(100); + } + function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var rgb = tinycolor(color).toRgb(); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); + return tinycolor(rgb); + } + function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + + // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. + // Values outside of this range will be wrapped into this range. + function _spin(color, amount) { + var hsl = tinycolor(color).toHsl(); + var hue = (hsl.h + amount) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return tinycolor(hsl); + } + + // Combination Functions + // --------------------- + // Thanks to jQuery xColor for some of the ideas behind these + // + + function _complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); + } + function polyad(color, number) { + if (isNaN(number) || number <= 0) { + throw new Error("Argument to polyad must be a positive number"); + } + var hsl = tinycolor(color).toHsl(); + var result = [tinycolor(color)]; + var step = 360 / number; + for (var i = 1; i < number; i++) { + result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + } + return result; + } + function _splitcomplement(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [tinycolor(color), tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + })]; + } + function _analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; + } + function _monochromatic(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, + s = hsv.s, + v = hsv.v; + var ret = []; + var modification = 1 / results; + while (results--) { + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; + } + return ret; + } + + // Utility Functions + // --------------------- + + tinycolor.mix = function (color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; + var rgb1 = tinycolor(color1).toRgb(); + var rgb2 = tinycolor(color2).toRgb(); + var p = amount / 100; + var rgba = { + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a + }; + return tinycolor(rgba); + }; + + // Readability Functions + // --------------------- + // false + // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false + tinycolor.isReadable = function (color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; + out = false; + wcag2Parms = validateWCAG2Parms(wcag2); + switch (wcag2Parms.level + wcag2Parms.size) { + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; + } + return out; + }; + + // `mostReadable` + // Given a base color and a list of possible foreground or background + // colors for that base, returns the most readable color. + // Optionally returns Black or White if the most readable color is unreadable. + // *Example* + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" + tinycolor.mostReadable = function (baseColor, colorList, args) { + var bestColor = null; + var bestScore = 0; + var readability; + var includeFallbackColors, level, size; + args = args || {}; + includeFallbackColors = args.includeFallbackColors; + level = args.level; + size = args.size; + for (var i = 0; i < colorList.length; i++) { + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } + } + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) { + return bestColor; + } else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); + } + }; + + // Big List of Colors + // ------------------ + // + var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + rebeccapurple: "663399", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" + }; + + // Make it easy to access colors via `hexNames[hex]` + var hexNames = tinycolor.hexNames = flip(names); + + // Utilities + // --------- + + // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` + function flip(o) { + var flipped = {}; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; + } + + // Return a valid alpha value [0,1] with all invalid values being set to 1 + function boundAlpha(a) { + a = parseFloat(a); + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + return a; + } + + // Take input from [0, n] and return it as [0, 1] + function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; + var processPercent = isPercentage(n); + n = Math.min(max, Math.max(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if (Math.abs(n - max) < 0.000001) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return n % max / parseFloat(max); + } + + // Force a number between 0 and 1 + function clamp01(val) { + return Math.min(1, Math.max(0, val)); + } + + // Parse a base-16 hex value into a base-10 integer + function parseIntFromHex(val) { + return parseInt(val, 16); + } + + // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 + // + function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; + } + + // Check to see if string passed in is a percentage + function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; + } + + // Force a hex value to have 2 characters + function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; + } + + // Replace a decimal with it's percentage value + function convertToPercentage(n) { + if (n <= 1) { + n = n * 100 + "%"; + } + return n; + } + + // Converts a decimal to a hex value + function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); + } + // Converts a hex value to a decimal + function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; + } + var matchers = function () { + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + return { + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; + }(); + + // `isValidCSSUnit` + // Take in a single string / number and check to see if it looks like a CSS unit + // (see `matchers` above for definition). + function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); + } + + // `stringInputToObject` + // Permissive string parsing. Take in a number of formats, and output an object + // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` + function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } else if (color == "transparent") { + return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if (match = matchers.rgb.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3] + }; + } + if (match = matchers.rgba.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; + } + if (match = matchers.hsl.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3] + }; + } + if (match = matchers.hsla.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; + } + if (match = matchers.hsv.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3] + }; + } + if (match = matchers.hsva.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; + } + if (match = matchers.hex8.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex6.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; + } + if (match = matchers.hex4.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex3.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; + } + return false; + } + function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + var level, size; + parms = parms || { + level: "AA", + size: "small" + }; + level = (parms.level || "AA").toUpperCase(); + size = (parms.size || "small").toLowerCase(); + if (level !== "AA" && level !== "AAA") { + level = "AA"; + } + if (size !== "small" && size !== "large") { + size = "small"; + } + return { + level: level, + size: size + }; + } + + return tinycolor; + +})); diff --git a/project starter code/node_modules/toidentifier/HISTORY.md b/node_modules/toidentifier/HISTORY.md similarity index 100% rename from project starter code/node_modules/toidentifier/HISTORY.md rename to node_modules/toidentifier/HISTORY.md diff --git a/project starter code/node_modules/toidentifier/LICENSE b/node_modules/toidentifier/LICENSE similarity index 100% rename from project starter code/node_modules/toidentifier/LICENSE rename to node_modules/toidentifier/LICENSE diff --git a/project starter code/node_modules/toidentifier/README.md b/node_modules/toidentifier/README.md similarity index 100% rename from project starter code/node_modules/toidentifier/README.md rename to node_modules/toidentifier/README.md diff --git a/project starter code/node_modules/toidentifier/index.js b/node_modules/toidentifier/index.js similarity index 100% rename from project starter code/node_modules/toidentifier/index.js rename to node_modules/toidentifier/index.js diff --git a/project starter code/node_modules/toidentifier/package.json b/node_modules/toidentifier/package.json similarity index 100% rename from project starter code/node_modules/toidentifier/package.json rename to node_modules/toidentifier/package.json diff --git a/node_modules/token-types/LICENSE b/node_modules/token-types/LICENSE new file mode 100644 index 00000000..ffcebb7b --- /dev/null +++ b/node_modules/token-types/LICENSE @@ -0,0 +1,7 @@ +Copyright 2017 Borewit + +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. \ No newline at end of file diff --git a/node_modules/token-types/README.md b/node_modules/token-types/README.md new file mode 100644 index 00000000..8391ac6f --- /dev/null +++ b/node_modules/token-types/README.md @@ -0,0 +1,115 @@ +![Node.js CI](https://github.com/Borewit/token-types/workflows/Node.js%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/token-types.svg)](https://npmjs.org/package/token-types) +[![npm downloads](http://img.shields.io/npm/dm/token-types.svg)](https://npmcharts.com/compare/token-types,strtok3?start=1200&interval=30) +[![coveralls](https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master)](https://coveralls.io/github/Borewit/token-types?branch=master) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4723ce4613fc49cda8db5eed29f18834)](https://www.codacy.com/app/Borewit/token-types?utm_source=github.com&utm_medium=referral&utm_content=Borewit/token-types&utm_campaign=Badge_Grade) +[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/token-types.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/token-types/context:javascript) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/token-types.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/token-types/alerts/) +[![DeepScan grade](https://deepscan.io/api/teams/5165/projects/6940/branches/61852/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=6940&bid=61852) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/token-types/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/token-types?targetFile=package.json) + +# token-types + +A primitive token library used to read and write from a node `Buffer`. +Although it is possible to use this module directly, it is primary designed to be used with [strtok3 tokenizer](https://github.com/Borewit/strtok3). + +## Installation + +```sh +npm install --save token-types +``` +Usually in combination with [strtok3](https://github.com/Borewit/strtok3): +```sh +npm install --save strtok3 +``` + +Using TypeScript you should also install [@tokenizer/token](https://github.com/Borewit/tokenizer-token) as a development +dependency: + +```shell +npm install --save-dev @tokenizer/token +``` + + +## Example + +```js +const strtok3 = require('strtok3'); +const token = require('token-types'); + +(async () => { + + const tokenizer = await strtok3.fromFile("somefile.bin"); + try { + const myNumber = await tokenizer.readToken(token.Float32_BE); + console.log(`My number: ${myNumber}`); + } finally { + tokenizer.close(); // Close the file + } +})(); +``` + +## Tokens + +### Numeric tokens + +`node-strtok` supports a wide variety of numerical tokens out of the box: + +| Token | Number | Bits | Endianness | +|---------------|------------------|------|----------------| +| `UINT8` | Unsigned integer | 8 | n/a | +| `UINT16_BE` | Unsigned integer | 16 | big endian | +| `UINT16_LE` | Unsigned integer | 16 | little endian | +| `UINT24_BE` | Unsigned integer | 24 | big endian | +| `UINT24_LE` | Unsigned integer | 24 | little endian | +| `UINT32_BE` | Unsigned integer | 32 | big endian | +| `UINT32_LE` | Unsigned integer | 32 | little endian | +| `UINT64_BE` | Unsigned integer | 64 | big endian | +| `UINT64_LE`* | Unsigned integer | 64 | little endian | +| `INT8` | Signed integer | 8 | n/a | +| `INT16_BE` | Signed integer | 16 | big endian | +| `INT16_LE` | Signed integer | 16 | little endian | +| `INT24_BE` | Signed integer | 24 | big endian | +| `INT24_LE` | Signed integer | 24 | little endian | +| `INT32_BE` | Signed integer | 32 | big endian | +| `INT32_LE` | Signed integer | 32 | little endian | +| `INT64_BE` | Signed integer | 64 | big endian | +| `INT64_LE`* | Signed integer | 64 | little endian | +| `Float16_BE` | IEEE 754 float | 16 | big endian | +| `Float16_LE` | IEEE 754 float | 16 | little endian | +| `Float32_BE` | IEEE 754 float | 32 | big endian | +| `Float32_LE` | IEEE 754 float | 32 | little endian | +| `Float64_BE` | IEEE 754 float | 64 | big endian | +| `Float64_LE` | IEEE 754 float | 64 | little endian | +| `Float80_BE`* | IEEE 754 float | 80 | big endian | +| `Float80_LE`* | IEEE 754 float | 80 | little endian | + +### Other tokens + +String types: +* Windows-1252 +* ISO-8859-1 + +*) The tokens exceed the JavaScript IEEE 754 64-bit Floating Point precision, decoding and encoding is best effort based. + +### Custom token + +Complex tokens can be added, which makes very suitable for reading binary files or network messages: +```js + ExtendedHeader = { + len: 10, + + get: (buf, off) => { + return { + // Extended header size + size: Token.UINT32_BE.get(buf, off), + // Extended Flags + extendedFlags: Token.UINT16_BE.get(buf, off + 4), + // Size of padding + sizeOfPadding: Token.UINT32_BE.get(buf, off + 6), + // CRC data present + crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31) + }; + } + }; +``` diff --git a/node_modules/token-types/lib/index.d.ts b/node_modules/token-types/lib/index.d.ts new file mode 100644 index 00000000..bcf41936 --- /dev/null +++ b/node_modules/token-types/lib/index.d.ts @@ -0,0 +1,150 @@ +/// +import { IToken, IGetToken } from '@tokenizer/token'; +/** + * 8-bit unsigned integer + */ +export declare const UINT8: IToken; +/** + * 16-bit unsigned integer, Little Endian byte order + */ +export declare const UINT16_LE: IToken; +/** + * 16-bit unsigned integer, Big Endian byte order + */ +export declare const UINT16_BE: IToken; +/** + * 24-bit unsigned integer, Little Endian byte order + */ +export declare const UINT24_LE: IToken; +/** + * 24-bit unsigned integer, Big Endian byte order + */ +export declare const UINT24_BE: IToken; +/** + * 32-bit unsigned integer, Little Endian byte order + */ +export declare const UINT32_LE: IToken; +/** + * 32-bit unsigned integer, Big Endian byte order + */ +export declare const UINT32_BE: IToken; +/** + * 8-bit signed integer + */ +export declare const INT8: IToken; +/** + * 16-bit signed integer, Big Endian byte order + */ +export declare const INT16_BE: IToken; +/** + * 16-bit signed integer, Little Endian byte order + */ +export declare const INT16_LE: IToken; +/** + * 24-bit signed integer, Little Endian byte order + */ +export declare const INT24_LE: IToken; +/** + * 24-bit signed integer, Big Endian byte order + */ +export declare const INT24_BE: IToken; +/** + * 32-bit signed integer, Big Endian byte order + */ +export declare const INT32_BE: IToken; +/** + * 32-bit signed integer, Big Endian byte order + */ +export declare const INT32_LE: IToken; +/** + * 64-bit unsigned integer, Little Endian byte order + */ +export declare const UINT64_LE: IToken; +/** + * 64-bit signed integer, Little Endian byte order + */ +export declare const INT64_LE: IToken; +/** + * 64-bit unsigned integer, Big Endian byte order + */ +export declare const UINT64_BE: IToken; +/** + * 64-bit signed integer, Big Endian byte order + */ +export declare const INT64_BE: IToken; +/** + * IEEE 754 16-bit (half precision) float, big endian + */ +export declare const Float16_BE: IToken; +/** + * IEEE 754 16-bit (half precision) float, little endian + */ +export declare const Float16_LE: IToken; +/** + * IEEE 754 32-bit (single precision) float, big endian + */ +export declare const Float32_BE: IToken; +/** + * IEEE 754 32-bit (single precision) float, little endian + */ +export declare const Float32_LE: IToken; +/** + * IEEE 754 64-bit (double precision) float, big endian + */ +export declare const Float64_BE: IToken; +/** + * IEEE 754 64-bit (double precision) float, little endian + */ +export declare const Float64_LE: IToken; +/** + * IEEE 754 80-bit (extended precision) float, big endian + */ +export declare const Float80_BE: IToken; +/** + * IEEE 754 80-bit (extended precision) float, little endian + */ +export declare const Float80_LE: IToken; +/** + * Ignore a given number of bytes + */ +export declare class IgnoreType implements IGetToken { + len: number; + /** + * @param len number of bytes to ignore + */ + constructor(len: number); + get(array: Uint8Array, off: number): void; +} +export declare class Uint8ArrayType implements IGetToken { + len: number; + constructor(len: number); + get(array: Uint8Array, offset: number): Uint8Array; +} +export declare class BufferType implements IGetToken { + len: number; + constructor(len: number); + get(uint8Array: Uint8Array, off: number): Buffer; +} +/** + * Consume a fixed number of bytes from the stream and return a string with a specified encoding. + */ +export declare class StringType implements IGetToken { + len: number; + encoding: BufferEncoding; + constructor(len: number, encoding: BufferEncoding); + get(uint8Array: Uint8Array, offset: number): string; +} +/** + * ANSI Latin 1 String + * Using windows-1252 / ISO 8859-1 decoding + */ +export declare class AnsiStringType implements IGetToken { + len: number; + private static windows1252; + private static decode; + private static inRange; + private static codePointToString; + private static singleByteDecoder; + constructor(len: number); + get(buffer: Buffer, offset?: number): string; +} diff --git a/node_modules/token-types/lib/index.js b/node_modules/token-types/lib/index.js new file mode 100644 index 00000000..82d8e0a2 --- /dev/null +++ b/node_modules/token-types/lib/index.js @@ -0,0 +1,455 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnsiStringType = exports.StringType = exports.BufferType = exports.Uint8ArrayType = exports.IgnoreType = exports.Float80_LE = exports.Float80_BE = exports.Float64_LE = exports.Float64_BE = exports.Float32_LE = exports.Float32_BE = exports.Float16_LE = exports.Float16_BE = exports.INT64_BE = exports.UINT64_BE = exports.INT64_LE = exports.UINT64_LE = exports.INT32_LE = exports.INT32_BE = exports.INT24_BE = exports.INT24_LE = exports.INT16_LE = exports.INT16_BE = exports.INT8 = exports.UINT32_BE = exports.UINT32_LE = exports.UINT24_BE = exports.UINT24_LE = exports.UINT16_BE = exports.UINT16_LE = exports.UINT8 = void 0; +const ieee754 = require("ieee754"); +// Primitive types +function dv(array) { + return new DataView(array.buffer, array.byteOffset); +} +/** + * 8-bit unsigned integer + */ +exports.UINT8 = { + len: 1, + get(array, offset) { + return dv(array).getUint8(offset); + }, + put(array, offset, value) { + dv(array).setUint8(offset, value); + return offset + 1; + } +}; +/** + * 16-bit unsigned integer, Little Endian byte order + */ +exports.UINT16_LE = { + len: 2, + get(array, offset) { + return dv(array).getUint16(offset, true); + }, + put(array, offset, value) { + dv(array).setUint16(offset, value, true); + return offset + 2; + } +}; +/** + * 16-bit unsigned integer, Big Endian byte order + */ +exports.UINT16_BE = { + len: 2, + get(array, offset) { + return dv(array).getUint16(offset); + }, + put(array, offset, value) { + dv(array).setUint16(offset, value); + return offset + 2; + } +}; +/** + * 24-bit unsigned integer, Little Endian byte order + */ +exports.UINT24_LE = { + len: 3, + get(array, offset) { + const dataView = dv(array); + return dataView.getUint8(offset) + (dataView.getUint16(offset + 1, true) << 8); + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint8(offset, value & 0xff); + dataView.setUint16(offset + 1, value >> 8, true); + return offset + 3; + } +}; +/** + * 24-bit unsigned integer, Big Endian byte order + */ +exports.UINT24_BE = { + len: 3, + get(array, offset) { + const dataView = dv(array); + return (dataView.getUint16(offset) << 8) + dataView.getUint8(offset + 2); + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint16(offset, value >> 8); + dataView.setUint8(offset + 2, value & 0xff); + return offset + 3; + } +}; +/** + * 32-bit unsigned integer, Little Endian byte order + */ +exports.UINT32_LE = { + len: 4, + get(array, offset) { + return dv(array).getUint32(offset, true); + }, + put(array, offset, value) { + dv(array).setUint32(offset, value, true); + return offset + 4; + } +}; +/** + * 32-bit unsigned integer, Big Endian byte order + */ +exports.UINT32_BE = { + len: 4, + get(array, offset) { + return dv(array).getUint32(offset); + }, + put(array, offset, value) { + dv(array).setUint32(offset, value); + return offset + 4; + } +}; +/** + * 8-bit signed integer + */ +exports.INT8 = { + len: 1, + get(array, offset) { + return dv(array).getInt8(offset); + }, + put(array, offset, value) { + dv(array).setInt8(offset, value); + return offset + 1; + } +}; +/** + * 16-bit signed integer, Big Endian byte order + */ +exports.INT16_BE = { + len: 2, + get(array, offset) { + return dv(array).getInt16(offset); + }, + put(array, offset, value) { + dv(array).setInt16(offset, value); + return offset + 2; + } +}; +/** + * 16-bit signed integer, Little Endian byte order + */ +exports.INT16_LE = { + len: 2, + get(array, offset) { + return dv(array).getInt16(offset, true); + }, + put(array, offset, value) { + dv(array).setInt16(offset, value, true); + return offset + 2; + } +}; +/** + * 24-bit signed integer, Little Endian byte order + */ +exports.INT24_LE = { + len: 3, + get(array, offset) { + const unsigned = exports.UINT24_LE.get(array, offset); + return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned; + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint8(offset, value & 0xff); + dataView.setUint16(offset + 1, value >> 8, true); + return offset + 3; + } +}; +/** + * 24-bit signed integer, Big Endian byte order + */ +exports.INT24_BE = { + len: 3, + get(array, offset) { + const unsigned = exports.UINT24_BE.get(array, offset); + return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned; + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint16(offset, value >> 8); + dataView.setUint8(offset + 2, value & 0xff); + return offset + 3; + } +}; +/** + * 32-bit signed integer, Big Endian byte order + */ +exports.INT32_BE = { + len: 4, + get(array, offset) { + return dv(array).getInt32(offset); + }, + put(array, offset, value) { + dv(array).setInt32(offset, value); + return offset + 4; + } +}; +/** + * 32-bit signed integer, Big Endian byte order + */ +exports.INT32_LE = { + len: 4, + get(array, offset) { + return dv(array).getInt32(offset, true); + }, + put(array, offset, value) { + dv(array).setInt32(offset, value, true); + return offset + 4; + } +}; +/** + * 64-bit unsigned integer, Little Endian byte order + */ +exports.UINT64_LE = { + len: 8, + get(array, offset) { + return dv(array).getBigUint64(offset, true); + }, + put(array, offset, value) { + dv(array).setBigUint64(offset, value, true); + return offset + 8; + } +}; +/** + * 64-bit signed integer, Little Endian byte order + */ +exports.INT64_LE = { + len: 8, + get(array, offset) { + return dv(array).getBigInt64(offset, true); + }, + put(array, offset, value) { + dv(array).setBigInt64(offset, value, true); + return offset + 8; + } +}; +/** + * 64-bit unsigned integer, Big Endian byte order + */ +exports.UINT64_BE = { + len: 8, + get(array, offset) { + return dv(array).getBigUint64(offset); + }, + put(array, offset, value) { + dv(array).setBigUint64(offset, value); + return offset + 8; + } +}; +/** + * 64-bit signed integer, Big Endian byte order + */ +exports.INT64_BE = { + len: 8, + get(array, offset) { + return dv(array).getBigInt64(offset); + }, + put(array, offset, value) { + dv(array).setBigInt64(offset, value); + return offset + 8; + } +}; +/** + * IEEE 754 16-bit (half precision) float, big endian + */ +exports.Float16_BE = { + len: 2, + get(dataView, offset) { + return ieee754.read(dataView, offset, false, 10, this.len); + }, + put(dataView, offset, value) { + ieee754.write(dataView, value, offset, false, 10, this.len); + return offset + this.len; + } +}; +/** + * IEEE 754 16-bit (half precision) float, little endian + */ +exports.Float16_LE = { + len: 2, + get(array, offset) { + return ieee754.read(array, offset, true, 10, this.len); + }, + put(array, offset, value) { + ieee754.write(array, value, offset, true, 10, this.len); + return offset + this.len; + } +}; +/** + * IEEE 754 32-bit (single precision) float, big endian + */ +exports.Float32_BE = { + len: 4, + get(array, offset) { + return dv(array).getFloat32(offset); + }, + put(array, offset, value) { + dv(array).setFloat32(offset, value); + return offset + 4; + } +}; +/** + * IEEE 754 32-bit (single precision) float, little endian + */ +exports.Float32_LE = { + len: 4, + get(array, offset) { + return dv(array).getFloat32(offset, true); + }, + put(array, offset, value) { + dv(array).setFloat32(offset, value, true); + return offset + 4; + } +}; +/** + * IEEE 754 64-bit (double precision) float, big endian + */ +exports.Float64_BE = { + len: 8, + get(array, offset) { + return dv(array).getFloat64(offset); + }, + put(array, offset, value) { + dv(array).setFloat64(offset, value); + return offset + 8; + } +}; +/** + * IEEE 754 64-bit (double precision) float, little endian + */ +exports.Float64_LE = { + len: 8, + get(array, offset) { + return dv(array).getFloat64(offset, true); + }, + put(array, offset, value) { + dv(array).setFloat64(offset, value, true); + return offset + 8; + } +}; +/** + * IEEE 754 80-bit (extended precision) float, big endian + */ +exports.Float80_BE = { + len: 10, + get(array, offset) { + return ieee754.read(array, offset, false, 63, this.len); + }, + put(array, offset, value) { + ieee754.write(array, value, offset, false, 63, this.len); + return offset + this.len; + } +}; +/** + * IEEE 754 80-bit (extended precision) float, little endian + */ +exports.Float80_LE = { + len: 10, + get(array, offset) { + return ieee754.read(array, offset, true, 63, this.len); + }, + put(array, offset, value) { + ieee754.write(array, value, offset, true, 63, this.len); + return offset + this.len; + } +}; +/** + * Ignore a given number of bytes + */ +class IgnoreType { + /** + * @param len number of bytes to ignore + */ + constructor(len) { + this.len = len; + } + // ToDo: don't read, but skip data + get(array, off) { + } +} +exports.IgnoreType = IgnoreType; +class Uint8ArrayType { + constructor(len) { + this.len = len; + } + get(array, offset) { + return array.subarray(offset, offset + this.len); + } +} +exports.Uint8ArrayType = Uint8ArrayType; +class BufferType { + constructor(len) { + this.len = len; + } + get(uint8Array, off) { + return Buffer.from(uint8Array.subarray(off, off + this.len)); + } +} +exports.BufferType = BufferType; +/** + * Consume a fixed number of bytes from the stream and return a string with a specified encoding. + */ +class StringType { + constructor(len, encoding) { + this.len = len; + this.encoding = encoding; + } + get(uint8Array, offset) { + return Buffer.from(uint8Array).toString(this.encoding, offset, offset + this.len); + } +} +exports.StringType = StringType; +/** + * ANSI Latin 1 String + * Using windows-1252 / ISO 8859-1 decoding + */ +class AnsiStringType { + constructor(len) { + this.len = len; + } + static decode(buffer, offset, until) { + let str = ''; + for (let i = offset; i < until; ++i) { + str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i])); + } + return str; + } + static inRange(a, min, max) { + return min <= a && a <= max; + } + static codePointToString(cp) { + if (cp <= 0xFFFF) { + return String.fromCharCode(cp); + } + else { + cp -= 0x10000; + return String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00); + } + } + static singleByteDecoder(bite) { + if (AnsiStringType.inRange(bite, 0x00, 0x7F)) { + return bite; + } + const codePoint = AnsiStringType.windows1252[bite - 0x80]; + if (codePoint === null) { + throw Error('invaliding encoding'); + } + return codePoint; + } + get(buffer, offset = 0) { + return AnsiStringType.decode(buffer, offset, offset + this.len); + } +} +exports.AnsiStringType = AnsiStringType; +AnsiStringType.windows1252 = [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, + 8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, + 8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255]; diff --git a/node_modules/token-types/package.json b/node_modules/token-types/package.json new file mode 100644 index 00000000..8882afe2 --- /dev/null +++ b/node_modules/token-types/package.json @@ -0,0 +1,93 @@ +{ + "name": "token-types", + "version": "4.2.1", + "description": "Common token types for decoding and encoding numeric and string values", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "scripts": { + "clean": "del-cli lib/**/*.js lib/***.js.map *.d.ts test/**/*.d.ts test/**/*.js test/**/*.js.map .nyc_output", + "build": "npm run compile", + "compile-src": "tsc --p lib", + "compile-test": "tsc --p test", + "compile": "npm run compile-src && npm run compile-test", + "lint-ts": "tslint lib/index.ts --exclude '*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'", + "lint-md": "remark -u preset-lint-recommended .", + "lint": "npm run lint-ts && npm run lint-md", + "test": "mocha --require ts-node/register --require source-map-support/register --full-trace --recursive test/test-*.ts", + "test-coverage": "nyc npm run test" + }, + "engines": { + "node": ">=10" + }, + "repository": { + "type": "git", + "url": "https://github.com/Borewit/token-types" + }, + "files": [ + "lib/index.js", + "lib/index.d.ts" + ], + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bugs": { + "url": "https://github.com/Borewit/token-types/issues" + }, + "devDependencies": { + "@types/chai": "^4.3.1", + "@types/mocha": "^9.1.0", + "@types/node": "^18.6.3", + "chai": "^4.3.6", + "coveralls": "^3.1.1", + "del-cli": "^5.0.0", + "mocha": "^9.2.2", + "nyc": "^15.1.0", + "remark-cli": "^11.0.0", + "remark-preset-lint-recommended": "^6.1.2", + "source-map-support": "^0.5.21", + "ts-node": "^10.9.1", + "tslint": "^6.1.3", + "typescript": "^4.7.4" + }, + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "remarkConfig": { + "plugins": [ + "preset-lint-recommended" + ] + }, + "nyc": { + "exclude": [ + "test/**/*.ts", + "lib/**/*.*.js" + ], + "extension": [ + ".ts" + ], + "sourceMap": true, + "instrument": true, + "reporter": [ + "lcov", + "text" + ], + "report-dir": "coverage" + }, + "keywords": [ + "token", + "integer", + "unsigned", + "numeric", + "float", + "IEEE", + "754", + "strtok3" + ] +} diff --git a/project starter code/node_modules/type-is/HISTORY.md b/node_modules/type-is/HISTORY.md similarity index 100% rename from project starter code/node_modules/type-is/HISTORY.md rename to node_modules/type-is/HISTORY.md diff --git a/project starter code/node_modules/type-is/LICENSE b/node_modules/type-is/LICENSE similarity index 100% rename from project starter code/node_modules/type-is/LICENSE rename to node_modules/type-is/LICENSE diff --git a/project starter code/node_modules/type-is/README.md b/node_modules/type-is/README.md similarity index 100% rename from project starter code/node_modules/type-is/README.md rename to node_modules/type-is/README.md diff --git a/project starter code/node_modules/type-is/index.js b/node_modules/type-is/index.js similarity index 100% rename from project starter code/node_modules/type-is/index.js rename to node_modules/type-is/index.js diff --git a/project starter code/node_modules/type-is/package.json b/node_modules/type-is/package.json similarity index 100% rename from project starter code/node_modules/type-is/package.json rename to node_modules/type-is/package.json diff --git a/project starter code/node_modules/unpipe/HISTORY.md b/node_modules/unpipe/HISTORY.md similarity index 100% rename from project starter code/node_modules/unpipe/HISTORY.md rename to node_modules/unpipe/HISTORY.md diff --git a/project starter code/node_modules/unpipe/LICENSE b/node_modules/unpipe/LICENSE similarity index 100% rename from project starter code/node_modules/unpipe/LICENSE rename to node_modules/unpipe/LICENSE diff --git a/project starter code/node_modules/unpipe/README.md b/node_modules/unpipe/README.md similarity index 100% rename from project starter code/node_modules/unpipe/README.md rename to node_modules/unpipe/README.md diff --git a/project starter code/node_modules/unpipe/index.js b/node_modules/unpipe/index.js similarity index 100% rename from project starter code/node_modules/unpipe/index.js rename to node_modules/unpipe/index.js diff --git a/project starter code/node_modules/unpipe/package.json b/node_modules/unpipe/package.json similarity index 100% rename from project starter code/node_modules/unpipe/package.json rename to node_modules/unpipe/package.json diff --git a/project starter code/node_modules/utif/LICENSE b/node_modules/utif/LICENSE similarity index 100% rename from project starter code/node_modules/utif/LICENSE rename to node_modules/utif/LICENSE diff --git a/project starter code/node_modules/utif/README.md b/node_modules/utif/README.md similarity index 100% rename from project starter code/node_modules/utif/README.md rename to node_modules/utif/README.md diff --git a/project starter code/node_modules/utif/UTIF.js b/node_modules/utif/UTIF.js similarity index 100% rename from project starter code/node_modules/utif/UTIF.js rename to node_modules/utif/UTIF.js diff --git a/project starter code/node_modules/utif/package.json b/node_modules/utif/package.json similarity index 100% rename from project starter code/node_modules/utif/package.json rename to node_modules/utif/package.json diff --git a/node_modules/util-deprecate/History.md b/node_modules/util-deprecate/History.md new file mode 100644 index 00000000..acc86753 --- /dev/null +++ b/node_modules/util-deprecate/History.md @@ -0,0 +1,16 @@ + +1.0.2 / 2015-10-07 +================== + + * use try/catch when checking `localStorage` (#3, @kumavis) + +1.0.1 / 2014-11-25 +================== + + * browser: use `console.warn()` for deprecation calls + * browser: more jsdocs + +1.0.0 / 2014-04-30 +================== + + * initial commit diff --git a/node_modules/util-deprecate/LICENSE b/node_modules/util-deprecate/LICENSE new file mode 100644 index 00000000..6a60e8c2 --- /dev/null +++ b/node_modules/util-deprecate/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +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. diff --git a/node_modules/util-deprecate/README.md b/node_modules/util-deprecate/README.md new file mode 100644 index 00000000..75622fa7 --- /dev/null +++ b/node_modules/util-deprecate/README.md @@ -0,0 +1,53 @@ +util-deprecate +============== +### The Node.js `util.deprecate()` function with browser support + +In Node.js, this module simply re-exports the `util.deprecate()` function. + +In the web browser (i.e. via browserify), a browser-specific implementation +of the `util.deprecate()` function is used. + + +## API + +A `deprecate()` function is the only thing exposed by this module. + +``` javascript +// setup: +exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); + + +// users see: +foo(); +// foo() is deprecated, use bar() instead +foo(); +foo(); +``` + + +## License + +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +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. diff --git a/node_modules/util-deprecate/browser.js b/node_modules/util-deprecate/browser.js new file mode 100644 index 00000000..549ae2f0 --- /dev/null +++ b/node_modules/util-deprecate/browser.js @@ -0,0 +1,67 @@ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} diff --git a/node_modules/util-deprecate/node.js b/node_modules/util-deprecate/node.js new file mode 100644 index 00000000..5e6fcff5 --- /dev/null +++ b/node_modules/util-deprecate/node.js @@ -0,0 +1,6 @@ + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = require('util').deprecate; diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json new file mode 100644 index 00000000..2e79f89a --- /dev/null +++ b/node_modules/util-deprecate/package.json @@ -0,0 +1,27 @@ +{ + "name": "util-deprecate", + "version": "1.0.2", + "description": "The Node.js `util.deprecate()` function with browser support", + "main": "node.js", + "browser": "browser.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/util-deprecate.git" + }, + "keywords": [ + "util", + "deprecate", + "browserify", + "browser", + "node" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/TooTallNate/util-deprecate/issues" + }, + "homepage": "https://github.com/TooTallNate/util-deprecate" +} diff --git a/project starter code/node_modules/utils-merge/.npmignore b/node_modules/utils-merge/.npmignore similarity index 100% rename from project starter code/node_modules/utils-merge/.npmignore rename to node_modules/utils-merge/.npmignore diff --git a/project starter code/node_modules/utils-merge/LICENSE b/node_modules/utils-merge/LICENSE similarity index 100% rename from project starter code/node_modules/utils-merge/LICENSE rename to node_modules/utils-merge/LICENSE diff --git a/project starter code/node_modules/utils-merge/README.md b/node_modules/utils-merge/README.md similarity index 100% rename from project starter code/node_modules/utils-merge/README.md rename to node_modules/utils-merge/README.md diff --git a/project starter code/node_modules/utils-merge/index.js b/node_modules/utils-merge/index.js similarity index 100% rename from project starter code/node_modules/utils-merge/index.js rename to node_modules/utils-merge/index.js diff --git a/project starter code/node_modules/utils-merge/package.json b/node_modules/utils-merge/package.json similarity index 100% rename from project starter code/node_modules/utils-merge/package.json rename to node_modules/utils-merge/package.json diff --git a/project starter code/node_modules/vary/HISTORY.md b/node_modules/vary/HISTORY.md similarity index 100% rename from project starter code/node_modules/vary/HISTORY.md rename to node_modules/vary/HISTORY.md diff --git a/project starter code/node_modules/vary/LICENSE b/node_modules/vary/LICENSE similarity index 100% rename from project starter code/node_modules/vary/LICENSE rename to node_modules/vary/LICENSE diff --git a/project starter code/node_modules/vary/README.md b/node_modules/vary/README.md similarity index 100% rename from project starter code/node_modules/vary/README.md rename to node_modules/vary/README.md diff --git a/project starter code/node_modules/vary/index.js b/node_modules/vary/index.js similarity index 100% rename from project starter code/node_modules/vary/index.js rename to node_modules/vary/index.js diff --git a/project starter code/node_modules/vary/package.json b/node_modules/vary/package.json similarity index 100% rename from project starter code/node_modules/vary/package.json rename to node_modules/vary/package.json diff --git a/project starter code/node_modules/xhr/.vscode/settings.json b/node_modules/xhr/.vscode/settings.json similarity index 100% rename from project starter code/node_modules/xhr/.vscode/settings.json rename to node_modules/xhr/.vscode/settings.json diff --git a/project starter code/node_modules/xhr/CONTRIBUTING.md b/node_modules/xhr/CONTRIBUTING.md similarity index 100% rename from project starter code/node_modules/xhr/CONTRIBUTING.md rename to node_modules/xhr/CONTRIBUTING.md diff --git a/project starter code/node_modules/xhr/LICENCE b/node_modules/xhr/LICENCE similarity index 100% rename from project starter code/node_modules/xhr/LICENCE rename to node_modules/xhr/LICENCE diff --git a/project starter code/node_modules/xhr/README.md b/node_modules/xhr/README.md similarity index 100% rename from project starter code/node_modules/xhr/README.md rename to node_modules/xhr/README.md diff --git a/project starter code/node_modules/xhr/index.d.ts b/node_modules/xhr/index.d.ts similarity index 100% rename from project starter code/node_modules/xhr/index.d.ts rename to node_modules/xhr/index.d.ts diff --git a/project starter code/node_modules/xhr/index.js b/node_modules/xhr/index.js similarity index 100% rename from project starter code/node_modules/xhr/index.js rename to node_modules/xhr/index.js diff --git a/project starter code/node_modules/xhr/package.json b/node_modules/xhr/package.json similarity index 100% rename from project starter code/node_modules/xhr/package.json rename to node_modules/xhr/package.json diff --git a/project starter code/node_modules/xml-parse-from-string/LICENSE.md b/node_modules/xml-parse-from-string/LICENSE.md similarity index 100% rename from project starter code/node_modules/xml-parse-from-string/LICENSE.md rename to node_modules/xml-parse-from-string/LICENSE.md diff --git a/project starter code/node_modules/xml-parse-from-string/README.md b/node_modules/xml-parse-from-string/README.md similarity index 100% rename from project starter code/node_modules/xml-parse-from-string/README.md rename to node_modules/xml-parse-from-string/README.md diff --git a/project starter code/node_modules/xml-parse-from-string/index.js b/node_modules/xml-parse-from-string/index.js similarity index 100% rename from project starter code/node_modules/xml-parse-from-string/index.js rename to node_modules/xml-parse-from-string/index.js diff --git a/project starter code/node_modules/xml-parse-from-string/package.json b/node_modules/xml-parse-from-string/package.json similarity index 100% rename from project starter code/node_modules/xml-parse-from-string/package.json rename to node_modules/xml-parse-from-string/package.json diff --git a/project starter code/node_modules/xml2js/LICENSE b/node_modules/xml2js/LICENSE similarity index 100% rename from project starter code/node_modules/xml2js/LICENSE rename to node_modules/xml2js/LICENSE diff --git a/node_modules/xml2js/README.md b/node_modules/xml2js/README.md new file mode 100644 index 00000000..67f2104a --- /dev/null +++ b/node_modules/xml2js/README.md @@ -0,0 +1,507 @@ +node-xml2js +=========== + +Ever had the urge to parse XML? And wanted to access the data in some sane, +easy way? Don't want to compile a C parser, for whatever reason? Then xml2js is +what you're looking for! + +Description +=========== + +Simple XML to JavaScript object converter. It supports bi-directional conversion. +Uses [sax-js](https://github.com/isaacs/sax-js/) and +[xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js/). + +Note: If you're looking for a full DOM parser, you probably want +[JSDom](https://github.com/tmpvar/jsdom). + +Installation +============ + +Simplest way to install `xml2js` is to use [npm](http://npmjs.org), just `npm +install xml2js` which will download xml2js and all dependencies. + +xml2js is also available via [Bower](http://bower.io/), just `bower install +xml2js` which will download xml2js and all dependencies. + +Usage +===== + +No extensive tutorials required because you are a smart developer! The task of +parsing XML should be an easy one, so let's make it so! Here's some examples. + +Shoot-and-forget usage +---------------------- + +You want to parse XML as simple and easy as possible? It's dangerous to go +alone, take this: + +```javascript +var parseString = require('xml2js').parseString; +var xml = "Hello xml2js!" +parseString(xml, function (err, result) { + console.dir(result); +}); +``` + +Can't get easier than this, right? This works starting with `xml2js` 0.2.3. +With CoffeeScript it looks like this: + +```coffeescript +{parseString} = require 'xml2js' +xml = "Hello xml2js!" +parseString xml, (err, result) -> + console.dir result +``` + +If you need some special options, fear not, `xml2js` supports a number of +options (see below), you can specify these as second argument: + +```javascript +parseString(xml, {trim: true}, function (err, result) { +}); +``` + +Simple as pie usage +------------------- + +That's right, if you have been using xml-simple or a home-grown +wrapper, this was added in 0.1.11 just for you: + +```javascript +var fs = require('fs'), + xml2js = require('xml2js'); + +var parser = new xml2js.Parser(); +fs.readFile(__dirname + '/foo.xml', function(err, data) { + parser.parseString(data, function (err, result) { + console.dir(result); + console.log('Done'); + }); +}); +``` + +Look ma, no event listeners! + +You can also use `xml2js` from +[CoffeeScript](https://github.com/jashkenas/coffeescript), further reducing +the clutter: + +```coffeescript +fs = require 'fs', +xml2js = require 'xml2js' + +parser = new xml2js.Parser() +fs.readFile __dirname + '/foo.xml', (err, data) -> + parser.parseString data, (err, result) -> + console.dir result + console.log 'Done.' +``` + +But what happens if you forget the `new` keyword to create a new `Parser`? In +the middle of a nightly coding session, it might get lost, after all. Worry +not, we got you covered! Starting with 0.2.8 you can also leave it out, in +which case `xml2js` will helpfully add it for you, no bad surprises and +inexplicable bugs! + +Promise usage +------------- + +```javascript +var xml2js = require('xml2js'); +var xml = ''; + +// With parser +var parser = new xml2js.Parser(/* options */); +parser.parseStringPromise(xml).then(function (result) { + console.dir(result); + console.log('Done'); +}) +.catch(function (err) { + // Failed +}); + +// Without parser +xml2js.parseStringPromise(xml /*, options */).then(function (result) { + console.dir(result); + console.log('Done'); +}) +.catch(function (err) { + // Failed +}); +``` + +Parsing multiple files +---------------------- + +If you want to parse multiple files, you have multiple possibilities: + + * You can create one `xml2js.Parser` per file. That's the recommended one + and is promised to always *just work*. + * You can call `reset()` on your parser object. + * You can hope everything goes well anyway. This behaviour is not + guaranteed work always, if ever. Use option #1 if possible. Thanks! + +So you wanna some JSON? +----------------------- + +Just wrap the `result` object in a call to `JSON.stringify` like this +`JSON.stringify(result)`. You get a string containing the JSON representation +of the parsed object that you can feed to JSON-hungry consumers. + +Displaying results +------------------ + +You might wonder why, using `console.dir` or `console.log` the output at some +level is only `[Object]`. Don't worry, this is not because `xml2js` got lazy. +That's because Node uses `util.inspect` to convert the object into strings and +that function stops after `depth=2` which is a bit low for most XML. + +To display the whole deal, you can use `console.log(util.inspect(result, false, +null))`, which displays the whole result. + +So much for that, but what if you use +[eyes](https://github.com/cloudhead/eyes.js) for nice colored output and it +truncates the output with `…`? Don't fear, there's also a solution for that, +you just need to increase the `maxLength` limit by creating a custom inspector +`var inspect = require('eyes').inspector({maxLength: false})` and then you can +easily `inspect(result)`. + +XML builder usage +----------------- + +Since 0.4.0, objects can be also be used to build XML: + +```javascript +var xml2js = require('xml2js'); + +var obj = {name: "Super", Surname: "Man", age: 23}; + +var builder = new xml2js.Builder(); +var xml = builder.buildObject(obj); +``` +will result in: + +```xml + + + Super + Man + 23 + +``` + +At the moment, a one to one bi-directional conversion is guaranteed only for +default configuration, except for `attrkey`, `charkey` and `explicitArray` options +you can redefine to your taste. Writing CDATA is supported via setting the `cdata` +option to `true`. + +To specify attributes: +```javascript +var xml2js = require('xml2js'); + +var obj = {root: {$: {id: "my id"}, _: "my inner text"}}; + +var builder = new xml2js.Builder(); +var xml = builder.buildObject(obj); +``` +will result in: +```xml + +my inner text +``` + +### Adding xmlns attributes + +You can generate XML that declares XML namespace prefix / URI pairs with xmlns attributes. + +Example declaring a default namespace on the root element: + +```javascript +let obj = { + Foo: { + $: { + "xmlns": "http://foo.com" + } + } +}; +``` +Result of `buildObject(obj)`: +```xml + +``` +Example declaring non-default namespaces on non-root elements: +```javascript +let obj = { + 'foo:Foo': { + $: { + 'xmlns:foo': 'http://foo.com' + }, + 'bar:Bar': { + $: { + 'xmlns:bar': 'http://bar.com' + } + } + } +} +``` +Result of `buildObject(obj)`: +```xml + + + +``` + + +Processing attribute, tag names and values +------------------------------------------ + +Since 0.4.1 you can optionally provide the parser with attribute name and tag name processors as well as element value processors (Since 0.4.14, you can also optionally provide the parser with attribute value processors): + +```javascript + +function nameToUpperCase(name){ + return name.toUpperCase(); +} + +//transform all attribute and tag names and values to uppercase +parseString(xml, { + tagNameProcessors: [nameToUpperCase], + attrNameProcessors: [nameToUpperCase], + valueProcessors: [nameToUpperCase], + attrValueProcessors: [nameToUpperCase]}, + function (err, result) { + // processed data +}); +``` + +The `tagNameProcessors` and `attrNameProcessors` options +accept an `Array` of functions with the following signature: + +```javascript +function (name){ + //do something with `name` + return name +} +``` + +The `attrValueProcessors` and `valueProcessors` options +accept an `Array` of functions with the following signature: + +```javascript +function (value, name) { + //`name` will be the node name or attribute name + //do something with `value`, (optionally) dependent on the node/attr name + return value +} +``` + +Some processors are provided out-of-the-box and can be found in `lib/processors.js`: + +- `normalize`: transforms the name to lowercase. +(Automatically used when `options.normalize` is set to `true`) + +- `firstCharLowerCase`: transforms the first character to lower case. +E.g. 'MyTagName' becomes 'myTagName' + +- `stripPrefix`: strips the xml namespace prefix. E.g `` will become 'Bar'. +(N.B.: the `xmlns` prefix is NOT stripped.) + +- `parseNumbers`: parses integer-like strings as integers and float-like strings as floats +E.g. "0" becomes 0 and "15.56" becomes 15.56 + +- `parseBooleans`: parses boolean-like strings to booleans +E.g. "true" becomes true and "False" becomes false + +Options +======= + +Apart from the default settings, there are a number of options that can be +specified for the parser. Options are specified by ``new Parser({optionName: +value})``. Possible options are: + + * `attrkey` (default: `$`): Prefix that is used to access the attributes. + Version 0.1 default was `@`. + * `charkey` (default: `_`): Prefix that is used to access the character + content. Version 0.1 default was `#`. + * `explicitCharkey` (default: `false`) Determines whether or not to use + a `charkey` prefix for elements with no attributes. + * `trim` (default: `false`): Trim the whitespace at the beginning and end of + text nodes. + * `normalizeTags` (default: `false`): Normalize all tag names to lowercase. + * `normalize` (default: `false`): Trim whitespaces inside text nodes. + * `explicitRoot` (default: `true`): Set this if you want to get the root + node in the resulting object. + * `emptyTag` (default: `''`): what will the value of empty nodes be. In case + you want to use an empty object as a default value, it is better to provide a factory + function `() => ({})` instead. Without this function a plain object would + become a shared reference across all occurrences with unwanted behavior. + * `explicitArray` (default: `true`): Always put child nodes in an array if + true; otherwise an array is created only if there is more than one. + * `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create + text nodes. + * `mergeAttrs` (default: `false`): Merge attributes and child elements as + properties of the parent, instead of keying attributes off a child + attribute object. This option is ignored if `ignoreAttrs` is `true`. + * `validator` (default `null`): You can specify a callable that validates + the resulting structure somehow, however you want. See unit tests + for an example. + * `xmlns` (default `false`): Give each element a field usually called '$ns' + (the first character is the same as attrkey) that contains its local name + and namespace URI. + * `explicitChildren` (default `false`): Put child elements to separate + property. Doesn't work with `mergeAttrs = true`. If element has no children + then "children" won't be created. Added in 0.2.5. + * `childkey` (default `$$`): Prefix that is used to access child elements if + `explicitChildren` is set to `true`. Added in 0.2.5. + * `preserveChildrenOrder` (default `false`): Modifies the behavior of + `explicitChildren` so that the value of the "children" property becomes an + ordered array. When this is `true`, every node will also get a `#name` field + whose value will correspond to the XML nodeName, so that you may iterate + the "children" array and still be able to determine node names. The named + (and potentially unordered) properties are also retained in this + configuration at the same level as the ordered "children" array. Added in + 0.4.9. + * `charsAsChildren` (default `false`): Determines whether chars should be + considered children if `explicitChildren` is on. Added in 0.2.5. + * `includeWhiteChars` (default `false`): Determines whether whitespace-only + text nodes should be included. Added in 0.4.17. + * `async` (default `false`): Should the callbacks be async? This *might* be + an incompatible change if your code depends on sync execution of callbacks. + Future versions of `xml2js` might change this default, so the recommendation + is to not depend on sync execution anyway. Added in 0.2.6. + * `strict` (default `true`): Set sax-js to strict or non-strict parsing mode. + Defaults to `true` which is *highly* recommended, since parsing HTML which + is not well-formed XML might yield just about anything. Added in 0.2.7. + * `attrNameProcessors` (default: `null`): Allows the addition of attribute + name processing functions. Accepts an `Array` of functions with following + signature: + ```javascript + function (name){ + //do something with `name` + return name + } + ``` + Added in 0.4.14 + * `attrValueProcessors` (default: `null`): Allows the addition of attribute + value processing functions. Accepts an `Array` of functions with following + signature: + ```javascript + function (value, name){ + //do something with `name` + return name + } + ``` + Added in 0.4.1 + * `tagNameProcessors` (default: `null`): Allows the addition of tag name + processing functions. Accepts an `Array` of functions with following + signature: + ```javascript + function (name){ + //do something with `name` + return name + } + ``` + Added in 0.4.1 + * `valueProcessors` (default: `null`): Allows the addition of element value + processing functions. Accepts an `Array` of functions with following + signature: + ```javascript + function (value, name){ + //do something with `name` + return name + } + ``` + Added in 0.4.6 + +Options for the `Builder` class +------------------------------- +These options are specified by ``new Builder({optionName: value})``. +Possible options are: + + * `attrkey` (default: `$`): Prefix that is used to access the attributes. + Version 0.1 default was `@`. + * `charkey` (default: `_`): Prefix that is used to access the character + content. Version 0.1 default was `#`. + * `rootName` (default `root` or the root key name): root element name to be used in case + `explicitRoot` is `false` or to override the root element name. + * `renderOpts` (default `{ 'pretty': true, 'indent': ' ', 'newline': '\n' }`): + Rendering options for xmlbuilder-js. + * pretty: prettify generated XML + * indent: whitespace for indentation (only when pretty) + * newline: newline char (only when pretty) + * `xmldec` (default `{ 'version': '1.0', 'encoding': 'UTF-8', 'standalone': true }`: + XML declaration attributes. + * `xmldec.version` A version number string, e.g. 1.0 + * `xmldec.encoding` Encoding declaration, e.g. UTF-8 + * `xmldec.standalone` standalone document declaration: true or false + * `doctype` (default `null`): optional DTD. Eg. `{'ext': 'hello.dtd'}` + * `headless` (default: `false`): omit the XML header. Added in 0.4.3. + * `allowSurrogateChars` (default: `false`): allows using characters from the Unicode + surrogate blocks. + * `cdata` (default: `false`): wrap text nodes in `` instead of + escaping when necessary. Does not add `` if it is not required. + Added in 0.4.5. + +`renderOpts`, `xmldec`,`doctype` and `headless` pass through to +[xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js). + +Updating to new version +======================= + +Version 0.2 changed the default parsing settings, but version 0.1.14 introduced +the default settings for version 0.2, so these settings can be tried before the +migration. + +```javascript +var xml2js = require('xml2js'); +var parser = new xml2js.Parser(xml2js.defaults["0.2"]); +``` + +To get the 0.1 defaults in version 0.2 you can just use +`xml2js.defaults["0.1"]` in the same place. This provides you with enough time +to migrate to the saner way of parsing in `xml2js` 0.2. We try to make the +migration as simple and gentle as possible, but some breakage cannot be +avoided. + +So, what exactly did change and why? In 0.2 we changed some defaults to parse +the XML in a more universal and sane way. So we disabled `normalize` and `trim` +so `xml2js` does not cut out any text content. You can reenable this at will of +course. A more important change is that we return the root tag in the resulting +JavaScript structure via the `explicitRoot` setting, so you need to access the +first element. This is useful for anybody who wants to know what the root node +is and preserves more information. The last major change was to enable +`explicitArray`, so everytime it is possible that one might embed more than one +sub-tag into a tag, xml2js >= 0.2 returns an array even if the array just +includes one element. This is useful when dealing with APIs that return +variable amounts of subtags. + +Running tests, development +========================== + +[![Build Status](https://travis-ci.org/Leonidas-from-XIV/node-xml2js.svg?branch=master)](https://travis-ci.org/Leonidas-from-XIV/node-xml2js) +[![Coverage Status](https://coveralls.io/repos/Leonidas-from-XIV/node-xml2js/badge.svg?branch=)](https://coveralls.io/r/Leonidas-from-XIV/node-xml2js?branch=master) +[![Dependency Status](https://david-dm.org/Leonidas-from-XIV/node-xml2js.svg)](https://david-dm.org/Leonidas-from-XIV/node-xml2js) + +The development requirements are handled by npm, you just need to install them. +We also have a number of unit tests, they can be run using `npm test` directly +from the project root. This runs zap to discover all the tests and execute +them. + +If you like to contribute, keep in mind that `xml2js` is written in +CoffeeScript, so don't develop on the JavaScript files that are checked into +the repository for convenience reasons. Also, please write some unit test to +check your behaviour and if it is some user-facing thing, add some +documentation to this README, so people will know it exists. Thanks in advance! + +Getting support +=============== + +Please, if you have a problem with the library, first make sure you read this +README. If you read this far, thanks, you're good. Then, please make sure your +problem really is with `xml2js`. It is? Okay, then I'll look at it. Send me a +mail and we can talk. Please don't open issues, as I don't think that is the +proper forum for support problems. Some problems might as well really be bugs +in `xml2js`, if so I'll let you know to open an issue instead :) + +But if you know you really found a bug, feel free to open an issue instead. diff --git a/project starter code/node_modules/xml2js/lib/bom.js b/node_modules/xml2js/lib/bom.js similarity index 100% rename from project starter code/node_modules/xml2js/lib/bom.js rename to node_modules/xml2js/lib/bom.js diff --git a/project starter code/node_modules/xml2js/lib/builder.js b/node_modules/xml2js/lib/builder.js similarity index 100% rename from project starter code/node_modules/xml2js/lib/builder.js rename to node_modules/xml2js/lib/builder.js diff --git a/project starter code/node_modules/xml2js/lib/defaults.js b/node_modules/xml2js/lib/defaults.js similarity index 100% rename from project starter code/node_modules/xml2js/lib/defaults.js rename to node_modules/xml2js/lib/defaults.js diff --git a/project starter code/node_modules/xml2js/lib/parser.js b/node_modules/xml2js/lib/parser.js similarity index 96% rename from project starter code/node_modules/xml2js/lib/parser.js rename to node_modules/xml2js/lib/parser.js index 59f4d545..192382d3 100644 --- a/project starter code/node_modules/xml2js/lib/parser.js +++ b/node_modules/xml2js/lib/parser.js @@ -141,14 +141,14 @@ this.saxParser.onopentag = (function(_this) { return function(node) { var key, newValue, obj, processedKey, ref; - obj = {}; + obj = Object.create(null); obj[charkey] = ""; if (!_this.options.ignoreAttrs) { ref = node.attributes; for (key in ref) { if (!hasProp.call(ref, key)) continue; if (!(attrkey in obj) && !_this.options.mergeAttrs) { - obj[attrkey] = {}; + obj[attrkey] = Object.create(null); } newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; @@ -198,7 +198,11 @@ } } if (isEmpty(obj)) { - obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; + if (typeof _this.options.emptyTag === 'function') { + obj = _this.options.emptyTag(); + } else { + obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; + } } if (_this.options.validator != null) { xpath = "/" + ((function() { @@ -222,7 +226,7 @@ } if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { if (!_this.options.preserveChildrenOrder) { - node = {}; + node = Object.create(null); if (_this.options.attrkey in obj) { node[_this.options.attrkey] = obj[_this.options.attrkey]; delete obj[_this.options.attrkey]; @@ -237,7 +241,7 @@ obj = node; } else if (s) { s[_this.options.childkey] = s[_this.options.childkey] || []; - objClone = {}; + objClone = Object.create(null); for (key in obj) { if (!hasProp.call(obj, key)) continue; objClone[key] = obj[key]; @@ -254,7 +258,7 @@ } else { if (_this.options.explicitRoot) { old = obj; - obj = {}; + obj = Object.create(null); obj[nodeName] = old; } _this.resultObject = obj; diff --git a/project starter code/node_modules/xml2js/lib/processors.js b/node_modules/xml2js/lib/processors.js similarity index 100% rename from project starter code/node_modules/xml2js/lib/processors.js rename to node_modules/xml2js/lib/processors.js diff --git a/project starter code/node_modules/xml2js/lib/xml2js.js b/node_modules/xml2js/lib/xml2js.js similarity index 100% rename from project starter code/node_modules/xml2js/lib/xml2js.js rename to node_modules/xml2js/lib/xml2js.js diff --git a/node_modules/xml2js/package.json b/node_modules/xml2js/package.json new file mode 100644 index 00000000..bc8eb663 --- /dev/null +++ b/node_modules/xml2js/package.json @@ -0,0 +1,93 @@ +{ + "name": "xml2js", + "description": "Simple XML to JavaScript object converter.", + "keywords": [ + "xml", + "json" + ], + "homepage": "https://github.com/Leonidas-from-XIV/node-xml2js", + "version": "0.5.0", + "author": "Marek Kubica (https://xivilization.net)", + "contributors": [ + "maqr (https://github.com/maqr)", + "Ben Weaver (http://benweaver.com/)", + "Jae Kwon (https://github.com/jaekwon)", + "Jim Robert", + "Ștefan Rusu (http://www.saltwaterc.eu/)", + "Carter Cole (http://cartercole.com/)", + "Kurt Raschke (http://www.kurtraschke.com/)", + "Contra (https://github.com/Contra)", + "Marcelo Diniz (https://github.com/mdiniz)", + "Michael Hart (https://github.com/mhart)", + "Zachary Scott (http://zacharyscott.net/)", + "Raoul Millais (https://github.com/raoulmillais)", + "Salsita Software (http://www.salsitasoft.com/)", + "Mike Schilling (http://www.emotive.com/)", + "Jackson Tian (http://weibo.com/shyvo)", + "Mikhail Zyatin (https://github.com/Sitin)", + "Chris Tavares (https://github.com/christav)", + "Frank Xu (http://f2e.us/)", + "Guido D'Albore (http://www.bitstorm.it/)", + "Jack Senechal (http://jacksenechal.com/)", + "Matthias Hölzl (https://github.com/hoelzl)", + "Camille Reynders (http://www.creynders.be/)", + "Taylor Gautier (https://github.com/tsgautier)", + "Todd Bryan (https://github.com/toddrbryan)", + "Leore Avidar (http://leoreavidar.com/)", + "Dave Aitken (http://www.actionshrimp.com/)", + "Shaney Orrowe ", + "Candle ", + "Jess Telford (http://jes.st)", + "Tom Hughes < (http://compton.nu/)", + "Piotr Rochala (http://rocha.la/)", + "Michael Avila (https://github.com/michaelavila)", + "Ryan Gahl (https://github.com/ryedin)", + "Eric Laberge (https://github.com/elaberge)", + "Benjamin E. Coe (https://twitter.com/benjamincoe)", + "Stephen Cresswell (https://github.com/cressie176)", + "Pascal Ehlert (http://www.hacksrus.net/)", + "Tom Spencer (http://fiznool.com/)", + "Tristian Flanagan (https://github.com/tflanagan)", + "Tim Johns (https://github.com/TimJohns)", + "Bogdan Chadkin (https://github.com/TrySound)", + "David Wood (http://codesleuth.co.uk/)", + "Nicolas Maquet (https://github.com/nmaquet)", + "Lovell Fuller (http://lovell.info/)", + "d3adc0d3 (https://github.com/d3adc0d3)", + "James Crosby (https://github.com/autopulated)" + ], + "main": "./lib/xml2js", + "files": [ + "lib" + ], + "directories": { + "lib": "./lib" + }, + "scripts": { + "build": "cake build", + "test": "zap", + "coverage": "nyc npm test && nyc report", + "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", + "doc": "cake doc" + }, + "repository": { + "type": "git", + "url": "https://github.com/Leonidas-from-XIV/node-xml2js.git" + }, + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "devDependencies": { + "coffee-script": ">=1.10.0", + "coveralls": "^3.0.1", + "diff": ">=1.0.8", + "docco": ">=0.6.2", + "nyc": ">=2.2.1", + "zap": ">=0.2.9" + }, + "engines": { + "node": ">=4.0.0" + }, + "license": "MIT" +} diff --git a/project starter code/node_modules/xmlbuilder/CHANGELOG.md b/node_modules/xmlbuilder/CHANGELOG.md similarity index 100% rename from project starter code/node_modules/xmlbuilder/CHANGELOG.md rename to node_modules/xmlbuilder/CHANGELOG.md diff --git a/project starter code/node_modules/xmlbuilder/LICENSE b/node_modules/xmlbuilder/LICENSE similarity index 100% rename from project starter code/node_modules/xmlbuilder/LICENSE rename to node_modules/xmlbuilder/LICENSE diff --git a/project starter code/node_modules/xmlbuilder/README.md b/node_modules/xmlbuilder/README.md similarity index 100% rename from project starter code/node_modules/xmlbuilder/README.md rename to node_modules/xmlbuilder/README.md diff --git a/project starter code/node_modules/xmlbuilder/appveyor.yml b/node_modules/xmlbuilder/appveyor.yml similarity index 100% rename from project starter code/node_modules/xmlbuilder/appveyor.yml rename to node_modules/xmlbuilder/appveyor.yml diff --git a/project starter code/node_modules/xmlbuilder/lib/Derivation.js b/node_modules/xmlbuilder/lib/Derivation.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/Derivation.js rename to node_modules/xmlbuilder/lib/Derivation.js diff --git a/project starter code/node_modules/xmlbuilder/lib/DocumentPosition.js b/node_modules/xmlbuilder/lib/DocumentPosition.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/DocumentPosition.js rename to node_modules/xmlbuilder/lib/DocumentPosition.js diff --git a/project starter code/node_modules/xmlbuilder/lib/NodeType.js b/node_modules/xmlbuilder/lib/NodeType.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/NodeType.js rename to node_modules/xmlbuilder/lib/NodeType.js diff --git a/project starter code/node_modules/xmlbuilder/lib/OperationType.js b/node_modules/xmlbuilder/lib/OperationType.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/OperationType.js rename to node_modules/xmlbuilder/lib/OperationType.js diff --git a/project starter code/node_modules/xmlbuilder/lib/Utility.js b/node_modules/xmlbuilder/lib/Utility.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/Utility.js rename to node_modules/xmlbuilder/lib/Utility.js diff --git a/project starter code/node_modules/xmlbuilder/lib/WriterState.js b/node_modules/xmlbuilder/lib/WriterState.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/WriterState.js rename to node_modules/xmlbuilder/lib/WriterState.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLAttribute.js b/node_modules/xmlbuilder/lib/XMLAttribute.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLAttribute.js rename to node_modules/xmlbuilder/lib/XMLAttribute.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLCData.js b/node_modules/xmlbuilder/lib/XMLCData.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLCData.js rename to node_modules/xmlbuilder/lib/XMLCData.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLCharacterData.js b/node_modules/xmlbuilder/lib/XMLCharacterData.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLCharacterData.js rename to node_modules/xmlbuilder/lib/XMLCharacterData.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLComment.js b/node_modules/xmlbuilder/lib/XMLComment.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLComment.js rename to node_modules/xmlbuilder/lib/XMLComment.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDOMConfiguration.js b/node_modules/xmlbuilder/lib/XMLDOMConfiguration.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDOMConfiguration.js rename to node_modules/xmlbuilder/lib/XMLDOMConfiguration.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js b/node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js rename to node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDOMImplementation.js b/node_modules/xmlbuilder/lib/XMLDOMImplementation.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDOMImplementation.js rename to node_modules/xmlbuilder/lib/XMLDOMImplementation.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDOMStringList.js b/node_modules/xmlbuilder/lib/XMLDOMStringList.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDOMStringList.js rename to node_modules/xmlbuilder/lib/XMLDOMStringList.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDTDAttList.js b/node_modules/xmlbuilder/lib/XMLDTDAttList.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDTDAttList.js rename to node_modules/xmlbuilder/lib/XMLDTDAttList.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDTDElement.js b/node_modules/xmlbuilder/lib/XMLDTDElement.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDTDElement.js rename to node_modules/xmlbuilder/lib/XMLDTDElement.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDTDEntity.js b/node_modules/xmlbuilder/lib/XMLDTDEntity.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDTDEntity.js rename to node_modules/xmlbuilder/lib/XMLDTDEntity.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDTDNotation.js b/node_modules/xmlbuilder/lib/XMLDTDNotation.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDTDNotation.js rename to node_modules/xmlbuilder/lib/XMLDTDNotation.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDeclaration.js b/node_modules/xmlbuilder/lib/XMLDeclaration.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDeclaration.js rename to node_modules/xmlbuilder/lib/XMLDeclaration.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDocType.js b/node_modules/xmlbuilder/lib/XMLDocType.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDocType.js rename to node_modules/xmlbuilder/lib/XMLDocType.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDocument.js b/node_modules/xmlbuilder/lib/XMLDocument.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDocument.js rename to node_modules/xmlbuilder/lib/XMLDocument.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDocumentCB.js b/node_modules/xmlbuilder/lib/XMLDocumentCB.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDocumentCB.js rename to node_modules/xmlbuilder/lib/XMLDocumentCB.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDocumentFragment.js b/node_modules/xmlbuilder/lib/XMLDocumentFragment.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDocumentFragment.js rename to node_modules/xmlbuilder/lib/XMLDocumentFragment.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLDummy.js b/node_modules/xmlbuilder/lib/XMLDummy.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLDummy.js rename to node_modules/xmlbuilder/lib/XMLDummy.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLElement.js b/node_modules/xmlbuilder/lib/XMLElement.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLElement.js rename to node_modules/xmlbuilder/lib/XMLElement.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js b/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js rename to node_modules/xmlbuilder/lib/XMLNamedNodeMap.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLNode.js b/node_modules/xmlbuilder/lib/XMLNode.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLNode.js rename to node_modules/xmlbuilder/lib/XMLNode.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLNodeFilter.js b/node_modules/xmlbuilder/lib/XMLNodeFilter.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLNodeFilter.js rename to node_modules/xmlbuilder/lib/XMLNodeFilter.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLNodeList.js b/node_modules/xmlbuilder/lib/XMLNodeList.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLNodeList.js rename to node_modules/xmlbuilder/lib/XMLNodeList.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js b/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js rename to node_modules/xmlbuilder/lib/XMLProcessingInstruction.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLRaw.js b/node_modules/xmlbuilder/lib/XMLRaw.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLRaw.js rename to node_modules/xmlbuilder/lib/XMLRaw.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLStreamWriter.js b/node_modules/xmlbuilder/lib/XMLStreamWriter.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLStreamWriter.js rename to node_modules/xmlbuilder/lib/XMLStreamWriter.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLStringWriter.js b/node_modules/xmlbuilder/lib/XMLStringWriter.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLStringWriter.js rename to node_modules/xmlbuilder/lib/XMLStringWriter.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLStringifier.js b/node_modules/xmlbuilder/lib/XMLStringifier.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLStringifier.js rename to node_modules/xmlbuilder/lib/XMLStringifier.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLText.js b/node_modules/xmlbuilder/lib/XMLText.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLText.js rename to node_modules/xmlbuilder/lib/XMLText.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLTypeInfo.js b/node_modules/xmlbuilder/lib/XMLTypeInfo.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLTypeInfo.js rename to node_modules/xmlbuilder/lib/XMLTypeInfo.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLUserDataHandler.js b/node_modules/xmlbuilder/lib/XMLUserDataHandler.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLUserDataHandler.js rename to node_modules/xmlbuilder/lib/XMLUserDataHandler.js diff --git a/project starter code/node_modules/xmlbuilder/lib/XMLWriterBase.js b/node_modules/xmlbuilder/lib/XMLWriterBase.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/XMLWriterBase.js rename to node_modules/xmlbuilder/lib/XMLWriterBase.js diff --git a/project starter code/node_modules/xmlbuilder/lib/index.js b/node_modules/xmlbuilder/lib/index.js similarity index 100% rename from project starter code/node_modules/xmlbuilder/lib/index.js rename to node_modules/xmlbuilder/lib/index.js diff --git a/project starter code/node_modules/xmlbuilder/package.json b/node_modules/xmlbuilder/package.json similarity index 100% rename from project starter code/node_modules/xmlbuilder/package.json rename to node_modules/xmlbuilder/package.json diff --git a/project starter code/node_modules/xmlbuilder/typings/index.d.ts b/node_modules/xmlbuilder/typings/index.d.ts similarity index 100% rename from project starter code/node_modules/xmlbuilder/typings/index.d.ts rename to node_modules/xmlbuilder/typings/index.d.ts diff --git a/project starter code/node_modules/xtend/.jshintrc b/node_modules/xtend/.jshintrc similarity index 100% rename from project starter code/node_modules/xtend/.jshintrc rename to node_modules/xtend/.jshintrc diff --git a/project starter code/node_modules/xtend/LICENSE b/node_modules/xtend/LICENSE similarity index 100% rename from project starter code/node_modules/xtend/LICENSE rename to node_modules/xtend/LICENSE diff --git a/project starter code/node_modules/xtend/README.md b/node_modules/xtend/README.md similarity index 100% rename from project starter code/node_modules/xtend/README.md rename to node_modules/xtend/README.md diff --git a/project starter code/node_modules/xtend/immutable.js b/node_modules/xtend/immutable.js similarity index 100% rename from project starter code/node_modules/xtend/immutable.js rename to node_modules/xtend/immutable.js diff --git a/project starter code/node_modules/xtend/mutable.js b/node_modules/xtend/mutable.js similarity index 100% rename from project starter code/node_modules/xtend/mutable.js rename to node_modules/xtend/mutable.js diff --git a/project starter code/node_modules/xtend/package.json b/node_modules/xtend/package.json similarity index 100% rename from project starter code/node_modules/xtend/package.json rename to node_modules/xtend/package.json diff --git a/project starter code/node_modules/xtend/test.js b/node_modules/xtend/test.js similarity index 100% rename from project starter code/node_modules/xtend/test.js rename to node_modules/xtend/test.js diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..4882452c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2664 @@ +{ + "name": "api", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "api", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "axios": "^1.7.2", + "body-parser": "^1.20.1", + "express": "^4.18.2", + "jimp": "^0.16.2" + } + }, + "node_modules/@babel/runtime": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.6.tgz", + "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "node_modules/@jimp/bmp": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.13.tgz", + "integrity": "sha512-9edAxu7N2FX7vzkdl5Jo1BbACfycUtBQX+XBMcHA2bk62P8R0otgkHg798frgAk/WxQIzwxqOH6wMiCwrlAzdQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "bmp-js": "^0.1.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/core": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.13.tgz", + "integrity": "sha512-qXpA1tzTnlkTku9yqtuRtS/wVntvE6f3m3GNxdTdtmc+O+Wcg9Xo2ABPMh7Nc0AHbMKzwvwgB2JnjZmlmJEObg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "any-base": "^1.1.0", + "buffer": "^5.2.0", + "exif-parser": "^0.1.12", + "file-type": "^16.5.4", + "load-bmfont": "^1.3.1", + "mkdirp": "^0.5.1", + "phin": "^2.9.1", + "pixelmatch": "^4.0.2", + "tinycolor2": "^1.4.1" + } + }, + "node_modules/@jimp/custom": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.13.tgz", + "integrity": "sha512-LTATglVUPGkPf15zX1wTMlZ0+AU7cGEGF6ekVF1crA8eHUWsGjrYTB+Ht4E3HTrCok8weQG+K01rJndCp/l4XA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/core": "^0.16.13" + } + }, + "node_modules/@jimp/gif": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.13.tgz", + "integrity": "sha512-yFAMZGv3o+YcjXilMWWwS/bv1iSqykFahFMSO169uVMtfQVfa90kt4/kDwrXNR6Q9i6VHpFiGZMlF2UnHClBvg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "gifwrap": "^0.9.2", + "omggif": "^1.0.9" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/jpeg": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.13.tgz", + "integrity": "sha512-BJHlDxzTlCqP2ThqP8J0eDrbBfod7npWCbJAcfkKqdQuFk0zBPaZ6KKaQKyKxmWJ87Z6ohANZoMKEbtvrwz1AA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "jpeg-js": "^0.4.2" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-blit": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.13.tgz", + "integrity": "sha512-8Z1k96ZFxlhK2bgrY1JNWNwvaBeI/bciLM0yDOni2+aZwfIIiC7Y6PeWHTAvjHNjphz+XCt01WQmOYWCn0ML6g==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-blur": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.13.tgz", + "integrity": "sha512-PvLrfa8vkej3qinlebyhLpksJgCF5aiysDMSVhOZqwH5nQLLtDE9WYbnsofGw4r0VVpyw3H/ANCIzYTyCtP9Cg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-circle": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.13.tgz", + "integrity": "sha512-RNave7EFgZrb5V5EpdvJGAEHMnDAJuwv05hKscNfIYxf0kR3KhViBTDy+MoTnMlIvaKFULfwIgaZWzyhuINMzA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-color": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.13.tgz", + "integrity": "sha512-xW+9BtEvoIkkH/Wde9ql4nAFbYLkVINhpgAE7VcBUsuuB34WUbcBl/taOuUYQrPEFQJ4jfXiAJZ2H/rvKjCVnQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "tinycolor2": "^1.4.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-contain": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.13.tgz", + "integrity": "sha512-QayTXw4tXMwU6q6acNTQrTTFTXpNRBe+MgTGMDU0lk+23PjlFCO/9sacflelG8lsp7vNHhAxFeHptDMAksEYzg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-cover": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.13.tgz", + "integrity": "sha512-BSsP71GTNaqWRcvkbWuIVH+zK7b3TSNebbhDkFK0fVaUTzHuKMS/mgY4hDZIEVt7Rf5FjadAYtsujHN9w0iSYA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-crop": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.13.tgz", + "integrity": "sha512-WEl2tPVYwzYL8OKme6Go2xqiWgKsgxlMwyHabdAU4tXaRwOCnOI7v4021gCcBb9zn/oWwguHuKHmK30Fw2Z/PA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-displace": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.13.tgz", + "integrity": "sha512-qt9WKq8vWrcjySa9DyQ0x/RBMHQeiVjdVSY1SJsMjssPUf0pS74qorcuAkGi89biN3YoGUgPkpqECnAWnYwgGA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-dither": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.13.tgz", + "integrity": "sha512-5/N3yJggbWQTlGZHQYJPmQXEwR52qaXjEzkp1yRBbtdaekXE3BG/suo0fqeoV/csf8ooI78sJzYmIrxNoWVtgQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-fisheye": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.13.tgz", + "integrity": "sha512-2rZmTdFbT/cF9lEZIkXCYO0TsT114Q27AX5IAo0Sju6jVQbvIk1dFUTnwLDadTo8wkJlFzGqMQ24Cs8cHWOliA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-flip": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.13.tgz", + "integrity": "sha512-EmcgAA74FTc5u7Z+hUO/sRjWwfPPLuOQP5O64x5g4j0T12Bd29IgsYZxoutZo/rb3579+JNa/3wsSEmyVv1EpA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-rotate": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-gaussian": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.13.tgz", + "integrity": "sha512-A1XKfGQD0iDdIiKqFYi8nZMv4dDVYdxbrmgR7y/CzUHhSYdcmoljLIIsZZM3Iks/Wa353W3vtvkWLuDbQbch1w==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-invert": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.13.tgz", + "integrity": "sha512-xFMrIn7czEZbdbMzZWuaZFnlLGJDVJ82y5vlsKsXRTG2kcxRsMPXvZRWHV57nSs1YFsNqXSbrC8B98n0E32njQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-mask": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.13.tgz", + "integrity": "sha512-wLRYKVBXql2GAYgt6FkTnCfE+q5NomM7Dlh0oIPGAoMBWDyTx0eYutRK6PlUrRK2yMHuroAJCglICTbxqGzowQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-normalize": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.13.tgz", + "integrity": "sha512-3tfad0n9soRna4IfW9NzQdQ2Z3ijkmo21DREHbE6CGcMIxOSvfRdSvf1qQPApxjTSo8LTU4MCi/fidx/NZ0GqQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-print": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.13.tgz", + "integrity": "sha512-0m6i3p01PGRkGAK9r53hDYrkyMq+tlhLOIbsSTmZyh6HLshUKlTB7eXskF5OpVd5ZUHoltlNc6R+ggvKIzxRFw==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "load-bmfont": "^1.4.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-resize": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.13.tgz", + "integrity": "sha512-qoqtN8LDknm3fJm9nuPygJv30O3vGhSBD2TxrsCnhtOsxKAqVPJtFVdGd/qVuZ8nqQANQmTlfqTiK9mVWQ7MiQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-rotate": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.13.tgz", + "integrity": "sha512-Ev+Jjmj1nHYw897z9C3R9dYsPv7S2/nxdgfFb/h8hOwK0Ovd1k/+yYS46A0uj/JCKK0pQk8wOslYBkPwdnLorw==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-scale": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.13.tgz", + "integrity": "sha512-05POQaEJVucjTiSGMoH68ZiELc7QqpIpuQlZ2JBbhCV+WCbPFUBcGSmE7w4Jd0E2GvCho/NoMODLwgcVGQA97A==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-shadow": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.13.tgz", + "integrity": "sha512-nmu5VSZ9hsB1JchTKhnnCY+paRBnwzSyK5fhkhtQHHoFD5ArBQ/5wU8y6tCr7k/GQhhGq1OrixsECeMjPoc8Zw==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blur": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-threshold": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.13.tgz", + "integrity": "sha512-+3zArBH0OE3Rhjm4HyAokMsZlIq5gpQec33CncyoSwxtRBM2WAhUVmCUKuBo+Lr/2/4ISoY4BWpHKhMLDix6cA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-color": ">=0.8.0", + "@jimp/plugin-resize": ">=0.8.0" + } + }, + "node_modules/@jimp/plugins": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.13.tgz", + "integrity": "sha512-CJLdqODEhEVs4MgWCxpWL5l95sCBlkuSLz65cxEm56X5akIsn4LOlwnKoSEZioYcZUBvHhCheH67AyPTudfnQQ==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/plugin-blur": "^0.16.13", + "@jimp/plugin-circle": "^0.16.13", + "@jimp/plugin-color": "^0.16.13", + "@jimp/plugin-contain": "^0.16.13", + "@jimp/plugin-cover": "^0.16.13", + "@jimp/plugin-crop": "^0.16.13", + "@jimp/plugin-displace": "^0.16.13", + "@jimp/plugin-dither": "^0.16.13", + "@jimp/plugin-fisheye": "^0.16.13", + "@jimp/plugin-flip": "^0.16.13", + "@jimp/plugin-gaussian": "^0.16.13", + "@jimp/plugin-invert": "^0.16.13", + "@jimp/plugin-mask": "^0.16.13", + "@jimp/plugin-normalize": "^0.16.13", + "@jimp/plugin-print": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/plugin-rotate": "^0.16.13", + "@jimp/plugin-scale": "^0.16.13", + "@jimp/plugin-shadow": "^0.16.13", + "@jimp/plugin-threshold": "^0.16.13", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/png": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.13.tgz", + "integrity": "sha512-8cGqINvbWJf1G0Her9zbq9I80roEX0A+U45xFby3tDWfzn+Zz8XKDF1Nv9VUwVx0N3zpcG1RPs9hfheG4Cq2kg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "pngjs": "^3.3.3" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/tiff": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.13.tgz", + "integrity": "sha512-oJY8d9u95SwW00VPHuCNxPap6Q1+E/xM5QThb9Hu+P6EGuu6lIeLaNBMmFZyblwFbwrH+WBOZlvIzDhi4Dm/6Q==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "utif": "^2.0.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/types": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.13.tgz", + "integrity": "sha512-mC0yVNUobFDjoYLg4hoUwzMKgNlxynzwt3cDXzumGvRJ7Kb8qQGOWJQjQFo5OxmGExqzPphkirdbBF88RVLBCg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/bmp": "^0.16.13", + "@jimp/gif": "^0.16.13", + "@jimp/jpeg": "^0.16.13", + "@jimp/png": "^0.16.13", + "@jimp/tiff": "^0.16.13", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/utils": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.13.tgz", + "integrity": "sha512-VyCpkZzFTHXtKgVO35iKN0sYR10psGpV6SkcSeV4oF7eSYlR8Bl6aQLCzVeFjvESF7mxTmIiI3/XrMobVrtxDA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "regenerator-runtime": "^0.13.3" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "node_modules/@types/node": { + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/any-base": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", + "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bmp-js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", + "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" + }, + "node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/exif-parser": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", + "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" + }, + "node_modules/express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/file-type": { + "version": "16.5.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", + "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gifwrap": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", + "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "dependencies": { + "image-q": "^4.0.0", + "omggif": "^1.0.10" + } + }, + "node_modules/global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "dependencies": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/image-q": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", + "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", + "dependencies": { + "@types/node": "16.9.1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "node_modules/jimp": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.13.tgz", + "integrity": "sha512-Bxz8q7V4rnCky9A0ktTNGA9SkNFVWRHodddI/DaAWZJzF7sVUlFYKQ60y9JGqrKpi48ECA/TnfMzzc5C70VByA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/custom": "^0.16.13", + "@jimp/plugins": "^0.16.13", + "@jimp/types": "^0.16.13", + "regenerator-runtime": "^0.13.3" + } + }, + "node_modules/jpeg-js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", + "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" + }, + "node_modules/load-bmfont": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", + "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", + "dependencies": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^2.9.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "dependencies": { + "dom-walk": "^0.1.0" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/omggif": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", + "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, + "node_modules/parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==" + }, + "node_modules/parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" + }, + "node_modules/parse-bmfont-xml": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", + "dependencies": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.5.0" + } + }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/peek-readable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", + "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==", + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/pixelmatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", + "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", + "dependencies": { + "pngjs": "^3.0.0" + }, + "bin": { + "pixelmatch": "bin/pixelmatch" + } + }, + "node_modules/pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strtok3": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", + "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/timm": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", + "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" + }, + "node_modules/tinycolor2": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utif": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", + "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "dependencies": { + "pako": "^1.0.5" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "dependencies": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "node_modules/xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" + }, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + } + }, + "dependencies": { + "@babel/runtime": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.6.tgz", + "integrity": "sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==", + "requires": { + "regenerator-runtime": "^0.14.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + } + } + }, + "@jimp/bmp": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.13.tgz", + "integrity": "sha512-9edAxu7N2FX7vzkdl5Jo1BbACfycUtBQX+XBMcHA2bk62P8R0otgkHg798frgAk/WxQIzwxqOH6wMiCwrlAzdQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "bmp-js": "^0.1.0" + } + }, + "@jimp/core": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.13.tgz", + "integrity": "sha512-qXpA1tzTnlkTku9yqtuRtS/wVntvE6f3m3GNxdTdtmc+O+Wcg9Xo2ABPMh7Nc0AHbMKzwvwgB2JnjZmlmJEObg==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "any-base": "^1.1.0", + "buffer": "^5.2.0", + "exif-parser": "^0.1.12", + "file-type": "^16.5.4", + "load-bmfont": "^1.3.1", + "mkdirp": "^0.5.1", + "phin": "^2.9.1", + "pixelmatch": "^4.0.2", + "tinycolor2": "^1.4.1" + } + }, + "@jimp/custom": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.13.tgz", + "integrity": "sha512-LTATglVUPGkPf15zX1wTMlZ0+AU7cGEGF6ekVF1crA8eHUWsGjrYTB+Ht4E3HTrCok8weQG+K01rJndCp/l4XA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/core": "^0.16.13" + } + }, + "@jimp/gif": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.13.tgz", + "integrity": "sha512-yFAMZGv3o+YcjXilMWWwS/bv1iSqykFahFMSO169uVMtfQVfa90kt4/kDwrXNR6Q9i6VHpFiGZMlF2UnHClBvg==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "gifwrap": "^0.9.2", + "omggif": "^1.0.9" + } + }, + "@jimp/jpeg": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.13.tgz", + "integrity": "sha512-BJHlDxzTlCqP2ThqP8J0eDrbBfod7npWCbJAcfkKqdQuFk0zBPaZ6KKaQKyKxmWJ87Z6ohANZoMKEbtvrwz1AA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "jpeg-js": "^0.4.2" + } + }, + "@jimp/plugin-blit": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.13.tgz", + "integrity": "sha512-8Z1k96ZFxlhK2bgrY1JNWNwvaBeI/bciLM0yDOni2+aZwfIIiC7Y6PeWHTAvjHNjphz+XCt01WQmOYWCn0ML6g==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-blur": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.13.tgz", + "integrity": "sha512-PvLrfa8vkej3qinlebyhLpksJgCF5aiysDMSVhOZqwH5nQLLtDE9WYbnsofGw4r0VVpyw3H/ANCIzYTyCtP9Cg==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-circle": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.13.tgz", + "integrity": "sha512-RNave7EFgZrb5V5EpdvJGAEHMnDAJuwv05hKscNfIYxf0kR3KhViBTDy+MoTnMlIvaKFULfwIgaZWzyhuINMzA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-color": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.13.tgz", + "integrity": "sha512-xW+9BtEvoIkkH/Wde9ql4nAFbYLkVINhpgAE7VcBUsuuB34WUbcBl/taOuUYQrPEFQJ4jfXiAJZ2H/rvKjCVnQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "tinycolor2": "^1.4.1" + } + }, + "@jimp/plugin-contain": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.13.tgz", + "integrity": "sha512-QayTXw4tXMwU6q6acNTQrTTFTXpNRBe+MgTGMDU0lk+23PjlFCO/9sacflelG8lsp7vNHhAxFeHptDMAksEYzg==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-cover": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.13.tgz", + "integrity": "sha512-BSsP71GTNaqWRcvkbWuIVH+zK7b3TSNebbhDkFK0fVaUTzHuKMS/mgY4hDZIEVt7Rf5FjadAYtsujHN9w0iSYA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-crop": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.13.tgz", + "integrity": "sha512-WEl2tPVYwzYL8OKme6Go2xqiWgKsgxlMwyHabdAU4tXaRwOCnOI7v4021gCcBb9zn/oWwguHuKHmK30Fw2Z/PA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-displace": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.13.tgz", + "integrity": "sha512-qt9WKq8vWrcjySa9DyQ0x/RBMHQeiVjdVSY1SJsMjssPUf0pS74qorcuAkGi89biN3YoGUgPkpqECnAWnYwgGA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-dither": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.13.tgz", + "integrity": "sha512-5/N3yJggbWQTlGZHQYJPmQXEwR52qaXjEzkp1yRBbtdaekXE3BG/suo0fqeoV/csf8ooI78sJzYmIrxNoWVtgQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-fisheye": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.13.tgz", + "integrity": "sha512-2rZmTdFbT/cF9lEZIkXCYO0TsT114Q27AX5IAo0Sju6jVQbvIk1dFUTnwLDadTo8wkJlFzGqMQ24Cs8cHWOliA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-flip": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.13.tgz", + "integrity": "sha512-EmcgAA74FTc5u7Z+hUO/sRjWwfPPLuOQP5O64x5g4j0T12Bd29IgsYZxoutZo/rb3579+JNa/3wsSEmyVv1EpA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-gaussian": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.13.tgz", + "integrity": "sha512-A1XKfGQD0iDdIiKqFYi8nZMv4dDVYdxbrmgR7y/CzUHhSYdcmoljLIIsZZM3Iks/Wa353W3vtvkWLuDbQbch1w==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-invert": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.13.tgz", + "integrity": "sha512-xFMrIn7czEZbdbMzZWuaZFnlLGJDVJ82y5vlsKsXRTG2kcxRsMPXvZRWHV57nSs1YFsNqXSbrC8B98n0E32njQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-mask": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.13.tgz", + "integrity": "sha512-wLRYKVBXql2GAYgt6FkTnCfE+q5NomM7Dlh0oIPGAoMBWDyTx0eYutRK6PlUrRK2yMHuroAJCglICTbxqGzowQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-normalize": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.13.tgz", + "integrity": "sha512-3tfad0n9soRna4IfW9NzQdQ2Z3ijkmo21DREHbE6CGcMIxOSvfRdSvf1qQPApxjTSo8LTU4MCi/fidx/NZ0GqQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-print": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.13.tgz", + "integrity": "sha512-0m6i3p01PGRkGAK9r53hDYrkyMq+tlhLOIbsSTmZyh6HLshUKlTB7eXskF5OpVd5ZUHoltlNc6R+ggvKIzxRFw==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "load-bmfont": "^1.4.0" + } + }, + "@jimp/plugin-resize": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.13.tgz", + "integrity": "sha512-qoqtN8LDknm3fJm9nuPygJv30O3vGhSBD2TxrsCnhtOsxKAqVPJtFVdGd/qVuZ8nqQANQmTlfqTiK9mVWQ7MiQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-rotate": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.13.tgz", + "integrity": "sha512-Ev+Jjmj1nHYw897z9C3R9dYsPv7S2/nxdgfFb/h8hOwK0Ovd1k/+yYS46A0uj/JCKK0pQk8wOslYBkPwdnLorw==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-scale": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.13.tgz", + "integrity": "sha512-05POQaEJVucjTiSGMoH68ZiELc7QqpIpuQlZ2JBbhCV+WCbPFUBcGSmE7w4Jd0E2GvCho/NoMODLwgcVGQA97A==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-shadow": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.13.tgz", + "integrity": "sha512-nmu5VSZ9hsB1JchTKhnnCY+paRBnwzSyK5fhkhtQHHoFD5ArBQ/5wU8y6tCr7k/GQhhGq1OrixsECeMjPoc8Zw==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugin-threshold": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.13.tgz", + "integrity": "sha512-+3zArBH0OE3Rhjm4HyAokMsZlIq5gpQec33CncyoSwxtRBM2WAhUVmCUKuBo+Lr/2/4ISoY4BWpHKhMLDix6cA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13" + } + }, + "@jimp/plugins": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.13.tgz", + "integrity": "sha512-CJLdqODEhEVs4MgWCxpWL5l95sCBlkuSLz65cxEm56X5akIsn4LOlwnKoSEZioYcZUBvHhCheH67AyPTudfnQQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/plugin-blit": "^0.16.13", + "@jimp/plugin-blur": "^0.16.13", + "@jimp/plugin-circle": "^0.16.13", + "@jimp/plugin-color": "^0.16.13", + "@jimp/plugin-contain": "^0.16.13", + "@jimp/plugin-cover": "^0.16.13", + "@jimp/plugin-crop": "^0.16.13", + "@jimp/plugin-displace": "^0.16.13", + "@jimp/plugin-dither": "^0.16.13", + "@jimp/plugin-fisheye": "^0.16.13", + "@jimp/plugin-flip": "^0.16.13", + "@jimp/plugin-gaussian": "^0.16.13", + "@jimp/plugin-invert": "^0.16.13", + "@jimp/plugin-mask": "^0.16.13", + "@jimp/plugin-normalize": "^0.16.13", + "@jimp/plugin-print": "^0.16.13", + "@jimp/plugin-resize": "^0.16.13", + "@jimp/plugin-rotate": "^0.16.13", + "@jimp/plugin-scale": "^0.16.13", + "@jimp/plugin-shadow": "^0.16.13", + "@jimp/plugin-threshold": "^0.16.13", + "timm": "^1.6.1" + } + }, + "@jimp/png": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.13.tgz", + "integrity": "sha512-8cGqINvbWJf1G0Her9zbq9I80roEX0A+U45xFby3tDWfzn+Zz8XKDF1Nv9VUwVx0N3zpcG1RPs9hfheG4Cq2kg==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.16.13", + "pngjs": "^3.3.3" + } + }, + "@jimp/tiff": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.13.tgz", + "integrity": "sha512-oJY8d9u95SwW00VPHuCNxPap6Q1+E/xM5QThb9Hu+P6EGuu6lIeLaNBMmFZyblwFbwrH+WBOZlvIzDhi4Dm/6Q==", + "requires": { + "@babel/runtime": "^7.7.2", + "utif": "^2.0.1" + } + }, + "@jimp/types": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.13.tgz", + "integrity": "sha512-mC0yVNUobFDjoYLg4hoUwzMKgNlxynzwt3cDXzumGvRJ7Kb8qQGOWJQjQFo5OxmGExqzPphkirdbBF88RVLBCg==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/bmp": "^0.16.13", + "@jimp/gif": "^0.16.13", + "@jimp/jpeg": "^0.16.13", + "@jimp/png": "^0.16.13", + "@jimp/tiff": "^0.16.13", + "timm": "^1.6.1" + } + }, + "@jimp/utils": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.13.tgz", + "integrity": "sha512-VyCpkZzFTHXtKgVO35iKN0sYR10psGpV6SkcSeV4oF7eSYlR8Bl6aQLCzVeFjvESF7mxTmIiI3/XrMobVrtxDA==", + "requires": { + "@babel/runtime": "^7.7.2", + "regenerator-runtime": "^0.13.3" + } + }, + "@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "@types/node": { + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" + }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "any-base": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", + "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "requires": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bmp-js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", + "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" + }, + "body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==" + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "requires": { + "safe-buffer": "5.2.1" + } + }, + "content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==" + }, + "cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" + }, + "dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" + }, + "exif-parser": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", + "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" + }, + "express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + } + }, + "file-type": { + "version": "16.5.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", + "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "requires": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + } + }, + "finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + } + }, + "follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "gifwrap": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", + "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "requires": { + "image-q": "^4.0.0", + "omggif": "^1.0.10" + } + }, + "global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "requires": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "image-q": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", + "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", + "requires": { + "@types/node": "16.9.1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + }, + "is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "jimp": { + "version": "0.16.13", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.13.tgz", + "integrity": "sha512-Bxz8q7V4rnCky9A0ktTNGA9SkNFVWRHodddI/DaAWZJzF7sVUlFYKQ60y9JGqrKpi48ECA/TnfMzzc5C70VByA==", + "requires": { + "@babel/runtime": "^7.7.2", + "@jimp/custom": "^0.16.13", + "@jimp/plugins": "^0.16.13", + "@jimp/types": "^0.16.13", + "regenerator-runtime": "^0.13.3" + } + }, + "jpeg-js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", + "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" + }, + "load-bmfont": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", + "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", + "requires": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^2.9.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "requires": { + "minimist": "^1.2.6" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" + }, + "object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" + }, + "omggif": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", + "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" + }, + "on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "requires": { + "ee-first": "1.1.1" + } + }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, + "parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==" + }, + "parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" + }, + "parse-bmfont-xml": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", + "requires": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.5.0" + } + }, + "parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "peek-readable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", + "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==" + }, + "phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" + }, + "pixelmatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", + "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", + "requires": { + "pngjs": "^3.0.0" + } + }, + "pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + } + }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "requires": { + "readable-stream": "^3.6.0" + } + }, + "regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" + }, + "send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "requires": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "strtok3": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", + "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "requires": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + } + }, + "timm": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", + "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" + }, + "tinycolor2": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "requires": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + } + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" + }, + "utif": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", + "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "requires": { + "pako": "^1.0.5" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" + }, + "xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "requires": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" + }, + "xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + } + }, + "xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..765359e3 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "api", + "version": "1.0.0", + "description": "", + "main": "server.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "author": "", + "license": "ISC", + "dependencies": { + "axios": "^1.7.2", + "body-parser": "^1.20.1", + "express": "^4.18.2", + "jimp": "^0.16.2" + } +} diff --git a/project starter code/node_modules/.package-lock.json b/project starter code/node_modules/.package-lock.json deleted file mode 100644 index b5fcbf14..00000000 --- a/project starter code/node_modules/.package-lock.json +++ /dev/null @@ -1,1349 +0,0 @@ -{ - "name": "api", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "dependencies": { - "regenerator-runtime": "^0.13.11" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@jimp/bmp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz", - "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "bmp-js": "^0.1.0" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/core": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz", - "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "any-base": "^1.1.0", - "buffer": "^5.2.0", - "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", - "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" - } - }, - "node_modules/@jimp/custom": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz", - "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" - } - }, - "node_modules/@jimp/gif": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz", - "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", - "omggif": "^1.0.9" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/jpeg": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz", - "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-blit": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz", - "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-blur": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz", - "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-circle": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz", - "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-color": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz", - "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-contain": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz", - "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5", - "@jimp/plugin-scale": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-cover": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz", - "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-crop": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5", - "@jimp/plugin-scale": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-crop": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz", - "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-displace": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz", - "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-dither": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz", - "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-fisheye": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz", - "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-flip": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz", - "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-rotate": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-gaussian": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz", - "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-invert": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz", - "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-mask": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz", - "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-normalize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz", - "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-print": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz", - "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-resize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz", - "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-rotate": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz", - "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5", - "@jimp/plugin-crop": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-scale": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz", - "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-shadow": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz", - "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blur": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-threshold": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz", - "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-color": ">=0.8.0", - "@jimp/plugin-resize": ">=0.8.0" - } - }, - "node_modules/@jimp/plugins": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz", - "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", - "timm": "^1.6.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/png": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz", - "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/tiff": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz", - "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/types": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz", - "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", - "timm": "^1.6.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/utils": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz", - "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "regenerator-runtime": "^0.13.3" - } - }, - "node_modules/@types/node": { - "version": "16.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", - "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/any-base": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", - "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bmp-js": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", - "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" - }, - "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/buffer-equal": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", - "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/exif-parser": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", - "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" - }, - "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gifwrap": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", - "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", - "dependencies": { - "image-q": "^4.0.0", - "omggif": "^1.0.10" - } - }, - "node_modules/global": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "dependencies": { - "min-document": "^2.19.0", - "process": "^0.11.10" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/image-q": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", - "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", - "dependencies": { - "@types/node": "16.9.1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" - }, - "node_modules/jimp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz", - "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", - "regenerator-runtime": "^0.13.3" - } - }, - "node_modules/jpeg-js": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", - "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" - }, - "node_modules/load-bmfont": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", - "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", - "dependencies": { - "buffer-equal": "0.0.1", - "mime": "^1.3.4", - "parse-bmfont-ascii": "^1.0.3", - "parse-bmfont-binary": "^1.0.5", - "parse-bmfont-xml": "^1.1.4", - "phin": "^2.9.1", - "xhr": "^2.0.1", - "xtend": "^4.0.0" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", - "dependencies": { - "dom-walk": "^0.1.0" - } - }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/omggif": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", - "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" - }, - "node_modules/parse-bmfont-ascii": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", - "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==" - }, - "node_modules/parse-bmfont-binary": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", - "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" - }, - "node_modules/parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", - "dependencies": { - "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" - } - }, - "node_modules/parse-headers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", - "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "node_modules/phin": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", - "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" - }, - "node_modules/pixelmatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", - "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", - "dependencies": { - "pngjs": "^3.0.0" - }, - "bin": { - "pixelmatch": "bin/pixelmatch" - } - }, - "node_modules/pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/timm": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", - "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" - }, - "node_modules/tinycolor2": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz", - "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==", - "engines": { - "node": "*" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", - "dependencies": { - "pako": "^1.0.5" - } - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/xhr": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", - "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", - "dependencies": { - "global": "~4.4.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "node_modules/xml-parse-from-string": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", - "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" - }, - "node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - } - } -} diff --git a/project starter code/node_modules/@babel/runtime/README.md b/project starter code/node_modules/@babel/runtime/README.md deleted file mode 100644 index be27e834..00000000 --- a/project starter code/node_modules/@babel/runtime/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/runtime - -> babel's modular runtime helpers - -See our website [@babel/runtime](https://babeljs.io/docs/en/babel-runtime) for more information. - -## Install - -Using npm: - -```sh -npm install --save @babel/runtime -``` - -or using yarn: - -```sh -yarn add @babel/runtime -``` diff --git a/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js deleted file mode 100644 index c3379a9c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js +++ /dev/null @@ -1,64 +0,0 @@ -var OverloadYield = require("./OverloadYield.js"); -function AsyncGenerator(gen) { - var front, back; - function resume(key, arg) { - try { - var result = gen[key](arg), - value = result.value, - overloaded = value instanceof OverloadYield; - Promise.resolve(overloaded ? value.v : value).then(function (arg) { - if (overloaded) { - var nextKey = "return" === key ? "return" : "next"; - if (!value.k || arg.done) return resume(nextKey, arg); - arg = gen[nextKey](arg).value; - } - settle(result.done ? "return" : "normal", arg); - }, function (err) { - resume("throw", err); - }); - } catch (err) { - settle("throw", err); - } - } - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: !0 - }); - break; - case "throw": - front.reject(value); - break; - default: - front.resolve({ - value: value, - done: !1 - }); - } - (front = front.next) ? resume(front.key, front.arg) : back = null; - } - this._invoke = function (key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - back ? back = back.next = request : (front = back = request, resume(key, arg)); - }); - }, "function" != typeof gen["return"] && (this["return"] = void 0); -} -AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { - return this; -}, AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); -}, AsyncGenerator.prototype["throw"] = function (arg) { - return this._invoke("throw", arg); -}, AsyncGenerator.prototype["return"] = function (arg) { - return this._invoke("return", arg); -}; -module.exports = AsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js b/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js deleted file mode 100644 index 7681c2df..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js +++ /dev/null @@ -1,4 +0,0 @@ -function _AwaitValue(value) { - this.wrapped = value; -} -module.exports = _AwaitValue, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js b/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js deleted file mode 100644 index b1331134..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js +++ /dev/null @@ -1,4 +0,0 @@ -function _OverloadYield(value, kind) { - this.v = value, this.k = kind; -} -module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js deleted file mode 100644 index 98810d61..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +++ /dev/null @@ -1,24 +0,0 @@ -function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object.keys(descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - if (desc.initializer === void 0) { - Object.defineProperty(target, property, desc); - desc = null; - } - return desc; -} -module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js deleted file mode 100644 index 68a08c26..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js +++ /dev/null @@ -1,236 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) { - return { - getMetadata: function getMetadata(key) { - old_assertNotFinished(decoratorFinishedRef, "getMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 !== metadataForKey) if (1 === kind) { - var pub = metadataForKey["public"]; - if (void 0 !== pub) return pub[property]; - } else if (2 === kind) { - var priv = metadataForKey["private"]; - if (void 0 !== priv) return priv.get(property); - } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor; - }, - setMetadata: function setMetadata(key, value) { - old_assertNotFinished(decoratorFinishedRef, "setMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) { - var pub = metadataForKey["public"]; - void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value; - } else if (2 === kind) { - var priv = metadataForKey.priv; - void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value); - } else metadataForKey.constructor = value; - } - }; -} -function old_convertMetadataMapToFinal(obj, metadataMap) { - var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")], - metadataKeys = Object.getOwnPropertySymbols(metadataMap); - if (0 !== metadataKeys.length) { - for (var i = 0; i < metadataKeys.length; i++) { - var key = metadataKeys[i], - metaForKey = metadataMap[key], - parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null, - pub = metaForKey["public"], - parentPub = parentMetaForKey ? parentMetaForKey["public"] : null; - pub && parentPub && Object.setPrototypeOf(pub, parentPub); - var priv = metaForKey["private"]; - if (priv) { - var privArr = Array.from(priv.values()), - parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null; - parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr; - } - parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey); - } - parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap; - } -} -function old_createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - old_assertNotFinished(decoratorFinishedRef, "addInitializer"), old_assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var metadataKind, - metadataName, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - isStatic: isStatic, - isPrivate: isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - if (0 !== kind && (ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) { - metadataKind = 2, metadataName = Symbol(name); - var access = {}; - 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () { - return desc.value; - } : (1 !== kind && 3 !== kind || (access.get = function () { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (access.set = function (v) { - desc.set.call(this, v); - })), ctx.access = access; - } else metadataKind = 1, metadataName = name; - try { - return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef))); - } finally { - decoratorFinishedRef.v = !0; - } -} -function old_assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function old_assertMetadataKey(key) { - if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key); -} -function old_assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function old_assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && old_assertCallable(value.get, "accessor.get"), void 0 !== value.set && old_assertCallable(value.set, "accessor.set"), void 0 !== value.init && old_assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && old_assertCallable(value.initializer, "accessor.initializer"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function old_getInit(desc) { - var initializer; - return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer; -} -function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) { - var desc, - initializer, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (old_assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = old_memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) old_assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === initializer) initializer = function initializer(instance, init) { - return init; - };else if ("function" != typeof initializer) { - var ownInitializers = initializer; - initializer = function initializer(instance, init) { - for (var value = init, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = initializer; - initializer = function initializer(instance, init) { - return originalInitializer.call(instance, init); - }; - } - ret.push(initializer); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - metadataMap, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers); - } - } - old_pushInitializers(ret, protoInitializers), old_pushInitializers(ret, staticInitializers); -} -function old_pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var ctx = Object.assign({ - kind: "class", - name: name, - addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef) - }, old_createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)), - nextNewClass = classDecs[i](newClass, ctx); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (old_assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -function applyDecs(targetClass, memberDecs, classDecs) { - var ret = [], - staticMetadataMap = {}, - protoMetadataMap = {}; - return old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), old_convertMetadataMapToFinal(targetClass, staticMetadataMap), ret; -} -module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js deleted file mode 100644 index 34419d52..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js +++ /dev/null @@ -1,184 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var get, - set, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - "static": isStatic, - "private": isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - 0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), 0 === kind ? isPrivate ? (get = desc.get, set = desc.set) : (get = function get() { - return this[name]; - }, set = function set(v) { - this[name] = v; - }) : 2 === kind ? get = function get() { - return desc.value; - } : (1 !== kind && 3 !== kind || (get = function get() { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (set = function set(v) { - desc.set.call(this, v); - })), ctx.access = get && set ? { - get: get, - set: set - } : get ? { - get: get - } : { - set: set - }; - try { - return dec(value, ctx); - } finally { - decoratorFinishedRef.v = !0; - } -} -function assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) { - var desc, - init, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? init = newValue : 1 === kind ? (init = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = memberDec(decs[i], name, desc, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === init ? init = newInit : "function" == typeof init ? init = [init, newInit] : init.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === init) init = function init(instance, _init) { - return _init; - };else if ("function" != typeof init) { - var ownInitializers = init; - init = function init(instance, _init2) { - for (var value = _init2, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = init; - init = function init(instance, _init3) { - return originalInitializer.call(instance, _init3); - }; - } - ret.push(init); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function applyMemberDecs(ret, Class, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers); - } - } - pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers); -} -function pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function applyClassDecs(ret, targetClass, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var nextNewClass = classDecs[i](newClass, { - kind: "class", - name: name, - addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef) - }); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -function applyDecs2203(targetClass, memberDecs, classDecs) { - var ret = []; - return applyMemberDecs(ret, targetClass, memberDecs), applyClassDecs(ret, targetClass, classDecs), ret; -} -module.exports = applyDecs2203, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js b/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js deleted file mode 100644 index 36865401..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +++ /dev/null @@ -1,6 +0,0 @@ -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; -} -module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js b/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js deleted file mode 100644 index ad0cc6b9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js +++ /dev/null @@ -1,4 +0,0 @@ -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} -module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js b/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js deleted file mode 100644 index 6d4b76de..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +++ /dev/null @@ -1,5 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} -module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js b/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js deleted file mode 100644 index 71487e57..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js +++ /dev/null @@ -1,7 +0,0 @@ -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; -} -module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js b/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js deleted file mode 100644 index c272bcde..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +++ /dev/null @@ -1,24 +0,0 @@ -var OverloadYield = require("./OverloadYield.js"); -function _asyncGeneratorDelegate(inner) { - var iter = {}, - waiting = !1; - function pump(key, value) { - return waiting = !0, value = new Promise(function (resolve) { - resolve(inner[key](value)); - }), { - done: !1, - value: new OverloadYield(value, 1) - }; - } - return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { - return this; - }, iter.next = function (value) { - return waiting ? (waiting = !1, value) : pump("next", value); - }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { - if (waiting) throw waiting = !1, value; - return pump("throw", value); - }), "function" == typeof inner["return"] && (iter["return"] = function (value) { - return waiting ? (waiting = !1, value) : pump("return", value); - }), iter; -} -module.exports = _asyncGeneratorDelegate, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js b/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js deleted file mode 100644 index 420ef080..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js +++ /dev/null @@ -1,45 +0,0 @@ -function _asyncIterator(iterable) { - var method, - async, - sync, - retry = 2; - for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { - if (async && null != (method = iterable[async])) return method.call(iterable); - if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); - async = "@@asyncIterator", sync = "@@iterator"; - } - throw new TypeError("Object is not async iterable"); -} -function AsyncFromSyncIterator(s) { - function AsyncFromSyncIteratorContinuation(r) { - if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); - var done = r.done; - return Promise.resolve(r.value).then(function (value) { - return { - value: value, - done: done - }; - }); - } - return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { - this.s = s, this.n = s.next; - }, AsyncFromSyncIterator.prototype = { - s: null, - n: null, - next: function next() { - return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); - }, - "return": function _return(value) { - var ret = this.s["return"]; - return void 0 === ret ? Promise.resolve({ - value: value, - done: !0 - }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); - }, - "throw": function _throw(value) { - var thr = this.s["return"]; - return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); - } - }, new AsyncFromSyncIterator(s); -} -module.exports = _asyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js deleted file mode 100644 index 6b9697af..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js +++ /dev/null @@ -1,31 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} -function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(undefined); - }); - }; -} -module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js deleted file mode 100644 index 7d4e9511..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +++ /dev/null @@ -1,5 +0,0 @@ -var OverloadYield = require("./OverloadYield.js"); -function _awaitAsyncGenerator(value) { - return new OverloadYield(value, 0); -} -module.exports = _awaitAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js b/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js deleted file mode 100644 index e6ba6389..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js +++ /dev/null @@ -1,6 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _checkInRHS(value) { - if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== value ? _typeof(value) : "null")); - return value; -} -module.exports = _checkInRHS, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js b/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js deleted file mode 100644 index 1bbfd346..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +++ /dev/null @@ -1,6 +0,0 @@ -function _checkPrivateRedeclaration(obj, privateCollection) { - if (privateCollection.has(obj)) { - throw new TypeError("Cannot initialize the same private elements twice on an object"); - } -} -module.exports = _checkPrivateRedeclaration, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js deleted file mode 100644 index 3ebfed87..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +++ /dev/null @@ -1,18 +0,0 @@ -function _classApplyDescriptorDestructureSet(receiver, descriptor) { - if (descriptor.set) { - if (!("__destrObj" in descriptor)) { - descriptor.__destrObj = { - set value(v) { - descriptor.set.call(receiver, v); - } - }; - } - return descriptor.__destrObj; - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - return descriptor; - } -} -module.exports = _classApplyDescriptorDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js deleted file mode 100644 index af3555da..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - return descriptor.value; -} -module.exports = _classApplyDescriptorGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js deleted file mode 100644 index 71bbf1df..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +++ /dev/null @@ -1,11 +0,0 @@ -function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - descriptor.value = value; - } -} -module.exports = _classApplyDescriptorSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js b/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js deleted file mode 100644 index eab7e520..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js b/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js deleted file mode 100644 index 34876843..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classCheckPrivateStaticAccess(receiver, classConstructor) { - if (receiver !== classConstructor) { - throw new TypeError("Private static access of wrong provenance"); - } -} -module.exports = _classCheckPrivateStaticAccess, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js deleted file mode 100644 index b937d15e..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { - if (descriptor === undefined) { - throw new TypeError("attempted to " + action + " private static field before its declaration"); - } -} -module.exports = _classCheckPrivateStaticFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js deleted file mode 100644 index e6f4725a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - return privateMap.get(receiver); -} -module.exports = _classExtractFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js b/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js deleted file mode 100644 index 9f84697a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js +++ /dev/null @@ -1,4 +0,0 @@ -function _classNameTDZError(name) { - throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys."); -} -module.exports = _classNameTDZError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js deleted file mode 100644 index 07f777df..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +++ /dev/null @@ -1,7 +0,0 @@ -var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); -function _classPrivateFieldDestructureSet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} -module.exports = _classPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js deleted file mode 100644 index a67951e1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +++ /dev/null @@ -1,7 +0,0 @@ -var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); -function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} -module.exports = _classPrivateFieldGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js deleted file mode 100644 index e55873a1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +++ /dev/null @@ -1,6 +0,0 @@ -var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js"); -function _classPrivateFieldInitSpec(obj, privateMap, value) { - checkPrivateRedeclaration(obj, privateMap); - privateMap.set(obj, value); -} -module.exports = _classPrivateFieldInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js deleted file mode 100644 index bb16c0bc..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { - throw new TypeError("attempted to use private field on non-instance"); - } - return receiver; -} -module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js deleted file mode 100644 index b3d546f1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +++ /dev/null @@ -1,5 +0,0 @@ -var id = 0; -function _classPrivateFieldKey(name) { - return "__private_" + id++ + "_" + name; -} -module.exports = _classPrivateFieldKey, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js deleted file mode 100644 index ffb73a10..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +++ /dev/null @@ -1,8 +0,0 @@ -var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); -function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} -module.exports = _classPrivateFieldSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js deleted file mode 100644 index 6a8436da..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return fn; -} -module.exports = _classPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js deleted file mode 100644 index 31064767..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +++ /dev/null @@ -1,6 +0,0 @@ -var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js"); -function _classPrivateMethodInitSpec(obj, privateSet) { - checkPrivateRedeclaration(obj, privateSet); - privateSet.add(obj); -} -module.exports = _classPrivateMethodInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js deleted file mode 100644 index 734aaafa..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +++ /dev/null @@ -1,9 +0,0 @@ -var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); -function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} -module.exports = _classStaticPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js deleted file mode 100644 index e8e295f4..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +++ /dev/null @@ -1,9 +0,0 @@ -var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); -function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} -module.exports = _classStaticPrivateFieldSpecGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js deleted file mode 100644 index b02e4c01..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +++ /dev/null @@ -1,10 +0,0 @@ -var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); -function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} -module.exports = _classStaticPrivateFieldSpecSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js deleted file mode 100644 index d3bb9968..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +++ /dev/null @@ -1,6 +0,0 @@ -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -function _classStaticPrivateMethodGet(receiver, classConstructor, method) { - classCheckPrivateStaticAccess(receiver, classConstructor); - return method; -} -module.exports = _classStaticPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/construct.js b/project starter code/node_modules/@babel/runtime/helpers/construct.js deleted file mode 100644 index 3d3c232d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/construct.js +++ /dev/null @@ -1,18 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); -var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); -function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports; - } else { - module.exports = _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - } - return _construct.apply(null, arguments); -} -module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createClass.js b/project starter code/node_modules/@babel/runtime/helpers/createClass.js deleted file mode 100644 index 201dcdf4..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createClass.js +++ /dev/null @@ -1,19 +0,0 @@ -var toPropertyKey = require("./toPropertyKey.js"); -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor); - } -} -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; -} -module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js b/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js deleted file mode 100644 index 19b6f141..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +++ /dev/null @@ -1,53 +0,0 @@ -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - var F = function F() {}; - return { - s: F, - n: function n() { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - var normalCompletion = true, - didErr = false, - err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) it["return"](); - } finally { - if (didErr) throw err; - } - } - }; -} -module.exports = _createForOfIteratorHelper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js b/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js deleted file mode 100644 index b8eb5507..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +++ /dev/null @@ -1,20 +0,0 @@ -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -function _createForOfIteratorHelperLoose(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (it) return (it = it.call(o)).next.bind(it); - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - return function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _createForOfIteratorHelperLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createSuper.js b/project starter code/node_modules/@babel/runtime/helpers/createSuper.js deleted file mode 100644 index bd72679c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createSuper.js +++ /dev/null @@ -1,18 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); -var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); -var possibleConstructorReturn = require("./possibleConstructorReturn.js"); -function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), - result; - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return possibleConstructorReturn(this, result); - }; -} -module.exports = _createSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/decorate.js b/project starter code/node_modules/@babel/runtime/helpers/decorate.js deleted file mode 100644 index 457741fb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/decorate.js +++ /dev/null @@ -1,343 +0,0 @@ -var toArray = require("./toArray.js"); -var toPropertyKey = require("./toPropertyKey.js"); -function _decorate(decorators, factory, superClass, mixins) { - var api = _getDecoratorsApi(); - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - api = mixins[i](api); - } - } - var r = factory(function initialize(O) { - api.initializeInstanceElements(O, decorated.elements); - }, superClass); - var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); - api.initializeClassElements(r.F, decorated.elements); - return api.runClassFinishers(r.F, decorated.finishers); -} -function _getDecoratorsApi() { - _getDecoratorsApi = function _getDecoratorsApi() { - return api; - }; - var api = { - elementsDefinitionOrder: [["method"], ["field"]], - initializeInstanceElements: function initializeInstanceElements(O, elements) { - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - if (element.kind === kind && element.placement === "own") { - this.defineClassElement(O, element); - } - }, this); - }, this); - }, - initializeClassElements: function initializeClassElements(F, elements) { - var proto = F.prototype; - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - var placement = element.placement; - if (element.kind === kind && (placement === "static" || placement === "prototype")) { - var receiver = placement === "static" ? F : proto; - this.defineClassElement(receiver, element); - } - }, this); - }, this); - }, - defineClassElement: function defineClassElement(receiver, element) { - var descriptor = element.descriptor; - if (element.kind === "field") { - var initializer = element.initializer; - descriptor = { - enumerable: descriptor.enumerable, - writable: descriptor.writable, - configurable: descriptor.configurable, - value: initializer === void 0 ? void 0 : initializer.call(receiver) - }; - } - Object.defineProperty(receiver, element.key, descriptor); - }, - decorateClass: function decorateClass(elements, decorators) { - var newElements = []; - var finishers = []; - var placements = { - "static": [], - prototype: [], - own: [] - }; - elements.forEach(function (element) { - this.addElementPlacement(element, placements); - }, this); - elements.forEach(function (element) { - if (!_hasDecorators(element)) return newElements.push(element); - var elementFinishersExtras = this.decorateElement(element, placements); - newElements.push(elementFinishersExtras.element); - newElements.push.apply(newElements, elementFinishersExtras.extras); - finishers.push.apply(finishers, elementFinishersExtras.finishers); - }, this); - if (!decorators) { - return { - elements: newElements, - finishers: finishers - }; - } - var result = this.decorateConstructor(newElements, decorators); - finishers.push.apply(finishers, result.finishers); - result.finishers = finishers; - return result; - }, - addElementPlacement: function addElementPlacement(element, placements, silent) { - var keys = placements[element.placement]; - if (!silent && keys.indexOf(element.key) !== -1) { - throw new TypeError("Duplicated element (" + element.key + ")"); - } - keys.push(element.key); - }, - decorateElement: function decorateElement(element, placements) { - var extras = []; - var finishers = []; - for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { - var keys = placements[element.placement]; - keys.splice(keys.indexOf(element.key), 1); - var elementObject = this.fromElementDescriptor(element); - var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); - element = elementFinisherExtras.element; - this.addElementPlacement(element, placements); - if (elementFinisherExtras.finisher) { - finishers.push(elementFinisherExtras.finisher); - } - var newExtras = elementFinisherExtras.extras; - if (newExtras) { - for (var j = 0; j < newExtras.length; j++) { - this.addElementPlacement(newExtras[j], placements); - } - extras.push.apply(extras, newExtras); - } - } - return { - element: element, - finishers: finishers, - extras: extras - }; - }, - decorateConstructor: function decorateConstructor(elements, decorators) { - var finishers = []; - for (var i = decorators.length - 1; i >= 0; i--) { - var obj = this.fromClassDescriptor(elements); - var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); - if (elementsAndFinisher.finisher !== undefined) { - finishers.push(elementsAndFinisher.finisher); - } - if (elementsAndFinisher.elements !== undefined) { - elements = elementsAndFinisher.elements; - for (var j = 0; j < elements.length - 1; j++) { - for (var k = j + 1; k < elements.length; k++) { - if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { - throw new TypeError("Duplicated element (" + elements[j].key + ")"); - } - } - } - } - } - return { - elements: elements, - finishers: finishers - }; - }, - fromElementDescriptor: function fromElementDescriptor(element) { - var obj = { - kind: element.kind, - key: element.key, - placement: element.placement, - descriptor: element.descriptor - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - if (element.kind === "field") obj.initializer = element.initializer; - return obj; - }, - toElementDescriptors: function toElementDescriptors(elementObjects) { - if (elementObjects === undefined) return; - return toArray(elementObjects).map(function (elementObject) { - var element = this.toElementDescriptor(elementObject); - this.disallowProperty(elementObject, "finisher", "An element descriptor"); - this.disallowProperty(elementObject, "extras", "An element descriptor"); - return element; - }, this); - }, - toElementDescriptor: function toElementDescriptor(elementObject) { - var kind = String(elementObject.kind); - if (kind !== "method" && kind !== "field") { - throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); - } - var key = toPropertyKey(elementObject.key); - var placement = String(elementObject.placement); - if (placement !== "static" && placement !== "prototype" && placement !== "own") { - throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); - } - var descriptor = elementObject.descriptor; - this.disallowProperty(elementObject, "elements", "An element descriptor"); - var element = { - kind: kind, - key: key, - placement: placement, - descriptor: Object.assign({}, descriptor) - }; - if (kind !== "field") { - this.disallowProperty(elementObject, "initializer", "A method descriptor"); - } else { - this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); - element.initializer = elementObject.initializer; - } - return element; - }, - toElementFinisherExtras: function toElementFinisherExtras(elementObject) { - var element = this.toElementDescriptor(elementObject); - var finisher = _optionalCallableProperty(elementObject, "finisher"); - var extras = this.toElementDescriptors(elementObject.extras); - return { - element: element, - finisher: finisher, - extras: extras - }; - }, - fromClassDescriptor: function fromClassDescriptor(elements) { - var obj = { - kind: "class", - elements: elements.map(this.fromElementDescriptor, this) - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - return obj; - }, - toClassDescriptor: function toClassDescriptor(obj) { - var kind = String(obj.kind); - if (kind !== "class") { - throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); - } - this.disallowProperty(obj, "key", "A class descriptor"); - this.disallowProperty(obj, "placement", "A class descriptor"); - this.disallowProperty(obj, "descriptor", "A class descriptor"); - this.disallowProperty(obj, "initializer", "A class descriptor"); - this.disallowProperty(obj, "extras", "A class descriptor"); - var finisher = _optionalCallableProperty(obj, "finisher"); - var elements = this.toElementDescriptors(obj.elements); - return { - elements: elements, - finisher: finisher - }; - }, - runClassFinishers: function runClassFinishers(constructor, finishers) { - for (var i = 0; i < finishers.length; i++) { - var newConstructor = (0, finishers[i])(constructor); - if (newConstructor !== undefined) { - if (typeof newConstructor !== "function") { - throw new TypeError("Finishers must return a constructor."); - } - constructor = newConstructor; - } - } - return constructor; - }, - disallowProperty: function disallowProperty(obj, name, objectType) { - if (obj[name] !== undefined) { - throw new TypeError(objectType + " can't have a ." + name + " property."); - } - } - }; - return api; -} -function _createElementDescriptor(def) { - var key = toPropertyKey(def.key); - var descriptor; - if (def.kind === "method") { - descriptor = { - value: def.value, - writable: true, - configurable: true, - enumerable: false - }; - } else if (def.kind === "get") { - descriptor = { - get: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "set") { - descriptor = { - set: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "field") { - descriptor = { - configurable: true, - writable: true, - enumerable: true - }; - } - var element = { - kind: def.kind === "field" ? "field" : "method", - key: key, - placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype", - descriptor: descriptor - }; - if (def.decorators) element.decorators = def.decorators; - if (def.kind === "field") element.initializer = def.value; - return element; -} -function _coalesceGetterSetter(element, other) { - if (element.descriptor.get !== undefined) { - other.descriptor.get = element.descriptor.get; - } else { - other.descriptor.set = element.descriptor.set; - } -} -function _coalesceClassElements(elements) { - var newElements = []; - var isSameElement = function isSameElement(other) { - return other.kind === "method" && other.key === element.key && other.placement === element.placement; - }; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var other; - if (element.kind === "method" && (other = newElements.find(isSameElement))) { - if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other)) { - throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); - } - other.descriptor = element.descriptor; - } else { - if (_hasDecorators(element)) { - if (_hasDecorators(other)) { - throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); - } - other.decorators = element.decorators; - } - _coalesceGetterSetter(element, other); - } - } else { - newElements.push(element); - } - } - return newElements; -} -function _hasDecorators(element) { - return element.decorators && element.decorators.length; -} -function _isDataDescriptor(desc) { - return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); -} -function _optionalCallableProperty(obj, name) { - var value = obj[name]; - if (value !== undefined && typeof value !== "function") { - throw new TypeError("Expected '" + name + "' to be a function"); - } - return value; -} -module.exports = _decorate, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defaults.js b/project starter code/node_modules/@babel/runtime/helpers/defaults.js deleted file mode 100644 index 86641e9c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defaults.js +++ /dev/null @@ -1,12 +0,0 @@ -function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - return obj; -} -module.exports = _defaults, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js b/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js deleted file mode 100644 index c7224271..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js +++ /dev/null @@ -1,8 +0,0 @@ -function _defineAccessor(type, obj, key, fn) { - var desc = { - configurable: !0, - enumerable: !0 - }; - return desc[type] = fn, Object.defineProperty(obj, key, desc); -} -module.exports = _defineAccessor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js b/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js deleted file mode 100644 index a04e6028..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +++ /dev/null @@ -1,20 +0,0 @@ -function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - return obj; -} -module.exports = _defineEnumerableProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js deleted file mode 100644 index 8762046d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js +++ /dev/null @@ -1,16 +0,0 @@ -var toPropertyKey = require("./toPropertyKey.js"); -function _defineProperty(obj, key, value) { - key = toPropertyKey(key); - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} -module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js deleted file mode 100644 index 5df93d44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +++ /dev/null @@ -1,63 +0,0 @@ -import OverloadYield from "./OverloadYield.js"; -export default function AsyncGenerator(gen) { - var front, back; - function resume(key, arg) { - try { - var result = gen[key](arg), - value = result.value, - overloaded = value instanceof OverloadYield; - Promise.resolve(overloaded ? value.v : value).then(function (arg) { - if (overloaded) { - var nextKey = "return" === key ? "return" : "next"; - if (!value.k || arg.done) return resume(nextKey, arg); - arg = gen[nextKey](arg).value; - } - settle(result.done ? "return" : "normal", arg); - }, function (err) { - resume("throw", err); - }); - } catch (err) { - settle("throw", err); - } - } - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: !0 - }); - break; - case "throw": - front.reject(value); - break; - default: - front.resolve({ - value: value, - done: !1 - }); - } - (front = front.next) ? resume(front.key, front.arg) : back = null; - } - this._invoke = function (key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - back ? back = back.next = request : (front = back = request, resume(key, arg)); - }); - }, "function" != typeof gen["return"] && (this["return"] = void 0); -} -AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { - return this; -}, AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); -}, AsyncGenerator.prototype["throw"] = function (arg) { - return this._invoke("throw", arg); -}, AsyncGenerator.prototype["return"] = function (arg) { - return this._invoke("return", arg); -}; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js b/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js deleted file mode 100644 index 5237e18f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _AwaitValue(value) { - this.wrapped = value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js b/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js deleted file mode 100644 index 0dd12e01..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _OverloadYield(value, kind) { - this.v = value, this.k = kind; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js deleted file mode 100644 index 5137e85f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +++ /dev/null @@ -1,23 +0,0 @@ -export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object.keys(descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - if (desc.initializer === void 0) { - Object.defineProperty(target, property, desc); - desc = null; - } - return desc; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js deleted file mode 100644 index 84988df3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js +++ /dev/null @@ -1,235 +0,0 @@ -import _typeof from "./typeof.js"; -function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) { - return { - getMetadata: function getMetadata(key) { - old_assertNotFinished(decoratorFinishedRef, "getMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 !== metadataForKey) if (1 === kind) { - var pub = metadataForKey["public"]; - if (void 0 !== pub) return pub[property]; - } else if (2 === kind) { - var priv = metadataForKey["private"]; - if (void 0 !== priv) return priv.get(property); - } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor; - }, - setMetadata: function setMetadata(key, value) { - old_assertNotFinished(decoratorFinishedRef, "setMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) { - var pub = metadataForKey["public"]; - void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value; - } else if (2 === kind) { - var priv = metadataForKey.priv; - void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value); - } else metadataForKey.constructor = value; - } - }; -} -function old_convertMetadataMapToFinal(obj, metadataMap) { - var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")], - metadataKeys = Object.getOwnPropertySymbols(metadataMap); - if (0 !== metadataKeys.length) { - for (var i = 0; i < metadataKeys.length; i++) { - var key = metadataKeys[i], - metaForKey = metadataMap[key], - parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null, - pub = metaForKey["public"], - parentPub = parentMetaForKey ? parentMetaForKey["public"] : null; - pub && parentPub && Object.setPrototypeOf(pub, parentPub); - var priv = metaForKey["private"]; - if (priv) { - var privArr = Array.from(priv.values()), - parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null; - parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr; - } - parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey); - } - parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap; - } -} -function old_createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - old_assertNotFinished(decoratorFinishedRef, "addInitializer"), old_assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var metadataKind, - metadataName, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - isStatic: isStatic, - isPrivate: isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - if (0 !== kind && (ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) { - metadataKind = 2, metadataName = Symbol(name); - var access = {}; - 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () { - return desc.value; - } : (1 !== kind && 3 !== kind || (access.get = function () { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (access.set = function (v) { - desc.set.call(this, v); - })), ctx.access = access; - } else metadataKind = 1, metadataName = name; - try { - return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef))); - } finally { - decoratorFinishedRef.v = !0; - } -} -function old_assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function old_assertMetadataKey(key) { - if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key); -} -function old_assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function old_assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && old_assertCallable(value.get, "accessor.get"), void 0 !== value.set && old_assertCallable(value.set, "accessor.set"), void 0 !== value.init && old_assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && old_assertCallable(value.initializer, "accessor.initializer"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function old_getInit(desc) { - var initializer; - return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer; -} -function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) { - var desc, - initializer, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (old_assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = old_memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) old_assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === initializer) initializer = function initializer(instance, init) { - return init; - };else if ("function" != typeof initializer) { - var ownInitializers = initializer; - initializer = function initializer(instance, init) { - for (var value = init, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = initializer; - initializer = function initializer(instance, init) { - return originalInitializer.call(instance, init); - }; - } - ret.push(initializer); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - metadataMap, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers); - } - } - old_pushInitializers(ret, protoInitializers), old_pushInitializers(ret, staticInitializers); -} -function old_pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var ctx = Object.assign({ - kind: "class", - name: name, - addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef) - }, old_createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)), - nextNewClass = classDecs[i](newClass, ctx); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (old_assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -export default function applyDecs(targetClass, memberDecs, classDecs) { - var ret = [], - staticMetadataMap = {}, - protoMetadataMap = {}; - return old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), old_convertMetadataMapToFinal(targetClass, staticMetadataMap), ret; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js deleted file mode 100644 index a9f9e80a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +++ /dev/null @@ -1,183 +0,0 @@ -import _typeof from "./typeof.js"; -function createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var get, - set, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - "static": isStatic, - "private": isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - 0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), 0 === kind ? isPrivate ? (get = desc.get, set = desc.set) : (get = function get() { - return this[name]; - }, set = function set(v) { - this[name] = v; - }) : 2 === kind ? get = function get() { - return desc.value; - } : (1 !== kind && 3 !== kind || (get = function get() { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (set = function set(v) { - desc.set.call(this, v); - })), ctx.access = get && set ? { - get: get, - set: set - } : get ? { - get: get - } : { - set: set - }; - try { - return dec(value, ctx); - } finally { - decoratorFinishedRef.v = !0; - } -} -function assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) { - var desc, - init, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? init = newValue : 1 === kind ? (init = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = memberDec(decs[i], name, desc, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === init ? init = newInit : "function" == typeof init ? init = [init, newInit] : init.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === init) init = function init(instance, _init) { - return _init; - };else if ("function" != typeof init) { - var ownInitializers = init; - init = function init(instance, _init2) { - for (var value = _init2, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = init; - init = function init(instance, _init3) { - return originalInitializer.call(instance, _init3); - }; - } - ret.push(init); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function applyMemberDecs(ret, Class, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers); - } - } - pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers); -} -function pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function applyClassDecs(ret, targetClass, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var nextNewClass = classDecs[i](newClass, { - kind: "class", - name: name, - addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef) - }); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -export default function applyDecs2203(targetClass, memberDecs, classDecs) { - var ret = []; - return applyMemberDecs(ret, targetClass, memberDecs), applyClassDecs(ret, targetClass, classDecs), ret; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js deleted file mode 100644 index 8a9fad8a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js deleted file mode 100644 index be734fc3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js deleted file mode 100644 index f7d8dc78..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +++ /dev/null @@ -1,4 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js b/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js deleted file mode 100644 index 1f8fcf4b..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js deleted file mode 100644 index d393d55b..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +++ /dev/null @@ -1,23 +0,0 @@ -import OverloadYield from "./OverloadYield.js"; -export default function _asyncGeneratorDelegate(inner) { - var iter = {}, - waiting = !1; - function pump(key, value) { - return waiting = !0, value = new Promise(function (resolve) { - resolve(inner[key](value)); - }), { - done: !1, - value: new OverloadYield(value, 1) - }; - } - return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { - return this; - }, iter.next = function (value) { - return waiting ? (waiting = !1, value) : pump("next", value); - }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { - if (waiting) throw waiting = !1, value; - return pump("throw", value); - }), "function" == typeof inner["return"] && (iter["return"] = function (value) { - return waiting ? (waiting = !1, value) : pump("return", value); - }), iter; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js deleted file mode 100644 index ae8aa397..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +++ /dev/null @@ -1,44 +0,0 @@ -export default function _asyncIterator(iterable) { - var method, - async, - sync, - retry = 2; - for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { - if (async && null != (method = iterable[async])) return method.call(iterable); - if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); - async = "@@asyncIterator", sync = "@@iterator"; - } - throw new TypeError("Object is not async iterable"); -} -function AsyncFromSyncIterator(s) { - function AsyncFromSyncIteratorContinuation(r) { - if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); - var done = r.done; - return Promise.resolve(r.value).then(function (value) { - return { - value: value, - done: done - }; - }); - } - return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { - this.s = s, this.n = s.next; - }, AsyncFromSyncIterator.prototype = { - s: null, - n: null, - next: function next() { - return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); - }, - "return": function _return(value) { - var ret = this.s["return"]; - return void 0 === ret ? Promise.resolve({ - value: value, - done: !0 - }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); - }, - "throw": function _throw(value) { - var thr = this.s["return"]; - return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); - } - }, new AsyncFromSyncIterator(s); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js deleted file mode 100644 index c37aa2c7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +++ /dev/null @@ -1,30 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} -export default function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(undefined); - }); - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js deleted file mode 100644 index cfa05220..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +++ /dev/null @@ -1,4 +0,0 @@ -import OverloadYield from "./OverloadYield.js"; -export default function _awaitAsyncGenerator(value) { - return new OverloadYield(value, 0); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js b/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js deleted file mode 100644 index 928d53d2..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js +++ /dev/null @@ -1,5 +0,0 @@ -import _typeof from "./typeof.js"; -export default function _checkInRHS(value) { - if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== value ? _typeof(value) : "null")); - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js b/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js deleted file mode 100644 index 99014036..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _checkPrivateRedeclaration(obj, privateCollection) { - if (privateCollection.has(obj)) { - throw new TypeError("Cannot initialize the same private elements twice on an object"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js deleted file mode 100644 index 68684f23..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function _classApplyDescriptorDestructureSet(receiver, descriptor) { - if (descriptor.set) { - if (!("__destrObj" in descriptor)) { - descriptor.__destrObj = { - set value(v) { - descriptor.set.call(receiver, v); - } - }; - } - return descriptor.__destrObj; - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - return descriptor; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js deleted file mode 100644 index 727e9e9b..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - return descriptor.value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js deleted file mode 100644 index b4df6d30..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - descriptor.value = value; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js deleted file mode 100644 index 2f1738a3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js deleted file mode 100644 index 098ed309..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCheckPrivateStaticAccess(receiver, classConstructor) { - if (receiver !== classConstructor) { - throw new TypeError("Private static access of wrong provenance"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js deleted file mode 100644 index 0ef34b8d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { - if (descriptor === undefined) { - throw new TypeError("attempted to " + action + " private static field before its declaration"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js deleted file mode 100644 index 1a8d71ba..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - return privateMap.get(receiver); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js deleted file mode 100644 index 46eea93a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classNameTDZError(name) { - throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js deleted file mode 100644 index fb588336..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +++ /dev/null @@ -1,6 +0,0 @@ -import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldDestructureSet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js deleted file mode 100644 index 53cd1379..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +++ /dev/null @@ -1,6 +0,0 @@ -import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js deleted file mode 100644 index 2253dd84..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +++ /dev/null @@ -1,5 +0,0 @@ -import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js"; -export default function _classPrivateFieldInitSpec(obj, privateMap, value) { - checkPrivateRedeclaration(obj, privateMap); - privateMap.set(obj, value); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js deleted file mode 100644 index 09e93304..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { - throw new TypeError("attempted to use private field on non-instance"); - } - return receiver; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js deleted file mode 100644 index 5b7e5ac0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +++ /dev/null @@ -1,4 +0,0 @@ -var id = 0; -export default function _classPrivateFieldKey(name) { - return "__private_" + id++ + "_" + name; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js deleted file mode 100644 index ad91be44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +++ /dev/null @@ -1,7 +0,0 @@ -import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js deleted file mode 100644 index f32a3da8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return fn; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js deleted file mode 100644 index 18d12915..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +++ /dev/null @@ -1,5 +0,0 @@ -import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js"; -export default function _classPrivateMethodInitSpec(obj, privateSet) { - checkPrivateRedeclaration(obj, privateSet); - privateSet.add(obj); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js deleted file mode 100644 index 2bbaf3a7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classPrivateMethodSet() { - throw new TypeError("attempted to reassign private method"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js deleted file mode 100644 index 77afcfb1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +++ /dev/null @@ -1,8 +0,0 @@ -import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js deleted file mode 100644 index d253d311..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +++ /dev/null @@ -1,8 +0,0 @@ -import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js deleted file mode 100644 index b0b0cc64..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +++ /dev/null @@ -1,9 +0,0 @@ -import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js deleted file mode 100644 index fddc7b2d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +++ /dev/null @@ -1,5 +0,0 @@ -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) { - classCheckPrivateStaticAccess(receiver, classConstructor); - return method; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js deleted file mode 100644 index d5ab60a9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classStaticPrivateMethodSet() { - throw new TypeError("attempted to set read only static private field"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js b/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js deleted file mode 100644 index 3860bdd0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js +++ /dev/null @@ -1,17 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; -export default function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct.bind(); - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - return _construct.apply(null, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js deleted file mode 100644 index bbacdfec..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js +++ /dev/null @@ -1,18 +0,0 @@ -import toPropertyKey from "./toPropertyKey.js"; -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor); - } -} -export default function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js deleted file mode 100644 index 5e0e0f19..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +++ /dev/null @@ -1,52 +0,0 @@ -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -export default function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - var F = function F() {}; - return { - s: F, - n: function n() { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - var normalCompletion = true, - didErr = false, - err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) it["return"](); - } finally { - if (didErr) throw err; - } - } - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js deleted file mode 100644 index 043857dc..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +++ /dev/null @@ -1,19 +0,0 @@ -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -export default function _createForOfIteratorHelperLoose(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (it) return (it = it.call(o)).next.bind(it); - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - return function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js deleted file mode 100644 index 7c962976..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js +++ /dev/null @@ -1,17 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; -import possibleConstructorReturn from "./possibleConstructorReturn.js"; -export default function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), - result; - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return possibleConstructorReturn(this, result); - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js b/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js deleted file mode 100644 index e511dfe6..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js +++ /dev/null @@ -1,342 +0,0 @@ -import toArray from "./toArray.js"; -import toPropertyKey from "./toPropertyKey.js"; -export default function _decorate(decorators, factory, superClass, mixins) { - var api = _getDecoratorsApi(); - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - api = mixins[i](api); - } - } - var r = factory(function initialize(O) { - api.initializeInstanceElements(O, decorated.elements); - }, superClass); - var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); - api.initializeClassElements(r.F, decorated.elements); - return api.runClassFinishers(r.F, decorated.finishers); -} -function _getDecoratorsApi() { - _getDecoratorsApi = function _getDecoratorsApi() { - return api; - }; - var api = { - elementsDefinitionOrder: [["method"], ["field"]], - initializeInstanceElements: function initializeInstanceElements(O, elements) { - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - if (element.kind === kind && element.placement === "own") { - this.defineClassElement(O, element); - } - }, this); - }, this); - }, - initializeClassElements: function initializeClassElements(F, elements) { - var proto = F.prototype; - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - var placement = element.placement; - if (element.kind === kind && (placement === "static" || placement === "prototype")) { - var receiver = placement === "static" ? F : proto; - this.defineClassElement(receiver, element); - } - }, this); - }, this); - }, - defineClassElement: function defineClassElement(receiver, element) { - var descriptor = element.descriptor; - if (element.kind === "field") { - var initializer = element.initializer; - descriptor = { - enumerable: descriptor.enumerable, - writable: descriptor.writable, - configurable: descriptor.configurable, - value: initializer === void 0 ? void 0 : initializer.call(receiver) - }; - } - Object.defineProperty(receiver, element.key, descriptor); - }, - decorateClass: function decorateClass(elements, decorators) { - var newElements = []; - var finishers = []; - var placements = { - "static": [], - prototype: [], - own: [] - }; - elements.forEach(function (element) { - this.addElementPlacement(element, placements); - }, this); - elements.forEach(function (element) { - if (!_hasDecorators(element)) return newElements.push(element); - var elementFinishersExtras = this.decorateElement(element, placements); - newElements.push(elementFinishersExtras.element); - newElements.push.apply(newElements, elementFinishersExtras.extras); - finishers.push.apply(finishers, elementFinishersExtras.finishers); - }, this); - if (!decorators) { - return { - elements: newElements, - finishers: finishers - }; - } - var result = this.decorateConstructor(newElements, decorators); - finishers.push.apply(finishers, result.finishers); - result.finishers = finishers; - return result; - }, - addElementPlacement: function addElementPlacement(element, placements, silent) { - var keys = placements[element.placement]; - if (!silent && keys.indexOf(element.key) !== -1) { - throw new TypeError("Duplicated element (" + element.key + ")"); - } - keys.push(element.key); - }, - decorateElement: function decorateElement(element, placements) { - var extras = []; - var finishers = []; - for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { - var keys = placements[element.placement]; - keys.splice(keys.indexOf(element.key), 1); - var elementObject = this.fromElementDescriptor(element); - var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); - element = elementFinisherExtras.element; - this.addElementPlacement(element, placements); - if (elementFinisherExtras.finisher) { - finishers.push(elementFinisherExtras.finisher); - } - var newExtras = elementFinisherExtras.extras; - if (newExtras) { - for (var j = 0; j < newExtras.length; j++) { - this.addElementPlacement(newExtras[j], placements); - } - extras.push.apply(extras, newExtras); - } - } - return { - element: element, - finishers: finishers, - extras: extras - }; - }, - decorateConstructor: function decorateConstructor(elements, decorators) { - var finishers = []; - for (var i = decorators.length - 1; i >= 0; i--) { - var obj = this.fromClassDescriptor(elements); - var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); - if (elementsAndFinisher.finisher !== undefined) { - finishers.push(elementsAndFinisher.finisher); - } - if (elementsAndFinisher.elements !== undefined) { - elements = elementsAndFinisher.elements; - for (var j = 0; j < elements.length - 1; j++) { - for (var k = j + 1; k < elements.length; k++) { - if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { - throw new TypeError("Duplicated element (" + elements[j].key + ")"); - } - } - } - } - } - return { - elements: elements, - finishers: finishers - }; - }, - fromElementDescriptor: function fromElementDescriptor(element) { - var obj = { - kind: element.kind, - key: element.key, - placement: element.placement, - descriptor: element.descriptor - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - if (element.kind === "field") obj.initializer = element.initializer; - return obj; - }, - toElementDescriptors: function toElementDescriptors(elementObjects) { - if (elementObjects === undefined) return; - return toArray(elementObjects).map(function (elementObject) { - var element = this.toElementDescriptor(elementObject); - this.disallowProperty(elementObject, "finisher", "An element descriptor"); - this.disallowProperty(elementObject, "extras", "An element descriptor"); - return element; - }, this); - }, - toElementDescriptor: function toElementDescriptor(elementObject) { - var kind = String(elementObject.kind); - if (kind !== "method" && kind !== "field") { - throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); - } - var key = toPropertyKey(elementObject.key); - var placement = String(elementObject.placement); - if (placement !== "static" && placement !== "prototype" && placement !== "own") { - throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); - } - var descriptor = elementObject.descriptor; - this.disallowProperty(elementObject, "elements", "An element descriptor"); - var element = { - kind: kind, - key: key, - placement: placement, - descriptor: Object.assign({}, descriptor) - }; - if (kind !== "field") { - this.disallowProperty(elementObject, "initializer", "A method descriptor"); - } else { - this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); - element.initializer = elementObject.initializer; - } - return element; - }, - toElementFinisherExtras: function toElementFinisherExtras(elementObject) { - var element = this.toElementDescriptor(elementObject); - var finisher = _optionalCallableProperty(elementObject, "finisher"); - var extras = this.toElementDescriptors(elementObject.extras); - return { - element: element, - finisher: finisher, - extras: extras - }; - }, - fromClassDescriptor: function fromClassDescriptor(elements) { - var obj = { - kind: "class", - elements: elements.map(this.fromElementDescriptor, this) - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - return obj; - }, - toClassDescriptor: function toClassDescriptor(obj) { - var kind = String(obj.kind); - if (kind !== "class") { - throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); - } - this.disallowProperty(obj, "key", "A class descriptor"); - this.disallowProperty(obj, "placement", "A class descriptor"); - this.disallowProperty(obj, "descriptor", "A class descriptor"); - this.disallowProperty(obj, "initializer", "A class descriptor"); - this.disallowProperty(obj, "extras", "A class descriptor"); - var finisher = _optionalCallableProperty(obj, "finisher"); - var elements = this.toElementDescriptors(obj.elements); - return { - elements: elements, - finisher: finisher - }; - }, - runClassFinishers: function runClassFinishers(constructor, finishers) { - for (var i = 0; i < finishers.length; i++) { - var newConstructor = (0, finishers[i])(constructor); - if (newConstructor !== undefined) { - if (typeof newConstructor !== "function") { - throw new TypeError("Finishers must return a constructor."); - } - constructor = newConstructor; - } - } - return constructor; - }, - disallowProperty: function disallowProperty(obj, name, objectType) { - if (obj[name] !== undefined) { - throw new TypeError(objectType + " can't have a ." + name + " property."); - } - } - }; - return api; -} -function _createElementDescriptor(def) { - var key = toPropertyKey(def.key); - var descriptor; - if (def.kind === "method") { - descriptor = { - value: def.value, - writable: true, - configurable: true, - enumerable: false - }; - } else if (def.kind === "get") { - descriptor = { - get: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "set") { - descriptor = { - set: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "field") { - descriptor = { - configurable: true, - writable: true, - enumerable: true - }; - } - var element = { - kind: def.kind === "field" ? "field" : "method", - key: key, - placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype", - descriptor: descriptor - }; - if (def.decorators) element.decorators = def.decorators; - if (def.kind === "field") element.initializer = def.value; - return element; -} -function _coalesceGetterSetter(element, other) { - if (element.descriptor.get !== undefined) { - other.descriptor.get = element.descriptor.get; - } else { - other.descriptor.set = element.descriptor.set; - } -} -function _coalesceClassElements(elements) { - var newElements = []; - var isSameElement = function isSameElement(other) { - return other.kind === "method" && other.key === element.key && other.placement === element.placement; - }; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var other; - if (element.kind === "method" && (other = newElements.find(isSameElement))) { - if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other)) { - throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); - } - other.descriptor = element.descriptor; - } else { - if (_hasDecorators(element)) { - if (_hasDecorators(other)) { - throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); - } - other.decorators = element.decorators; - } - _coalesceGetterSetter(element, other); - } - } else { - newElements.push(element); - } - } - return newElements; -} -function _hasDecorators(element) { - return element.decorators && element.decorators.length; -} -function _isDataDescriptor(desc) { - return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); -} -function _optionalCallableProperty(obj, name) { - var value = obj[name]; - if (value !== undefined && typeof value !== "function") { - throw new TypeError("Expected '" + name + "' to be a function"); - } - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js deleted file mode 100644 index 9e59e9a8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - return obj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js deleted file mode 100644 index 154271d1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _defineAccessor(type, obj, key, fn) { - var desc = { - configurable: !0, - enumerable: !0 - }; - return desc[type] = fn, Object.defineProperty(obj, key, desc); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js deleted file mode 100644 index 0c04128a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +++ /dev/null @@ -1,19 +0,0 @@ -export default function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - return obj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js deleted file mode 100644 index 56c06a25..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js +++ /dev/null @@ -1,15 +0,0 @@ -import toPropertyKey from "./toPropertyKey.js"; -export default function _defineProperty(obj, key, value) { - key = toPropertyKey(key); - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js b/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js deleted file mode 100644 index ab17131f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function _extends() { - _extends = Object.assign ? Object.assign.bind() : function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }; - return _extends.apply(this, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/get.js b/project starter code/node_modules/@babel/runtime/helpers/esm/get.js deleted file mode 100644 index 0705d5fc..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/get.js +++ /dev/null @@ -1,17 +0,0 @@ -import superPropBase from "./superPropBase.js"; -export default function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get.bind(); - } else { - _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target : receiver); - } - return desc.value; - }; - } - return _get.apply(this, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js deleted file mode 100644 index e9bb1d54..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js b/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js deleted file mode 100644 index a1e7e4cd..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _identity(x) { - return x; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js b/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js deleted file mode 100644 index 0b0a0eac..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js +++ /dev/null @@ -1,17 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -export default function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) setPrototypeOf(subClass, superClass); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js deleted file mode 100644 index 90bb7965..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +++ /dev/null @@ -1,6 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -export default function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js deleted file mode 100644 index 26fdea08..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _initializerDefineProperty(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js deleted file mode 100644 index 30d518cf..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js b/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js deleted file mode 100644 index 8c43b717..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js b/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js deleted file mode 100644 index c2df7b64..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js b/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js deleted file mode 100644 index 6ec63091..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +++ /dev/null @@ -1,40 +0,0 @@ -import _typeof from "./typeof.js"; -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== "function") return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -export default function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { - return { - "default": obj - }; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj["default"] = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js b/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js deleted file mode 100644 index 7b1bc821..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js b/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js deleted file mode 100644 index 61840807..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js deleted file mode 100644 index cfe9fbd3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js deleted file mode 100644 index 5c31a593..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +++ /dev/null @@ -1,27 +0,0 @@ -export default function _iterableToArrayLimit(arr, i) { - var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; - if (null != _i) { - var _s, - _e, - _x, - _r, - _arr = [], - _n = !0, - _d = !1; - try { - if (_x = (_i = _i.call(arr)).next, 0 === i) { - if (Object(_i) !== _i) return; - _n = !1; - } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); - } catch (err) { - _d = !0, _e = err; - } finally { - try { - if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; - } finally { - if (_d) throw _e; - } - } - return _arr; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js deleted file mode 100644 index 9237c307..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _iterableToArrayLimitLoose(arr, i) { - var _i = arr && ("undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]); - if (null != _i) { - var _s, - _arr = []; - for (_i = _i.call(arr); arr.length < i && !(_s = _i.next()).done;) _arr.push(_s.value); - return _arr; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js b/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js deleted file mode 100644 index 742afd5c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js +++ /dev/null @@ -1,21 +0,0 @@ -var REACT_ELEMENT_TYPE; -export default function _createRawReactElement(type, props, key, children) { - REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103); - var defaultProps = type && type.defaultProps, - childrenLength = arguments.length - 3; - if (props || 0 === childrenLength || (props = { - children: void 0 - }), 1 === childrenLength) props.children = children;else if (childrenLength > 1) { - for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; - props.children = childArray; - } - if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {}); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: void 0 === key ? null : "" + key, - ref: null, - props: props, - _owner: null - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js b/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js deleted file mode 100644 index 38fd78fb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +++ /dev/null @@ -1,8 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _maybeArrayLike(next, arr, i) { - if (arr && !Array.isArray(arr) && typeof arr.length === "number") { - var len = arr.length; - return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); - } - return next(arr, i); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js b/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js deleted file mode 100644 index d6cd8643..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js b/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js deleted file mode 100644 index b349d006..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js b/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js deleted file mode 100644 index 82d82961..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js deleted file mode 100644 index 251b8595..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure " + obj); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js deleted file mode 100644 index a4e05e56..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js +++ /dev/null @@ -1,16 +0,0 @@ -import defineProperty from "./defineProperty.js"; -export default function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js deleted file mode 100644 index 7d69accd..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +++ /dev/null @@ -1,22 +0,0 @@ -import defineProperty from "./defineProperty.js"; -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); - } - return keys; -} -export default function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] ? arguments[i] : {}; - i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { - defineProperty(target, key, source[key]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js deleted file mode 100644 index 36804a39..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +++ /dev/null @@ -1,16 +0,0 @@ -import objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js"; -export default function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js deleted file mode 100644 index 4b308bde..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js b/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js deleted file mode 100644 index 87788244..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +++ /dev/null @@ -1,10 +0,0 @@ -import _typeof from "./typeof.js"; -import assertThisInitialized from "./assertThisInitialized.js"; -export default function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return assertThisInitialized(self); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js deleted file mode 100644 index 166e40e5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _readOnlyError(name) { - throw new TypeError("\"" + name + "\" is read-only"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js b/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js deleted file mode 100644 index 562d8119..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +++ /dev/null @@ -1,303 +0,0 @@ -import _typeof from "./typeof.js"; -export default function _regeneratorRuntime() { - "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ - _regeneratorRuntime = function _regeneratorRuntime() { - return exports; - }; - var exports = {}, - Op = Object.prototype, - hasOwn = Op.hasOwnProperty, - defineProperty = Object.defineProperty || function (obj, key, desc) { - obj[key] = desc.value; - }, - $Symbol = "function" == typeof Symbol ? Symbol : {}, - iteratorSymbol = $Symbol.iterator || "@@iterator", - asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", - toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - function define(obj, key, value) { - return Object.defineProperty(obj, key, { - value: value, - enumerable: !0, - configurable: !0, - writable: !0 - }), obj[key]; - } - try { - define({}, ""); - } catch (err) { - define = function define(obj, key, value) { - return obj[key] = value; - }; - } - function wrap(innerFn, outerFn, self, tryLocsList) { - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, - generator = Object.create(protoGenerator.prototype), - context = new Context(tryLocsList || []); - return defineProperty(generator, "_invoke", { - value: makeInvokeMethod(innerFn, self, context) - }), generator; - } - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - exports.wrap = wrap; - var ContinueSentinel = {}; - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - var IteratorPrototype = {}; - define(IteratorPrototype, iteratorSymbol, function () { - return this; - }); - var getProto = Object.getPrototypeOf, - NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - define(prototype, method, function (arg) { - return this._invoke(method, arg); - }); - }); - } - function AsyncIterator(generator, PromiseImpl) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if ("throw" !== record.type) { - var result = record.arg, - value = result.value; - return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }) : PromiseImpl.resolve(value).then(function (unwrapped) { - result.value = unwrapped, resolve(result); - }, function (error) { - return invoke("throw", error, resolve, reject); - }); - } - reject(record.arg); - } - var previousPromise; - defineProperty(this, "_invoke", { - value: function value(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function (resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } - }); - } - function makeInvokeMethod(innerFn, self, context) { - var state = "suspendedStart"; - return function (method, arg) { - if ("executing" === state) throw new Error("Generator is already running"); - if ("completed" === state) { - if ("throw" === method) throw arg; - return doneResult(); - } - for (context.method = method, context.arg = arg;;) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { - if ("suspendedStart" === state) throw state = "completed", context.arg; - context.dispatchException(context.arg); - } else "return" === context.method && context.abrupt("return", context.arg); - state = "executing"; - var record = tryCatch(innerFn, self, context); - if ("normal" === record.type) { - if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; - return { - value: record.arg, - done: context.done - }; - } - "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); - } - }; - } - function maybeInvokeDelegate(delegate, context) { - var methodName = context.method, - method = delegate.iterator[methodName]; - if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; - var record = tryCatch(method, delegate.iterator, context.arg); - if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; - var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); - } - function pushTryEntry(locs) { - var entry = { - tryLoc: locs[0] - }; - 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); - } - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal", delete record.arg, entry.completion = record; - } - function Context(tryLocsList) { - this.tryEntries = [{ - tryLoc: "root" - }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); - } - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) return iteratorMethod.call(iterable); - if ("function" == typeof iterable.next) return iterable; - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; - return next.value = undefined, next.done = !0, next; - }; - return next.next = next; - } - } - return { - next: doneResult - }; - } - function doneResult() { - return { - value: undefined, - done: !0 - }; - } - return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { - value: GeneratorFunctionPrototype, - configurable: !0 - }), defineProperty(GeneratorFunctionPrototype, "constructor", { - value: GeneratorFunction, - configurable: !0 - }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { - var ctor = "function" == typeof genFun && genFun.constructor; - return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); - }, exports.mark = function (genFun) { - return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; - }, exports.awrap = function (arg) { - return { - __await: arg - }; - }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { - return this; - }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { - void 0 === PromiseImpl && (PromiseImpl = Promise); - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); - return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { - return this; - }), define(Gp, "toString", function () { - return "[object Generator]"; - }), exports.keys = function (val) { - var object = Object(val), - keys = []; - for (var key in object) keys.push(key); - return keys.reverse(), function next() { - for (; keys.length;) { - var key = keys.pop(); - if (key in object) return next.value = key, next.done = !1, next; - } - return next.done = !0, next; - }; - }, exports.values = values, Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); - }, - stop: function stop() { - this.done = !0; - var rootRecord = this.tryEntries[0].completion; - if ("throw" === rootRecord.type) throw rootRecord.arg; - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) throw exception; - var context = this; - function handle(loc, caught) { - return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; - } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i], - record = entry.completion; - if ("root" === entry.tryLoc) return handle("end"); - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"), - hasFinally = hasOwn.call(entry, "finallyLoc"); - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } else if (hasCatch) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - } else { - if (!hasFinally) throw new Error("try statement without catch or finally"); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } - } - } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); - var record = finallyEntry ? finallyEntry.completion : {}; - return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); - }, - complete: function complete(record, afterLoc) { - if ("throw" === record.type) throw record.arg; - return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; - } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if ("throw" === record.type) { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - return this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }, "next" === this.method && (this.arg = undefined), ContinueSentinel; - } - }, exports; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/set.js b/project starter code/node_modules/@babel/runtime/helpers/esm/set.js deleted file mode 100644 index c9ee6c72..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/set.js +++ /dev/null @@ -1,40 +0,0 @@ -import superPropBase from "./superPropBase.js"; -import defineProperty from "./defineProperty.js"; -function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - return false; - } - } - desc = Object.getOwnPropertyDescriptor(receiver, property); - if (desc) { - if (!desc.writable) { - return false; - } - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - defineProperty(receiver, property, value); - } - return true; - }; - } - return set(target, property, value, receiver); -} -export default function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - if (!s && isStrict) { - throw new TypeError('failed to set property'); - } - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js deleted file mode 100644 index 905e13c0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - return _setPrototypeOf(o, p); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js b/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js deleted file mode 100644 index cadd9bb5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js deleted file mode 100644 index 618200b9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArrayLimit from "./iterableToArrayLimit.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js deleted file mode 100644 index efc7429e..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArrayLimitLoose from "./iterableToArrayLimitLoose.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js b/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js deleted file mode 100644 index 605724d7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js +++ /dev/null @@ -1,8 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -export default function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - return object; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js b/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js deleted file mode 100644 index 990d5e43..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js deleted file mode 100644 index 9fcba323..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - strings.raw = raw; - return strings; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js b/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js deleted file mode 100644 index d5d0adc8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _tdzError(name) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js b/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js deleted file mode 100644 index b25f7c44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js +++ /dev/null @@ -1,5 +0,0 @@ -import undef from "./temporalUndefined.js"; -import err from "./tdz.js"; -export default function _temporalRef(val, name) { - return val === undef ? err(name) : val; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js b/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js deleted file mode 100644 index 1a357173..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +++ /dev/null @@ -1 +0,0 @@ -export default function _temporalUndefined() {} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js deleted file mode 100644 index ad7c871a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArray from "./iterableToArray.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js deleted file mode 100644 index bd912855..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithoutHoles from "./arrayWithoutHoles.js"; -import iterableToArray from "./iterableToArray.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableSpread from "./nonIterableSpread.js"; -export default function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js deleted file mode 100644 index cbfabb7f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +++ /dev/null @@ -1,11 +0,0 @@ -import _typeof from "./typeof.js"; -export default function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js deleted file mode 100644 index 0fcc93b3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +++ /dev/null @@ -1,6 +0,0 @@ -import _typeof from "./typeof.js"; -import toPrimitive from "./toPrimitive.js"; -export default function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js b/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js deleted file mode 100644 index 92100c66..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _typeof(obj) { - "@babel/helpers - typeof"; - - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, _typeof(obj); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js deleted file mode 100644 index c0f63bd5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +++ /dev/null @@ -1,9 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js deleted file mode 100644 index 723b2dda..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +++ /dev/null @@ -1,6 +0,0 @@ -import AsyncGenerator from "./AsyncGenerator.js"; -export default function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js deleted file mode 100644 index 43d0ded7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +++ /dev/null @@ -1,30 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -import setPrototypeOf from "./setPrototypeOf.js"; -import isNativeFunction from "./isNativeFunction.js"; -import construct from "./construct.js"; -export default function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - _cache.set(Class, Wrapper); - } - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }; - return _wrapNativeSuper(Class); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js deleted file mode 100644 index 620d84c7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +++ /dev/null @@ -1,50 +0,0 @@ -import _typeof from "./typeof.js"; -import setPrototypeOf from "./setPrototypeOf.js"; -import inherits from "./inherits.js"; -export default function _wrapRegExp() { - _wrapRegExp = function _wrapRegExp(re, groups) { - return new BabelRegExp(re, void 0, groups); - }; - var _super = RegExp.prototype, - _groups = new WeakMap(); - function BabelRegExp(re, flags, groups) { - var _this = new RegExp(re, flags); - return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype); - } - function buildGroups(result, re) { - var g = _groups.get(re); - return Object.keys(g).reduce(function (groups, name) { - var i = g[name]; - if ("number" == typeof i) groups[name] = result[i];else { - for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++; - groups[name] = result[i[k]]; - } - return groups; - }, Object.create(null)); - } - return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { - var result = _super.exec.call(this, str); - if (result) { - result.groups = buildGroups(result, this); - var indices = result.indices; - indices && (indices.groups = buildGroups(indices, this)); - } - return result; - }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { - if ("string" == typeof substitution) { - var groups = _groups.get(this); - return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { - var group = groups[name]; - return "$" + (Array.isArray(group) ? group.join("$") : group); - })); - } - if ("function" == typeof substitution) { - var _this = this; - return _super[Symbol.replace].call(this, str, function () { - var args = arguments; - return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); - }); - } - return _super[Symbol.replace].call(this, str, substitution); - }, _wrapRegExp.apply(this, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js deleted file mode 100644 index 9170bd45..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _writeOnlyError(name) { - throw new TypeError("\"" + name + "\" is write-only"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/extends.js b/project starter code/node_modules/@babel/runtime/helpers/extends.js deleted file mode 100644 index bb111607..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/extends.js +++ /dev/null @@ -1,15 +0,0 @@ -function _extends() { - module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _extends.apply(this, arguments); -} -module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/get.js b/project starter code/node_modules/@babel/runtime/helpers/get.js deleted file mode 100644 index 9b44d2fb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/get.js +++ /dev/null @@ -1,18 +0,0 @@ -var superPropBase = require("./superPropBase.js"); -function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target : receiver); - } - return desc.value; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - } - return _get.apply(this, arguments); -} -module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js deleted file mode 100644 index 0639a655..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js +++ /dev/null @@ -1,7 +0,0 @@ -function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _getPrototypeOf(o); -} -module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/identity.js b/project starter code/node_modules/@babel/runtime/helpers/identity.js deleted file mode 100644 index 7dd82dc7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/identity.js +++ /dev/null @@ -1,4 +0,0 @@ -function _identity(x) { - return x; -} -module.exports = _identity, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/inherits.js b/project starter code/node_modules/@babel/runtime/helpers/inherits.js deleted file mode 100644 index 6521cce3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/inherits.js +++ /dev/null @@ -1,18 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) setPrototypeOf(subClass, superClass); -} -module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js b/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js deleted file mode 100644 index 19a60c93..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} -module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js deleted file mode 100644 index 7f35d503..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +++ /dev/null @@ -1,10 +0,0 @@ -function _initializerDefineProperty(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); -} -module.exports = _initializerDefineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js b/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js deleted file mode 100644 index c58b04ee..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +++ /dev/null @@ -1,4 +0,0 @@ -function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); -} -module.exports = _initializerWarningHelper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/instanceof.js b/project starter code/node_modules/@babel/runtime/helpers/instanceof.js deleted file mode 100644 index bc3d9e7f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/instanceof.js +++ /dev/null @@ -1,8 +0,0 @@ -function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } -} -module.exports = _instanceof, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js b/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js deleted file mode 100644 index 429b270d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js +++ /dev/null @@ -1,6 +0,0 @@ -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; -} -module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js b/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js deleted file mode 100644 index 3765dcc7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +++ /dev/null @@ -1,41 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== "function") return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { - return { - "default": obj - }; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj["default"] = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js b/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js deleted file mode 100644 index ea595353..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js +++ /dev/null @@ -1,4 +0,0 @@ -function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} -module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js b/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js deleted file mode 100644 index 6b4e73f0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +++ /dev/null @@ -1,12 +0,0 @@ -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} -module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js deleted file mode 100644 index 89607526..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js +++ /dev/null @@ -1,4 +0,0 @@ -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} -module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js deleted file mode 100644 index 20a18351..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +++ /dev/null @@ -1,28 +0,0 @@ -function _iterableToArrayLimit(arr, i) { - var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; - if (null != _i) { - var _s, - _e, - _x, - _r, - _arr = [], - _n = !0, - _d = !1; - try { - if (_x = (_i = _i.call(arr)).next, 0 === i) { - if (Object(_i) !== _i) return; - _n = !1; - } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); - } catch (err) { - _d = !0, _e = err; - } finally { - try { - if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; - } finally { - if (_d) throw _e; - } - } - return _arr; - } -} -module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js deleted file mode 100644 index c56bebdb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +++ /dev/null @@ -1,10 +0,0 @@ -function _iterableToArrayLimitLoose(arr, i) { - var _i = arr && ("undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]); - if (null != _i) { - var _s, - _arr = []; - for (_i = _i.call(arr); arr.length < i && !(_s = _i.next()).done;) _arr.push(_s.value); - return _arr; - } -} -module.exports = _iterableToArrayLimitLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/jsx.js b/project starter code/node_modules/@babel/runtime/helpers/jsx.js deleted file mode 100644 index 8c6de765..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/jsx.js +++ /dev/null @@ -1,22 +0,0 @@ -var REACT_ELEMENT_TYPE; -function _createRawReactElement(type, props, key, children) { - REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103); - var defaultProps = type && type.defaultProps, - childrenLength = arguments.length - 3; - if (props || 0 === childrenLength || (props = { - children: void 0 - }), 1 === childrenLength) props.children = children;else if (childrenLength > 1) { - for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; - props.children = childArray; - } - if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {}); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: void 0 === key ? null : "" + key, - ref: null, - props: props, - _owner: null - }; -} -module.exports = _createRawReactElement, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js b/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js deleted file mode 100644 index 5d000975..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js +++ /dev/null @@ -1,9 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); -function _maybeArrayLike(next, arr, i) { - if (arr && !Array.isArray(arr) && typeof arr.length === "number") { - var len = arr.length; - return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); - } - return next(arr, i); -} -module.exports = _maybeArrayLike, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js b/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js deleted file mode 100644 index 9c680c8d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js +++ /dev/null @@ -1,6 +0,0 @@ -function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } -} -module.exports = _newArrowCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js b/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js deleted file mode 100644 index 5b405e00..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +++ /dev/null @@ -1,4 +0,0 @@ -function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure " + obj); -} -module.exports = _objectDestructuringEmpty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js b/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js deleted file mode 100644 index f3934031..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js +++ /dev/null @@ -1,17 +0,0 @@ -var defineProperty = require("./defineProperty.js"); -function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } - return target; -} -module.exports = _objectSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js b/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js deleted file mode 100644 index 214f9e04..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js +++ /dev/null @@ -1,23 +0,0 @@ -var defineProperty = require("./defineProperty.js"); -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); - } - return keys; -} -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] ? arguments[i] : {}; - i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { - defineProperty(target, key, source[key]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - return target; -} -module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js b/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js deleted file mode 100644 index cf526bc8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +++ /dev/null @@ -1,17 +0,0 @@ -var objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js"); -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - return target; -} -module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js b/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js deleted file mode 100644 index 3c65a9db..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +++ /dev/null @@ -1,13 +0,0 @@ -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - return target; -} -module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js b/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js deleted file mode 100644 index b2424b00..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +++ /dev/null @@ -1,11 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -var assertThisInitialized = require("./assertThisInitialized.js"); -function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return assertThisInitialized(self); -} -module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js deleted file mode 100644 index 6637a0e0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js +++ /dev/null @@ -1,4 +0,0 @@ -function _readOnlyError(name) { - throw new TypeError("\"" + name + "\" is read-only"); -} -module.exports = _readOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js b/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js deleted file mode 100644 index 98db5918..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +++ /dev/null @@ -1,304 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _regeneratorRuntime() { - "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ - module.exports = _regeneratorRuntime = function _regeneratorRuntime() { - return exports; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - var exports = {}, - Op = Object.prototype, - hasOwn = Op.hasOwnProperty, - defineProperty = Object.defineProperty || function (obj, key, desc) { - obj[key] = desc.value; - }, - $Symbol = "function" == typeof Symbol ? Symbol : {}, - iteratorSymbol = $Symbol.iterator || "@@iterator", - asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", - toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - function define(obj, key, value) { - return Object.defineProperty(obj, key, { - value: value, - enumerable: !0, - configurable: !0, - writable: !0 - }), obj[key]; - } - try { - define({}, ""); - } catch (err) { - define = function define(obj, key, value) { - return obj[key] = value; - }; - } - function wrap(innerFn, outerFn, self, tryLocsList) { - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, - generator = Object.create(protoGenerator.prototype), - context = new Context(tryLocsList || []); - return defineProperty(generator, "_invoke", { - value: makeInvokeMethod(innerFn, self, context) - }), generator; - } - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - exports.wrap = wrap; - var ContinueSentinel = {}; - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - var IteratorPrototype = {}; - define(IteratorPrototype, iteratorSymbol, function () { - return this; - }); - var getProto = Object.getPrototypeOf, - NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - define(prototype, method, function (arg) { - return this._invoke(method, arg); - }); - }); - } - function AsyncIterator(generator, PromiseImpl) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if ("throw" !== record.type) { - var result = record.arg, - value = result.value; - return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }) : PromiseImpl.resolve(value).then(function (unwrapped) { - result.value = unwrapped, resolve(result); - }, function (error) { - return invoke("throw", error, resolve, reject); - }); - } - reject(record.arg); - } - var previousPromise; - defineProperty(this, "_invoke", { - value: function value(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function (resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } - }); - } - function makeInvokeMethod(innerFn, self, context) { - var state = "suspendedStart"; - return function (method, arg) { - if ("executing" === state) throw new Error("Generator is already running"); - if ("completed" === state) { - if ("throw" === method) throw arg; - return doneResult(); - } - for (context.method = method, context.arg = arg;;) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { - if ("suspendedStart" === state) throw state = "completed", context.arg; - context.dispatchException(context.arg); - } else "return" === context.method && context.abrupt("return", context.arg); - state = "executing"; - var record = tryCatch(innerFn, self, context); - if ("normal" === record.type) { - if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; - return { - value: record.arg, - done: context.done - }; - } - "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); - } - }; - } - function maybeInvokeDelegate(delegate, context) { - var methodName = context.method, - method = delegate.iterator[methodName]; - if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; - var record = tryCatch(method, delegate.iterator, context.arg); - if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; - var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); - } - function pushTryEntry(locs) { - var entry = { - tryLoc: locs[0] - }; - 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); - } - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal", delete record.arg, entry.completion = record; - } - function Context(tryLocsList) { - this.tryEntries = [{ - tryLoc: "root" - }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); - } - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) return iteratorMethod.call(iterable); - if ("function" == typeof iterable.next) return iterable; - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; - return next.value = undefined, next.done = !0, next; - }; - return next.next = next; - } - } - return { - next: doneResult - }; - } - function doneResult() { - return { - value: undefined, - done: !0 - }; - } - return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { - value: GeneratorFunctionPrototype, - configurable: !0 - }), defineProperty(GeneratorFunctionPrototype, "constructor", { - value: GeneratorFunction, - configurable: !0 - }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { - var ctor = "function" == typeof genFun && genFun.constructor; - return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); - }, exports.mark = function (genFun) { - return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; - }, exports.awrap = function (arg) { - return { - __await: arg - }; - }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { - return this; - }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { - void 0 === PromiseImpl && (PromiseImpl = Promise); - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); - return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { - return this; - }), define(Gp, "toString", function () { - return "[object Generator]"; - }), exports.keys = function (val) { - var object = Object(val), - keys = []; - for (var key in object) keys.push(key); - return keys.reverse(), function next() { - for (; keys.length;) { - var key = keys.pop(); - if (key in object) return next.value = key, next.done = !1, next; - } - return next.done = !0, next; - }; - }, exports.values = values, Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); - }, - stop: function stop() { - this.done = !0; - var rootRecord = this.tryEntries[0].completion; - if ("throw" === rootRecord.type) throw rootRecord.arg; - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) throw exception; - var context = this; - function handle(loc, caught) { - return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; - } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i], - record = entry.completion; - if ("root" === entry.tryLoc) return handle("end"); - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"), - hasFinally = hasOwn.call(entry, "finallyLoc"); - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } else if (hasCatch) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - } else { - if (!hasFinally) throw new Error("try statement without catch or finally"); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } - } - } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); - var record = finallyEntry ? finallyEntry.completion : {}; - return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); - }, - complete: function complete(record, afterLoc) { - if ("throw" === record.type) throw record.arg; - return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; - } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if ("throw" === record.type) { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - return this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }, "next" === this.method && (this.arg = undefined), ContinueSentinel; - } - }, exports; -} -module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/set.js b/project starter code/node_modules/@babel/runtime/helpers/set.js deleted file mode 100644 index e1356241..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/set.js +++ /dev/null @@ -1,41 +0,0 @@ -var superPropBase = require("./superPropBase.js"); -var defineProperty = require("./defineProperty.js"); -function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - return false; - } - } - desc = Object.getOwnPropertyDescriptor(receiver, property); - if (desc) { - if (!desc.writable) { - return false; - } - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - defineProperty(receiver, property, value); - } - return true; - }; - } - return set(target, property, value, receiver); -} -function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - if (!s && isStrict) { - throw new TypeError('failed to set property'); - } - return value; -} -module.exports = _set, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js deleted file mode 100644 index e0d8b518..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js +++ /dev/null @@ -1,8 +0,0 @@ -function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _setPrototypeOf(o, p); -} -module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js b/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js deleted file mode 100644 index ca269aad..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +++ /dev/null @@ -1,8 +0,0 @@ -function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - }; -} -module.exports = _skipFirstGeneratorNext, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js b/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js deleted file mode 100644 index 534b61aa..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); -var iterableToArrayLimit = require("./iterableToArrayLimit.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableRest = require("./nonIterableRest.js"); -function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} -module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js b/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js deleted file mode 100644 index b1989b48..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); -var iterableToArrayLimitLoose = require("./iterableToArrayLimitLoose.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableRest = require("./nonIterableRest.js"); -function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} -module.exports = _slicedToArrayLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js b/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js deleted file mode 100644 index e43a0293..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js +++ /dev/null @@ -1,9 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - return object; -} -module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js b/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js deleted file mode 100644 index 1ab0e7a2..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +++ /dev/null @@ -1,11 +0,0 @@ -function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); -} -module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js b/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js deleted file mode 100644 index 904e1a7d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +++ /dev/null @@ -1,8 +0,0 @@ -function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - strings.raw = raw; - return strings; -} -module.exports = _taggedTemplateLiteralLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/tdz.js b/project starter code/node_modules/@babel/runtime/helpers/tdz.js deleted file mode 100644 index 0641c76d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/tdz.js +++ /dev/null @@ -1,4 +0,0 @@ -function _tdzError(name) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); -} -module.exports = _tdzError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js b/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js deleted file mode 100644 index a9be53d2..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js +++ /dev/null @@ -1,6 +0,0 @@ -var temporalUndefined = require("./temporalUndefined.js"); -var tdz = require("./tdz.js"); -function _temporalRef(val, name) { - return val === temporalUndefined ? tdz(name) : val; -} -module.exports = _temporalRef, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toArray.js b/project starter code/node_modules/@babel/runtime/helpers/toArray.js deleted file mode 100644 index 5c808c2e..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toArray.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); -var iterableToArray = require("./iterableToArray.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableRest = require("./nonIterableRest.js"); -function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); -} -module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js b/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js deleted file mode 100644 index 547c6c44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithoutHoles = require("./arrayWithoutHoles.js"); -var iterableToArray = require("./iterableToArray.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableSpread = require("./nonIterableSpread.js"); -function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} -module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js b/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js deleted file mode 100644 index adf63bb5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js +++ /dev/null @@ -1,12 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); -} -module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js b/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js deleted file mode 100644 index 320bb2b9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js +++ /dev/null @@ -1,7 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -var toPrimitive = require("./toPrimitive.js"); -function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); -} -module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/typeof.js b/project starter code/node_modules/@babel/runtime/helpers/typeof.js deleted file mode 100644 index aa88477c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/typeof.js +++ /dev/null @@ -1,10 +0,0 @@ -function _typeof(obj) { - "@babel/helpers - typeof"; - - return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj); -} -module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js deleted file mode 100644 index b7d18c6a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +++ /dev/null @@ -1,10 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} -module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js deleted file mode 100644 index a62dcf02..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +++ /dev/null @@ -1,7 +0,0 @@ -var AsyncGenerator = require("./AsyncGenerator.js"); -function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; -} -module.exports = _wrapAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js b/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js deleted file mode 100644 index b6ea60c6..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +++ /dev/null @@ -1,31 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); -var setPrototypeOf = require("./setPrototypeOf.js"); -var isNativeFunction = require("./isNativeFunction.js"); -var construct = require("./construct.js"); -function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - _cache.set(Class, Wrapper); - } - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _wrapNativeSuper(Class); -} -module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js b/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js deleted file mode 100644 index da710f83..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js +++ /dev/null @@ -1,51 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -var setPrototypeOf = require("./setPrototypeOf.js"); -var inherits = require("./inherits.js"); -function _wrapRegExp() { - module.exports = _wrapRegExp = function _wrapRegExp(re, groups) { - return new BabelRegExp(re, void 0, groups); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - var _super = RegExp.prototype, - _groups = new WeakMap(); - function BabelRegExp(re, flags, groups) { - var _this = new RegExp(re, flags); - return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype); - } - function buildGroups(result, re) { - var g = _groups.get(re); - return Object.keys(g).reduce(function (groups, name) { - var i = g[name]; - if ("number" == typeof i) groups[name] = result[i];else { - for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++; - groups[name] = result[i[k]]; - } - return groups; - }, Object.create(null)); - } - return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { - var result = _super.exec.call(this, str); - if (result) { - result.groups = buildGroups(result, this); - var indices = result.indices; - indices && (indices.groups = buildGroups(indices, this)); - } - return result; - }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { - if ("string" == typeof substitution) { - var groups = _groups.get(this); - return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { - var group = groups[name]; - return "$" + (Array.isArray(group) ? group.join("$") : group); - })); - } - if ("function" == typeof substitution) { - var _this = this; - return _super[Symbol.replace].call(this, str, function () { - var args = arguments; - return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); - }); - } - return _super[Symbol.replace].call(this, str, substitution); - }, _wrapRegExp.apply(this, arguments); -} -module.exports = _wrapRegExp, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js deleted file mode 100644 index c66c6f29..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js +++ /dev/null @@ -1,4 +0,0 @@ -function _writeOnlyError(name) { - throw new TypeError("\"" + name + "\" is write-only"); -} -module.exports = _writeOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/package.json b/project starter code/node_modules/@babel/runtime/package.json deleted file mode 100644 index 85b2cced..00000000 --- a/project starter code/node_modules/@babel/runtime/package.json +++ /dev/null @@ -1,912 +0,0 @@ -{ - "name": "@babel/runtime", - "version": "7.20.7", - "description": "babel's modular runtime helpers", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-runtime" - }, - "homepage": "https://babel.dev/docs/en/next/babel-runtime", - "author": "The Babel Team (https://babel.dev/team)", - "dependencies": { - "regenerator-runtime": "^0.13.11" - }, - "exports": { - "./helpers/AsyncGenerator": [ - { - "node": "./helpers/AsyncGenerator.js", - "import": "./helpers/esm/AsyncGenerator.js", - "default": "./helpers/AsyncGenerator.js" - }, - "./helpers/AsyncGenerator.js" - ], - "./helpers/esm/AsyncGenerator": "./helpers/esm/AsyncGenerator.js", - "./helpers/OverloadYield": [ - { - "node": "./helpers/OverloadYield.js", - "import": "./helpers/esm/OverloadYield.js", - "default": "./helpers/OverloadYield.js" - }, - "./helpers/OverloadYield.js" - ], - "./helpers/esm/OverloadYield": "./helpers/esm/OverloadYield.js", - "./helpers/applyDecs": [ - { - "node": "./helpers/applyDecs.js", - "import": "./helpers/esm/applyDecs.js", - "default": "./helpers/applyDecs.js" - }, - "./helpers/applyDecs.js" - ], - "./helpers/esm/applyDecs": "./helpers/esm/applyDecs.js", - "./helpers/applyDecs2203": [ - { - "node": "./helpers/applyDecs2203.js", - "import": "./helpers/esm/applyDecs2203.js", - "default": "./helpers/applyDecs2203.js" - }, - "./helpers/applyDecs2203.js" - ], - "./helpers/esm/applyDecs2203": "./helpers/esm/applyDecs2203.js", - "./helpers/asyncGeneratorDelegate": [ - { - "node": "./helpers/asyncGeneratorDelegate.js", - "import": "./helpers/esm/asyncGeneratorDelegate.js", - "default": "./helpers/asyncGeneratorDelegate.js" - }, - "./helpers/asyncGeneratorDelegate.js" - ], - "./helpers/esm/asyncGeneratorDelegate": "./helpers/esm/asyncGeneratorDelegate.js", - "./helpers/asyncIterator": [ - { - "node": "./helpers/asyncIterator.js", - "import": "./helpers/esm/asyncIterator.js", - "default": "./helpers/asyncIterator.js" - }, - "./helpers/asyncIterator.js" - ], - "./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js", - "./helpers/awaitAsyncGenerator": [ - { - "node": "./helpers/awaitAsyncGenerator.js", - "import": "./helpers/esm/awaitAsyncGenerator.js", - "default": "./helpers/awaitAsyncGenerator.js" - }, - "./helpers/awaitAsyncGenerator.js" - ], - "./helpers/esm/awaitAsyncGenerator": "./helpers/esm/awaitAsyncGenerator.js", - "./helpers/checkInRHS": [ - { - "node": "./helpers/checkInRHS.js", - "import": "./helpers/esm/checkInRHS.js", - "default": "./helpers/checkInRHS.js" - }, - "./helpers/checkInRHS.js" - ], - "./helpers/esm/checkInRHS": "./helpers/esm/checkInRHS.js", - "./helpers/defineAccessor": [ - { - "node": "./helpers/defineAccessor.js", - "import": "./helpers/esm/defineAccessor.js", - "default": "./helpers/defineAccessor.js" - }, - "./helpers/defineAccessor.js" - ], - "./helpers/esm/defineAccessor": "./helpers/esm/defineAccessor.js", - "./helpers/iterableToArrayLimit": [ - { - "node": "./helpers/iterableToArrayLimit.js", - "import": "./helpers/esm/iterableToArrayLimit.js", - "default": "./helpers/iterableToArrayLimit.js" - }, - "./helpers/iterableToArrayLimit.js" - ], - "./helpers/esm/iterableToArrayLimit": "./helpers/esm/iterableToArrayLimit.js", - "./helpers/iterableToArrayLimitLoose": [ - { - "node": "./helpers/iterableToArrayLimitLoose.js", - "import": "./helpers/esm/iterableToArrayLimitLoose.js", - "default": "./helpers/iterableToArrayLimitLoose.js" - }, - "./helpers/iterableToArrayLimitLoose.js" - ], - "./helpers/esm/iterableToArrayLimitLoose": "./helpers/esm/iterableToArrayLimitLoose.js", - "./helpers/jsx": [ - { - "node": "./helpers/jsx.js", - "import": "./helpers/esm/jsx.js", - "default": "./helpers/jsx.js" - }, - "./helpers/jsx.js" - ], - "./helpers/esm/jsx": "./helpers/esm/jsx.js", - "./helpers/objectSpread2": [ - { - "node": "./helpers/objectSpread2.js", - "import": "./helpers/esm/objectSpread2.js", - "default": "./helpers/objectSpread2.js" - }, - "./helpers/objectSpread2.js" - ], - "./helpers/esm/objectSpread2": "./helpers/esm/objectSpread2.js", - "./helpers/regeneratorRuntime": [ - { - "node": "./helpers/regeneratorRuntime.js", - "import": "./helpers/esm/regeneratorRuntime.js", - "default": "./helpers/regeneratorRuntime.js" - }, - "./helpers/regeneratorRuntime.js" - ], - "./helpers/esm/regeneratorRuntime": "./helpers/esm/regeneratorRuntime.js", - "./helpers/typeof": [ - { - "node": "./helpers/typeof.js", - "import": "./helpers/esm/typeof.js", - "default": "./helpers/typeof.js" - }, - "./helpers/typeof.js" - ], - "./helpers/esm/typeof": "./helpers/esm/typeof.js", - "./helpers/wrapRegExp": [ - { - "node": "./helpers/wrapRegExp.js", - "import": "./helpers/esm/wrapRegExp.js", - "default": "./helpers/wrapRegExp.js" - }, - "./helpers/wrapRegExp.js" - ], - "./helpers/esm/wrapRegExp": "./helpers/esm/wrapRegExp.js", - "./helpers/AwaitValue": [ - { - "node": "./helpers/AwaitValue.js", - "import": "./helpers/esm/AwaitValue.js", - "default": "./helpers/AwaitValue.js" - }, - "./helpers/AwaitValue.js" - ], - "./helpers/esm/AwaitValue": "./helpers/esm/AwaitValue.js", - "./helpers/wrapAsyncGenerator": [ - { - "node": "./helpers/wrapAsyncGenerator.js", - "import": "./helpers/esm/wrapAsyncGenerator.js", - "default": "./helpers/wrapAsyncGenerator.js" - }, - "./helpers/wrapAsyncGenerator.js" - ], - "./helpers/esm/wrapAsyncGenerator": "./helpers/esm/wrapAsyncGenerator.js", - "./helpers/asyncToGenerator": [ - { - "node": "./helpers/asyncToGenerator.js", - "import": "./helpers/esm/asyncToGenerator.js", - "default": "./helpers/asyncToGenerator.js" - }, - "./helpers/asyncToGenerator.js" - ], - "./helpers/esm/asyncToGenerator": "./helpers/esm/asyncToGenerator.js", - "./helpers/classCallCheck": [ - { - "node": "./helpers/classCallCheck.js", - "import": "./helpers/esm/classCallCheck.js", - "default": "./helpers/classCallCheck.js" - }, - "./helpers/classCallCheck.js" - ], - "./helpers/esm/classCallCheck": "./helpers/esm/classCallCheck.js", - "./helpers/createClass": [ - { - "node": "./helpers/createClass.js", - "import": "./helpers/esm/createClass.js", - "default": "./helpers/createClass.js" - }, - "./helpers/createClass.js" - ], - "./helpers/esm/createClass": "./helpers/esm/createClass.js", - "./helpers/defineEnumerableProperties": [ - { - "node": "./helpers/defineEnumerableProperties.js", - "import": "./helpers/esm/defineEnumerableProperties.js", - "default": "./helpers/defineEnumerableProperties.js" - }, - "./helpers/defineEnumerableProperties.js" - ], - "./helpers/esm/defineEnumerableProperties": "./helpers/esm/defineEnumerableProperties.js", - "./helpers/defaults": [ - { - "node": "./helpers/defaults.js", - "import": "./helpers/esm/defaults.js", - "default": "./helpers/defaults.js" - }, - "./helpers/defaults.js" - ], - "./helpers/esm/defaults": "./helpers/esm/defaults.js", - "./helpers/defineProperty": [ - { - "node": "./helpers/defineProperty.js", - "import": "./helpers/esm/defineProperty.js", - "default": "./helpers/defineProperty.js" - }, - "./helpers/defineProperty.js" - ], - "./helpers/esm/defineProperty": "./helpers/esm/defineProperty.js", - "./helpers/extends": [ - { - "node": "./helpers/extends.js", - "import": "./helpers/esm/extends.js", - "default": "./helpers/extends.js" - }, - "./helpers/extends.js" - ], - "./helpers/esm/extends": "./helpers/esm/extends.js", - "./helpers/objectSpread": [ - { - "node": "./helpers/objectSpread.js", - "import": "./helpers/esm/objectSpread.js", - "default": "./helpers/objectSpread.js" - }, - "./helpers/objectSpread.js" - ], - "./helpers/esm/objectSpread": "./helpers/esm/objectSpread.js", - "./helpers/inherits": [ - { - "node": "./helpers/inherits.js", - "import": "./helpers/esm/inherits.js", - "default": "./helpers/inherits.js" - }, - "./helpers/inherits.js" - ], - "./helpers/esm/inherits": "./helpers/esm/inherits.js", - "./helpers/inheritsLoose": [ - { - "node": "./helpers/inheritsLoose.js", - "import": "./helpers/esm/inheritsLoose.js", - "default": "./helpers/inheritsLoose.js" - }, - "./helpers/inheritsLoose.js" - ], - "./helpers/esm/inheritsLoose": "./helpers/esm/inheritsLoose.js", - "./helpers/getPrototypeOf": [ - { - "node": "./helpers/getPrototypeOf.js", - "import": "./helpers/esm/getPrototypeOf.js", - "default": "./helpers/getPrototypeOf.js" - }, - "./helpers/getPrototypeOf.js" - ], - "./helpers/esm/getPrototypeOf": "./helpers/esm/getPrototypeOf.js", - "./helpers/setPrototypeOf": [ - { - "node": "./helpers/setPrototypeOf.js", - "import": "./helpers/esm/setPrototypeOf.js", - "default": "./helpers/setPrototypeOf.js" - }, - "./helpers/setPrototypeOf.js" - ], - "./helpers/esm/setPrototypeOf": "./helpers/esm/setPrototypeOf.js", - "./helpers/isNativeReflectConstruct": [ - { - "node": "./helpers/isNativeReflectConstruct.js", - "import": "./helpers/esm/isNativeReflectConstruct.js", - "default": "./helpers/isNativeReflectConstruct.js" - }, - "./helpers/isNativeReflectConstruct.js" - ], - "./helpers/esm/isNativeReflectConstruct": "./helpers/esm/isNativeReflectConstruct.js", - "./helpers/construct": [ - { - "node": "./helpers/construct.js", - "import": "./helpers/esm/construct.js", - "default": "./helpers/construct.js" - }, - "./helpers/construct.js" - ], - "./helpers/esm/construct": "./helpers/esm/construct.js", - "./helpers/isNativeFunction": [ - { - "node": "./helpers/isNativeFunction.js", - "import": "./helpers/esm/isNativeFunction.js", - "default": "./helpers/isNativeFunction.js" - }, - "./helpers/isNativeFunction.js" - ], - "./helpers/esm/isNativeFunction": "./helpers/esm/isNativeFunction.js", - "./helpers/wrapNativeSuper": [ - { - "node": "./helpers/wrapNativeSuper.js", - "import": "./helpers/esm/wrapNativeSuper.js", - "default": "./helpers/wrapNativeSuper.js" - }, - "./helpers/wrapNativeSuper.js" - ], - "./helpers/esm/wrapNativeSuper": "./helpers/esm/wrapNativeSuper.js", - "./helpers/instanceof": [ - { - "node": "./helpers/instanceof.js", - "import": "./helpers/esm/instanceof.js", - "default": "./helpers/instanceof.js" - }, - "./helpers/instanceof.js" - ], - "./helpers/esm/instanceof": "./helpers/esm/instanceof.js", - "./helpers/interopRequireDefault": [ - { - "node": "./helpers/interopRequireDefault.js", - "import": "./helpers/esm/interopRequireDefault.js", - "default": "./helpers/interopRequireDefault.js" - }, - "./helpers/interopRequireDefault.js" - ], - "./helpers/esm/interopRequireDefault": "./helpers/esm/interopRequireDefault.js", - "./helpers/interopRequireWildcard": [ - { - "node": "./helpers/interopRequireWildcard.js", - "import": "./helpers/esm/interopRequireWildcard.js", - "default": "./helpers/interopRequireWildcard.js" - }, - "./helpers/interopRequireWildcard.js" - ], - "./helpers/esm/interopRequireWildcard": "./helpers/esm/interopRequireWildcard.js", - "./helpers/newArrowCheck": [ - { - "node": "./helpers/newArrowCheck.js", - "import": "./helpers/esm/newArrowCheck.js", - "default": "./helpers/newArrowCheck.js" - }, - "./helpers/newArrowCheck.js" - ], - "./helpers/esm/newArrowCheck": "./helpers/esm/newArrowCheck.js", - "./helpers/objectDestructuringEmpty": [ - { - "node": "./helpers/objectDestructuringEmpty.js", - "import": "./helpers/esm/objectDestructuringEmpty.js", - "default": "./helpers/objectDestructuringEmpty.js" - }, - "./helpers/objectDestructuringEmpty.js" - ], - "./helpers/esm/objectDestructuringEmpty": "./helpers/esm/objectDestructuringEmpty.js", - "./helpers/objectWithoutPropertiesLoose": [ - { - "node": "./helpers/objectWithoutPropertiesLoose.js", - "import": "./helpers/esm/objectWithoutPropertiesLoose.js", - "default": "./helpers/objectWithoutPropertiesLoose.js" - }, - "./helpers/objectWithoutPropertiesLoose.js" - ], - "./helpers/esm/objectWithoutPropertiesLoose": "./helpers/esm/objectWithoutPropertiesLoose.js", - "./helpers/objectWithoutProperties": [ - { - "node": "./helpers/objectWithoutProperties.js", - "import": "./helpers/esm/objectWithoutProperties.js", - "default": "./helpers/objectWithoutProperties.js" - }, - "./helpers/objectWithoutProperties.js" - ], - "./helpers/esm/objectWithoutProperties": "./helpers/esm/objectWithoutProperties.js", - "./helpers/assertThisInitialized": [ - { - "node": "./helpers/assertThisInitialized.js", - "import": "./helpers/esm/assertThisInitialized.js", - "default": "./helpers/assertThisInitialized.js" - }, - "./helpers/assertThisInitialized.js" - ], - "./helpers/esm/assertThisInitialized": "./helpers/esm/assertThisInitialized.js", - "./helpers/possibleConstructorReturn": [ - { - "node": "./helpers/possibleConstructorReturn.js", - "import": "./helpers/esm/possibleConstructorReturn.js", - "default": "./helpers/possibleConstructorReturn.js" - }, - "./helpers/possibleConstructorReturn.js" - ], - "./helpers/esm/possibleConstructorReturn": "./helpers/esm/possibleConstructorReturn.js", - "./helpers/createSuper": [ - { - "node": "./helpers/createSuper.js", - "import": "./helpers/esm/createSuper.js", - "default": "./helpers/createSuper.js" - }, - "./helpers/createSuper.js" - ], - "./helpers/esm/createSuper": "./helpers/esm/createSuper.js", - "./helpers/superPropBase": [ - { - "node": "./helpers/superPropBase.js", - "import": "./helpers/esm/superPropBase.js", - "default": "./helpers/superPropBase.js" - }, - "./helpers/superPropBase.js" - ], - "./helpers/esm/superPropBase": "./helpers/esm/superPropBase.js", - "./helpers/get": [ - { - "node": "./helpers/get.js", - "import": "./helpers/esm/get.js", - "default": "./helpers/get.js" - }, - "./helpers/get.js" - ], - "./helpers/esm/get": "./helpers/esm/get.js", - "./helpers/set": [ - { - "node": "./helpers/set.js", - "import": "./helpers/esm/set.js", - "default": "./helpers/set.js" - }, - "./helpers/set.js" - ], - "./helpers/esm/set": "./helpers/esm/set.js", - "./helpers/taggedTemplateLiteral": [ - { - "node": "./helpers/taggedTemplateLiteral.js", - "import": "./helpers/esm/taggedTemplateLiteral.js", - "default": "./helpers/taggedTemplateLiteral.js" - }, - "./helpers/taggedTemplateLiteral.js" - ], - "./helpers/esm/taggedTemplateLiteral": "./helpers/esm/taggedTemplateLiteral.js", - "./helpers/taggedTemplateLiteralLoose": [ - { - "node": "./helpers/taggedTemplateLiteralLoose.js", - "import": "./helpers/esm/taggedTemplateLiteralLoose.js", - "default": "./helpers/taggedTemplateLiteralLoose.js" - }, - "./helpers/taggedTemplateLiteralLoose.js" - ], - "./helpers/esm/taggedTemplateLiteralLoose": "./helpers/esm/taggedTemplateLiteralLoose.js", - "./helpers/readOnlyError": [ - { - "node": "./helpers/readOnlyError.js", - "import": "./helpers/esm/readOnlyError.js", - "default": "./helpers/readOnlyError.js" - }, - "./helpers/readOnlyError.js" - ], - "./helpers/esm/readOnlyError": "./helpers/esm/readOnlyError.js", - "./helpers/writeOnlyError": [ - { - "node": "./helpers/writeOnlyError.js", - "import": "./helpers/esm/writeOnlyError.js", - "default": "./helpers/writeOnlyError.js" - }, - "./helpers/writeOnlyError.js" - ], - "./helpers/esm/writeOnlyError": "./helpers/esm/writeOnlyError.js", - "./helpers/classNameTDZError": [ - { - "node": "./helpers/classNameTDZError.js", - "import": "./helpers/esm/classNameTDZError.js", - "default": "./helpers/classNameTDZError.js" - }, - "./helpers/classNameTDZError.js" - ], - "./helpers/esm/classNameTDZError": "./helpers/esm/classNameTDZError.js", - "./helpers/temporalUndefined": [ - { - "node": "./helpers/temporalUndefined.js", - "import": "./helpers/esm/temporalUndefined.js", - "default": "./helpers/temporalUndefined.js" - }, - "./helpers/temporalUndefined.js" - ], - "./helpers/esm/temporalUndefined": "./helpers/esm/temporalUndefined.js", - "./helpers/tdz": [ - { - "node": "./helpers/tdz.js", - "import": "./helpers/esm/tdz.js", - "default": "./helpers/tdz.js" - }, - "./helpers/tdz.js" - ], - "./helpers/esm/tdz": "./helpers/esm/tdz.js", - "./helpers/temporalRef": [ - { - "node": "./helpers/temporalRef.js", - "import": "./helpers/esm/temporalRef.js", - "default": "./helpers/temporalRef.js" - }, - "./helpers/temporalRef.js" - ], - "./helpers/esm/temporalRef": "./helpers/esm/temporalRef.js", - "./helpers/slicedToArray": [ - { - "node": "./helpers/slicedToArray.js", - "import": "./helpers/esm/slicedToArray.js", - "default": "./helpers/slicedToArray.js" - }, - "./helpers/slicedToArray.js" - ], - "./helpers/esm/slicedToArray": "./helpers/esm/slicedToArray.js", - "./helpers/slicedToArrayLoose": [ - { - "node": "./helpers/slicedToArrayLoose.js", - "import": "./helpers/esm/slicedToArrayLoose.js", - "default": "./helpers/slicedToArrayLoose.js" - }, - "./helpers/slicedToArrayLoose.js" - ], - "./helpers/esm/slicedToArrayLoose": "./helpers/esm/slicedToArrayLoose.js", - "./helpers/toArray": [ - { - "node": "./helpers/toArray.js", - "import": "./helpers/esm/toArray.js", - "default": "./helpers/toArray.js" - }, - "./helpers/toArray.js" - ], - "./helpers/esm/toArray": "./helpers/esm/toArray.js", - "./helpers/toConsumableArray": [ - { - "node": "./helpers/toConsumableArray.js", - "import": "./helpers/esm/toConsumableArray.js", - "default": "./helpers/toConsumableArray.js" - }, - "./helpers/toConsumableArray.js" - ], - "./helpers/esm/toConsumableArray": "./helpers/esm/toConsumableArray.js", - "./helpers/arrayWithoutHoles": [ - { - "node": "./helpers/arrayWithoutHoles.js", - "import": "./helpers/esm/arrayWithoutHoles.js", - "default": "./helpers/arrayWithoutHoles.js" - }, - "./helpers/arrayWithoutHoles.js" - ], - "./helpers/esm/arrayWithoutHoles": "./helpers/esm/arrayWithoutHoles.js", - "./helpers/arrayWithHoles": [ - { - "node": "./helpers/arrayWithHoles.js", - "import": "./helpers/esm/arrayWithHoles.js", - "default": "./helpers/arrayWithHoles.js" - }, - "./helpers/arrayWithHoles.js" - ], - "./helpers/esm/arrayWithHoles": "./helpers/esm/arrayWithHoles.js", - "./helpers/maybeArrayLike": [ - { - "node": "./helpers/maybeArrayLike.js", - "import": "./helpers/esm/maybeArrayLike.js", - "default": "./helpers/maybeArrayLike.js" - }, - "./helpers/maybeArrayLike.js" - ], - "./helpers/esm/maybeArrayLike": "./helpers/esm/maybeArrayLike.js", - "./helpers/iterableToArray": [ - { - "node": "./helpers/iterableToArray.js", - "import": "./helpers/esm/iterableToArray.js", - "default": "./helpers/iterableToArray.js" - }, - "./helpers/iterableToArray.js" - ], - "./helpers/esm/iterableToArray": "./helpers/esm/iterableToArray.js", - "./helpers/unsupportedIterableToArray": [ - { - "node": "./helpers/unsupportedIterableToArray.js", - "import": "./helpers/esm/unsupportedIterableToArray.js", - "default": "./helpers/unsupportedIterableToArray.js" - }, - "./helpers/unsupportedIterableToArray.js" - ], - "./helpers/esm/unsupportedIterableToArray": "./helpers/esm/unsupportedIterableToArray.js", - "./helpers/arrayLikeToArray": [ - { - "node": "./helpers/arrayLikeToArray.js", - "import": "./helpers/esm/arrayLikeToArray.js", - "default": "./helpers/arrayLikeToArray.js" - }, - "./helpers/arrayLikeToArray.js" - ], - "./helpers/esm/arrayLikeToArray": "./helpers/esm/arrayLikeToArray.js", - "./helpers/nonIterableSpread": [ - { - "node": "./helpers/nonIterableSpread.js", - "import": "./helpers/esm/nonIterableSpread.js", - "default": "./helpers/nonIterableSpread.js" - }, - "./helpers/nonIterableSpread.js" - ], - "./helpers/esm/nonIterableSpread": "./helpers/esm/nonIterableSpread.js", - "./helpers/nonIterableRest": [ - { - "node": "./helpers/nonIterableRest.js", - "import": "./helpers/esm/nonIterableRest.js", - "default": "./helpers/nonIterableRest.js" - }, - "./helpers/nonIterableRest.js" - ], - "./helpers/esm/nonIterableRest": "./helpers/esm/nonIterableRest.js", - "./helpers/createForOfIteratorHelper": [ - { - "node": "./helpers/createForOfIteratorHelper.js", - "import": "./helpers/esm/createForOfIteratorHelper.js", - "default": "./helpers/createForOfIteratorHelper.js" - }, - "./helpers/createForOfIteratorHelper.js" - ], - "./helpers/esm/createForOfIteratorHelper": "./helpers/esm/createForOfIteratorHelper.js", - "./helpers/createForOfIteratorHelperLoose": [ - { - "node": "./helpers/createForOfIteratorHelperLoose.js", - "import": "./helpers/esm/createForOfIteratorHelperLoose.js", - "default": "./helpers/createForOfIteratorHelperLoose.js" - }, - "./helpers/createForOfIteratorHelperLoose.js" - ], - "./helpers/esm/createForOfIteratorHelperLoose": "./helpers/esm/createForOfIteratorHelperLoose.js", - "./helpers/skipFirstGeneratorNext": [ - { - "node": "./helpers/skipFirstGeneratorNext.js", - "import": "./helpers/esm/skipFirstGeneratorNext.js", - "default": "./helpers/skipFirstGeneratorNext.js" - }, - "./helpers/skipFirstGeneratorNext.js" - ], - "./helpers/esm/skipFirstGeneratorNext": "./helpers/esm/skipFirstGeneratorNext.js", - "./helpers/toPrimitive": [ - { - "node": "./helpers/toPrimitive.js", - "import": "./helpers/esm/toPrimitive.js", - "default": "./helpers/toPrimitive.js" - }, - "./helpers/toPrimitive.js" - ], - "./helpers/esm/toPrimitive": "./helpers/esm/toPrimitive.js", - "./helpers/toPropertyKey": [ - { - "node": "./helpers/toPropertyKey.js", - "import": "./helpers/esm/toPropertyKey.js", - "default": "./helpers/toPropertyKey.js" - }, - "./helpers/toPropertyKey.js" - ], - "./helpers/esm/toPropertyKey": "./helpers/esm/toPropertyKey.js", - "./helpers/initializerWarningHelper": [ - { - "node": "./helpers/initializerWarningHelper.js", - "import": "./helpers/esm/initializerWarningHelper.js", - "default": "./helpers/initializerWarningHelper.js" - }, - "./helpers/initializerWarningHelper.js" - ], - "./helpers/esm/initializerWarningHelper": "./helpers/esm/initializerWarningHelper.js", - "./helpers/initializerDefineProperty": [ - { - "node": "./helpers/initializerDefineProperty.js", - "import": "./helpers/esm/initializerDefineProperty.js", - "default": "./helpers/initializerDefineProperty.js" - }, - "./helpers/initializerDefineProperty.js" - ], - "./helpers/esm/initializerDefineProperty": "./helpers/esm/initializerDefineProperty.js", - "./helpers/applyDecoratedDescriptor": [ - { - "node": "./helpers/applyDecoratedDescriptor.js", - "import": "./helpers/esm/applyDecoratedDescriptor.js", - "default": "./helpers/applyDecoratedDescriptor.js" - }, - "./helpers/applyDecoratedDescriptor.js" - ], - "./helpers/esm/applyDecoratedDescriptor": "./helpers/esm/applyDecoratedDescriptor.js", - "./helpers/classPrivateFieldLooseKey": [ - { - "node": "./helpers/classPrivateFieldLooseKey.js", - "import": "./helpers/esm/classPrivateFieldLooseKey.js", - "default": "./helpers/classPrivateFieldLooseKey.js" - }, - "./helpers/classPrivateFieldLooseKey.js" - ], - "./helpers/esm/classPrivateFieldLooseKey": "./helpers/esm/classPrivateFieldLooseKey.js", - "./helpers/classPrivateFieldLooseBase": [ - { - "node": "./helpers/classPrivateFieldLooseBase.js", - "import": "./helpers/esm/classPrivateFieldLooseBase.js", - "default": "./helpers/classPrivateFieldLooseBase.js" - }, - "./helpers/classPrivateFieldLooseBase.js" - ], - "./helpers/esm/classPrivateFieldLooseBase": "./helpers/esm/classPrivateFieldLooseBase.js", - "./helpers/classPrivateFieldGet": [ - { - "node": "./helpers/classPrivateFieldGet.js", - "import": "./helpers/esm/classPrivateFieldGet.js", - "default": "./helpers/classPrivateFieldGet.js" - }, - "./helpers/classPrivateFieldGet.js" - ], - "./helpers/esm/classPrivateFieldGet": "./helpers/esm/classPrivateFieldGet.js", - "./helpers/classPrivateFieldSet": [ - { - "node": "./helpers/classPrivateFieldSet.js", - "import": "./helpers/esm/classPrivateFieldSet.js", - "default": "./helpers/classPrivateFieldSet.js" - }, - "./helpers/classPrivateFieldSet.js" - ], - "./helpers/esm/classPrivateFieldSet": "./helpers/esm/classPrivateFieldSet.js", - "./helpers/classPrivateFieldDestructureSet": [ - { - "node": "./helpers/classPrivateFieldDestructureSet.js", - "import": "./helpers/esm/classPrivateFieldDestructureSet.js", - "default": "./helpers/classPrivateFieldDestructureSet.js" - }, - "./helpers/classPrivateFieldDestructureSet.js" - ], - "./helpers/esm/classPrivateFieldDestructureSet": "./helpers/esm/classPrivateFieldDestructureSet.js", - "./helpers/classExtractFieldDescriptor": [ - { - "node": "./helpers/classExtractFieldDescriptor.js", - "import": "./helpers/esm/classExtractFieldDescriptor.js", - "default": "./helpers/classExtractFieldDescriptor.js" - }, - "./helpers/classExtractFieldDescriptor.js" - ], - "./helpers/esm/classExtractFieldDescriptor": "./helpers/esm/classExtractFieldDescriptor.js", - "./helpers/classStaticPrivateFieldSpecGet": [ - { - "node": "./helpers/classStaticPrivateFieldSpecGet.js", - "import": "./helpers/esm/classStaticPrivateFieldSpecGet.js", - "default": "./helpers/classStaticPrivateFieldSpecGet.js" - }, - "./helpers/classStaticPrivateFieldSpecGet.js" - ], - "./helpers/esm/classStaticPrivateFieldSpecGet": "./helpers/esm/classStaticPrivateFieldSpecGet.js", - "./helpers/classStaticPrivateFieldSpecSet": [ - { - "node": "./helpers/classStaticPrivateFieldSpecSet.js", - "import": "./helpers/esm/classStaticPrivateFieldSpecSet.js", - "default": "./helpers/classStaticPrivateFieldSpecSet.js" - }, - "./helpers/classStaticPrivateFieldSpecSet.js" - ], - "./helpers/esm/classStaticPrivateFieldSpecSet": "./helpers/esm/classStaticPrivateFieldSpecSet.js", - "./helpers/classStaticPrivateMethodGet": [ - { - "node": "./helpers/classStaticPrivateMethodGet.js", - "import": "./helpers/esm/classStaticPrivateMethodGet.js", - "default": "./helpers/classStaticPrivateMethodGet.js" - }, - "./helpers/classStaticPrivateMethodGet.js" - ], - "./helpers/esm/classStaticPrivateMethodGet": "./helpers/esm/classStaticPrivateMethodGet.js", - "./helpers/classStaticPrivateMethodSet": [ - { - "node": "./helpers/classStaticPrivateMethodSet.js", - "import": "./helpers/esm/classStaticPrivateMethodSet.js", - "default": "./helpers/classStaticPrivateMethodSet.js" - }, - "./helpers/classStaticPrivateMethodSet.js" - ], - "./helpers/esm/classStaticPrivateMethodSet": "./helpers/esm/classStaticPrivateMethodSet.js", - "./helpers/classApplyDescriptorGet": [ - { - "node": "./helpers/classApplyDescriptorGet.js", - "import": "./helpers/esm/classApplyDescriptorGet.js", - "default": "./helpers/classApplyDescriptorGet.js" - }, - "./helpers/classApplyDescriptorGet.js" - ], - "./helpers/esm/classApplyDescriptorGet": "./helpers/esm/classApplyDescriptorGet.js", - "./helpers/classApplyDescriptorSet": [ - { - "node": "./helpers/classApplyDescriptorSet.js", - "import": "./helpers/esm/classApplyDescriptorSet.js", - "default": "./helpers/classApplyDescriptorSet.js" - }, - "./helpers/classApplyDescriptorSet.js" - ], - "./helpers/esm/classApplyDescriptorSet": "./helpers/esm/classApplyDescriptorSet.js", - "./helpers/classApplyDescriptorDestructureSet": [ - { - "node": "./helpers/classApplyDescriptorDestructureSet.js", - "import": "./helpers/esm/classApplyDescriptorDestructureSet.js", - "default": "./helpers/classApplyDescriptorDestructureSet.js" - }, - "./helpers/classApplyDescriptorDestructureSet.js" - ], - "./helpers/esm/classApplyDescriptorDestructureSet": "./helpers/esm/classApplyDescriptorDestructureSet.js", - "./helpers/classStaticPrivateFieldDestructureSet": [ - { - "node": "./helpers/classStaticPrivateFieldDestructureSet.js", - "import": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", - "default": "./helpers/classStaticPrivateFieldDestructureSet.js" - }, - "./helpers/classStaticPrivateFieldDestructureSet.js" - ], - "./helpers/esm/classStaticPrivateFieldDestructureSet": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", - "./helpers/classCheckPrivateStaticAccess": [ - { - "node": "./helpers/classCheckPrivateStaticAccess.js", - "import": "./helpers/esm/classCheckPrivateStaticAccess.js", - "default": "./helpers/classCheckPrivateStaticAccess.js" - }, - "./helpers/classCheckPrivateStaticAccess.js" - ], - "./helpers/esm/classCheckPrivateStaticAccess": "./helpers/esm/classCheckPrivateStaticAccess.js", - "./helpers/classCheckPrivateStaticFieldDescriptor": [ - { - "node": "./helpers/classCheckPrivateStaticFieldDescriptor.js", - "import": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", - "default": "./helpers/classCheckPrivateStaticFieldDescriptor.js" - }, - "./helpers/classCheckPrivateStaticFieldDescriptor.js" - ], - "./helpers/esm/classCheckPrivateStaticFieldDescriptor": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", - "./helpers/decorate": [ - { - "node": "./helpers/decorate.js", - "import": "./helpers/esm/decorate.js", - "default": "./helpers/decorate.js" - }, - "./helpers/decorate.js" - ], - "./helpers/esm/decorate": "./helpers/esm/decorate.js", - "./helpers/classPrivateMethodGet": [ - { - "node": "./helpers/classPrivateMethodGet.js", - "import": "./helpers/esm/classPrivateMethodGet.js", - "default": "./helpers/classPrivateMethodGet.js" - }, - "./helpers/classPrivateMethodGet.js" - ], - "./helpers/esm/classPrivateMethodGet": "./helpers/esm/classPrivateMethodGet.js", - "./helpers/checkPrivateRedeclaration": [ - { - "node": "./helpers/checkPrivateRedeclaration.js", - "import": "./helpers/esm/checkPrivateRedeclaration.js", - "default": "./helpers/checkPrivateRedeclaration.js" - }, - "./helpers/checkPrivateRedeclaration.js" - ], - "./helpers/esm/checkPrivateRedeclaration": "./helpers/esm/checkPrivateRedeclaration.js", - "./helpers/classPrivateFieldInitSpec": [ - { - "node": "./helpers/classPrivateFieldInitSpec.js", - "import": "./helpers/esm/classPrivateFieldInitSpec.js", - "default": "./helpers/classPrivateFieldInitSpec.js" - }, - "./helpers/classPrivateFieldInitSpec.js" - ], - "./helpers/esm/classPrivateFieldInitSpec": "./helpers/esm/classPrivateFieldInitSpec.js", - "./helpers/classPrivateMethodInitSpec": [ - { - "node": "./helpers/classPrivateMethodInitSpec.js", - "import": "./helpers/esm/classPrivateMethodInitSpec.js", - "default": "./helpers/classPrivateMethodInitSpec.js" - }, - "./helpers/classPrivateMethodInitSpec.js" - ], - "./helpers/esm/classPrivateMethodInitSpec": "./helpers/esm/classPrivateMethodInitSpec.js", - "./helpers/classPrivateMethodSet": [ - { - "node": "./helpers/classPrivateMethodSet.js", - "import": "./helpers/esm/classPrivateMethodSet.js", - "default": "./helpers/classPrivateMethodSet.js" - }, - "./helpers/classPrivateMethodSet.js" - ], - "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", - "./helpers/identity": [ - { - "node": "./helpers/identity.js", - "import": "./helpers/esm/identity.js", - "default": "./helpers/identity.js" - }, - "./helpers/identity.js" - ], - "./helpers/esm/identity": "./helpers/esm/identity.js", - "./package": "./package.json", - "./package.json": "./package.json", - "./regenerator": "./regenerator/index.js", - "./regenerator/*.js": "./regenerator/*.js", - "./regenerator/": "./regenerator/" - }, - "engines": { - "node": ">=6.9.0" - }, - "type": "commonjs" -} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/CHANGELOG.md b/project starter code/node_modules/@jimp/bmp/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/bmp/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/dist/index.js b/project starter code/node_modules/@jimp/bmp/dist/index.js deleted file mode 100644 index 977f85d0..00000000 --- a/project starter code/node_modules/@jimp/bmp/dist/index.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _bmpJs = _interopRequireDefault(require("bmp-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/bmp'; -var MIME_TYPE_SECOND = 'image/x-ms-bmp'; - -function toAGBR(image) { - return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { - var red = this.bitmap.data[index + 0]; - var green = this.bitmap.data[index + 1]; - var blue = this.bitmap.data[index + 2]; - var alpha = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = alpha; - this.bitmap.data[index + 1] = blue; - this.bitmap.data[index + 2] = green; - this.bitmap.data[index + 3] = red; - }).bitmap; -} - -function fromAGBR(bitmap) { - return (0, _utils.scan)({ - bitmap: bitmap - }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { - var alpha = this.bitmap.data[index + 0]; - var blue = this.bitmap.data[index + 1]; - var green = this.bitmap.data[index + 2]; - var red = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = red; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; - }).bitmap; -} - -var decode = function decode(data) { - return fromAGBR(_bmpJs["default"].decode(data)); -}; - -var encode = function encode(image) { - return _bmpJs["default"].encode(toAGBR(image)).data; -}; - -var _default = function _default() { - var _decoders, _encoders; - - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']), - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), - encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/dist/index.js.map b/project starter code/node_modules/@jimp/bmp/dist/index.js.map deleted file mode 100644 index ea487cba..00000000 --- a/project starter code/node_modules/@jimp/bmp/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBAAKA,KAAL,EAAY,CAAZ,EAAe,CAAf,EAAkBA,KAAK,CAACC,MAAN,CAAaC,KAA/B,EAAsCF,KAAK,CAACC,MAAN,CAAaE,MAAnD,EAA2D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toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/es/index.js b/project starter code/node_modules/@jimp/bmp/es/index.js deleted file mode 100644 index ca54f0f3..00000000 --- a/project starter code/node_modules/@jimp/bmp/es/index.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _bmpJs = _interopRequireDefault(require("bmp-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/bmp'; -var MIME_TYPE_SECOND = 'image/x-ms-bmp'; - -function toAGBR(image) { - return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { - var red = this.bitmap.data[index + 0]; - var green = this.bitmap.data[index + 1]; - var blue = this.bitmap.data[index + 2]; - var alpha = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = alpha; - this.bitmap.data[index + 1] = blue; - this.bitmap.data[index + 2] = green; - this.bitmap.data[index + 3] = red; - }).bitmap; -} - -function fromAGBR(bitmap) { - return (0, _utils.scan)({ - bitmap: bitmap - }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { - var alpha = this.bitmap.data[index + 0]; - var blue = this.bitmap.data[index + 1]; - var green = this.bitmap.data[index + 2]; - var red = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = red; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; - }).bitmap; -} - -var decode = function decode(data) { - return fromAGBR(_bmpJs["default"].decode(data)); -}; - -var encode = function encode(image) { - return _bmpJs["default"].encode(toAGBR(image)).data; -}; - -var _default = function _default() { - var _decoders, _encoders; - - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']), - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), - encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/es/index.js.map b/project starter code/node_modules/@jimp/bmp/es/index.js.map deleted file mode 100644 index ea487cba..00000000 --- a/project starter code/node_modules/@jimp/bmp/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBAAKA,KAAL,EAAY,CAAZ,EAAe,CAAf,EAAkBA,KAAK,CAACC,MAAN,CAAaC,KAA/B,EAAsCF,KAAK,CAACC,MAAN,CAAaE,MAAnD,EAA2D,UAChEC,CADgE,EAEhEC,CAFgE,EAGhEC,KAHgE,EAIhE;AACA,QAAMC,GAAG,GAAG,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAZ;AACA,QAAMG,KAAK,GAAG,KAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AACA,QAAMI,IAAI,GAAG,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAb;AACA,QAAMK,KAAK,GAAG,KAAKV,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AAEA,SAAKL,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BK,KAA9B;AACA,SAAKV,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BI,IAA9B;AACA,SAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BG,KAA9B;AACA,SAAKR,MAAL,CAAYO,IAAZ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BAAIC,MAAJ,CAAWjB,MAAM,CAACC,KAAD,CAAjB,EAA0BQ,IAA9B;AAAA,CAApB;;eAEe;AAAA;;AAAA,SAAO;AACpBS,IAAAA,IAAI,uCAAKpB,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBqB,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEtB,SADD;AAETuB,MAAAA,aAAa,EAAEtB;AAFN,KAHS;AAQpBuB,IAAAA,QAAQ,+DACLxB,SADK,EACOiB,MADP,+CAELhB,gBAFK,EAEcgB,MAFd,aARY;AAapBQ,IAAAA,QAAQ,+DACLzB,SADK,EACOmB,MADP,+CAELlB,gBAFK,EAEckB,MAFd;AAbY,GAAP;AAAA,C","sourcesContent":["import BMP from 'bmp-js';\nimport { scan } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/bmp';\nconst MIME_TYPE_SECOND = 'image/x-ms-bmp';\n\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/index.d.ts b/project starter code/node_modules/@jimp/bmp/index.d.ts deleted file mode 100644 index bbb9baec..00000000 --- a/project starter code/node_modules/@jimp/bmp/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { DecoderFn, EncoderFn } from '@jimp/core'; - -interface Bmp { - constants: { - MIME_BMP: 'image/bmp'; - MIME_X_MS_BMP: 'image/x-ms-bmp'; - } - - mime: { - 'image/bmp': string[] - } - - decoders: { - 'image/bmp': DecoderFn - 'image/x-ms-bmp': DecoderFn - } - - encoders: { - 'image/bmp': EncoderFn - 'image/x-ms-bmp': EncoderFn - } -} - -export default function(): Bmp; diff --git a/project starter code/node_modules/@jimp/bmp/package.json b/project starter code/node_modules/@jimp/bmp/package.json deleted file mode 100644 index 4d3bc24c..00000000 --- a/project starter code/node_modules/@jimp/bmp/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jimp/bmp", - "version": "0.16.2", - "description": "Default Jimp bmp encoder/decoder.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "bmp-js": "^0.1.0" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/bmp/src/index.js b/project starter code/node_modules/@jimp/bmp/src/index.js deleted file mode 100644 index 897da77a..00000000 --- a/project starter code/node_modules/@jimp/bmp/src/index.js +++ /dev/null @@ -1,63 +0,0 @@ -import BMP from 'bmp-js'; -import { scan } from '@jimp/utils'; - -const MIME_TYPE = 'image/bmp'; -const MIME_TYPE_SECOND = 'image/x-ms-bmp'; - -function toAGBR(image) { - return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function( - x, - y, - index - ) { - const red = this.bitmap.data[index + 0]; - const green = this.bitmap.data[index + 1]; - const blue = this.bitmap.data[index + 2]; - const alpha = this.bitmap.data[index + 3]; - - this.bitmap.data[index + 0] = alpha; - this.bitmap.data[index + 1] = blue; - this.bitmap.data[index + 2] = green; - this.bitmap.data[index + 3] = red; - }).bitmap; -} - -function fromAGBR(bitmap) { - return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function( - x, - y, - index - ) { - const alpha = this.bitmap.data[index + 0]; - const blue = this.bitmap.data[index + 1]; - const green = this.bitmap.data[index + 2]; - const red = this.bitmap.data[index + 3]; - - this.bitmap.data[index + 0] = red; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; - }).bitmap; -} - -const decode = data => fromAGBR(BMP.decode(data)); -const encode = image => BMP.encode(toAGBR(image)).data; - -export default () => ({ - mime: { [MIME_TYPE]: ['bmp'] }, - - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - - decoders: { - [MIME_TYPE]: decode, - [MIME_TYPE_SECOND]: decode - }, - - encoders: { - [MIME_TYPE]: encode, - [MIME_TYPE_SECOND]: encode - } -}); diff --git a/project starter code/node_modules/@jimp/bmp/test/bmp.test.js b/project starter code/node_modules/@jimp/bmp/test/bmp.test.js deleted file mode 100644 index 82b3bded..00000000 --- a/project starter code/node_modules/@jimp/bmp/test/bmp.test.js +++ /dev/null @@ -1,54 +0,0 @@ -/* eslint-disable no-control-regex */ - -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import bmp from '../src'; - -const jimp = configure({ types: [bmp] }, Jimp); - -describe('BMP', () => { - const imagesDir = getTestDir(__dirname) + '/images'; - - it('load BMP', async () => { - const image = await jimp.read(imagesDir + '/windows95.bmp'); - - image.getPixelColor(10, 10).should.be.equal(0xeff7f7ff); - image.getPixelColor(150, 80).should.be.equal(0x73add6ff); - image.getPixelColor(190, 200).should.be.equal(0xf7c300ff); - }); - - it('export BMP', async () => { - const image = await jimp.read({ - width: 3, - height: 3, - data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] - }); - const buffer = await image.getBufferAsync('image/bmp'); - - buffer.toString().should.match(/^BMZ\u0000/); - }); - - it('uses correct colors for BMP', async function() { - this.timeout(4000); - - const expectedImg = await jimp.read( - getTestDir(__dirname) + '/images/windows95.png' - ); - const image = await jimp.read( - getTestDir(__dirname) + '/images/windows95.bmp' - ); - - image.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); -}); diff --git a/project starter code/node_modules/@jimp/core/CHANGELOG.md b/project starter code/node_modules/@jimp/core/CHANGELOG.md deleted file mode 100644 index aee584b5..00000000 --- a/project starter code/node_modules/@jimp/core/CHANGELOG.md +++ /dev/null @@ -1,83 +0,0 @@ -# v0.14.0 (Mon Jun 29 2020) - -#### 🚀 Enhancement - -- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - -#### Authors: 1 - -- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### 🐛 Bug Fix - -- Make callback optional for Jimp.rgbaToInt [#889](https://github.com/oliver-moran/jimp/pull/889) ([@HanKruiger](https://github.com/HanKruiger)) - -#### Authors: 2 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) -- Han Kruiger ([@HanKruiger](https://github.com/HanKruiger)) - ---- - -# v0.10.2 (Tue Apr 14 2020) - -#### 🐛 Bug Fix - -- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee)) - -#### Authors: 1 - -- Sebastian Skałacki ([@skalee](https://github.com/skalee)) - ---- - -# v0.10.0 (Mon Mar 30 2020) - -#### 🚀 Enhancement - -- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) - -#### Authors: 1 - -- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) - ---- - -# v0.9.6 (Wed Mar 18 2020) - -#### 🐛 Bug Fix - -- Relax mkdirp dependency to allow newer minimist [#857](https://github.com/oliver-moran/jimp/pull/857) ([@Den-dp](https://github.com/Den-dp)) - -#### 🏠 Internal - -- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 2 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) -- Denis Bendrikov ([@Den-dp](https://github.com/Den-dp)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) -- `@jimp/core` - - Follow redirects [#789](https://github.com/oliver-moran/jimp/pull/789) ([@SaWey](https://github.com/SaWey) sander@solora.be) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/README.md b/project starter code/node_modules/@jimp/core/README.md deleted file mode 100644 index a85714fc..00000000 --- a/project starter code/node_modules/@jimp/core/README.md +++ /dev/null @@ -1,52 +0,0 @@ -
- -

@jimp/core

-
- -The main Jimp class. This class can be extended with types and bitmap manipulation functions. Out of the box it does not support any image type. - -## Available Methods - -### Jimp - -The Jimp class constructor. - -### addConstants - -Add constant or static methods to the Jimp constructor. - -```js -addConstants({ - MIME_SPECIAL: 'image/special' -}); -``` - -### addJimpMethods - -Add a bitmap manipulation method to Jimp constructor. These method should return this so that the function can be chain-able. - -```js -addJimpMethods({ - cropCrazy: function() { - // Your custom image manipulation method - - return this; - } -}) - -const image = await Jimp.read(...); - -image.resize(10, Jimp.AUTO), - .cropCrazy(); - -await image.writeAsync('test.png'); -``` - -### addType - -Add a image mime type to Jimp constructor. First argument is a mime type and the second is an array of file extension for that type. - -```js -addType('image/special', ['spec', 'special']); -``` diff --git a/project starter code/node_modules/@jimp/core/dist/composite/index.js b/project starter code/node_modules/@jimp/core/dist/composite/index.js deleted file mode 100644 index ec9595d9..00000000 --- a/project starter code/node_modules/@jimp/core/dist/composite/index.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = composite; - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var compositeModes = _interopRequireWildcard(require("./composite-modes")); - -/** - * Composites a source image over to this image respecting alpha channels - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {object} options determine what mode to use - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function composite(src, x, y) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var cb = arguments.length > 4 ? arguments[4] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - var _options = options, - mode = _options.mode, - opacitySource = _options.opacitySource, - opacityDest = _options.opacityDest; - - if (!mode) { - mode = constants.BLEND_SOURCE_OVER; - } - - if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) { - opacitySource = 1.0; - } - - if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) { - opacityDest = 1.0; - } - - var blendmode = compositeModes[mode]; // round input - - x = Math.round(x); - y = Math.round(y); - var baseImage = this; - - if (opacityDest !== 1.0) { - baseImage.opacity(opacityDest); - } - - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); - var blended = blendmode({ - r: this.bitmap.data[idx + 0] / 255, - g: this.bitmap.data[idx + 1] / 255, - b: this.bitmap.data[idx + 2] / 255, - a: this.bitmap.data[idx + 3] / 255 - }, { - r: baseImage.bitmap.data[dstIdx + 0] / 255, - g: baseImage.bitmap.data[dstIdx + 1] / 255, - b: baseImage.bitmap.data[dstIdx + 2] / 255, - a: baseImage.bitmap.data[dstIdx + 3] / 255 - }, opacitySource); - baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(blended.r * 255); - baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(blended.g * 255); - baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/composite/index.js.map b/project starter code/node_modules/@jimp/core/dist/composite/index.js.map deleted file mode 100644 index 290d15ef..00000000 --- a/project starter code/node_modules/@jimp/core/dist/composite/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,SAAT,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AC,EAAEjB,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC;AAJzC,KAPuB,EAavBjB,aAbuB,CAAzB;AAgBAQ,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACC,CAAR,GAAY,GADsB,CAApC;AAGAb,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACG,CAAR,GAAY,GADsB,CAApC;AAGAf,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACI,CAAR,GAAY,GADsB,CAApC;AAGAhB,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACK,CAAR,GAAY,GADsB,CAApC;AAGD,GAlCD;;AAoCA,MAAI,0BAAc9B,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\nimport * as constants from '../constants';\n\nimport * as compositeModes from './composite-modes';\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== 'number' ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/constants.js b/project starter code/node_modules/@jimp/core/dist/constants.js deleted file mode 100644 index cc86acb3..00000000 --- a/project starter code/node_modules/@jimp/core/dist/constants.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; -// used to auto resizing etc. -var AUTO = -1; // Align modes for cover, contain, bit masks - -exports.AUTO = AUTO; -var HORIZONTAL_ALIGN_LEFT = 1; -exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; -var HORIZONTAL_ALIGN_CENTER = 2; -exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; -var HORIZONTAL_ALIGN_RIGHT = 4; -exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; -var VERTICAL_ALIGN_TOP = 8; -exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; -var VERTICAL_ALIGN_MIDDLE = 16; -exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; -var VERTICAL_ALIGN_BOTTOM = 32; // blend modes - -exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; -var BLEND_SOURCE_OVER = 'srcOver'; -exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; -var BLEND_DESTINATION_OVER = 'dstOver'; -exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; -var BLEND_MULTIPLY = 'multiply'; -exports.BLEND_MULTIPLY = BLEND_MULTIPLY; -var BLEND_ADD = 'add'; -exports.BLEND_ADD = BLEND_ADD; -var BLEND_SCREEN = 'screen'; -exports.BLEND_SCREEN = BLEND_SCREEN; -var BLEND_OVERLAY = 'overlay'; -exports.BLEND_OVERLAY = BLEND_OVERLAY; -var BLEND_DARKEN = 'darken'; -exports.BLEND_DARKEN = BLEND_DARKEN; -var BLEND_LIGHTEN = 'lighten'; -exports.BLEND_LIGHTEN = BLEND_LIGHTEN; -var BLEND_HARDLIGHT = 'hardLight'; -exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; -var BLEND_DIFFERENCE = 'difference'; -exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; -var BLEND_EXCLUSION = 'exclusion'; // Edge Handling - -exports.BLEND_EXCLUSION = BLEND_EXCLUSION; -var EDGE_EXTEND = 1; -exports.EDGE_EXTEND = EDGE_EXTEND; -var EDGE_WRAP = 2; -exports.EDGE_WRAP = EDGE_WRAP; -var EDGE_CROP = 3; -exports.EDGE_CROP = EDGE_CROP; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/constants.js.map b/project starter code/node_modules/@jimp/core/dist/constants.js.map deleted file mode 100644 index 31fc25ea..00000000 --- a/project starter code/node_modules/@jimp/core/dist/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = 'srcOver';\nexport const BLEND_DESTINATION_OVER = 'dstOver';\nexport const BLEND_MULTIPLY = 'multiply';\nexport const BLEND_ADD = 'add';\nexport const BLEND_SCREEN = 'screen';\nexport const BLEND_OVERLAY = 'overlay';\nexport const BLEND_DARKEN = 'darken';\nexport const BLEND_LIGHTEN = 'lighten';\nexport const BLEND_HARDLIGHT = 'hardLight';\nexport const BLEND_DIFFERENCE = 'difference';\nexport const BLEND_EXCLUSION = 'exclusion';\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/index.js b/project starter code/node_modules/@jimp/core/dist/index.js deleted file mode 100644 index a656d756..00000000 --- a/project starter code/node_modules/@jimp/core/dist/index.js +++ /dev/null @@ -1,1291 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addConstants = addConstants; -exports.addJimpMethods = addJimpMethods; -exports.jimpEvMethod = jimpEvMethod; -exports.jimpEvChange = jimpEvChange; -Object.defineProperty(exports, "addType", { - enumerable: true, - get: function get() { - return MIME.addType; - } -}); -exports["default"] = void 0; - -var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); - -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); - -var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); - -var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); - -var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); - -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _fs = _interopRequireDefault(require("fs")); - -var _path = _interopRequireDefault(require("path")); - -var _events = _interopRequireDefault(require("events")); - -var _utils = require("@jimp/utils"); - -var _anyBase = _interopRequireDefault(require("any-base")); - -var _mkdirp = _interopRequireDefault(require("mkdirp")); - -var _pixelmatch = _interopRequireDefault(require("pixelmatch")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _phash = _interopRequireDefault(require("./modules/phash")); - -var _request = _interopRequireDefault(require("./request")); - -var _composite = _interopRequireDefault(require("./composite")); - -var _promisify = _interopRequireDefault(require("./utils/promisify")); - -var MIME = _interopRequireWildcard(require("./utils/mime")); - -var _imageBitmap = require("./utils/image-bitmap"); - -var constants = _interopRequireWildcard(require("./constants")); - -var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases -// 0 and 1 do not exist as possible hash lengths - -var maxHashLength = [NaN, NaN]; - -for (var i = 2; i < 65; i++) { - var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1')); - maxHashLength.push(maxHash.length); -} // no operation - - -function noop() {} // error checking methods - - -function isArrayBuffer(test) { - return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1; -} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, -// But this function is not useful when running in node directly - - -function bufferFromArrayBuffer(arrayBuffer) { - var buffer = Buffer.alloc(arrayBuffer.byteLength); - var view = new Uint8Array(arrayBuffer); - - for (var _i = 0; _i < buffer.length; ++_i) { - buffer[_i] = view[_i]; - } - - return buffer; -} - -function loadFromURL(options, cb) { - (0, _request["default"])(options, function (err, response, data) { - if (err) { - return cb(err); - } - - if ('headers' in response && 'location' in response.headers) { - options.url = response.headers.location; - return loadFromURL(options, cb); - } - - if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) { - return cb(null, data); - } - - var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')'; - return new Error(msg); - }); -} - -function loadBufferFromPath(src, cb) { - if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) { - _fs["default"].readFile(src, cb); - } else { - loadFromURL({ - url: src - }, cb); - } -} - -function isRawRGBAData(obj) { - return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); -} - -function makeRGBABufferFromRGB(buffer) { - if (buffer.length % 3 !== 0) { - throw new Error('Buffer length is incorrect'); - } - - var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); - var j = 0; - - for (var _i2 = 0; _i2 < buffer.length; _i2++) { - rgbaBuffer[j] = buffer[_i2]; - - if ((_i2 + 1) % 3 === 0) { - rgbaBuffer[++j] = 255; - } - - j++; - } - - return rgbaBuffer; -} - -var emptyBitmap = { - data: null, - width: null, - height: null -}; -/** - * Jimp constructor (from a file) - * @param path a path to the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a url with options) - * @param options { url, otherOptions} - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from another Jimp image or raw image data) - * @param image a Jimp image to clone - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a Buffer) - * @param data a Buffer containing the image data - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param background color to fill the image with - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -var Jimp = -/*#__PURE__*/ -function (_EventEmitter) { - (0, _inherits2["default"])(Jimp, _EventEmitter); - - // An object representing a bitmap in memory, comprising: - // - data: a buffer of the bitmap data - // - width: the width of the image in pixels - // - height: the height of the image in pixels - // Default colour to use for new pixels - // Default MIME is PNG - // Exif data for the image - // Whether Transparency supporting formats will be exported as RGB or RGBA - function Jimp() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - (0, _classCallCheck2["default"])(this, Jimp); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { - return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { - return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); - var jimpInstance = (0, _assertThisInitialized2["default"])(_this); - var cb = noop; - - if (isArrayBuffer(args[0])) { - args[0] = bufferFromArrayBuffer(args[0]); - } - - function finish() { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - var err = args[0]; - var evData = err || {}; - evData.methodName = 'constructor'; - setTimeout(function () { - var _cb; - - // run on next tick. - if (err && cb === noop) { - jimpInstance.emitError('constructor', err); - } else if (!err) { - jimpInstance.emitMulti('constructor', 'initialized'); - } - - (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); - }, 1); - } - - if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) { - // create a new image - var w = parseInt(args[0], 10); - var h = parseInt(args[1], 10); - cb = args[2]; // with a hex color - - if (typeof args[2] === 'number') { - _this._background = args[2]; - cb = args[3]; - } // with a css color - - - if (typeof args[2] === 'string') { - _this._background = Jimp.cssColorToHex(args[2]); - cb = args[3]; - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { - _this.bitmap.data.writeUInt32BE(_this._background, _i3); - } - - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) { - cb = args[1] || noop; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadFromURL(args[0], function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, args[0].url, finish); - }); - } else if (args[0] instanceof Jimp) { - // clone an existing Jimp - var original = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.from(original.bitmap.data), - width: original.bitmap.width, - height: original.bitmap.height - }; - _this._quality = original._quality; - _this._deflateLevel = original._deflateLevel; - _this._deflateStrategy = original._deflateStrategy; - _this._filterType = original._filterType; - _this._rgba = original._rgba; - _this._background = original._background; - _this._originalMime = original._originalMime; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (isRawRGBAData(args[0])) { - var imageData = args[0]; - cb = args[1] || noop; - var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; - var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); - _this.bitmap = { - data: buffer, - width: imageData.width, - height: imageData.height - }; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (typeof args[0] === 'string') { - // read from a path - var path = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadBufferFromPath(path, function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, path, finish); - }); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) { - // read from a buffer - var data = args[0]; - cb = args[1]; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.parseBitmap(data, null, finish); - } else { - // Allow client libs to add new ways to build a Jimp object. - // Extra constructors must be added by `Jimp.appendConstructorOption()` - cb = args[args.length - 1]; - - if (typeof cb !== 'function') { - // TODO: try to solve the args after cb problem. - cb = args[args.length - 2]; - - if (typeof cb !== 'function') { - cb = noop; - } - } - - var extraConstructor = Jimp.__extraConstructors.find(function (c) { - return c.test.apply(c, args); - }); - - if (extraConstructor) { - new Promise(function (resolve, reject) { - var _extraConstructor$run; - - return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); - }).then(function () { - return finish(null, (0, _assertThisInitialized2["default"])(_this)); - })["catch"](finish); - } else { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish)); - } - } - - return _this; - } - /** - * Parse a bitmap with the loaded image types. - * - * @param {Buffer} data raw image data - * @param {string} path optional path to file - * @param {function(Error, Jimp)} finish (optional) a callback for when complete - * @memberof Jimp - */ - - - (0, _createClass2["default"])(Jimp, [{ - key: "parseBitmap", - value: function parseBitmap(data, path, finish) { - _imageBitmap.parseBitmap.call(this, data, null, finish); - } - /** - * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) - * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "rgba", - value: function rgba(bool, cb) { - if (typeof bool !== 'boolean') { - return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb); - } - - this._rgba = bool; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - /** - * Emit for multiple listeners - * @param {string} methodName name of the method to emit an error for - * @param {string} eventName name of the eventName to emit an error for - * @param {object} data to emit - */ - - }, { - key: "emitMulti", - value: function emitMulti(methodName, eventName) { - var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - data = Object.assign(data, { - methodName: methodName, - eventName: eventName - }); - this.emit('any', data); - - if (methodName) { - this.emit(methodName, data); - } - - this.emit(eventName, data); - } - }, { - key: "emitError", - value: function emitError(methodName, err) { - this.emitMulti(methodName, 'error', err); - } - /** - * Get the current height of the image - * @return {number} height of the image - */ - - }, { - key: "getHeight", - value: function getHeight() { - return this.bitmap.height; - } - /** - * Get the current width of the image - * @return {number} width of the image - */ - - }, { - key: "getWidth", - value: function getWidth() { - return this.bitmap.width; - } - /** - * Nicely format Jimp object when sent to the console e.g. console.log(image) - * @returns {string} pretty printed - */ - - }, { - key: "inspect", - value: function inspect() { - return ''; - } - /** - * Nicely format Jimp object when converted to a string - * @returns {string} pretty printed - */ - - }, { - key: "toString", - value: function toString() { - return '[object Jimp]'; - } - /** - * Returns the original MIME of the image (default: "image/png") - * @returns {string} the MIME - */ - - }, { - key: "getMIME", - value: function getMIME() { - var mime = this._originalMime || Jimp.MIME_PNG; - return mime; - } - /** - * Returns the appropriate file extension for the original MIME of the image (default: "png") - * @returns {string} the file extension - */ - - }, { - key: "getExtension", - value: function getExtension() { - var mime = this.getMIME(); - return MIME.getExtension(mime); - } - /** - * Writes the image to a file - * @param {string} path a path to the destination file - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "write", - value: function write(path, cb) { - var _this2 = this; - - if (!_fs["default"] || !_fs["default"].createWriteStream) { - throw new Error('Cant access the filesystem. You can use the getBase64 method.'); - } - - if (typeof path !== 'string') { - return _utils.throwError.call(this, 'path must be a string', cb); - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - var mime = MIME.getType(path) || this.getMIME(); - - var pathObj = _path["default"].parse(path); - - if (pathObj.dir) { - _mkdirp["default"].sync(pathObj.dir); - } - - this.getBuffer(mime, function (err, buffer) { - if (err) { - return _utils.throwError.call(_this2, err, cb); - } - - var stream = _fs["default"].createWriteStream(path); - - stream.on('open', function () { - stream.write(buffer); - stream.end(); - }).on('error', function (err) { - return _utils.throwError.call(_this2, err, cb); - }); - stream.on('finish', function () { - cb.call(_this2, null, _this2); - }); - }); - return this; - } - }, { - key: "getBase64", - - /** - * Converts the image to a base 64 string - * @param {string} mime the mime type of the image data to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - value: function getBase64(mime, cb) { - if (mime === Jimp.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - this.getBuffer(mime, function (err, data) { - if (err) { - return _utils.throwError.call(this, err, cb); - } - - var src = 'data:' + mime + ';base64,' + data.toString('base64'); - cb.call(this, null, src); - }); - return this; - } - }, { - key: "hash", - - /** - * Generates a perceptual hash of the image . And pads the string. Can configure base. - * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {string} a string representing the hash - */ - value: function hash(base, cb) { - base = base || 64; - - if (typeof base === 'function') { - cb = base; - base = 64; - } - - if (typeof base !== 'number') { - return _utils.throwError.call(this, 'base must be a number', cb); - } - - if (base < 2 || base > 64) { - return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb); - } - - var hash = this.pHash(); - hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); - - while (hash.length < maxHashLength[base]) { - hash = '0' + hash; // pad out with leading zeros - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hash); - } - - return hash; - } - /** - * Calculates the perceptual hash - * @returns {number} the perceptual hash - */ - - }, { - key: "pHash", - value: function pHash() { - var pHash = new _phash["default"](); - return pHash.getHash(this); - } - /** - * Calculates the hamming distance of the current image and a hash based on their perceptual hash - * @param {hash} compareHash hash to compare to - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - }, { - key: "distanceFromHash", - value: function distanceFromHash(compareHash) { - var pHash = new _phash["default"](); - var currentHash = pHash.getHash(this); - return pHash.distance(currentHash, compareHash); - } - /** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "getPixelIndex", - - /** - * Returns the offset of a pixel in the bitmap buffer - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {number} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function getPixelIndex(x, y, edgeHandling, cb) { - var xi; - var yi; - - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = Jimp.EDGE_EXTEND; - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - xi = x; - yi = y; - - if (edgeHandling === Jimp.EDGE_EXTEND) { - if (x < 0) xi = 0; - if (x >= this.bitmap.width) xi = this.bitmap.width - 1; - if (y < 0) yi = 0; - if (y >= this.bitmap.height) yi = this.bitmap.height - 1; - } - - if (edgeHandling === Jimp.EDGE_WRAP) { - if (x < 0) { - xi = this.bitmap.width + x; - } - - if (x >= this.bitmap.width) { - xi = x % this.bitmap.width; - } - - if (y < 0) { - xi = this.bitmap.height + y; - } - - if (y >= this.bitmap.height) { - yi = y % this.bitmap.height; - } - } - - var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 - - if (xi < 0 || xi >= this.bitmap.width) { - i = -1; - } - - if (yi < 0 || yi >= this.bitmap.height) { - i = -1; - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; - } - /** - * Returns the hex colour value of a pixel - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the color of the pixel - */ - - }, { - key: "getPixelColor", - value: function getPixelColor(x, y, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - var hex = this.bitmap.data.readUInt32BE(idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hex); - } - - return hex; - } - }, { - key: "setPixelColor", - - /** - * Returns the hex colour value of a pixel - * @param {number} hex color to set - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function setPixelColor(hex, x, y, cb) { - if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - this.bitmap.data.writeUInt32BE(hex, idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }, { - key: "hasAlpha", - - /** - * Determine if the image contains opaque pixels. - * @return {boolean} hasAlpha whether the image contains opaque pixels - */ - value: function hasAlpha() { - for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { - for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { - var idx = this.bitmap.width * yIndex + xIndex << 2; - var alpha = this.bitmap.data[idx + 3]; - - if (alpha !== 0xff) { - return true; - } - } - } - - return false; - } - /** - * Iterate scan through a region of the bitmap - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} - */ - - }, { - key: "scanIterator", - value: function scanIterator(x, y, w, h) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers'); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers'); - } - - return (0, _utils.scanIterator)(this, x, y, w, h); - } - }]); - return Jimp; -}(_events["default"]); - -function addConstants(constants) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(constants).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - value = _ref2[1]; - - jimpInstance[name] = value; - }); -} - -function addJimpMethods(methods) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(methods).forEach(function (_ref3) { - var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), - name = _ref4[0], - value = _ref4[1]; - - jimpInstance.prototype[name] = value; - }); -} - -addConstants(constants); -addJimpMethods({ - composite: _composite["default"] -}); -Jimp.__extraConstructors = []; -/** - * Allow client libs to add new ways to build a Jimp object. - * @param {string} name identify the extra constructor. - * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. - * @param {function} run where the magic happens. - */ - -Jimp.appendConstructorOption = function (name, test, run) { - Jimp.__extraConstructors.push({ - name: name, - test: test, - run: run - }); -}; -/** - * Read an image from a file or a Buffer. Takes the same args as the constructor - * @returns {Promise} a promise - */ - - -Jimp.read = function () { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - return new Promise(function (resolve, reject) { - (0, _construct2["default"])(Jimp, args.concat([function (err, image) { - if (err) reject(err);else resolve(image); - }])); - }); -}; - -Jimp.create = Jimp.read; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} r the red value (0-255) - * @param {number} g the green value (0-255) - * @param {number} b the blue value (0-255) - * @param {number} a the alpha value (0-255) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {number} an single integer colour value - */ - -Jimp.rgbaToInt = function (r, g, b, a, cb) { - if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') { - return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb); - } - - if (r < 0 || r > 255) { - return _utils.throwError.call(this, 'r must be between 0 and 255', cb); - } - - if (g < 0 || g > 255) { - _utils.throwError.call(this, 'g must be between 0 and 255', cb); - } - - if (b < 0 || b > 255) { - return _utils.throwError.call(this, 'b must be between 0 and 255', cb); - } - - if (a < 0 || a > 255) { - return _utils.throwError.call(this, 'a must be between 0 and 255', cb); - } - - r = Math.round(r); - b = Math.round(b); - g = Math.round(g); - a = Math.round(a); - var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; -}; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {object} an object with the properties r, g, b and a representing RGBA values - */ - - -Jimp.intToRGBA = function (i, cb) { - if (typeof i !== 'number') { - return _utils.throwError.call(this, 'i must be a number', cb); - } - - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, rgba); - } - - return rgba; -}; -/** - * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number - * @param {string} cssColor a number - * @returns {number} a hex number representing a color - */ - - -Jimp.cssColorToHex = function (cssColor) { - cssColor = cssColor || 0; // 0, null, undefined, NaN - - if (typeof cssColor === 'number') return Number(cssColor); - return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); -}; -/** - * Limits a number to between 0 or 255 - * @param {number} n a number - * @returns {number} the number limited to between 0 or 255 - */ - - -Jimp.limit255 = function (n) { - n = Math.max(n, 0); - n = Math.min(n, 255); - return n; -}; -/** - * Diffs two images and returns - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) - * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } - */ - - -Jimp.diff = function (img1, img2) { - var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; - if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images'); - var bmp1 = img1.bitmap; - var bmp2 = img2.bitmap; - - if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { - if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { - // img1 is bigger - img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height); - } else { - // img2 is bigger (or they are the same in area) - img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); - } - } - - if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) { - return _utils.throwError.call(this, 'threshold must be a number between 0 and 1'); - } - - var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); - var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { - threshold: threshold - }); - return { - percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), - image: diff - }; -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.distance = function (img1, img2) { - var phash = new _phash["default"](); - var hash1 = phash.getHash(img1); - var hash2 = phash.getHash(img2); - return phash.distance(hash1, hash2); -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {hash} hash1 a pHash - * @param {hash} hash2 a pHash - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.compareHashes = function (hash1, hash2) { - var phash = new _phash["default"](); - return phash.distance(hash1, hash2); -}; -/** - * Compute color difference - * 0 means no difference, 1 means maximum difference. - * @param {number} rgba1: first color to compare. - * @param {number} rgba2: second color to compare. - * Both parameters must be an color object {r:val, g:val, b:val, a:val} - * Where `a` is optional and `val` is an integer between 0 and 255. - * @returns {number} float between 0 and 1. - */ - - -Jimp.colorDiff = function (rgba1, rgba2) { - var pow = function pow(n) { - return Math.pow(n, 2); - }; - - var max = Math.max; - var maxVal = 255 * 255 * 3; - - if (rgba1.a !== 0 && !rgba1.a) { - rgba1.a = 255; - } - - if (rgba2.a !== 0 && !rgba2.a) { - rgba2.a = 255; - } - - return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; -}; -/** - * Helper to create Jimp methods that emit events before and after its execution. - * @param {string} methodName The name to be appended to Jimp prototype. - * @param {string} evName The event name to be called. - * It will be prefixed by `before-` and emitted when on method call. - * It will be appended by `ed` and emitted after the method run. - * @param {function} method A function implementing the method itself. - * It will also create a quiet version that will not emit events, to not - * mess the user code with many `changed` event calls. You can call with - * `methodName + "Quiet"`. - * - * The emitted event comes with a object parameter to the listener with the - * `methodName` as one attribute. - */ - - -function jimpEvMethod(methodName, evName, method) { - var evNameBefore = 'before-' + evName; - var evNameAfter = evName.replace(/e$/, '') + 'ed'; - - Jimp.prototype[methodName] = function () { - var wrappedCb; - - for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; - } - - var cb = args[method.length - 1]; - var jimpInstance = this; - - if (typeof cb === 'function') { - wrappedCb = function wrappedCb() { - for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - args[_key5] = arguments[_key5]; - } - - var err = args[0], - data = args[1]; - - if (err) { - jimpInstance.emitError(methodName, err); - } else { - jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); - } - - cb.apply(this, args); - }; - - args[args.length - 1] = wrappedCb; - } else { - wrappedCb = false; - } - - this.emitMulti(methodName, evNameBefore); - var result; - - try { - result = method.apply(this, args); - - if (!wrappedCb) { - this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); - } - } catch (error) { - error.methodName = methodName; - this.emitError(methodName, error); - } - - return result; - }; - - Jimp.prototype[methodName + 'Quiet'] = method; -} -/** - * Creates a new image that is a clone of this one. - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns the new image - */ - - -jimpEvMethod('clone', 'clone', function (cb) { - var clone = new Jimp(this); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(clone, null, clone); - } - - return clone; -}); -/** - * Simplify jimpEvMethod call for the common `change` evName. - * @param {string} methodName name of the method - * @param {function} method to watch changes for - */ - -function jimpEvChange(methodName, method) { - jimpEvMethod(methodName, 'change', method); -} -/** - * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) - * @param b A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -jimpEvChange('background', function (hex, cb) { - if (typeof hex !== 'number') { - return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb); - } - - this._background = hex; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -}); -/** - * Scans through a region of the bitmap, calling a function for each pixel. - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @param f a function to call on even pixel; the (x, y) position of the pixel - * and the index of the pixel in the bitmap buffer are passed to the function - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - -jimpEvChange('scan', function (x, y, w, h, f, cb) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof f !== 'function') { - return _utils.throwError.call(this, 'f must be a function', cb); - } - - var result = (0, _utils.scan)(this, x, y, w, h, f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, result); - } - - return result; -}); - -if (process.env.ENVIRONMENT === 'BROWSER') { - // For use in a web browser or web worker - - /* global self */ - var gl; - - if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') { - gl = window; - } - - if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') { - gl = self; - } - - gl.Jimp = Jimp; - gl.Buffer = Buffer; -} - -var _default = Jimp; -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/index.js.map b/project starter code/node_modules/@jimp/core/dist/index.js.map deleted file mode 100644 index 8e69060a..00000000 --- a/project starter code/node_modules/@jimp/core/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,GACZ,kEADF,C,CAGA;AACA;;AACA,IAAMC,aAAa,GAAG,CAACC,GAAD,EAAMA,GAAN,CAAtB;;AAEA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,E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WAAOnD,kBAAW9D,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDa,EAAjD,CAAP;AACD;;AAED,MAAI,OAAO6C,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,WAAOG,kBAAW9D,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDa,EAAjD,CAAP;AACD;;AAED,MAAI,OAAO+K,CAAP,KAAa,UAAjB,EAA6B;AAC3B,WAAO9H,kBAAW9D,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8Ca,EAA9C,CAAP;AACD;;AAED,MAAM2K,MAAM,GAAG,iBAAK,IAAL,EAAWxE,CAAX,EAAcC,CAAd,EAAiBvD,CAAjB,EAAoBC,CAApB,EAAuBiI,CAAvB,CAAf;;AAEA,MAAI,0BAAc/K,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACb,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBwL,MAApB;AACD;;AAED,SAAOA,MAAP;AACD,CApBW,CAAZ;;AAsBA,IAAIK,OAAO,CAACC,GAAR,CAAYC,WAAZ,KAA4B,SAAhC,EAA2C;AACzC;;AACA;AACA,MAAIC,EAAJ;;AAEA,MAAI,OAAOC,MAAP,KAAkB,WAAlB,IAAiC,QAAOA,MAAP,0DAAOA,MAAP,OAAkB,QAAvD,EAAiE;AAC/DD,IAAAA,EAAE,GAAGC,MAAL;AACD;;AAED,MAAI,OAAOC,IAAP,KAAgB,WAAhB,IAA+B,QAAOA,IAAP,0DAAOA,IAAP,OAAgB,QAAnD,EAA6D;AAC3DF,IAAAA,EAAE,GAAGE,IAAL;AACD;;AAEDF,EAAAA,EAAE,CAACzJ,IAAH,GAAUA,IAAV;AACAyJ,EAAAA,EAAE,CAAC1L,MAAH,GAAYA,MAAZ;AACD;;eAIciC,I","sourcesContent":["import fs from 'fs';\nimport Path from 'path';\nimport EventEmitter from 'events';\n\nimport { isNodePattern, throwError, scan, scanIterator } from '@jimp/utils';\nimport anyBase from 'any-base';\nimport mkdirp from 'mkdirp';\nimport pixelMatch from 'pixelmatch';\nimport tinyColor from 'tinycolor2';\n\nimport ImagePHash from './modules/phash';\nimport request from './request';\n\nimport composite from './composite';\nimport promisify from './utils/promisify';\nimport * as MIME from './utils/mime';\nimport { parseBitmap, getBuffer, getBufferAsync } from './utils/image-bitmap';\nimport * as constants from './constants';\n\nconst alphabet =\n '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(\n new Array(64 + 1).join('1')\n );\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString\n .call(test)\n .toLowerCase()\n .indexOf('arraybuffer') > -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if ('headers' in response && 'location' in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === 'object' && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n 'Could not load Buffer from <' +\n options.url +\n '> ' +\n '(HTTP: ' +\n response.statusCode +\n ')';\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === 'function' &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.width === 'number' &&\n typeof obj.height === 'number' &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === 'function' &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error('Buffer length is incorrect');\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = 'constructor';\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError('constructor', err);\n } else if (!err) {\n jimpInstance.emitMulti('constructor', 'initialized');\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === 'number' && typeof args[1] === 'number') ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === 'number') {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === 'string') {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === 'object' && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n\n finish(null, this);\n } else if (typeof args[0] === 'string') {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === 'object' && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== 'function') {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== 'function') {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find(c =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) =>\n extraConstructor.run.call(this, resolve, reject, ...args)\n )\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n 'No matching constructor overloading was found. ' +\n 'Please see the docs for how to call the Jimp constructor.',\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== 'boolean') {\n return throwError.call(\n this,\n 'bool must be a boolean, true for RGBA or false for RGB',\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit('any', data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, 'error', err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n ''\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return '[object Jimp]';\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n 'Cant access the filesystem. You can use the getBase64 method.'\n );\n }\n\n if (typeof path !== 'string') {\n return throwError.call(this, 'path must be a string', cb);\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on('open', () => {\n stream.write(buffer);\n stream.end();\n })\n .on('error', err => {\n return throwError.call(this, err, cb);\n });\n stream.on('finish', () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = path => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n this.getBuffer(mime, function(err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = 'data:' + mime + ';base64,' + data.toString('base64');\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = mime => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === 'function') {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== 'number') {\n return throwError.call(this, 'base must be a number', cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n 'base must be a number between 2 and 64',\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = '0' + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== 'number' ||\n typeof x !== 'number' ||\n typeof y !== 'number'\n )\n return throwError.call(this, 'hex, x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers');\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers');\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function(name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function(...args) {\n return new Promise((resolve, reject) => {\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function(r, g, b, a, cb) {\n if (\n typeof r !== 'number' ||\n typeof g !== 'number' ||\n typeof b !== 'number' ||\n typeof a !== 'number'\n ) {\n return throwError.call(this, 'r, g, b and a must be numbers', cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, 'r must be between 0 and 255', cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, 'g must be between 0 and 255', cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, 'b must be between 0 and 255', cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, 'a must be between 0 and 255', cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function(i, cb) {\n if (typeof i !== 'number') {\n return throwError.call(this, 'i must be a number', cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function(cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === 'number') return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function(n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function(img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, 'img1 and img2 must be an Jimp images');\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {\n return throwError.call(this, 'threshold must be a number between 0 and 1');\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function(img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function(hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function(rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = 'before-' + evName;\n const evNameAfter = evName.replace(/e$/, '') + 'ed';\n\n Jimp.prototype[methodName] = function(...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === 'function') {\n wrappedCb = function(...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + 'Quiet'] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod('clone', 'clone', function(cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, 'change', method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('background', function(hex, cb) {\n if (typeof hex !== 'number') {\n return throwError.call(this, 'hex must be a hexadecimal rgba value', cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('scan', function(x, y, w, h, f, cb) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof f !== 'function') {\n return throwError.call(this, 'f must be a function', cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === 'BROWSER') {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== 'undefined' && typeof window === 'object') {\n gl = window;\n }\n\n if (typeof self !== 'undefined' && typeof self === 'object') {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from './utils/mime';\n\nexport default Jimp;\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/modules/phash.js b/project starter code/node_modules/@jimp/core/dist/modules/phash.js deleted file mode 100644 index dac128a5..00000000 --- a/project starter code/node_modules/@jimp/core/dist/modules/phash.js +++ /dev/null @@ -1,173 +0,0 @@ -"use strict"; - -/* -Copyright (c) 2011 Elliot Shepherd - -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. -*/ -// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java - -/* - * pHash-like image hash. - * Author: Elliot Shepherd (elliot@jarofworms.com - * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html - */ -function ImagePHash(size, smallerSize) { - this.size = this.size || size; - this.smallerSize = this.smallerSize || smallerSize; - initCoefficients(this.size); -} - -ImagePHash.prototype.size = 32; -ImagePHash.prototype.smallerSize = 8; - -ImagePHash.prototype.distance = function (s1, s2) { - var counter = 0; - - for (var k = 0; k < s1.length; k++) { - if (s1[k] !== s2[k]) { - counter++; - } - } - - return counter / s1.length; -}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. - - -ImagePHash.prototype.getHash = function (img) { - /* 1. Reduce size. - * Like Average Hash, pHash starts with a small image. - * However, the image is larger than 8x8; 32x32 is a good size. - * This is really done to simplify the DCT computation and not - * because it is needed to reduce the high frequencies. - */ - img = img.clone().resize(this.size, this.size); - /* 2. Reduce color. - * The image is reduced to a grayscale just to further simplify - * the number of computations. - */ - - img.grayscale(); - var vals = []; - - for (var x = 0; x < img.bitmap.width; x++) { - vals[x] = []; - - for (var y = 0; y < img.bitmap.height; y++) { - vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; - } - } - /* 3. Compute the DCT. - * The DCT separates the image into a collection of frequencies - * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses - * a 32x32 DCT. - */ - - - var dctVals = applyDCT(vals, this.size); - /* 4. Reduce the DCT. - * This is the magic step. While the DCT is 32x32, just keep the - * top-left 8x8. Those represent the lowest frequencies in the - * picture. - */ - - /* 5. Compute the average value. - * Like the Average Hash, compute the mean DCT value (using only - * the 8x8 DCT low-frequency values and excluding the first term - * since the DC coefficient can be significantly different from - * the other values and will throw off the average). - */ - - var total = 0; - - for (var _x = 0; _x < this.smallerSize; _x++) { - for (var _y = 0; _y < this.smallerSize; _y++) { - total += dctVals[_x][_y]; - } - } - - var avg = total / (this.smallerSize * this.smallerSize); - /* 6. Further reduce the DCT. - * This is the magic step. Set the 64 hash bits to 0 or 1 - * depending on whether each of the 64 DCT values is above or - * below the average value. The result doesn't tell us the - * actual low frequencies; it just tells us the very-rough - * relative scale of the frequencies to the mean. The result - * will not vary as long as the overall structure of the image - * remains the same; this can survive gamma and color histogram - * adjustments without a problem. - */ - - var hash = ''; - - for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { - for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { - hash += dctVals[_x2][_y2] > avg ? '1' : '0'; - } - } - - return hash; -}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java - - -function intToRGBA(i) { - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - return rgba; -} - -var c = []; - -function initCoefficients(size) { - for (var i = 1; i < size; i++) { - c[i] = 1; - } - - c[0] = 1 / Math.sqrt(2.0); -} - -function applyDCT(f, size) { - var N = size; - var F = []; - - for (var u = 0; u < N; u++) { - F[u] = []; - - for (var v = 0; v < N; v++) { - var sum = 0; - - for (var i = 0; i < N; i++) { - for (var j = 0; j < N; j++) { - sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; - } - } - - sum *= c[u] * c[v] / 4; - F[u][v] = sum; - } - } - - return F; -} - -module.exports = ImagePHash; -//# sourceMappingURL=phash.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map b/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map deleted file mode 100644 index 5556e315..00000000 --- a/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WAAL,IAAoBA,WAAvC;AACAC,EAAAA,gBAAgB,CAAC,KAAKF,IAAN,CAAhB;AACD;;AAEDD,UAAU,CAACI,SAAX,CAAqBH,IAArB,GAA4B,EAA5B;AACAD,UAAU,CAACI,SAAX,CAAqBF,WAArB,GAAmC,CAAnC;;AAEAF,UAAU,CAACI,SAAX,CAAqBC,QAArB,GAAgC,UAASC,EAAT,EAAaC,EAAb,EAAiB;AAC/C,MAAIC,OAAO,GAAG,CAAd;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,EAAE,CAACI,MAAvB,EAA+BD,CAAC,EAAhC,EAAoC;AAClC,QAAIH,EAAE,CAACG,CAAD,CAAF,KAAUF,EAAE,CAACE,CAAD,CAAhB,EAAqB;AACnBD,MAAAA,OAAO;AACR;AACF;;AAED,SAAOA,OAAO,GAAGF,EAAE,CAACI,MAApB;AACD,CAVD,C,CAYA;;;AACAV,UAAU,CAACI,SAAX,CAAqBO,OAArB,GAA+B,UAASC,GAAT,EAAc;AAC3C;;;;;;AAMAA,EAAAA,GAAG,GAAGA,GAAG,CAACC,KAAJ,GAAYC,MAAZ,CAAmB,KAAKb,IAAxB,EAA8B,KAAKA,IAAnC,CAAN;AAEA;;;;;AAIAW,EAAAA,GAAG,CAACG,SAAJ;AAEA,MAAMC,IAAI,GAAG,EAAb;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,GAAG,CAACM,MAAJ,CAAWC,KAA/B,EAAsCF,CAAC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P,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function(s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function(img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = '';\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? '1' : '0';\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/request.js b/project starter code/node_modules/@jimp/core/dist/request.js deleted file mode 100644 index 4b211f73..00000000 --- a/project starter code/node_modules/@jimp/core/dist/request.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/* global XMLHttpRequest */ -if (process.browser || process.env.ENVIRONMENT === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') { - // If we run into a browser or the electron renderer process, - // use XHR method instead of Request node module. - module.exports = function (options, cb) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', options.url, true); - xhr.responseType = 'arraybuffer'; - xhr.addEventListener('load', function () { - if (xhr.status < 400) { - try { - var data = Buffer.from(this.response); - cb(null, xhr, data); - } catch (error) { - return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message)); - } - } else { - cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url)); - } - }); - xhr.addEventListener('error', function (e) { - cb(e); - }); - xhr.send(); - }; -} else { - module.exports = function (_ref, cb) { - var options = (0, _extends2["default"])({}, _ref); - - var p = require('phin'); - - p(_objectSpread({ - compression: true - }, options), function (err, res) { - if (err === null) { - cb(null, res, res.body); - } else { - cb(err); - } - }); - }; -} -//# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/request.js.map b/project starter code/node_modules/@jimp/core/dist/request.js.map deleted file mode 100644 index 04a1d461..00000000 --- a/project starter code/node_modules/@jimp/core/dist/request.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAASC,OAAT,EAAkBC,EAAlB,EAAsB;AACrC,QAAMC,GAAG,GAAG,IAAIL,cAAJ,EAAZ;AACAK,IAAAA,GAAG,CAACC,IAAJ,CAAS,KAAT,EAAgBH,OAAO,CAACI,GAAxB,EAA6B,IAA7B;AACAF,IAAAA,GAAG,CAACG,YAAJ,GAAmB,aAAnB;AACAH,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,MAArB,EAA6B,YAAW;AACtC,UAAIJ,GAAG,CAACK,MAAJ,GAAa,GAAjB,EAAsB;AACpB,YAAI;AACF,cAAMC,IAAI,GAAGC,MAAM,CAACC,IAAP,CAAY,KAAKC,QAAjB,CAAb;AACAV,UAAAA,EAAE,CAAC,IAAD,EAAOC,GAAP,EAAYM,IAAZ,CAAF;AACD,SAHD,CAGE,OAAOI,KAAP,EAAc;AACd,iBAAOX,EAAE,CACP,IAAIY,KAAJ,CACE,sCACEb,OAAO,CAACI,GADV,GAEE,WAFF,GAGEQ,KAAK,CAACE,OAJV,CADO,CAAT;AAQD;AACF,OAdD,MAcO;AACLb,QAAAA,EAAE,CAAC,IAAIY,KAAJ,CAAU,iBAAiBX,GAAG,CAACK,MAArB,GAA8B,WAA9B,GAA4CP,OAAO,CAACI,GAA9D,CAAD,CAAF;AACD;AACF,KAlBD;AAmBAF,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,OAArB,EAA8B,UAAAS,CAAC,EAAI;AACjCd,MAAAA,EAAE,CAACc,CAAD,CAAF;AACD,KAFD;AAGAb,IAAAA,GAAG,CAACc,IAAJ;AACD,GA3BD;AA4BD,CAtCD,MAsCO;AACLlB,EAAAA,MAAM,CAACC,OAAP,GAAiB,gBAAyBE,EAAzB,EAA6B;AAAA,QAAfD,OAAe;;AAC5C,QAAMiB,CAAC,GAAGC,OAAO,CAAC,MAAD,CAAjB;;AAEAD,IAAAA,CAAC;AAAGE,MAAAA,WAAW,EAAE;AAAhB,OAAyBnB,OAAzB,GAAoC,UAACoB,GAAD,EAAMC,GAAN,EAAc;AACjD,UAAID,GAAG,KAAK,IAAZ,EAAkB;AAChBnB,QAAAA,EAAE,CAAC,IAAD,EAAOoB,GAAP,EAAYA,GAAG,CAACC,IAAhB,CAAF;AACD,OAFD,MAEO;AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === 'BROWSER' ||\n (typeof process.versions.electron !== 'undefined' &&\n process.type === 'renderer' &&\n typeof XMLHttpRequest === 'function')\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function(options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', options.url, true);\n xhr.responseType = 'arraybuffer';\n xhr.addEventListener('load', function() {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n 'Response is not a buffer for url ' +\n options.url +\n '. Error: ' +\n error.message\n )\n );\n }\n } else {\n cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));\n }\n });\n xhr.addEventListener('error', e => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function({ ...options }, cb) {\n const p = require('phin');\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js deleted file mode 100644 index 4beabbe0..00000000 --- a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js +++ /dev/null @@ -1,263 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseBitmap = parseBitmap; -exports.getBuffer = getBuffer; -exports.getBufferAsync = getBufferAsync; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _fileType = _interopRequireDefault(require("file-type")); - -var _exifParser = _interopRequireDefault(require("exif-parser")); - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var MIME = _interopRequireWildcard(require("./mime")); - -var _promisify = _interopRequireDefault(require("./promisify")); - -function getMIMEFromBuffer(buffer, path) { - var fileTypeFromBuffer = (0, _fileType["default"])(buffer); - - if (fileTypeFromBuffer) { - // If fileType returns something for buffer, then return the mime given - return fileTypeFromBuffer.mime; - } - - if (path) { - // If a path is supplied, and fileType yields no results, then retry with MIME - // Path can be either a file path or a url - return MIME.getType(path); - } - - return null; -} -/* - * Obtains image orientation from EXIF metadata. - * - * @param img {Jimp} a Jimp image object - * @returns {number} a number 1-8 representing EXIF orientation, - * in particular 1 if orientation tag is missing - */ - - -function getExifOrientation(img) { - return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; -} -/** - * Returns a function which translates EXIF-rotated coordinates into - * non-rotated ones. - * - * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. - * - * @param img {Jimp} a Jimp image object - * @returns {function} transformation function for transformBitmap(). - */ - - -function getExifOrientationTransformation(img) { - var w = img.getWidth(); - var h = img.getHeight(); - - switch (getExifOrientation(img)) { - case 1: - // Horizontal (normal) - // does not need to be supported here - return null; - - case 2: - // Mirror horizontal - return function (x, y) { - return [w - x - 1, y]; - }; - - case 3: - // Rotate 180 - return function (x, y) { - return [w - x - 1, h - y - 1]; - }; - - case 4: - // Mirror vertical - return function (x, y) { - return [x, h - y - 1]; - }; - - case 5: - // Mirror horizontal and rotate 270 CW - return function (x, y) { - return [y, x]; - }; - - case 6: - // Rotate 90 CW - return function (x, y) { - return [y, h - x - 1]; - }; - - case 7: - // Mirror horizontal and rotate 90 CW - return function (x, y) { - return [w - y - 1, h - x - 1]; - }; - - case 8: - // Rotate 270 CW - return function (x, y) { - return [w - y - 1, x]; - }; - - default: - return null; - } -} -/* - * Transforms bitmap in place (moves pixels around) according to given - * transformation function. - * - * @param img {Jimp} a Jimp image object, which bitmap is supposed to - * be transformed - * @param width {number} bitmap width after the transformation - * @param height {number} bitmap height after the transformation - * @param transformation {function} transformation function which defines pixel - * mapping between new and source bitmap. It takes a pair of coordinates - * in the target, and returns a respective pair of coordinates in - * the source bitmap, i.e. has following form: - * `function(new_x, new_y) { return [src_x, src_y] }`. - */ - - -function transformBitmap(img, width, height, transformation) { - // Underscore-prefixed values are related to the source bitmap - // Their counterparts with no prefix are related to the target bitmap - var _data = img.bitmap.data; - var _width = img.bitmap.width; - var data = Buffer.alloc(_data.length); - - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var _transformation = transformation(x, y), - _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), - _x = _transformation2[0], - _y = _transformation2[1]; - - var idx = width * y + x << 2; - - var _idx = _width * _y + _x << 2; - - var pixel = _data.readUInt32BE(_idx); - - data.writeUInt32BE(pixel, idx); - } - } - - img.bitmap.data = data; - img.bitmap.width = width; - img.bitmap.height = height; -} -/* - * Automagically rotates an image based on its EXIF data (if present). - * @param img {Jimp} a Jimp image object - */ - - -function exifRotate(img) { - if (getExifOrientation(img) < 2) return; - var transformation = getExifOrientationTransformation(img); - var swapDimensions = getExifOrientation(img) > 4; - var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; - var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; - transformBitmap(img, newWidth, newHeight, transformation); -} // parses a bitmap from the constructor to the JIMP bitmap property - - -function parseBitmap(data, path, cb) { - var mime = getMIMEFromBuffer(data, path); - - if (typeof mime !== 'string') { - return cb(new Error('Could not find MIME for Buffer <' + path + '>')); - } - - this._originalMime = mime.toLowerCase(); - - try { - var _mime = this.getMIME(); - - if (this.constructor.decoders[_mime]) { - this.bitmap = this.constructor.decoders[_mime](data); - } else { - return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb); - } - } catch (error) { - return cb.call(this, error, this); - } - - try { - this._exif = _exifParser["default"].create(data).parse(); - exifRotate(this); // EXIF data - } catch (error) { - /* meh */ - } - - cb.call(this, null, this); - return this; -} - -function compositeBitmapOverBackground(Jimp, image) { - return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; -} -/** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - -function getBuffer(mime, cb) { - if (mime === constants.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - mime = mime.toLowerCase(); - - if (this._rgba && this.constructor.hasAlpha[mime]) { - this.bitmap.data = Buffer.from(this.bitmap.data); - } else { - // when format doesn't support alpha - // composite onto a new image so that the background shows through alpha channels - this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; - } - - if (this.constructor.encoders[mime]) { - var buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); - } else { - cb.call(this, 'Unsupported MIME type: ' + mime); - } - - return this; -} - -function getBufferAsync(mime) { - return (0, _promisify["default"])(getBuffer, this, mime); -} -//# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map deleted file mode 100644 index dc78d9d8..00000000 --- a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAASA,iBAAT,CAA2BC,MAA3B,EAAmCC,IAAnC,EAAyC;AACvC,MAAMC,kBAAkB,GAAG,0BAASF,MAAT,CAA3B;;AAEA,MAAIE,kBAAJ,EAAwB;AACtB;AACA,WAAOA,kBAAkB,CAACC,IAA1B;AACD;;AAED,MAAIF,IAAJ,EAAU;AACR;AACA;AACA,WAAOG,IAAI,CAACC,OAAL,CAAaJ,IAAb,CAAP;AACD;;AAED,SAAO,IAAP;AACD;AAED;;;;;;;;;AAOA,SAASK,kBAAT,CAA4BC,GAA5B,EAAiC;AAC/B,SAAQA,GAAG,CAACC,KAAJ,IAAaD,GAAG,CAACC,KAAJ,CAAUC,IAA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R,EAA/C,CAAP;AACD;;AAEDtC,EAAAA,IAAI,GAAGA,IAAI,CAACyC,WAAL,EAAP;;AAEA,MAAI,KAAKkB,KAAL,IAAc,KAAKhB,WAAL,CAAiBiB,QAAjB,CAA0B5D,IAA1B,CAAlB,EAAmD;AACjD,SAAKoB,MAAL,CAAYC,IAAZ,GAAmBE,MAAM,CAACsC,IAAP,CAAY,KAAKzC,MAAL,CAAYC,IAAxB,CAAnB;AACD,GAFD,MAEO;AACL;AACA;AACA,SAAKD,MAAL,CAAYC,IAAZ,GAAmB8B,6BAA6B,CAC9C,KAAKR,WADyC,EAE9C,IAF8C,CAA7B,CAGjBtB,IAHF;AAID;;AAED,MAAI,KAAKsB,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,CAAJ,EAAqC;AACnC,QAAMH,MAAM,GAAG,KAAK8C,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,EAAgC,IAAhC,CAAf;AACAsC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBjD,MAApB;AACD,GAHD,MAGO;AACLyC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,4BAA4B9C,IAA1C;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAAS+D,cAAT,CAAwB/D,IAAxB,EAA8B;AACnC,SAAO,2BAAUwD,SAAV,EAAqB,IAArB,EAA2BxD,IAA3B,CAAP;AACD","sourcesContent":["import fileType from 'file-type';\n\nimport EXIFParser from 'exif-parser';\nimport { throwError } from '@jimp/utils';\n\nimport * as constants from '../constants';\nimport * as MIME from './mime';\nimport promisify from './promisify';\n\nfunction getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = fileType(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function(x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function(x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function(x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function(x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function(x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function(x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function(x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport function parseBitmap(data, path, cb) {\n const mime = getMIMEFromBuffer(data, path);\n\n if (typeof mime !== 'string') {\n return cb(new Error('Could not find MIME for Buffer <' + path + '>'));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, 'Unsupported MIME type: ' + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, 'Unsupported MIME type: ' + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/mime.js b/project starter code/node_modules/@jimp/core/dist/utils/mime.js deleted file mode 100644 index 9e48085a..00000000 --- a/project starter code/node_modules/@jimp/core/dist/utils/mime.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getExtension = exports.getType = exports.addType = void 0; -var mimeTypes = {}; - -var findType = function findType(extension) { - return Object.entries(mimeTypes).find(function (type) { - return type[1].includes(extension); - }) || []; -}; - -var addType = function addType(mime, extensions) { - mimeTypes[mime] = extensions; -}; -/** - * Lookup a mime type based on extension - * @param {string} path path to find extension for - * @returns {string} mime found mime type - */ - - -exports.addType = addType; - -var getType = function getType(path) { - var pathParts = path.split('/').slice(-1); - var extension = pathParts[pathParts.length - 1].split('.').pop(); - var type = findType(extension); - return type[0]; -}; -/** - * Return file extension associated with a mime type - * @param {string} type mime type to look up - * @returns {string} extension file extension - */ - - -exports.getType = getType; - -var getExtension = function getExtension(type) { - return (mimeTypes[type.toLowerCase()] || [])[0]; -}; - -exports.getExtension = getExtension; -//# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map b/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map deleted file mode 100644 index 5a3501b1..00000000 --- a/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,SAAS;AAAA,SACxBC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAAAC,IAAI;AAAA,WAAIA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAJ;AAAA,GAAnC,KAAuE,EAD/C;AAAA,CAA1B;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,IAAI,EAAI;AAC7B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAAAZ,IAAI;AAAA,SAAI,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAJ;AAAA,CAAzB","sourcesContent":["const mimeTypes = {};\n\nconst findType = extension =>\n Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split('/').slice(-1);\n const extension = pathParts[pathParts.length - 1].split('.').pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js deleted file mode 100644 index eee30efd..00000000 --- a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js +++ /dev/null @@ -1,236 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.srcOver = srcOver; -exports.dstOver = dstOver; -exports.multiply = multiply; -exports.add = add; -exports.screen = screen; -exports.overlay = overlay; -exports.darken = darken; -exports.lighten = lighten; -exports.hardLight = hardLight; -exports.difference = difference; -exports.exclusion = exclusion; - -function srcOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; - var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; - var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function dstOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; - var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; - var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function multiply(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function add(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra) / a; - var g = (sga + dga) / a; - var b = (sba + dba) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function screen(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function overlay(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function darken(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function lighten(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function hardLight(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function difference(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; - var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; - var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function exclusion(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} -//# sourceMappingURL=composite-modes.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map deleted file mode 100644 index 2d24ac88..00000000 --- a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/composite/composite-modes.js"],"names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"mappings":";;;;;;;;;;;;;;;;;AAAO,SAASA,OAAT,CAAiBC,GAAjB,EAAsBC,GAAtB,EAAoC;AAAA,MAATC,GAAS,uEAAH,CAAG;AACzCF,EAAAA,GAAG,CAACG,CAAJ,IAASD,GAAT;AAEA,MAAMC,CAAC,GAAGF,GAAG,CAACE,CAAJ,GAAQH,GAAG,CAACG,CAAZ,GAAgBF,GAAG,CAACE,CAAJ,GAAQH,GAAG,CAACG,CAAtC;AAEA,MAAMC,CAAC,GAAG,CAACJ,GAAG,CAACI,CAAJ,GAAQJ,GAAG,CAACG,CAAZ,GAAgBF,GAAG,CAACG,CAAJ,GAAQH,GAAG,CAACE,CAAZ,IAAiB,IAAIH,GAAG,CAAC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G,CAAJ,GAAQH,GAAG,CAACE,CAAxB;AACA,MAAMU,GAAG,GAAGZ,GAAG,CAACI,CAAJ,GAAQJ,GAAG,CAACE,CAAxB;AACA,MAAMW,GAAG,GAAGb,GAAG,CAACK,CAAJ,GAAQL,GAAG,CAACE,CAAxB;AAEA,MAAMC,CAAC,GACL,CAACK,GAAG,GAAGR,GAAG,CAACE,CAAV,GACCS,GAAG,GAAGZ,GAAG,CAACG,CADX,GAEC,IAAIM,GAAJ,GAAUG,GAFX,GAGCH,GAAG,IAAI,IAAIR,GAAG,CAACE,CAAZ,CAHJ,GAICS,GAAG,IAAI,IAAIZ,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAOA,MAAME,CAAC,GACL,CAACK,GAAG,GAAGT,GAAG,CAACE,CAAV,GACCU,GAAG,GAAGb,GAAG,CAACG,CADX,GAEC,IAAIO,GAAJ,GAAUG,GAFX,GAGCH,GAAG,IAAI,IAAIT,GAAG,CAACE,CAAZ,CAHJ,GAICU,GAAG,IAAI,IAAIb,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAOA,MAAMG,CAAC,GACL,CAACK,GAAG,GAAGV,GAAG,CAACE,CAAV,GACCW,GAAG,GAAGd,GAAG,CAACG,CADX,GAEC,IAAIQ,GAAJ,GAAUG,GAFX,GAGCH,GAAG,IAAI,IAAIV,GAAG,CAACE,CAAZ,CAHJ,GAICW,GAAG,IAAI,IAAId,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAQA,SAAO;AAAEC,IAAAA,CAAC,EAADA,CAAF;AAAKC,IAAAA,CAAC,EAADA,CAAL;AAAQC,IAAAA,CAAC,EAADA,CAAR;AAAWH,IAAAA,CAAC,EAADA;AAAX,GAAP;AACD","sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"file":"composite-modes.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/index.js b/project starter code/node_modules/@jimp/core/es/composite/index.js deleted file mode 100644 index cd3165d7..00000000 --- a/project starter code/node_modules/@jimp/core/es/composite/index.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = composite; - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var compositeModes = _interopRequireWildcard(require("./composite-modes")); - -/** - * Composites a source image over to this image respecting alpha channels - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {object} options determine what mode to use - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function composite(src, x, y) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var cb = arguments.length > 4 ? arguments[4] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - var _options = options, - mode = _options.mode, - opacitySource = _options.opacitySource, - opacityDest = _options.opacityDest; - - if (!mode) { - mode = constants.BLEND_SOURCE_OVER; - } - - if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) { - opacitySource = 1.0; - } - - if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) { - opacityDest = 1.0; - } - - var blendmode = compositeModes[mode]; // round input - - x = Math.round(x); - y = Math.round(y); - var baseImage = this; - - if (opacityDest !== 1.0) { - baseImage.opacity(opacityDest); - } - - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); - var blended = blendmode({ - r: this.bitmap.data[idx + 0] / 255, - g: this.bitmap.data[idx + 1] / 255, - b: this.bitmap.data[idx + 2] / 255, - a: this.bitmap.data[idx + 3] / 255 - }, { - r: baseImage.bitmap.data[dstIdx + 0] / 255, - g: baseImage.bitmap.data[dstIdx + 1] / 255, - b: baseImage.bitmap.data[dstIdx + 2] / 255, - a: baseImage.bitmap.data[dstIdx + 3] / 255 - }, opacitySource); - baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(blended.r * 255); - baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(blended.g * 255); - baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/index.js.map b/project starter code/node_modules/@jimp/core/es/composite/index.js.map deleted file mode 100644 index 290d15ef..00000000 --- a/project starter code/node_modules/@jimp/core/es/composite/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,SAAT,CAAmBC,GAAnB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAAgD;AAAA,MAAlBC,OAAkB,uEAAR,EAAQ;AAAA,MAAJC,EAAI;;AAC7D,MAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,IAAAA,EAAE,GAAGD,OAAL;AACAA,IAAAA,OAAO,GAAG,EAAV;AACD;;AAED,MAAI,EAAEH,GAAG,YAAY,KAAKK,WAAtB,CAAJ,EAAwC;AACtC,WAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,MAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,WAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAZ4D,iBAclBD,OAdkB;AAAA,MAcvDK,IAduD,YAcvDA,IAduD;AAAA,MAcjDC,aAdiD,YAcjDA,aAdiD;AAAA,MAclCC,WAdkC,YAclCA,WAdkC;;AAgB7D,MAAI,CAACF,IAAL,EAAW;AACTA,IAAAA,IAAI,GAAGG,SAAS,CAACC,iBAAjB;AACD;;AAED,MACE,OAAOH,aAAP,KAAyB,QAAzB,IACAA,aAAa,GAAG,CADhB,IAEAA,aAAa,GAAG,CAHlB,EAIE;AACAA,IAAAA,aAAa,GAAG,GAAhB;AACD;;AAED,MAAI,OAAOC,WAAP,KAA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ent":["import { isNodePattern, throwError } from '@jimp/utils';\nimport * as constants from '../constants';\n\nimport * as compositeModes from './composite-modes';\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== 'number' ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/constants.js b/project starter code/node_modules/@jimp/core/es/constants.js deleted file mode 100644 index cc86acb3..00000000 --- a/project starter code/node_modules/@jimp/core/es/constants.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; -// used to auto resizing etc. -var AUTO = -1; // Align modes for cover, contain, bit masks - -exports.AUTO = AUTO; -var HORIZONTAL_ALIGN_LEFT = 1; -exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; -var HORIZONTAL_ALIGN_CENTER = 2; -exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; -var HORIZONTAL_ALIGN_RIGHT = 4; -exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; -var VERTICAL_ALIGN_TOP = 8; -exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; -var VERTICAL_ALIGN_MIDDLE = 16; -exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; -var VERTICAL_ALIGN_BOTTOM = 32; // blend modes - -exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; -var BLEND_SOURCE_OVER = 'srcOver'; -exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; -var BLEND_DESTINATION_OVER = 'dstOver'; -exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; -var BLEND_MULTIPLY = 'multiply'; -exports.BLEND_MULTIPLY = BLEND_MULTIPLY; -var BLEND_ADD = 'add'; -exports.BLEND_ADD = BLEND_ADD; -var BLEND_SCREEN = 'screen'; -exports.BLEND_SCREEN = BLEND_SCREEN; -var BLEND_OVERLAY = 'overlay'; -exports.BLEND_OVERLAY = BLEND_OVERLAY; -var BLEND_DARKEN = 'darken'; -exports.BLEND_DARKEN = BLEND_DARKEN; -var BLEND_LIGHTEN = 'lighten'; -exports.BLEND_LIGHTEN = BLEND_LIGHTEN; -var BLEND_HARDLIGHT = 'hardLight'; -exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; -var BLEND_DIFFERENCE = 'difference'; -exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; -var BLEND_EXCLUSION = 'exclusion'; // Edge Handling - -exports.BLEND_EXCLUSION = BLEND_EXCLUSION; -var EDGE_EXTEND = 1; -exports.EDGE_EXTEND = EDGE_EXTEND; -var EDGE_WRAP = 2; -exports.EDGE_WRAP = EDGE_WRAP; -var EDGE_CROP = 3; -exports.EDGE_CROP = EDGE_CROP; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/constants.js.map b/project starter code/node_modules/@jimp/core/es/constants.js.map deleted file mode 100644 index 31fc25ea..00000000 --- a/project starter code/node_modules/@jimp/core/es/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = 'srcOver';\nexport const BLEND_DESTINATION_OVER = 'dstOver';\nexport const BLEND_MULTIPLY = 'multiply';\nexport const BLEND_ADD = 'add';\nexport const BLEND_SCREEN = 'screen';\nexport const BLEND_OVERLAY = 'overlay';\nexport const BLEND_DARKEN = 'darken';\nexport const BLEND_LIGHTEN = 'lighten';\nexport const BLEND_HARDLIGHT = 'hardLight';\nexport const BLEND_DIFFERENCE = 'difference';\nexport const BLEND_EXCLUSION = 'exclusion';\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/index.js b/project starter code/node_modules/@jimp/core/es/index.js deleted file mode 100644 index a656d756..00000000 --- a/project starter code/node_modules/@jimp/core/es/index.js +++ /dev/null @@ -1,1291 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addConstants = addConstants; -exports.addJimpMethods = addJimpMethods; -exports.jimpEvMethod = jimpEvMethod; -exports.jimpEvChange = jimpEvChange; -Object.defineProperty(exports, "addType", { - enumerable: true, - get: function get() { - return MIME.addType; - } -}); -exports["default"] = void 0; - -var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); - -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); - -var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); - -var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); - -var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); - -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _fs = _interopRequireDefault(require("fs")); - -var _path = _interopRequireDefault(require("path")); - -var _events = _interopRequireDefault(require("events")); - -var _utils = require("@jimp/utils"); - -var _anyBase = _interopRequireDefault(require("any-base")); - -var _mkdirp = _interopRequireDefault(require("mkdirp")); - -var _pixelmatch = _interopRequireDefault(require("pixelmatch")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _phash = _interopRequireDefault(require("./modules/phash")); - -var _request = _interopRequireDefault(require("./request")); - -var _composite = _interopRequireDefault(require("./composite")); - -var _promisify = _interopRequireDefault(require("./utils/promisify")); - -var MIME = _interopRequireWildcard(require("./utils/mime")); - -var _imageBitmap = require("./utils/image-bitmap"); - -var constants = _interopRequireWildcard(require("./constants")); - -var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases -// 0 and 1 do not exist as possible hash lengths - -var maxHashLength = [NaN, NaN]; - -for (var i = 2; i < 65; i++) { - var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1')); - maxHashLength.push(maxHash.length); -} // no operation - - -function noop() {} // error checking methods - - -function isArrayBuffer(test) { - return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1; -} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, -// But this function is not useful when running in node directly - - -function bufferFromArrayBuffer(arrayBuffer) { - var buffer = Buffer.alloc(arrayBuffer.byteLength); - var view = new Uint8Array(arrayBuffer); - - for (var _i = 0; _i < buffer.length; ++_i) { - buffer[_i] = view[_i]; - } - - return buffer; -} - -function loadFromURL(options, cb) { - (0, _request["default"])(options, function (err, response, data) { - if (err) { - return cb(err); - } - - if ('headers' in response && 'location' in response.headers) { - options.url = response.headers.location; - return loadFromURL(options, cb); - } - - if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) { - return cb(null, data); - } - - var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')'; - return new Error(msg); - }); -} - -function loadBufferFromPath(src, cb) { - if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) { - _fs["default"].readFile(src, cb); - } else { - loadFromURL({ - url: src - }, cb); - } -} - -function isRawRGBAData(obj) { - return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); -} - -function makeRGBABufferFromRGB(buffer) { - if (buffer.length % 3 !== 0) { - throw new Error('Buffer length is incorrect'); - } - - var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); - var j = 0; - - for (var _i2 = 0; _i2 < buffer.length; _i2++) { - rgbaBuffer[j] = buffer[_i2]; - - if ((_i2 + 1) % 3 === 0) { - rgbaBuffer[++j] = 255; - } - - j++; - } - - return rgbaBuffer; -} - -var emptyBitmap = { - data: null, - width: null, - height: null -}; -/** - * Jimp constructor (from a file) - * @param path a path to the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a url with options) - * @param options { url, otherOptions} - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from another Jimp image or raw image data) - * @param image a Jimp image to clone - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a Buffer) - * @param data a Buffer containing the image data - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param background color to fill the image with - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -var Jimp = -/*#__PURE__*/ -function (_EventEmitter) { - (0, _inherits2["default"])(Jimp, _EventEmitter); - - // An object representing a bitmap in memory, comprising: - // - data: a buffer of the bitmap data - // - width: the width of the image in pixels - // - height: the height of the image in pixels - // Default colour to use for new pixels - // Default MIME is PNG - // Exif data for the image - // Whether Transparency supporting formats will be exported as RGB or RGBA - function Jimp() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - (0, _classCallCheck2["default"])(this, Jimp); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { - return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { - return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); - var jimpInstance = (0, _assertThisInitialized2["default"])(_this); - var cb = noop; - - if (isArrayBuffer(args[0])) { - args[0] = bufferFromArrayBuffer(args[0]); - } - - function finish() { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - var err = args[0]; - var evData = err || {}; - evData.methodName = 'constructor'; - setTimeout(function () { - var _cb; - - // run on next tick. - if (err && cb === noop) { - jimpInstance.emitError('constructor', err); - } else if (!err) { - jimpInstance.emitMulti('constructor', 'initialized'); - } - - (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); - }, 1); - } - - if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) { - // create a new image - var w = parseInt(args[0], 10); - var h = parseInt(args[1], 10); - cb = args[2]; // with a hex color - - if (typeof args[2] === 'number') { - _this._background = args[2]; - cb = args[3]; - } // with a css color - - - if (typeof args[2] === 'string') { - _this._background = Jimp.cssColorToHex(args[2]); - cb = args[3]; - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { - _this.bitmap.data.writeUInt32BE(_this._background, _i3); - } - - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) { - cb = args[1] || noop; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadFromURL(args[0], function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, args[0].url, finish); - }); - } else if (args[0] instanceof Jimp) { - // clone an existing Jimp - var original = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.from(original.bitmap.data), - width: original.bitmap.width, - height: original.bitmap.height - }; - _this._quality = original._quality; - _this._deflateLevel = original._deflateLevel; - _this._deflateStrategy = original._deflateStrategy; - _this._filterType = original._filterType; - _this._rgba = original._rgba; - _this._background = original._background; - _this._originalMime = original._originalMime; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (isRawRGBAData(args[0])) { - var imageData = args[0]; - cb = args[1] || noop; - var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; - var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); - _this.bitmap = { - data: buffer, - width: imageData.width, - height: imageData.height - }; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (typeof args[0] === 'string') { - // read from a path - var path = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadBufferFromPath(path, function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, path, finish); - }); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) { - // read from a buffer - var data = args[0]; - cb = args[1]; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.parseBitmap(data, null, finish); - } else { - // Allow client libs to add new ways to build a Jimp object. - // Extra constructors must be added by `Jimp.appendConstructorOption()` - cb = args[args.length - 1]; - - if (typeof cb !== 'function') { - // TODO: try to solve the args after cb problem. - cb = args[args.length - 2]; - - if (typeof cb !== 'function') { - cb = noop; - } - } - - var extraConstructor = Jimp.__extraConstructors.find(function (c) { - return c.test.apply(c, args); - }); - - if (extraConstructor) { - new Promise(function (resolve, reject) { - var _extraConstructor$run; - - return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); - }).then(function () { - return finish(null, (0, _assertThisInitialized2["default"])(_this)); - })["catch"](finish); - } else { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish)); - } - } - - return _this; - } - /** - * Parse a bitmap with the loaded image types. - * - * @param {Buffer} data raw image data - * @param {string} path optional path to file - * @param {function(Error, Jimp)} finish (optional) a callback for when complete - * @memberof Jimp - */ - - - (0, _createClass2["default"])(Jimp, [{ - key: "parseBitmap", - value: function parseBitmap(data, path, finish) { - _imageBitmap.parseBitmap.call(this, data, null, finish); - } - /** - * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) - * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "rgba", - value: function rgba(bool, cb) { - if (typeof bool !== 'boolean') { - return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb); - } - - this._rgba = bool; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - /** - * Emit for multiple listeners - * @param {string} methodName name of the method to emit an error for - * @param {string} eventName name of the eventName to emit an error for - * @param {object} data to emit - */ - - }, { - key: "emitMulti", - value: function emitMulti(methodName, eventName) { - var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - data = Object.assign(data, { - methodName: methodName, - eventName: eventName - }); - this.emit('any', data); - - if (methodName) { - this.emit(methodName, data); - } - - this.emit(eventName, data); - } - }, { - key: "emitError", - value: function emitError(methodName, err) { - this.emitMulti(methodName, 'error', err); - } - /** - * Get the current height of the image - * @return {number} height of the image - */ - - }, { - key: "getHeight", - value: function getHeight() { - return this.bitmap.height; - } - /** - * Get the current width of the image - * @return {number} width of the image - */ - - }, { - key: "getWidth", - value: function getWidth() { - return this.bitmap.width; - } - /** - * Nicely format Jimp object when sent to the console e.g. console.log(image) - * @returns {string} pretty printed - */ - - }, { - key: "inspect", - value: function inspect() { - return ''; - } - /** - * Nicely format Jimp object when converted to a string - * @returns {string} pretty printed - */ - - }, { - key: "toString", - value: function toString() { - return '[object Jimp]'; - } - /** - * Returns the original MIME of the image (default: "image/png") - * @returns {string} the MIME - */ - - }, { - key: "getMIME", - value: function getMIME() { - var mime = this._originalMime || Jimp.MIME_PNG; - return mime; - } - /** - * Returns the appropriate file extension for the original MIME of the image (default: "png") - * @returns {string} the file extension - */ - - }, { - key: "getExtension", - value: function getExtension() { - var mime = this.getMIME(); - return MIME.getExtension(mime); - } - /** - * Writes the image to a file - * @param {string} path a path to the destination file - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "write", - value: function write(path, cb) { - var _this2 = this; - - if (!_fs["default"] || !_fs["default"].createWriteStream) { - throw new Error('Cant access the filesystem. You can use the getBase64 method.'); - } - - if (typeof path !== 'string') { - return _utils.throwError.call(this, 'path must be a string', cb); - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - var mime = MIME.getType(path) || this.getMIME(); - - var pathObj = _path["default"].parse(path); - - if (pathObj.dir) { - _mkdirp["default"].sync(pathObj.dir); - } - - this.getBuffer(mime, function (err, buffer) { - if (err) { - return _utils.throwError.call(_this2, err, cb); - } - - var stream = _fs["default"].createWriteStream(path); - - stream.on('open', function () { - stream.write(buffer); - stream.end(); - }).on('error', function (err) { - return _utils.throwError.call(_this2, err, cb); - }); - stream.on('finish', function () { - cb.call(_this2, null, _this2); - }); - }); - return this; - } - }, { - key: "getBase64", - - /** - * Converts the image to a base 64 string - * @param {string} mime the mime type of the image data to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - value: function getBase64(mime, cb) { - if (mime === Jimp.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - this.getBuffer(mime, function (err, data) { - if (err) { - return _utils.throwError.call(this, err, cb); - } - - var src = 'data:' + mime + ';base64,' + data.toString('base64'); - cb.call(this, null, src); - }); - return this; - } - }, { - key: "hash", - - /** - * Generates a perceptual hash of the image . And pads the string. Can configure base. - * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {string} a string representing the hash - */ - value: function hash(base, cb) { - base = base || 64; - - if (typeof base === 'function') { - cb = base; - base = 64; - } - - if (typeof base !== 'number') { - return _utils.throwError.call(this, 'base must be a number', cb); - } - - if (base < 2 || base > 64) { - return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb); - } - - var hash = this.pHash(); - hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); - - while (hash.length < maxHashLength[base]) { - hash = '0' + hash; // pad out with leading zeros - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hash); - } - - return hash; - } - /** - * Calculates the perceptual hash - * @returns {number} the perceptual hash - */ - - }, { - key: "pHash", - value: function pHash() { - var pHash = new _phash["default"](); - return pHash.getHash(this); - } - /** - * Calculates the hamming distance of the current image and a hash based on their perceptual hash - * @param {hash} compareHash hash to compare to - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - }, { - key: "distanceFromHash", - value: function distanceFromHash(compareHash) { - var pHash = new _phash["default"](); - var currentHash = pHash.getHash(this); - return pHash.distance(currentHash, compareHash); - } - /** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "getPixelIndex", - - /** - * Returns the offset of a pixel in the bitmap buffer - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {number} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function getPixelIndex(x, y, edgeHandling, cb) { - var xi; - var yi; - - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = Jimp.EDGE_EXTEND; - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - xi = x; - yi = y; - - if (edgeHandling === Jimp.EDGE_EXTEND) { - if (x < 0) xi = 0; - if (x >= this.bitmap.width) xi = this.bitmap.width - 1; - if (y < 0) yi = 0; - if (y >= this.bitmap.height) yi = this.bitmap.height - 1; - } - - if (edgeHandling === Jimp.EDGE_WRAP) { - if (x < 0) { - xi = this.bitmap.width + x; - } - - if (x >= this.bitmap.width) { - xi = x % this.bitmap.width; - } - - if (y < 0) { - xi = this.bitmap.height + y; - } - - if (y >= this.bitmap.height) { - yi = y % this.bitmap.height; - } - } - - var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 - - if (xi < 0 || xi >= this.bitmap.width) { - i = -1; - } - - if (yi < 0 || yi >= this.bitmap.height) { - i = -1; - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; - } - /** - * Returns the hex colour value of a pixel - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the color of the pixel - */ - - }, { - key: "getPixelColor", - value: function getPixelColor(x, y, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - var hex = this.bitmap.data.readUInt32BE(idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hex); - } - - return hex; - } - }, { - key: "setPixelColor", - - /** - * Returns the hex colour value of a pixel - * @param {number} hex color to set - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function setPixelColor(hex, x, y, cb) { - if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - this.bitmap.data.writeUInt32BE(hex, idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }, { - key: "hasAlpha", - - /** - * Determine if the image contains opaque pixels. - * @return {boolean} hasAlpha whether the image contains opaque pixels - */ - value: function hasAlpha() { - for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { - for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { - var idx = this.bitmap.width * yIndex + xIndex << 2; - var alpha = this.bitmap.data[idx + 3]; - - if (alpha !== 0xff) { - return true; - } - } - } - - return false; - } - /** - * Iterate scan through a region of the bitmap - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} - */ - - }, { - key: "scanIterator", - value: function scanIterator(x, y, w, h) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers'); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers'); - } - - return (0, _utils.scanIterator)(this, x, y, w, h); - } - }]); - return Jimp; -}(_events["default"]); - -function addConstants(constants) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(constants).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - value = _ref2[1]; - - jimpInstance[name] = value; - }); -} - -function addJimpMethods(methods) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(methods).forEach(function (_ref3) { - var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), - name = _ref4[0], - value = _ref4[1]; - - jimpInstance.prototype[name] = value; - }); -} - -addConstants(constants); -addJimpMethods({ - composite: _composite["default"] -}); -Jimp.__extraConstructors = []; -/** - * Allow client libs to add new ways to build a Jimp object. - * @param {string} name identify the extra constructor. - * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. - * @param {function} run where the magic happens. - */ - -Jimp.appendConstructorOption = function (name, test, run) { - Jimp.__extraConstructors.push({ - name: name, - test: test, - run: run - }); -}; -/** - * Read an image from a file or a Buffer. Takes the same args as the constructor - * @returns {Promise} a promise - */ - - -Jimp.read = function () { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - return new Promise(function (resolve, reject) { - (0, _construct2["default"])(Jimp, args.concat([function (err, image) { - if (err) reject(err);else resolve(image); - }])); - }); -}; - -Jimp.create = Jimp.read; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} r the red value (0-255) - * @param {number} g the green value (0-255) - * @param {number} b the blue value (0-255) - * @param {number} a the alpha value (0-255) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {number} an single integer colour value - */ - -Jimp.rgbaToInt = function (r, g, b, a, cb) { - if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') { - return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb); - } - - if (r < 0 || r > 255) { - return _utils.throwError.call(this, 'r must be between 0 and 255', cb); - } - - if (g < 0 || g > 255) { - _utils.throwError.call(this, 'g must be between 0 and 255', cb); - } - - if (b < 0 || b > 255) { - return _utils.throwError.call(this, 'b must be between 0 and 255', cb); - } - - if (a < 0 || a > 255) { - return _utils.throwError.call(this, 'a must be between 0 and 255', cb); - } - - r = Math.round(r); - b = Math.round(b); - g = Math.round(g); - a = Math.round(a); - var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; -}; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {object} an object with the properties r, g, b and a representing RGBA values - */ - - -Jimp.intToRGBA = function (i, cb) { - if (typeof i !== 'number') { - return _utils.throwError.call(this, 'i must be a number', cb); - } - - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, rgba); - } - - return rgba; -}; -/** - * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number - * @param {string} cssColor a number - * @returns {number} a hex number representing a color - */ - - -Jimp.cssColorToHex = function (cssColor) { - cssColor = cssColor || 0; // 0, null, undefined, NaN - - if (typeof cssColor === 'number') return Number(cssColor); - return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); -}; -/** - * Limits a number to between 0 or 255 - * @param {number} n a number - * @returns {number} the number limited to between 0 or 255 - */ - - -Jimp.limit255 = function (n) { - n = Math.max(n, 0); - n = Math.min(n, 255); - return n; -}; -/** - * Diffs two images and returns - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) - * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } - */ - - -Jimp.diff = function (img1, img2) { - var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; - if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images'); - var bmp1 = img1.bitmap; - var bmp2 = img2.bitmap; - - if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { - if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { - // img1 is bigger - img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height); - } else { - // img2 is bigger (or they are the same in area) - img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); - } - } - - if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) { - return _utils.throwError.call(this, 'threshold must be a number between 0 and 1'); - } - - var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); - var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { - threshold: threshold - }); - return { - percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), - image: diff - }; -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.distance = function (img1, img2) { - var phash = new _phash["default"](); - var hash1 = phash.getHash(img1); - var hash2 = phash.getHash(img2); - return phash.distance(hash1, hash2); -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {hash} hash1 a pHash - * @param {hash} hash2 a pHash - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.compareHashes = function (hash1, hash2) { - var phash = new _phash["default"](); - return phash.distance(hash1, hash2); -}; -/** - * Compute color difference - * 0 means no difference, 1 means maximum difference. - * @param {number} rgba1: first color to compare. - * @param {number} rgba2: second color to compare. - * Both parameters must be an color object {r:val, g:val, b:val, a:val} - * Where `a` is optional and `val` is an integer between 0 and 255. - * @returns {number} float between 0 and 1. - */ - - -Jimp.colorDiff = function (rgba1, rgba2) { - var pow = function pow(n) { - return Math.pow(n, 2); - }; - - var max = Math.max; - var maxVal = 255 * 255 * 3; - - if (rgba1.a !== 0 && !rgba1.a) { - rgba1.a = 255; - } - - if (rgba2.a !== 0 && !rgba2.a) { - rgba2.a = 255; - } - - return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; -}; -/** - * Helper to create Jimp methods that emit events before and after its execution. - * @param {string} methodName The name to be appended to Jimp prototype. - * @param {string} evName The event name to be called. - * It will be prefixed by `before-` and emitted when on method call. - * It will be appended by `ed` and emitted after the method run. - * @param {function} method A function implementing the method itself. - * It will also create a quiet version that will not emit events, to not - * mess the user code with many `changed` event calls. You can call with - * `methodName + "Quiet"`. - * - * The emitted event comes with a object parameter to the listener with the - * `methodName` as one attribute. - */ - - -function jimpEvMethod(methodName, evName, method) { - var evNameBefore = 'before-' + evName; - var evNameAfter = evName.replace(/e$/, '') + 'ed'; - - Jimp.prototype[methodName] = function () { - var wrappedCb; - - for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; - } - - var cb = args[method.length - 1]; - var jimpInstance = this; - - if (typeof cb === 'function') { - wrappedCb = function wrappedCb() { - for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - args[_key5] = arguments[_key5]; - } - - var err = args[0], - data = args[1]; - - if (err) { - jimpInstance.emitError(methodName, err); - } else { - jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); - } - - cb.apply(this, args); - }; - - args[args.length - 1] = wrappedCb; - } else { - wrappedCb = false; - } - - this.emitMulti(methodName, evNameBefore); - var result; - - try { - result = method.apply(this, args); - - if (!wrappedCb) { - this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); - } - } catch (error) { - error.methodName = methodName; - this.emitError(methodName, error); - } - - return result; - }; - - Jimp.prototype[methodName + 'Quiet'] = method; -} -/** - * Creates a new image that is a clone of this one. - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns the new image - */ - - -jimpEvMethod('clone', 'clone', function (cb) { - var clone = new Jimp(this); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(clone, null, clone); - } - - return clone; -}); -/** - * Simplify jimpEvMethod call for the common `change` evName. - * @param {string} methodName name of the method - * @param {function} method to watch changes for - */ - -function jimpEvChange(methodName, method) { - jimpEvMethod(methodName, 'change', method); -} -/** - * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) - * @param b A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -jimpEvChange('background', function (hex, cb) { - if (typeof hex !== 'number') { - return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb); - } - - this._background = hex; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -}); -/** - * Scans through a region of the bitmap, calling a function for each pixel. - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @param f a function to call on even pixel; the (x, y) position of the pixel - * and the index of the pixel in the bitmap buffer are passed to the function - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - -jimpEvChange('scan', function (x, y, w, h, f, cb) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof f !== 'function') { - return _utils.throwError.call(this, 'f must be a function', cb); - } - - var result = (0, _utils.scan)(this, x, y, w, h, f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, result); - } - - return result; -}); - -if (process.env.ENVIRONMENT === 'BROWSER') { - // For use in a web browser or web worker - - /* global self */ - var gl; - - if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') { - gl = window; - } - - if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') { - gl = self; - } - - gl.Jimp = Jimp; - gl.Buffer = Buffer; -} - -var _default = Jimp; -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/index.js.map b/project starter code/node_modules/@jimp/core/es/index.js.map deleted file mode 100644 index 8e69060a..00000000 --- a/project starter code/node_modules/@jimp/core/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self"],"mappings":";;;;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gB,WAAhB,IAA+B,QAAOA,IAAP,0DAAOA,IAAP,OAAgB,QAAnD,EAA6D;AAC3DF,IAAAA,EAAE,GAAGE,IAAL;AACD;;AAEDF,EAAAA,EAAE,CAACzJ,IAAH,GAAUA,IAAV;AACAyJ,EAAAA,EAAE,CAAC1L,MAAH,GAAYA,MAAZ;AACD;;eAIciC,I","sourcesContent":["import fs from 'fs';\nimport Path from 'path';\nimport EventEmitter from 'events';\n\nimport { isNodePattern, throwError, scan, scanIterator } from '@jimp/utils';\nimport anyBase from 'any-base';\nimport mkdirp from 'mkdirp';\nimport pixelMatch from 'pixelmatch';\nimport tinyColor from 'tinycolor2';\n\nimport ImagePHash from './modules/phash';\nimport request from './request';\n\nimport composite from './composite';\nimport promisify from './utils/promisify';\nimport * as MIME from './utils/mime';\nimport { parseBitmap, getBuffer, getBufferAsync } from './utils/image-bitmap';\nimport * as constants from './constants';\n\nconst alphabet =\n '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(\n new Array(64 + 1).join('1')\n );\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString\n .call(test)\n .toLowerCase()\n .indexOf('arraybuffer') > -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if ('headers' in response && 'location' in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === 'object' && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n 'Could not load Buffer from <' +\n options.url +\n '> ' +\n '(HTTP: ' +\n response.statusCode +\n ')';\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === 'function' &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.width === 'number' &&\n typeof obj.height === 'number' &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === 'function' &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error('Buffer length is incorrect');\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = 'constructor';\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError('constructor', err);\n } else if (!err) {\n jimpInstance.emitMulti('constructor', 'initialized');\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === 'number' && typeof args[1] === 'number') ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === 'number') {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === 'string') {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === 'object' && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n\n finish(null, this);\n } else if (typeof args[0] === 'string') {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === 'object' && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== 'function') {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== 'function') {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find(c =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) =>\n extraConstructor.run.call(this, resolve, reject, ...args)\n )\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n 'No matching constructor overloading was found. ' +\n 'Please see the docs for how to call the Jimp constructor.',\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== 'boolean') {\n return throwError.call(\n this,\n 'bool must be a boolean, true for RGBA or false for RGB',\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit('any', data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, 'error', err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n ''\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return '[object Jimp]';\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n 'Cant access the filesystem. You can use the getBase64 method.'\n );\n }\n\n if (typeof path !== 'string') {\n return throwError.call(this, 'path must be a string', cb);\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on('open', () => {\n stream.write(buffer);\n stream.end();\n })\n .on('error', err => {\n return throwError.call(this, err, cb);\n });\n stream.on('finish', () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = path => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n this.getBuffer(mime, function(err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = 'data:' + mime + ';base64,' + data.toString('base64');\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = mime => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === 'function') {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== 'number') {\n return throwError.call(this, 'base must be a number', cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n 'base must be a number between 2 and 64',\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = '0' + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== 'number' ||\n typeof x !== 'number' ||\n typeof y !== 'number'\n )\n return throwError.call(this, 'hex, x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers');\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers');\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function(name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function(...args) {\n return new Promise((resolve, reject) => {\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function(r, g, b, a, cb) {\n if (\n typeof r !== 'number' ||\n typeof g !== 'number' ||\n typeof b !== 'number' ||\n typeof a !== 'number'\n ) {\n return throwError.call(this, 'r, g, b and a must be numbers', cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, 'r must be between 0 and 255', cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, 'g must be between 0 and 255', cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, 'b must be between 0 and 255', cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, 'a must be between 0 and 255', cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function(i, cb) {\n if (typeof i !== 'number') {\n return throwError.call(this, 'i must be a number', cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function(cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === 'number') return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function(n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function(img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, 'img1 and img2 must be an Jimp images');\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {\n return throwError.call(this, 'threshold must be a number between 0 and 1');\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function(img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function(hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function(rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = 'before-' + evName;\n const evNameAfter = evName.replace(/e$/, '') + 'ed';\n\n Jimp.prototype[methodName] = function(...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === 'function') {\n wrappedCb = function(...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + 'Quiet'] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod('clone', 'clone', function(cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, 'change', method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('background', function(hex, cb) {\n if (typeof hex !== 'number') {\n return throwError.call(this, 'hex must be a hexadecimal rgba value', cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('scan', function(x, y, w, h, f, cb) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof f !== 'function') {\n return throwError.call(this, 'f must be a function', cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === 'BROWSER') {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== 'undefined' && typeof window === 'object') {\n gl = window;\n }\n\n if (typeof self !== 'undefined' && typeof self === 'object') {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from './utils/mime';\n\nexport default Jimp;\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/modules/phash.js b/project starter code/node_modules/@jimp/core/es/modules/phash.js deleted file mode 100644 index dac128a5..00000000 --- a/project starter code/node_modules/@jimp/core/es/modules/phash.js +++ /dev/null @@ -1,173 +0,0 @@ -"use strict"; - -/* -Copyright (c) 2011 Elliot Shepherd - -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. -*/ -// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java - -/* - * pHash-like image hash. - * Author: Elliot Shepherd (elliot@jarofworms.com - * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html - */ -function ImagePHash(size, smallerSize) { - this.size = this.size || size; - this.smallerSize = this.smallerSize || smallerSize; - initCoefficients(this.size); -} - -ImagePHash.prototype.size = 32; -ImagePHash.prototype.smallerSize = 8; - -ImagePHash.prototype.distance = function (s1, s2) { - var counter = 0; - - for (var k = 0; k < s1.length; k++) { - if (s1[k] !== s2[k]) { - counter++; - } - } - - return counter / s1.length; -}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. - - -ImagePHash.prototype.getHash = function (img) { - /* 1. Reduce size. - * Like Average Hash, pHash starts with a small image. - * However, the image is larger than 8x8; 32x32 is a good size. - * This is really done to simplify the DCT computation and not - * because it is needed to reduce the high frequencies. - */ - img = img.clone().resize(this.size, this.size); - /* 2. Reduce color. - * The image is reduced to a grayscale just to further simplify - * the number of computations. - */ - - img.grayscale(); - var vals = []; - - for (var x = 0; x < img.bitmap.width; x++) { - vals[x] = []; - - for (var y = 0; y < img.bitmap.height; y++) { - vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; - } - } - /* 3. Compute the DCT. - * The DCT separates the image into a collection of frequencies - * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses - * a 32x32 DCT. - */ - - - var dctVals = applyDCT(vals, this.size); - /* 4. Reduce the DCT. - * This is the magic step. While the DCT is 32x32, just keep the - * top-left 8x8. Those represent the lowest frequencies in the - * picture. - */ - - /* 5. Compute the average value. - * Like the Average Hash, compute the mean DCT value (using only - * the 8x8 DCT low-frequency values and excluding the first term - * since the DC coefficient can be significantly different from - * the other values and will throw off the average). - */ - - var total = 0; - - for (var _x = 0; _x < this.smallerSize; _x++) { - for (var _y = 0; _y < this.smallerSize; _y++) { - total += dctVals[_x][_y]; - } - } - - var avg = total / (this.smallerSize * this.smallerSize); - /* 6. Further reduce the DCT. - * This is the magic step. Set the 64 hash bits to 0 or 1 - * depending on whether each of the 64 DCT values is above or - * below the average value. The result doesn't tell us the - * actual low frequencies; it just tells us the very-rough - * relative scale of the frequencies to the mean. The result - * will not vary as long as the overall structure of the image - * remains the same; this can survive gamma and color histogram - * adjustments without a problem. - */ - - var hash = ''; - - for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { - for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { - hash += dctVals[_x2][_y2] > avg ? '1' : '0'; - } - } - - return hash; -}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java - - -function intToRGBA(i) { - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - return rgba; -} - -var c = []; - -function initCoefficients(size) { - for (var i = 1; i < size; i++) { - c[i] = 1; - } - - c[0] = 1 / Math.sqrt(2.0); -} - -function applyDCT(f, size) { - var N = size; - var F = []; - - for (var u = 0; u < N; u++) { - F[u] = []; - - for (var v = 0; v < N; v++) { - var sum = 0; - - for (var i = 0; i < N; i++) { - for (var j = 0; j < N; j++) { - sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; - } - } - - sum *= c[u] * c[v] / 4; - F[u][v] = sum; - } - } - - return F; -} - -module.exports = ImagePHash; -//# sourceMappingURL=phash.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/modules/phash.js.map b/project starter code/node_modules/@jimp/core/es/modules/phash.js.map deleted file mode 100644 index 5556e315..00000000 --- a/project starter code/node_modules/@jimp/core/es/modules/phash.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WAAL,IAAoBA,WAAvC;AACAC,EAAAA,gBAAgB,CAAC,KAAKF,IAAN,CAAhB;AACD;;AAEDD,UAAU,CAACI,SAAX,CAAqBH,IAArB,GAA4B,EAA5B;AACAD,UAAU,CAACI,SAAX,CAAqBF,WAArB,GAAmC,CAAnC;;AAEAF,UAAU,CAACI,SAAX,CAAqBC,QAArB,GAAgC,UAASC,EAAT,EAAaC,EAAb,EAAiB;AAC/C,MAAIC,OAAO,GAAG,CAAd;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,EAAE,CAACI,MAAvB,EAA+BD,CAAC,EAAhC,EAAoC;AAClC,QAAIH,EAAE,CAACG,CAAD,CAAF,KAAUF,EAAE,CAACE,CAAD,CAAhB,EAAqB;AACnBD,MAAAA,OAAO;AACR;AACF;;AAED,SAAOA,OAAO,GAAGF,EAAE,CAACI,MAApB;AACD,CAVD,C,CAYA;;;AACAV,UAAU,CAACI,SAAX,CAAqBO,OAArB,GAA+B,UAASC,GAAT,EAAc;AAC3C;;;;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AAT,KAAe,MAAMW,CAArB,CAAD,GAA4BE,CAA5B,GAAgCV,IAAI,CAACe,EAA9C,IACAf,IAAI,CAACc,GAAL,CAAU,CAAC,IAAID,CAAJ,GAAQ,CAAT,KAAe,MAAML,CAArB,CAAD,GAA4BG,CAA5B,GAAgCX,IAAI,CAACe,EAA9C,CADA,GAEAR,CAAC,CAACV,CAAD,CAAD,CAAKgB,CAAL,CAHF;AAID;AACF;;AAEDD,MAAAA,GAAG,IAAKP,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function(s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function(img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = '';\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? '1' : '0';\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/request.js b/project starter code/node_modules/@jimp/core/es/request.js deleted file mode 100644 index 4b211f73..00000000 --- a/project starter code/node_modules/@jimp/core/es/request.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/* global XMLHttpRequest */ -if (process.browser || process.env.ENVIRONMENT === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') { - // If we run into a browser or the electron renderer process, - // use XHR method instead of Request node module. - module.exports = function (options, cb) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', options.url, true); - xhr.responseType = 'arraybuffer'; - xhr.addEventListener('load', function () { - if (xhr.status < 400) { - try { - var data = Buffer.from(this.response); - cb(null, xhr, data); - } catch (error) { - return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message)); - } - } else { - cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url)); - } - }); - xhr.addEventListener('error', function (e) { - cb(e); - }); - xhr.send(); - }; -} else { - module.exports = function (_ref, cb) { - var options = (0, _extends2["default"])({}, _ref); - - var p = require('phin'); - - p(_objectSpread({ - compression: true - }, options), function (err, res) { - if (err === null) { - cb(null, res, res.body); - } else { - cb(err); - } - }); - }; -} -//# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/request.js.map b/project starter code/node_modules/@jimp/core/es/request.js.map deleted file mode 100644 index 04a1d461..00000000 --- a/project starter code/node_modules/@jimp/core/es/request.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAASC,OAAT,EAAkBC,EAAlB,EAAsB;AACrC,QAAMC,GAAG,GAAG,IAAIL,cAAJ,EAAZ;AACAK,IAAAA,GAAG,CAACC,IAAJ,CAAS,KAAT,EAAgBH,OAAO,CAACI,GAAxB,EAA6B,IAA7B;AACAF,IAAAA,GAAG,CAACG,YAAJ,GAAmB,aAAnB;AACAH,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,MAArB,EAA6B,YAAW;AACtC,UAAIJ,GAAG,CAACK,MAAJ,GAAa,GAAjB,EAAsB;AACpB,YAAI;AACF,cAAMC,IAAI,GAAGC,MAAM,CAACC,IAAP,CAAY,KAAKC,QAAjB,CAAb;AACAV,UAAAA,EAAE,CAAC,IAAD,EAAOC,GAAP,EAAYM,IAAZ,CAAF;AACD,SAHD,CAGE,OAAOI,KAAP,EAAc;AACd,iBAAOX,EAAE,CACP,IAAIY,KAAJ,CACE,sCACEb,OAAO,CAACI,GADV,GAEE,WAFF,GAGEQ,KAAK,CAACE,OAJV,CADO,CAAT;AAQD;AACF,OAdD,MAcO;AACLb,QAAAA,EAAE,CAAC,IAAIY,KAAJ,CAAU,iBAAiBX,GAAG,CAACK,MAArB,GAA8B,WAA9B,GAA4CP,OAAO,CAACI,GAA9D,CAAD,CAAF;AACD;AACF,KAlBD;AAmBAF,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,OAArB,EAA8B,UAAAS,CAAC,EAAI;AACjCd,MAAAA,EAAE,CAACc,CAAD,CAAF;AACD,KAFD;AAGAb,IAAAA,GAAG,CAACc,IAAJ;AACD,GA3BD;AA4BD,CAtCD,MAsCO;AACLlB,EAAAA,MAAM,CAACC,OAAP,GAAiB,gBAAyBE,EAAzB,EAA6B;AAAA,QAAfD,OAAe;;AAC5C,QAAMiB,CAAC,GAAGC,OAAO,CAAC,MAAD,CAAjB;;AAEAD,IAAAA,CAAC;AAAGE,MAAAA,WAAW,EAAE;AAAhB,OAAyBnB,OAAzB,GAAoC,UAACoB,GAAD,EAAMC,GAAN,EAAc;AACjD,UAAID,GAAG,KAAK,IAAZ,EAAkB;AAChBnB,QAAAA,EAAE,CAAC,IAAD,EAAOoB,GAAP,EAAYA,GAAG,CAACC,IAAhB,CAAF;AACD,OAFD,MAEO;AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === 'BROWSER' ||\n (typeof process.versions.electron !== 'undefined' &&\n process.type === 'renderer' &&\n typeof XMLHttpRequest === 'function')\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function(options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', options.url, true);\n xhr.responseType = 'arraybuffer';\n xhr.addEventListener('load', function() {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n 'Response is not a buffer for url ' +\n options.url +\n '. Error: ' +\n error.message\n )\n );\n }\n } else {\n cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));\n }\n });\n xhr.addEventListener('error', e => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function({ ...options }, cb) {\n const p = require('phin');\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js deleted file mode 100644 index 4beabbe0..00000000 --- a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js +++ /dev/null @@ -1,263 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseBitmap = parseBitmap; -exports.getBuffer = getBuffer; -exports.getBufferAsync = getBufferAsync; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _fileType = _interopRequireDefault(require("file-type")); - -var _exifParser = _interopRequireDefault(require("exif-parser")); - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var MIME = _interopRequireWildcard(require("./mime")); - -var _promisify = _interopRequireDefault(require("./promisify")); - -function getMIMEFromBuffer(buffer, path) { - var fileTypeFromBuffer = (0, _fileType["default"])(buffer); - - if (fileTypeFromBuffer) { - // If fileType returns something for buffer, then return the mime given - return fileTypeFromBuffer.mime; - } - - if (path) { - // If a path is supplied, and fileType yields no results, then retry with MIME - // Path can be either a file path or a url - return MIME.getType(path); - } - - return null; -} -/* - * Obtains image orientation from EXIF metadata. - * - * @param img {Jimp} a Jimp image object - * @returns {number} a number 1-8 representing EXIF orientation, - * in particular 1 if orientation tag is missing - */ - - -function getExifOrientation(img) { - return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; -} -/** - * Returns a function which translates EXIF-rotated coordinates into - * non-rotated ones. - * - * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. - * - * @param img {Jimp} a Jimp image object - * @returns {function} transformation function for transformBitmap(). - */ - - -function getExifOrientationTransformation(img) { - var w = img.getWidth(); - var h = img.getHeight(); - - switch (getExifOrientation(img)) { - case 1: - // Horizontal (normal) - // does not need to be supported here - return null; - - case 2: - // Mirror horizontal - return function (x, y) { - return [w - x - 1, y]; - }; - - case 3: - // Rotate 180 - return function (x, y) { - return [w - x - 1, h - y - 1]; - }; - - case 4: - // Mirror vertical - return function (x, y) { - return [x, h - y - 1]; - }; - - case 5: - // Mirror horizontal and rotate 270 CW - return function (x, y) { - return [y, x]; - }; - - case 6: - // Rotate 90 CW - return function (x, y) { - return [y, h - x - 1]; - }; - - case 7: - // Mirror horizontal and rotate 90 CW - return function (x, y) { - return [w - y - 1, h - x - 1]; - }; - - case 8: - // Rotate 270 CW - return function (x, y) { - return [w - y - 1, x]; - }; - - default: - return null; - } -} -/* - * Transforms bitmap in place (moves pixels around) according to given - * transformation function. - * - * @param img {Jimp} a Jimp image object, which bitmap is supposed to - * be transformed - * @param width {number} bitmap width after the transformation - * @param height {number} bitmap height after the transformation - * @param transformation {function} transformation function which defines pixel - * mapping between new and source bitmap. It takes a pair of coordinates - * in the target, and returns a respective pair of coordinates in - * the source bitmap, i.e. has following form: - * `function(new_x, new_y) { return [src_x, src_y] }`. - */ - - -function transformBitmap(img, width, height, transformation) { - // Underscore-prefixed values are related to the source bitmap - // Their counterparts with no prefix are related to the target bitmap - var _data = img.bitmap.data; - var _width = img.bitmap.width; - var data = Buffer.alloc(_data.length); - - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var _transformation = transformation(x, y), - _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), - _x = _transformation2[0], - _y = _transformation2[1]; - - var idx = width * y + x << 2; - - var _idx = _width * _y + _x << 2; - - var pixel = _data.readUInt32BE(_idx); - - data.writeUInt32BE(pixel, idx); - } - } - - img.bitmap.data = data; - img.bitmap.width = width; - img.bitmap.height = height; -} -/* - * Automagically rotates an image based on its EXIF data (if present). - * @param img {Jimp} a Jimp image object - */ - - -function exifRotate(img) { - if (getExifOrientation(img) < 2) return; - var transformation = getExifOrientationTransformation(img); - var swapDimensions = getExifOrientation(img) > 4; - var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; - var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; - transformBitmap(img, newWidth, newHeight, transformation); -} // parses a bitmap from the constructor to the JIMP bitmap property - - -function parseBitmap(data, path, cb) { - var mime = getMIMEFromBuffer(data, path); - - if (typeof mime !== 'string') { - return cb(new Error('Could not find MIME for Buffer <' + path + '>')); - } - - this._originalMime = mime.toLowerCase(); - - try { - var _mime = this.getMIME(); - - if (this.constructor.decoders[_mime]) { - this.bitmap = this.constructor.decoders[_mime](data); - } else { - return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb); - } - } catch (error) { - return cb.call(this, error, this); - } - - try { - this._exif = _exifParser["default"].create(data).parse(); - exifRotate(this); // EXIF data - } catch (error) { - /* meh */ - } - - cb.call(this, null, this); - return this; -} - -function compositeBitmapOverBackground(Jimp, image) { - return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; -} -/** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - -function getBuffer(mime, cb) { - if (mime === constants.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - mime = mime.toLowerCase(); - - if (this._rgba && this.constructor.hasAlpha[mime]) { - this.bitmap.data = Buffer.from(this.bitmap.data); - } else { - // when format doesn't support alpha - // composite onto a new image so that the background shows through alpha channels - this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; - } - - if (this.constructor.encoders[mime]) { - var buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); - } else { - cb.call(this, 'Unsupported MIME type: ' + mime); - } - - return this; -} - -function getBufferAsync(mime) { - return (0, _promisify["default"])(getBuffer, this, mime); -} -//# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map deleted file mode 100644 index dc78d9d8..00000000 --- a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAASA,iBAAT,CAA2BC,MAA3B,EAAmCC,IAAnC,EAAyC;AACvC,MAAMC,kBAAkB,GAAG,0BAASF,MAAT,CAA3B;;AAEA,MAAIE,kBAAJ,EAAwB;AACtB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@jimp/utils';\n\nimport * as constants from '../constants';\nimport * as MIME from './mime';\nimport promisify from './promisify';\n\nfunction getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = fileType(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function(x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function(x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function(x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function(x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function(x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function(x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function(x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport function parseBitmap(data, path, cb) {\n const mime = getMIMEFromBuffer(data, path);\n\n if (typeof mime !== 'string') {\n return cb(new Error('Could not find MIME for Buffer <' + path + '>'));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, 'Unsupported MIME type: ' + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, 'Unsupported MIME type: ' + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/mime.js b/project starter code/node_modules/@jimp/core/es/utils/mime.js deleted file mode 100644 index 9e48085a..00000000 --- a/project starter code/node_modules/@jimp/core/es/utils/mime.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getExtension = exports.getType = exports.addType = void 0; -var mimeTypes = {}; - -var findType = function findType(extension) { - return Object.entries(mimeTypes).find(function (type) { - return type[1].includes(extension); - }) || []; -}; - -var addType = function addType(mime, extensions) { - mimeTypes[mime] = extensions; -}; -/** - * Lookup a mime type based on extension - * @param {string} path path to find extension for - * @returns {string} mime found mime type - */ - - -exports.addType = addType; - -var getType = function getType(path) { - var pathParts = path.split('/').slice(-1); - var extension = pathParts[pathParts.length - 1].split('.').pop(); - var type = findType(extension); - return type[0]; -}; -/** - * Return file extension associated with a mime type - * @param {string} type mime type to look up - * @returns {string} extension file extension - */ - - -exports.getType = getType; - -var getExtension = function getExtension(type) { - return (mimeTypes[type.toLowerCase()] || [])[0]; -}; - -exports.getExtension = getExtension; -//# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/mime.js.map b/project starter code/node_modules/@jimp/core/es/utils/mime.js.map deleted file mode 100644 index 5a3501b1..00000000 --- a/project starter code/node_modules/@jimp/core/es/utils/mime.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,SAAS;AAAA,SACxBC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAAAC,IAAI;AAAA,WAAIA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAJ;AAAA,GAAnC,KAAuE,EAD/C;AAAA,CAA1B;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,IAAI,EAAI;AAC7B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAAAZ,IAAI;AAAA,SAAI,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAJ;AAAA,CAAzB","sourcesContent":["const mimeTypes = {};\n\nconst findType = extension =>\n Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split('/').slice(-1);\n const extension = pathParts[pathParts.length - 1].split('.').pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/promisify.js b/project starter code/node_modules/@jimp/core/es/utils/promisify.js deleted file mode 100644 index a307532d..00000000 --- a/project starter code/node_modules/@jimp/core/es/utils/promisify.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var promisify = function promisify(fun, ctx) { - for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - - return new Promise(function (resolve, reject) { - args.push(function (err, data) { - if (err) { - reject(err); - } - - resolve(data); - }); - fun.bind(ctx).apply(void 0, args); - }); -}; - -var _default = promisify; -exports["default"] = _default; -//# sourceMappingURL=promisify.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map b/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map deleted file mode 100644 index c72c0c48..00000000 --- a/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/utils/promisify.js"],"names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAMC,GAAN;AAAA,oCAAcC,IAAd;AAAcA,IAAAA,IAAd;AAAA;;AAAA,SAChB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;AAC/BH,IAAAA,IAAI,CAACI,IAAL,CAAU,UAACC,GAAD,EAAMC,IAAN,EAAe;AACvB,UAAID,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD;;AAEDH,MAAAA,OAAO,CAACI,IAAD,CAAP;AACD,KAND;AAOAR,IAAAA,GAAG,CAACS,IAAJ,CAASR,GAAT,gBAAiBC,IAAjB;AACD,GATD,CADgB;AAAA,CAAlB;;eAYeH,S","sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"file":"promisify.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/package.json b/project starter code/node_modules/@jimp/core/package.json deleted file mode 100644 index ab28529b..00000000 --- a/project starter code/node_modules/@jimp/core/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@jimp/core", - "version": "0.16.2", - "description": "Jimp core", - "main": "dist/index.js", - "module": "es/index.js", - "types": "types/index.d.ts", - "files": [ - "dist", - "es", - "index.d.ts", - "fonts", - "types" - ], - "repository": { - "type": "git", - "url": "https://github.com/oliver-moran/jimp.git" - }, - "bugs": { - "url": "https://github.com/oliver-moran/jimp/issues" - }, - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register test/**/*.js", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "Oliver Moran ", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "any-base": "^1.1.0", - "buffer": "^5.2.0", - "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", - "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" - }, - "devDependencies": { - "should": "^13.2.3" - }, - "xo": false, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/core/types/etc.d.ts b/project starter code/node_modules/@jimp/core/types/etc.d.ts deleted file mode 100644 index e5f16b56..00000000 --- a/project starter code/node_modules/@jimp/core/types/etc.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import {Jimp} from '@jimp/core/types/jimp'; - -export interface Image { - bitmap: Bitmap; -} - -export type DecoderFn = (data: Buffer) => Bitmap; -export type EncoderFn = ( - image: ImageType -) => Buffer; - -export type GenericCallback = ( - this: TThis, - err: Error | null, - value: T -) => U; - -/** - * `jimp` must be defined otherwise `this` will not apply properly - * for custom configurations where plugins and types are needed - */ -export type ImageCallback = ( - this: jimp, - err: Error | null, - value: jimp, - coords: { - x: number; - y: number; - } -) => any; - -type BlendMode = { - mode: string; - opacitySource: number; - opacityDest: number; -}; - -type ChangeName = 'background' | 'scan' | 'crop'; - -type ListenableName = - | 'any' - | 'initialized' - | 'before-change' - | 'changed' - | 'before-clone' - | 'cloned' - | ChangeName; - -type ListenerData = T extends 'any' - ? any - : T extends ChangeName - ? { - eventName: 'before-change' | 'changed'; - methodName: T; - [key: string]: any; - } - : { - eventName: T; - methodName: T extends 'initialized' - ? 'constructor' - : T extends 'before-change' | 'changed' - ? ChangeName - : T extends 'before-clone' | 'cloned' ? 'clone' : any; - }; - -type URLOptions = { - url: string; - compression?: boolean; - headers: { - [key: string]: any; - }; -}; - -export interface Bitmap { - data: Buffer; - width: number; - height: number; -} - -export interface RGB { - r: number; - g: number; - b: number; -} - -export interface RGBA { - r: number; - g: number; - b: number; - a: number; -} diff --git a/project starter code/node_modules/@jimp/core/types/index.d.ts b/project starter code/node_modules/@jimp/core/types/index.d.ts deleted file mode 100644 index 83042628..00000000 --- a/project starter code/node_modules/@jimp/core/types/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from '@jimp/core/types/etc'; -export * from '@jimp/core/types/functions'; -export * from '@jimp/core/types/plugins'; -export * from '@jimp/core/types/utils'; -import {Jimp, JimpConstructors} from '@jimp/core/types/jimp'; - -export { Jimp, JimpConstructors }; -declare const defaultExp: Jimp; -export default defaultExp; diff --git a/project starter code/node_modules/@jimp/core/types/jimp.d.ts b/project starter code/node_modules/@jimp/core/types/jimp.d.ts deleted file mode 100644 index a01331c9..00000000 --- a/project starter code/node_modules/@jimp/core/types/jimp.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { - Bitmap, - ImageCallback, - URLOptions, - ListenableName, - ListenerData, - GenericCallback, - BlendMode, - RGBA, - RGB -} from '@jimp/core/types/etc'; - -interface DiffReturn { - percent: number; - image: This; -} - -interface ScanIteratorReturn { - x: number; - y: number; - idx: number; - image: This; -} - -export interface JimpConstructors { - prototype: Jimp; - // Constants - AUTO: -1; - // blend modes - BLEND_SOURCE_OVER: string; - BLEND_DESTINATION_OVER: string; - BLEND_MULTIPLY: string; - BLEND_ADD: string; - BLEND_SCREEN: string; - BLEND_OVERLAY: string; - BLEND_DARKEN: string; - BLEND_LIGHTEN: string; - BLEND_HARDLIGHT: string; - BLEND_DIFFERENCE: string; - BLEND_EXCLUSION: string; - // Align modes for cover, contain, bit masks - HORIZONTAL_ALIGN_LEFT: 1; - HORIZONTAL_ALIGN_CENTER: 2; - HORIZONTAL_ALIGN_RIGHT: 4; - VERTICAL_ALIGN_TOP: 8; - VERTICAL_ALIGN_MIDDLE: 16; - VERTICAL_ALIGN_BOTTOM: 32; - // Edge Handling - EDGE_EXTEND: 1; - EDGE_WRAP: 2; - EDGE_CROP: 3; - - // Constructors - new(path: string, cb?: ImageCallback): this['prototype']; - new(urlOptions: URLOptions, cb?: ImageCallback): this['prototype']; - new(image: Jimp, cb?: ImageCallback): this['prototype']; - new(data: Buffer, cb?: ImageCallback): this['prototype']; - new(data: Bitmap, cb?: ImageCallback): this['prototype']; - new(w: number, h: number, cb?: ImageCallback): this['prototype']; - new( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): this['prototype']; - // For custom constructors when using Jimp.appendConstructorOption - new(...args: any[]): this['prototype']; - - // Functions - /** - * I'd like to make `Args` generic and used in `run` and `test` but alas, - * it's not possible RN: - * https://github.com/microsoft/TypeScript/issues/26113 - */ - appendConstructorOption( - name: string, - test: (...args: any[]) => boolean, - run: ( - this: J, - resolve: (jimp?: J) => any, - reject: (reason: Error) => any, - ...args: any[] - ) => any - ): void; - read(path: string, cb?: ImageCallback): Promise; - read(image: Jimp, cb?: ImageCallback): Promise; - read(data: Buffer, cb?: ImageCallback): Promise; - read( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): Promise; - create(path: string): Promise; - create(image: Jimp): Promise; - create(data: Buffer): Promise; - create(w: number, h: number, background?: number | string): Promise; - rgbaToInt( - r: number, - g: number, - b: number, - a: number, - cb?: GenericCallback - ): number; - intToRGBA(i: number, cb?: GenericCallback): RGBA; - cssColorToHex(cssColor: string): number; - limit255(n: number): number; - diff(img1: Jimp, img2: Jimp, threshold?: number): DiffReturn; - distance(img1: Jimp, img2: Jimp): number; - compareHashes(hash1: string, hash2: string): number; - colorDiff(rgba1: RGB, rgba2: RGB): number; - colorDiff(rgba1: RGBA, rgba2: RGBA): number; -} - -export interface Jimp { - // Properties - bitmap: Bitmap; - _rgba: boolean; - _background: number; - _originalMime: string; - // Methods - on( - event: T, - cb: (data: ListenerData) => any - ): any; - parseBitmap( - data: Buffer, - path: string | null | undefined, - cb?: ImageCallback - ): void; - hasAlpha(): boolean; - getHeight(): number; - getWidth(): number; - inspect(): string; - toString(): string; - getMIME(): string; - getExtension(): string; - distanceFromHash(hash: string): number; - write(path: string, cb?: ImageCallback): this; - writeAsync(path: string): Promise; - rgba(bool: boolean, cb?: ImageCallback): this; - getBase64(mime: string, cb: GenericCallback): this; - getBase64Async(mime: string): Promise; - hash(cb?: GenericCallback): string; - hash( - base: number | null | undefined, - cb?: GenericCallback - ): string; - getBuffer(mime: string, cb: GenericCallback): this; - getBufferAsync(mime: string): Promise; - getPixelIndex( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelIndex( - x: number, - y: number, - edgeHandling: string, - cb?: GenericCallback - ): number; - getPixelColor( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelColour( - x: number, - y: number, - cb?: GenericCallback - ): number; - setPixelColor( - hex: number, - x: number, - y: number, - cb?: ImageCallback - ): this; - setPixelColour( - hex: number, - x: number, - y: number, - cb?: ImageCallback - ): this; - clone(cb?: ImageCallback): this; - cloneQuiet(cb?: ImageCallback): this; - background(hex: number, cb?: ImageCallback): this; - backgroundQuiet(hex: number, cb?: ImageCallback): this; - scan( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanQuiet( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanIterator( - x: number, - y: number, - w: number, - h: number - ): IterableIterator>; - - // Effect methods - composite( - src: Jimp, - x: number, - y: number, - options?: BlendMode, - cb?: ImageCallback - ): this; -} diff --git a/project starter code/node_modules/@jimp/core/types/utils.d.ts b/project starter code/node_modules/@jimp/core/types/utils.d.ts deleted file mode 100644 index afde123a..00000000 --- a/project starter code/node_modules/@jimp/core/types/utils.d.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - JimpType, - JimpPlugin, -} from '@jimp/core/types/plugins'; - -// This is required as providing type arrays gives a union of all the generic -// types in the array rather than an intersection -export type UnionToIntersection = - (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; - -/** - * The values to be extracted from a WellFormedPlugin to put onto the Jimp instance - * Left loose as "any" in order to enable the GetPluginVal to work properly - */ -export type WellFormedValues = - (T extends {class: infer Class} ? Class : {}); - -/** - * The constants to be extracted from a WellFormedPlugin to put onto the Jimp instance - * Left loose as "any" in order to enable the GetPluginConstants to work properly - */ -export type WellFormedConstants = - (T extends {constants: infer Constants} ? Constants : {}); - -// Util type for the functions that deal with `@jimp/custom` -// Must accept any or no props thanks to typing of the `plugins` intersected function -export type FunctionRet = Array<(...props: any[] | never) => T>; - -/** - * This conditional cannot be flipped. TS assumes that Q is `WellFormed` even - * it does not have the `class` or `constant` props. As a result, it will end - * up `undefined`. Because we're always extending `IllformedPlugin` on the - * plugins, this should work fine - */ -export type GetPluginVal = Q extends Required<{class: any}> | Required<{constants: any}> - ? WellFormedValues - : Q; - -export type GetPluginConst = Q extends Required<{class: any}> | Required<{constants: any}> - ? WellFormedConstants - : {}; - -export type GetPluginDecoders = Q extends Required<{class: any}> | Required<{constants: any}> - ? Q extends {decoders: infer Decoders} ? Decoders : {} : {}; - -export type GetPluginEncoders = Q extends Required<{class: any}> | Required<{constants: any}> - ? Q extends {encoders: infer Encoders} ? Encoders : {} : {}; - -type GetPluginFuncArrValues = - // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin value, may be ill-formed or well-formed - GetPluginVal - : // This should never be reached - undefined : undefined; - -/** - * A helper type to get the values to be intersected with `Jimp` to give - * the proper typing given an array of functions for plugins and types - */ -export type GetIntersectionFromPlugins< - PluginFuncArr extends FunctionRet -> = UnionToIntersection, undefined>>; - -type GetPluginFuncArrConsts = - // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin constants, may be ill-formed or well-formed - GetPluginConst - : // This should never be reached - undefined : undefined; - -type GetPluginFuncArrEncoders = - // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin encoders, may be ill-formed or well-formed - GetPluginEncoders - : // This should never be reached - undefined : undefined; - -type GetPluginFuncArrDecoders = - // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin decoders, may be ill-formed or well-formed - GetPluginDecoders - : // This should never be reached - undefined : undefined; - -/** - * A helper type to get the statics to be intersected with `Jimp` to give - * the proper typing given an array of functions for plugins and types - */ -export type GetIntersectionFromPluginsStatics< - PluginFuncArr extends FunctionRet -> = UnionToIntersection> & { - encoders: UnionToIntersection>; - decoders: UnionToIntersection>; -}; - -/** - * While this was added to TS 3.5, in order to support down to TS 2.8, we need - * to export this and use it in sub-packges that utilize it - */ -export type Omit = Pick>; diff --git a/project starter code/node_modules/@jimp/custom/CHANGELOG.md b/project starter code/node_modules/@jimp/custom/CHANGELOG.md deleted file mode 100644 index 9997674c..00000000 --- a/project starter code/node_modules/@jimp/custom/CHANGELOG.md +++ /dev/null @@ -1,47 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.0 (Mon Mar 30 2020) - -#### 🚀 Enhancement - -- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) - -#### Authors: 1 - -- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) - ---- - -# v0.9.6 (Wed Mar 18 2020) - -#### 🏠 Internal - -- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 1 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/README.md b/project starter code/node_modules/@jimp/custom/README.md deleted file mode 100644 index e7892bb6..00000000 --- a/project starter code/node_modules/@jimp/custom/README.md +++ /dev/null @@ -1,196 +0,0 @@ -
- -

@jimp/custom

-

Configure jimp with types and plugins.

-
- -## Useful Defaults - -The following wil configure a `jimp` instance with the same functionality as the main `jimp` package. - -```js -import configure from '@jimp/custom'; -// all of jimp's default types -import types from '@jimp/types'; -// all of jimp's default types -import plugins from '@jimp/plugins'; - -configure({ - types: [types], - plugins: [plugins] -}); -``` - -## Available Methods - -### configure - -Takes a Jimp configuration and applies it to `@jimp/core`. - -Sample Jimp configuration: - -```js -import types from '@jimp/types'; - -import bmp from '@jimp/bmp'; -import jpeg from '@jimp/types'; -... - -configure({ - types: [types] -}) - -// or - -configure({ - types: [bmp, jpeg, ...] -}) -``` - -#### Extending Jimp Further - -You can use configure to add more types and plugins to a jimp multiple times. - -```js -let jimp = configure({ - types: [bmp] -}); - -jimp = configure( - { - types: [jpeg] - }, - jimp -); -``` - -## Type Definition - -To define a new Jimp image type write a function the takes the current Jimp configuration. In this function you can extend Jimp's internal data structures. - -This function must return an object whose key is the mime type and value is an array of valid file extensions. - -```js -const special = require('special-js'); - -const MIME_TYPE = 'image/special'; - -export default () => ({ - mime: {[MIME_TYPE], ['spec', 'special']}, - - constants: { - MIME_SPECIAL: MIME_TYPE - }, - - decoders: { - [MIME_TYPE]: data => special.decode(data) - }, - - encoders: { - [MIME_TYPE]: image => special.encode(image.bitmap) - } -}); -``` - -### Constants - -A jimp image type can expose as many constants as it wants. Each jimp type is required to expose a mime type. - -```js -constants: { - MIME_SPECIAL: MIME_TYPE -}, -``` - -### hasAlpha - -A image type can define whether it supports an alpha channel. - -```js -hasAlpha: { - MIME_SPECIAL: true -}, -``` - -### Decoder - -A function that when supplied with a buffer should return a bitmap with height and width. - -```js -decoders: { - [MIME_TYPE]: data => special.decode(data) -}, -``` - -### Encoder - -A function that when supplied with a Jimp image should return an encoded buffer. - -```js -encoders: { - [MIME_TYPE]: image => special.encode(image.bitmap) -} -``` - -### Class - -Add class properties and function to the Jimp constructor. - -```js -class: { - _quality: 100, - quality: function(n, cb) { - if (typeof n !== 'number') { - return throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}; -``` - -## Plugin Definition - -Defining a plugin has access to all the same things in the type definition. Mainly plugins use just the `constants` and `class` config options. - -Below is the `invert` plugin. If a plugin doesn return an object with `constants` and `class`, all keys are treated as class functions. - -```js -import { isNodePattern } from '@jimp/utils'; - -/** - * Inverts the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); -``` diff --git a/project starter code/node_modules/@jimp/custom/dist/index.js.map b/project starter code/node_modules/@jimp/custom/dist/index.js.map deleted file mode 100644 index afe7b2a4..00000000 --- a/project starter code/node_modules/@jimp/custom/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;AAOe,SAASA,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANC,gBAAM;AACpE,MAAMC,UAAU,GAAG;AACjBC,IAAAA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,CAAoBf,OAApB,CAA4BG,YAA5B;AAEAd,IAAAA,YAAY,CAACK,QAAb,qBACKL,YAAY,CAACK,QADlB,MAEKH,UAAU,CAACG,QAFhB;AAIAL,IAAAA,YAAY,CAACI,QAAb,qBACKJ,YAAY,CAACI,QADlB,MAEKF,UAAU,CAACE,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,MAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIJ,aAAa,CAAC4B,OAAlB,EAA2B;AACzB5B,IAAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/es/index.js b/project starter code/node_modules/@jimp/custom/es/index.js deleted file mode 100644 index ddc334e1..00000000 --- a/project starter code/node_modules/@jimp/custom/es/index.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = configure; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _core = _interopRequireWildcard(require("@jimp/core")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function configure(configuration) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"]; - var jimpConfig = { - hasAlpha: {}, - encoders: {}, - decoders: {}, - "class": {}, - constants: {} - }; - - function addToConfig(newConfig) { - Object.entries(newConfig).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value); - }); - } - - function addImageType(typeModule) { - var type = typeModule(); - - if (Array.isArray(type.mime)) { - _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime)); - } else { - Object.entries(type.mime).forEach(function (mimeType) { - return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType)); - }); - } - - delete type.mime; - addToConfig(type); - } - - function addPlugin(pluginModule) { - var plugin = pluginModule(_core.jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { - // Default to class function - addToConfig({ - "class": plugin - }); - } else { - addToConfig(plugin); - } - } - - if (configuration.types) { - configuration.types.forEach(addImageType); - jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders); - jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders); - jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha); - } - - if (configuration.plugins) { - configuration.plugins.forEach(addPlugin); - } - - (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance); - (0, _core.addConstants)(jimpConfig.constants, jimpInstance); - return _core["default"]; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/es/index.js.map b/project starter code/node_modules/@jimp/custom/es/index.js.map deleted file mode 100644 index afe7b2a4..00000000 --- a/project starter code/node_modules/@jimp/custom/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","plu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C;AAAE,iBAAOiB;AAAT,OAAD,CAAX;AACD,KAHD,MAGO;AACLjB,MAAAA,WAAW,CAACiB,MAAD,CAAX;AACD;AACF;;AAED,MAAIzB,aAAa,CAAC2B,KAAlB,EAAyB;AACvB3B,IAAAA,aAAa,CAAC2B,KAAd,CAAoBf,OAApB,CAA4BG,YAA5B;AAEAd,IAAAA,YAAY,CAACK,QAAb,qBACKL,YAAY,CAACK,QADlB,MAEKH,UAAU,CAACG,QAFhB;AAIAL,IAAAA,YAAY,CAACI,QAAb,qBACKJ,YAAY,CAACI,QADlB,MAEKF,UAAU,CAACE,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,MAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIJ,aAAa,CAAC4B,OAAlB,EAA2B;AACzB5B,IAAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/package.json b/project starter code/node_modules/@jimp/custom/package.json deleted file mode 100644 index e0aa83b5..00000000 --- a/project starter code/node_modules/@jimp/custom/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@jimp/custom", - "version": "0.16.2", - "description": "Interface to customize jimp configuration", - "main": "dist/index.js", - "module": "es/index.js", - "types": "types/index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/custom/src/index.js b/project starter code/node_modules/@jimp/custom/src/index.js deleted file mode 100644 index ce571f80..00000000 --- a/project starter code/node_modules/@jimp/custom/src/index.js +++ /dev/null @@ -1,74 +0,0 @@ -import Jimp, { - addType, - addJimpMethods, - addConstants, - jimpEvChange -} from '@jimp/core'; - -export default function configure(configuration, jimpInstance = Jimp) { - const jimpConfig = { - hasAlpha: {}, - encoders: {}, - decoders: {}, - class: {}, - constants: {} - }; - - function addToConfig(newConfig) { - Object.entries(newConfig).forEach(([key, value]) => { - jimpConfig[key] = { - ...jimpConfig[key], - ...value - }; - }); - } - - function addImageType(typeModule) { - const type = typeModule(); - - if (Array.isArray(type.mime)) { - addType(...type.mime); - } else { - Object.entries(type.mime).forEach(mimeType => addType(...mimeType)); - } - - delete type.mime; - addToConfig(type); - } - - function addPlugin(pluginModule) { - const plugin = pluginModule(jimpEvChange) || {}; - if (!plugin.class && !plugin.constants) { - // Default to class function - addToConfig({ class: plugin }); - } else { - addToConfig(plugin); - } - } - - if (configuration.types) { - configuration.types.forEach(addImageType); - - jimpInstance.decoders = { - ...jimpInstance.decoders, - ...jimpConfig.decoders - }; - jimpInstance.encoders = { - ...jimpInstance.encoders, - ...jimpConfig.encoders - }; - jimpInstance.hasAlpha = { - ...jimpInstance.hasAlpha, - ...jimpConfig.hasAlpha - }; - } - - if (configuration.plugins) { - configuration.plugins.forEach(addPlugin); - } - - addJimpMethods(jimpConfig.class, jimpInstance); - addConstants(jimpConfig.constants, jimpInstance); - - return Jimp; -} diff --git a/project starter code/node_modules/@jimp/custom/types/index.d.ts b/project starter code/node_modules/@jimp/custom/types/index.d.ts deleted file mode 100644 index bdd65342..00000000 --- a/project starter code/node_modules/@jimp/custom/types/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// TypeScript Version: 3.1 -// See the `jimp` package index.d.ts for why the version is not 2.8 -import { - FunctionRet, - Jimp, - JimpPlugin, - JimpType, - GetIntersectionFromPlugins, - GetIntersectionFromPluginsStatics, - JimpConstructors -} from '@jimp/core'; - -type JimpInstance< - TypesFuncArr extends FunctionRet | undefined, - PluginFuncArr extends FunctionRet | undefined, - J extends JimpConstructors -> = J & GetIntersectionFromPluginsStatics> & { - prototype: JimpType & GetIntersectionFromPlugins> -}; - -declare function configure< - TypesFuncArr extends FunctionRet | undefined = undefined, - PluginFuncArr extends FunctionRet | undefined = undefined, - J extends JimpConstructors = JimpConstructors ->( - configuration: { - types?: TypesFuncArr; - plugins?: PluginFuncArr; - }, - jimpInstance?: J - // Since JimpInstance is required, we want to use the default `Jimp` type -): JimpInstance; - -export default configure; diff --git a/project starter code/node_modules/@jimp/custom/types/test.ts b/project starter code/node_modules/@jimp/custom/types/test.ts deleted file mode 100644 index 9b7f20a3..00000000 --- a/project starter code/node_modules/@jimp/custom/types/test.ts +++ /dev/null @@ -1,404 +0,0 @@ -import configure from '@jimp/custom'; -import gif from '@jimp/gif'; -import png from '@jimp/png'; -import displace from '@jimp/plugin-displace'; -import resize from '@jimp/plugin-resize'; -import scale from '@jimp/plugin-scale'; -import types from '@jimp/types'; -import plugins from '@jimp/plugins'; -import * as Jimp from 'jimp'; - -// configure should return a valid Jimp type with addons -const CustomJimp = configure({ - types: [gif, png], - plugins: [displace, resize] -}); - -test('should function the same as the `jimp` types', () => { - const FullCustomJimp = configure({ - types: [types], - plugins: [plugins] - }); - - const jimpInst = new FullCustomJimp('test'); - - // Main Jimp export should already have all of these already applied - // $ExpectError - jimpInst.read('Test'); - jimpInst.displace(jimpInst, 2); - jimpInst.resize(40, 40); - jimpInst.displace(jimpInst, 2); - jimpInst.shadow((err, val, coords) => {}); - jimpInst.fishEye({r: 12}); - jimpInst.circle({radius: 12, x: 12, y: 12}); - // $ExpectError - jimpInst.PNG_FILTER_NONE; - - // $ExpectError - jimpInst.test; - - // $ExpectError - jimpInst.func(); - - // Main Jimp export should already have all of these already applied - FullCustomJimp.read('Test'); - - // $ExpectType 0 - FullCustomJimp.PNG_FILTER_NONE; - - // $ExpectError - FullCustomJimp.test; - - // $ExpectError - FullCustomJimp.func(); - - test('can clone properly', async () => { - const baseImage = await FullCustomJimp.read('filename'); - const cloneBaseImage = baseImage.clone(); - - // $ExpectType number - cloneBaseImage._deflateLevel; - - test('can handle `this` returns on the core type properly', () => { - // $ExpectType number - cloneBaseImage.posterize(3)._quality - }); - - test('can handle `this` returns properly', () => { - cloneBaseImage - .resize(1, 1) - .crop(0, 0, 0, 0) - .mask(cloneBaseImage, 2, 2) - .print('a' as any, 2, 2, 'a' as any) - .resize(1, 1) - .quality(1) - .deflateLevel(2) - ._filterType; - }); - - test('can handle imageCallbacks `this` properly', () => { - cloneBaseImage.rgba(false, (_, jimpCBIn) => { - // $ExpectError - jimpCBIn.read('Test'); - jimpCBIn.displace(jimpInst, 2); - jimpCBIn.resize(40, 40); - // $ExpectType number - jimpCBIn._filterType; - - // $ExpectError - jimpCBIn.test; - - // $ExpectError - jimpCBIn.func(); - }) - }) - }); - - test('Can handle callback with constructor', () => { - const myBmpBuffer: Buffer = {} as any; - - Jimp.read(myBmpBuffer, (err, cbJimpInst) => { - // $ExpectError - cbJimpInst.read('Test'); - cbJimpInst.displace(jimpInst, 2); - cbJimpInst.resize(40, 40); - // $ExpectType number - cbJimpInst._filterType; - - // $ExpectError - cbJimpInst.test; - - // $ExpectError - cbJimpInst.func(); - }); - }); - -}); - -test('can handle custom jimp', () => { - // Constants from types should be applied - // $ExpectType 0 - CustomJimp.PNG_FILTER_NONE; - - // Core functions should still work from Jimp - CustomJimp.read('Test'); - - // Constants should not(?) be applied from ill-formed plugins - // $ExpectError - CustomJimp.displace(CustomJimp, 2); - - // Methods should be applied from well-formed plugins only to the instance - // $ExpectError - CustomJimp.resize(40, 40) - - // Constants should be applied from well-formed plugins - CustomJimp.RESIZE_NEAREST_NEIGHBOR - - // $ExpectError - CustomJimp.test; - - // $ExpectError - CustomJimp.func(); - - const Jiimp = new CustomJimp('test'); - // Methods from types should be applied - Jiimp.deflateLevel(4); - // Constants from types should be applied to the static only - // $ExpectError - Jiimp.PNG_FILTER_NONE; - - // Core functions should still work from Jimp - Jiimp.getPixelColor(1, 1); - - // Constants should be applied from ill-formed plugins - Jiimp.displace(Jiimp, 2); - - // Methods should be applied from well-formed plugins - Jiimp.resize(40, 40) - - // Constants should not be applied to the object - // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR - - // $ExpectError - Jiimp.test; - - // $ExpectError - Jiimp.func(); -}); - -test('can compose', () => { - const OtherCustomJimp = configure({ - plugins: [scale] - }, CustomJimp); - // Constants from types should be applied - // $ExpectType 0 - OtherCustomJimp.PNG_FILTER_NONE; - - // Core functions should still work from Jimp - OtherCustomJimp.read('Test'); - - // Constants should not be applied to the static instance from ill-formed plugins - // $ExpectError - OtherCustomJimp.displace(OtherCustomJimp, 2); - - // Methods should not be applied to the static instance from well-formed plugins - // $ExpectError - OtherCustomJimp.resize(40, 40); - - // Constants should be applied from well-formed plugins - OtherCustomJimp.RESIZE_NEAREST_NEIGHBOR; - - // $ExpectError - OtherCustomJimp.test; - - // $ExpectError - OtherCustomJimp.func(); - - const Jiimp = new OtherCustomJimp('test'); - // Methods from types should be applied - Jiimp.deflateLevel(4); - // Constants from types should not be applied to objects - // $ExpectError - Jiimp.PNG_FILTER_NONE; - - // Methods from new plugins should be applied - Jiimp.scale(3); - - // Methods from types should be applied - Jiimp.filterType(4); - - // Core functions should still work from Jimp - Jiimp.getPixelColor(1, 1); - - // Constants should be applied from ill-formed plugins - Jiimp.displace(Jiimp, 2); - - // Methods should be applied from well-formed plugins - Jiimp.resize(40, 40) - - // Constants should not be applied from well-formed plugins to objects - // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR - - // $ExpectError - Jiimp.test; - - // $ExpectError - Jiimp.func(); -}); - -test('can handle only plugins', () => { - const PluginsJimp = configure({ - plugins: [plugins] - }); - - // Core functions should still work from Jimp - PluginsJimp.read('Test'); - - // Constants should not be applied from ill-formed plugins - // $ExpectError - PluginsJimp.displace(PluginsJimp, 2); - - // Methods should be not be applied to from well-formed plugins to the top level - // $ExpectError - PluginsJimp.resize(40, 40); - - // Constants should be applied from well-formed plugins - // $ExpectType "nearestNeighbor" - PluginsJimp.RESIZE_NEAREST_NEIGHBOR; - - // $ExpectError - PluginsJimp.test; - - // $ExpectError - PluginsJimp.func(); - - const Jiimp = new PluginsJimp('test'); - - // Core functions should still work from Jimp - Jiimp.getPixelColor(1, 1); - - // Constants should be applied from ill-formed plugins - Jiimp.displace(Jiimp, 2); - - // Methods should be applied from well-formed plugins - Jiimp.resize(40, 40) - - // Constants should be not applied to objects from well-formed plugins - // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR - - // $ExpectError - Jiimp.test; - - // $ExpectError - Jiimp.func(); -}) - -test('can handle only all types', () => { - const TypesJimp = configure({ - types: [types] - }); - - // Methods from types should not be applied - // $ExpectError - TypesJimp.filterType(4); - // Constants from types should be applied - // $ExpectType 0 - TypesJimp.PNG_FILTER_NONE; - - // $ExpectError - TypesJimp.test; - - // $ExpectError - TypesJimp.func(); - - const Jiimp = new TypesJimp('test'); - // Methods from types should be applied - Jiimp.filterType(4); - // Constants from types should be not applied to objects - // $ExpectError - Jiimp.PNG_FILTER_NONE; - - // $ExpectError - Jiimp.test; - - // $ExpectError - Jiimp.func(); -}); - -test('can handle only one type', () => { - const PngJimp = configure({ - types: [png] - }); - - // Constants from other types should be not applied - // $ExpectError - PngJimp.MIME_TIFF; - - // Constants from types should be applied - // $ExpectType 0 - PngJimp.PNG_FILTER_NONE; - - // $ExpectError - PngJimp.test; - - // $ExpectError - PngJimp.func(); - - - const Jiimp = new PngJimp('test'); - // Constants from other types should be not applied - // $ExpectError - Jiimp.MIME_TIFF; - - // Constants from types should not be applied to objects - // $ExpectError - Jiimp.PNG_FILTER_NONE; - - // $ExpectError - Jiimp.test; - - // $ExpectError - Jiimp.func(); -}); - - -test('can handle only one plugin', () => { - const ResizeJimp = configure({ - plugins: [resize] - }); - - // Constants from other plugins should be not applied - // $ExpectError - ResizeJimp.FONT_SANS_8_BLACK; - - // Constants from plugin should be applied - // $ExpectType "nearestNeighbor" - ResizeJimp.RESIZE_NEAREST_NEIGHBOR; - - // $ExpectError - ResizeJimp.resize(2, 2); - - // $ExpectError - ResizeJimp.test; - - // $ExpectError - ResizeJimp.func(); - - - const Jiimp: InstanceType = new ResizeJimp('test'); - // Constants from other plugins should be not applied - // $ExpectError - Jiimp.FONT_SANS_8_BLACK; - - // Constants from plugin should not be applied to the object - // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR; - - Jiimp.resize(2, 2); - - // $ExpectError - Jiimp.test; - - // $ExpectError - Jiimp.func(); -}); - - -test('Can handle appendConstructorOption', () => { - const AppendJimp = configure({}); - - AppendJimp.appendConstructorOption( - 'Name of Option', - args => args.hasSomeCustomThing, - function(resolve, reject, args) { - // $ExpectError - this.bitmap = 3; - // $ExpectError - AppendJimp.resize(2, 2); - resolve(); - } - ); -}); diff --git a/project starter code/node_modules/@jimp/gif/CHANGELOG.md b/project starter code/node_modules/@jimp/gif/CHANGELOG.md deleted file mode 100644 index 392a46ce..00000000 --- a/project starter code/node_modules/@jimp/gif/CHANGELOG.md +++ /dev/null @@ -1,36 +0,0 @@ -# v0.13.0 (Fri Jun 05 2020) - -#### 🚀 Enhancement - -- Add single frame encoder for type-gif [#899](https://github.com/oliver-moran/jimp/pull/899) ([@jeffbseeking](https://github.com/jeffbseeking) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Jeff Bonnes ([@jeffbseeking](https://github.com/jeffbseeking)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/dist/index.js b/project starter code/node_modules/@jimp/gif/dist/index.js deleted file mode 100644 index ee1f31c2..00000000 --- a/project starter code/node_modules/@jimp/gif/dist/index.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _omggif = _interopRequireDefault(require("omggif")); - -var _gifwrap = require("gifwrap"); - -var MIME_TYPE = 'image/gif'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']), - constants: { - MIME_GIF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var gifObj = new _omggif["default"].GifReader(data); - var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); - gifObj.decodeAndBlitFrameRGBA(0, gifData); - return { - data: gifData, - width: gifObj.width, - height: gifObj.height - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var bitmap = new _gifwrap.BitmapImage(data.bitmap); - - _gifwrap.GifUtil.quantizeDekker(bitmap, 256); - - var newFrame = new _gifwrap.GifFrame(bitmap); - var gifCodec = new _gifwrap.GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { - return newGif.buffer; - }); - }) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/dist/index.js.map b/project starter code/node_modules/@jimp/gif/dist/index.js.map deleted file mode 100644 index fcc6e6d8..00000000 --- a/project starter code/node_modules/@jimp/gif/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEH;AADD,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,MAAM,GAAG,IAAIC,mBAAIC,SAAR,CAAkBH,IAAlB,CAAf;AACA,UAAMI,OAAO,GAAGC,MAAM,CAACC,KAAP,CAAaL,MAAM,CAACM,KAAP,GAAeN,MAAM,CAACO,MAAtB,GAA+B,CAA5C,CAAhB;AAEAP,MAAAA,MAAM,CAACQ,sBAAP,CAA8B,CAA9B,EAAiCL,OAAjC;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEI,OADD;AAELG,QAAAA,KAAK,EAAEN,MAAM,CAACM,KAFT;AAGLC,QAAAA,MAAM,EAAEP,MAAM,CAACO;AAHV,OAAP;AAKD,KAZK,CAPY;AAsBpBE,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMW,MAAM,GAAG,IAAIC,oBAAJ,CAAgBZ,IAAI,CAACW,MAArB,CAAf;;AACAE,uBAAQC,cAAR,CAAuBH,MAAvB,EAA+B,GAA/B;;AACA,UAAMI,QAAQ,GAAG,IAAIC,iBAAJ,CAAaL,MAAb,CAAjB;AACA,UAAMM,QAAQ,GAAG,IAAIC,iBAAJ,EAAjB;AACA,aAAOD,QAAQ,CAACE,SAAT,CAAmB,CAACJ,QAAD,CAAnB,EAA+B,EAA/B,EAAmCK,IAAnC,CAAwC,UAAAC,MAAM,EAAI;AACvD,eAAOA,MAAM,CAACC,MAAd;AACD,OAFM,CAAP;AAGD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import GIF from 'omggif';\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';\n\nconst MIME_TYPE = 'image/gif';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['gif'] },\n\n constants: {\n MIME_GIF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/es/index.js b/project starter code/node_modules/@jimp/gif/es/index.js deleted file mode 100644 index 37015c1e..00000000 --- a/project starter code/node_modules/@jimp/gif/es/index.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _omggif = _interopRequireDefault(require("omggif")); - -var _gifwrap = require("gifwrap"); - -var MIME_TYPE = 'image/gif'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']), - constants: { - MIME_GIF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var gifObj = new _omggif["default"].GifReader(data); - var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); - gifObj.decodeAndBlitFrameRGBA(0, gifData); - return { - data: gifData, - width: gifObj.width, - height: gifObj.height - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var bitmap = new _gifwrap.BitmapImage(data.bitmap); - - _gifwrap.GifUtil.quantizeDekker(bitmap, 256); - - var newFrame = new _gifwrap.GifFrame(bitmap); - var gifCodec = new _gifwrap.GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { - return newGif.buffer; - }); - }) - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/es/index.js.map b/project starter code/node_modules/@jimp/gif/es/index.js.map deleted file mode 100644 index fcc6e6d8..00000000 --- a/project starter code/node_modules/@jimp/gif/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifC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if';\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';\n\nconst MIME_TYPE = 'image/gif';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['gif'] },\n\n constants: {\n MIME_GIF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/index.d.ts b/project starter code/node_modules/@jimp/gif/index.d.ts deleted file mode 100644 index 59ac0778..00000000 --- a/project starter code/node_modules/@jimp/gif/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { DecoderFn } from '@jimp/core'; - -interface Gif { - mime: { - 'image/gif': string[] - } - - constants: { - MIME_GIF: 'image/gif'; - } - - decoders: { - 'image/gif': DecoderFn - } -} - -export default function(): Gif; diff --git a/project starter code/node_modules/@jimp/gif/package.json b/project starter code/node_modules/@jimp/gif/package.json deleted file mode 100644 index 624b6ac9..00000000 --- a/project starter code/node_modules/@jimp/gif/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@jimp/gif", - "version": "0.16.2", - "description": "Default Jimp gif encoder/decoder.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", - "omggif": "^1.0.9" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/gif/src/index.js b/project starter code/node_modules/@jimp/gif/src/index.js deleted file mode 100644 index 5ef76943..00000000 --- a/project starter code/node_modules/@jimp/gif/src/index.js +++ /dev/null @@ -1,39 +0,0 @@ -import GIF from 'omggif'; -import { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap'; - -const MIME_TYPE = 'image/gif'; - -export default () => ({ - mime: { [MIME_TYPE]: ['gif'] }, - - constants: { - MIME_GIF: MIME_TYPE - }, - - decoders: { - [MIME_TYPE]: data => { - const gifObj = new GIF.GifReader(data); - const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); - - gifObj.decodeAndBlitFrameRGBA(0, gifData); - - return { - data: gifData, - width: gifObj.width, - height: gifObj.height - }; - } - }, - - encoders: { - [MIME_TYPE]: data => { - const bitmap = new BitmapImage(data.bitmap); - GifUtil.quantizeDekker(bitmap, 256); - const newFrame = new GifFrame(bitmap); - const gifCodec = new GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(newGif => { - return newGif.buffer; - }); - } - } -}); diff --git a/project starter code/node_modules/@jimp/gif/test/gif.test.js b/project starter code/node_modules/@jimp/gif/test/gif.test.js deleted file mode 100644 index 100d7a5d..00000000 --- a/project starter code/node_modules/@jimp/gif/test/gif.test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import gif from '../src'; - -const jimp = configure({ types: [gif] }, Jimp); - -describe('GIF', () => { - const imagesDir = getTestDir(__dirname) + '/images'; - - it('load GIF', async () => { - const image = await jimp.read(imagesDir + '/flower.gif'); - image.getPixelColor(10, 10).should.be.equal(0xe5e6d9ff); - }); - - it('load animated GIF', async () => { - const image = await jimp.read(imagesDir + '/animated.gif'); - image.getPixelColor(10, 10).should.be.equal(0xa1d2f1ff); - }); - - it('export GIF', async () => { - const jgd = await jimp.read(imagesDir + '/flower.gif'); - const buffer = await jgd.getBufferAsync('image/gif'); - buffer - .toString() - .startsWith('GIF') - .should.be.equal(true); - }); -}); diff --git a/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md b/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md deleted file mode 100644 index 14710629..00000000 --- a/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md +++ /dev/null @@ -1,72 +0,0 @@ -# v0.16.2 (Thu Sep 15 2022) - -#### 🐛 Bug Fix - -- Bump jpeg-js over 0.4.4 to avoid cve-2022-25851 [#1093](https://github.com/oliver-moran/jimp/pull/1093) ([@melhadad](https://github.com/melhadad)) - -#### Authors: 1 - -- Michael Elhadad ([@melhadad](https://github.com/melhadad)) - ---- - -# v0.16.1 (Fri Aug 28 2020) - -#### 🐛 Bug Fix - -- upgrade jpeg-js dependency [#933](https://github.com/oliver-moran/jimp/pull/933) (vincentdufrasnes@vincent-dufrasnes [@Chupsy](https://github.com/Chupsy)) - -#### Authors: 2 - -- Vincent Dufrasnes ([@Chupsy](https://github.com/Chupsy)) -- vincent dufrasnes (vincentdufrasnes@vincent-dufrasnes) - ---- - -# v0.12.1 (Tue May 19 2020) - -#### 🐛 Bug Fix - -- update jpeg-js [#892](https://github.com/oliver-moran/jimp/pull/892) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 1 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.0 (Mon Mar 30 2020) - -#### 🚀 Enhancement - -- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) - -#### Authors: 1 - -- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/dist/index.js b/project starter code/node_modules/@jimp/jpeg/dist/index.js deleted file mode 100644 index 72f904ca..00000000 --- a/project starter code/node_modules/@jimp/jpeg/dist/index.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _jpegJs = _interopRequireDefault(require("jpeg-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/jpeg'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']), - constants: { - MIME_JPEG: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - return _jpegJs["default"].encode(image.bitmap, image._quality).data; - }), - "class": { - // The quality to be used when saving JPEG images - _quality: 100, - - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality: function quality(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return _utils.throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/dist/index.js.map b/project starter code/node_modules/@jimp/jpeg/dist/index.js.map deleted file mode 100644 index e8af597e..00000000 --- a/project starter code/node_modules/@jimp/jpeg/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/es/index.js b/project starter code/node_modules/@jimp/jpeg/es/index.js deleted file mode 100644 index cb33e15c..00000000 --- a/project starter code/node_modules/@jimp/jpeg/es/index.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _jpegJs = _interopRequireDefault(require("jpeg-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/jpeg'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']), - constants: { - MIME_JPEG: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - return _jpegJs["default"].encode(image.bitmap, image._quality).data; - }), - "class": { - // The quality to be used when saving JPEG images - _quality: 100, - - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality: function quality(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return _utils.throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/es/index.js.map b/project starter code/node_modules/@jimp/jpeg/es/index.js.map deleted file mode 100644 index e8af597e..00000000 --- a/project starter code/node_modules/@jimp/jpeg/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/index.d.ts b/project starter code/node_modules/@jimp/jpeg/index.d.ts deleted file mode 100644 index 3423874d..00000000 --- a/project starter code/node_modules/@jimp/jpeg/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core'; - -interface JpegClass { - _quality: number; - quality: (n: number, cb?: ImageCallback) => this; -} - -interface Jpeg { - mime: { 'image/jpeg': string[] }, - - constants: { - MIME_JPEG: 'image/jpeg'; - } - - encoders: { - 'image/jpeg': EncoderFn - } - - decoders: { - 'image/jpeg': DecoderFn - } - - class: JpegClass -} - -export default function(): Jpeg; diff --git a/project starter code/node_modules/@jimp/jpeg/package.json b/project starter code/node_modules/@jimp/jpeg/package.json deleted file mode 100644 index 199b613a..00000000 --- a/project starter code/node_modules/@jimp/jpeg/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jimp/jpeg", - "version": "0.16.2", - "description": "Default Jimp jpeg encoder/decoder.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/jpeg/src/index.js b/project starter code/node_modules/@jimp/jpeg/src/index.js deleted file mode 100644 index a746a78b..00000000 --- a/project starter code/node_modules/@jimp/jpeg/src/index.js +++ /dev/null @@ -1,48 +0,0 @@ -import JPEG from 'jpeg-js'; -import { throwError, isNodePattern } from '@jimp/utils'; - -const MIME_TYPE = 'image/jpeg'; - -export default () => ({ - mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] }, - - constants: { - MIME_JPEG: MIME_TYPE - }, - - decoders: { - [MIME_TYPE]: JPEG.decode - }, - - encoders: { - [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data - }, - - class: { - // The quality to be used when saving JPEG images - _quality: 100, - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality(n, cb) { - if (typeof n !== 'number') { - return throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } - } -}); diff --git a/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js b/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js deleted file mode 100644 index 480e8a1d..00000000 --- a/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js +++ /dev/null @@ -1,48 +0,0 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import jpeg from '../src'; - -const jimp = configure({ types: [jpeg] }, Jimp); - -describe('JPEG', () => { - const imagesDir = getTestDir(__dirname) + '/images'; - - it('load JPG', async () => { - const image = await jimp.read(imagesDir + '/cops.jpg'); - - image.getPixelColor(10, 10).should.be.equal(0x3f4a02ff); - image.getPixelColor(220, 190).should.be.equal(0x5d94b6ff); - image.getPixelColor(350, 130).should.be.equal(0xdf7944ff); - }); - - it('load JPG with fill bytes', async () => { - const image = await jimp.read(imagesDir + '/fillbytes.jpg'); - - image.getPixelColor(10, 10).should.be.equal(0xaeb8c3ff); - image.getPixelColor(220, 190).should.be.equal(0x262b21ff); - image.getPixelColor(350, 130).should.be.equal(0x4e5d30ff); - }); - - it('export JPG', async () => { - const image = await jimp.read({ - width: 3, - height: 3, - data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] - }); - image.quality(50); - const buffer = await image.getBufferAsync('image/jpeg'); - - buffer.toString().should.match(/^.{3,9}JFIF\u0000/); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/README.md b/project starter code/node_modules/@jimp/plugin-blit/README.md deleted file mode 100644 index e7e7ee49..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/README.md +++ /dev/null @@ -1,34 +0,0 @@ -
- -

@jimp/plugin-blit

-

Blit an image.

-
- -> Blit - a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. - -## Usage - -Blits a source image on to this image - -- @param {Jimp} src image to blit -- @param {number} x the x position to blit the image -- @param {number} y the y position to blit the image -- @param {number} srcx (optional) the x position from which to crop the source image -- @param {number} srcy (optional) the y position from which to crop the source image -- @param {number} srcw (optional) the width to which to crop the source image -- @param {number} srch (optional) the height to which to crop the source image -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - const parrot = await jimp.read('test/party-parrot.png'); - - image.blit(parrot, x, y); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js deleted file mode 100644 index 55717769..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); // round input - - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - var maxWidth = this.bitmap.width; - var maxHeight = this.bitmap.height; - var baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { - var xOffset = x + sx - srcx; - var yOffset = y + sy - srcy; - - if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { - var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - var _src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - var dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map deleted file mode 100644 index 0c3d69b7..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"mappings":";;;;;;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;;;;;;AAYAA,IAAAA,IAboB,gBAafC,GAbe,EAaVC,CAbU,EAaPC,CAbO,EAaJC,IAbI,EAaEC,IAbF,EAaQC,IAbR,EAacC,IAbd,EAaoBC,EAbpB,EAawB;AAC1C,UAAI,EAAEP,GAAG,YAAY,KAAKQ,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAON,CAAP,KAAa,QAAb,IAAyB,O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,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof srcx === 'function') {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n 'srcx, srcy, srcw, srch must be numbers',\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/es/index.js b/project starter code/node_modules/@jimp/plugin-blit/es/index.js deleted file mode 100644 index 0a6f8acf..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/es/index.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); // round input - - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - var maxWidth = this.bitmap.width; - var maxHeight = this.bitmap.height; - var baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { - var xOffset = x + sx - srcx; - var yOffset = y + sy - srcy; - - if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { - var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - var _src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - var dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map b/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map deleted file mode 100644 index 0c3d69b7..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"mappings":";;;;;;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;;;;;;AAYAA,IAAAA,IAboB,gBAafC,GAbe,EAaVC,CAbU,EAaPC,CAbO,EAaJC,IAbI,EAaEC,IAbF,EAaQC,IAbR,EAacC,IAbd,EAaoBC,EAbpB,EAawB;AAC1C,UAAI,EAAEP,GAAG,YAAY,KAAKQ,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAON,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAI,OAAOJ,IAAP,KAAgB,UAApB,EAAgC;AAC9BI,QAAAA,EAAE,GAAGJ,IAAL;AACAA,QAAAA,IAAI,GAAG,CAAP;AACAC,QAAAA,IAAI,GAAG,CAAP;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ACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAtB,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC2B,CAAJ,GAAQK,GAAG,CAACL,CAArB,IAA0BK,GAAG,CAACL,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDK,GAAG,CAACL,CADvD;AAEAT,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC6B,CAAJ,GAAQG,GAAG,CAACH,CAArB,IAA0BG,GAAG,CAACH,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDG,GAAG,CAACH,CADvD;AAEAX,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC8B,CAAJ,GAAQE,GAAG,CAACF,CAArB,IAA0BE,GAAG,CAACF,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDE,GAAG,CAACF,CADvD;AAEAZ,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IAAoC,KAAKjB,WAAL,CAAiByB,QAAjB,CAClCD,GAAG,CAACD,CAAJ,GAAQ/B,IAAG,CAAC+B,CADsB,CAApC;AAGD;AACF,OAnCD;;AAqCA,UAAI,0BAAcxB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof srcx === 'function') {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n 'srcx, srcy, srcw, srch must be numbers',\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/index.d.ts b/project starter code/node_modules/@jimp/plugin-blit/index.d.ts deleted file mode 100644 index abe5ee2c..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Jimp, ImageCallback } from '@jimp/core'; - -interface Blit { - blit(src: Jimp, x: number, y: number, cb?: ImageCallback): this; - blit( - src: Jimp, - x: number, - y: number, - srcx: number, - srcy: number, - srcw: number, - srch: number, - cb?: ImageCallback - ): this; -} - -export default function(): Blit; diff --git a/project starter code/node_modules/@jimp/plugin-blit/package.json b/project starter code/node_modules/@jimp/plugin-blit/package.json deleted file mode 100644 index 74cefc97..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jimp/plugin-blit", - "version": "0.16.2", - "description": "Blit an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-blit/src/index.js b/project starter code/node_modules/@jimp/plugin-blit/src/index.js deleted file mode 100644 index 467bd314..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/src/index.js +++ /dev/null @@ -1,105 +0,0 @@ -import { throwError, isNodePattern } from '@jimp/utils'; - -export default () => ({ - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ( - typeof srcx === typeof srcy && - typeof srcy === typeof srcw && - typeof srcw === typeof srch - ) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return throwError.call( - this, - 'srcx, srcy, srcw, srch must be numbers', - cb - ); - } - - // round input - x = Math.round(x); - y = Math.round(y); - - // round input - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - - const maxWidth = this.bitmap.width; - const maxHeight = this.bitmap.height; - const baseImage = this; - - src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) { - const xOffset = x + sx - srcx; - const yOffset = y + sy - srcy; - - if ( - xOffset >= 0 && - yOffset >= 0 && - maxWidth - xOffset > 0 && - maxHeight - yOffset > 0 - ) { - const dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - const src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - - const dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - - baseImage.bitmap.data[dstIdx] = - ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = - ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = - ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255( - dst.a + src.a - ); - } - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js b/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js deleted file mode 100644 index 94a372f7..00000000 --- a/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js +++ /dev/null @@ -1,235 +0,0 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import jpeg from '@jimp/jpeg'; -import configure from '@jimp/custom'; - -import blit from '../src'; - -const jimp = configure({ types: [jpeg], plugins: [blit] }, Jimp); -const testDir = getTestDir(__dirname); - -describe('Blit over image', function() { - this.timeout(15000); - const targetJGD = mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ); - const srcJGD = mkJGD( - '□□□□□□', - '□▥▥▥▥□', - '□▥■■▥□', - '□▥■■▥□', - '□▥▥▥▥□', - '□□□□□□' - ); - - let targetImg; - let srcImg; // stores the Jimp instances of the JGD images above. - - before(done => { - const img1 = jimp.read(targetJGD); - const img2 = jimp.read(srcJGD); - Promise.all([img1, img2]) - .then(images => { - targetImg = images[0]; - srcImg = images[1]; - done(); - }) - .catch(done); - }); - - it('blit on top, with no crop', () => { - targetImg - .clone() - .blit(srcImg, 0, 0) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '□□□□□□▸▸', - '□▥▥▥▥□▸▸', - '□▥■■▥□▸▸', - '□▥■■▥□▸▸', - '□▥▥▥▥□◆◆', - '□□□□□□◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ) - ); - }); - - it('blit on middle, with no crop', () => { - targetImg - .clone() - .blit(srcImg, 1, 1) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴□□□□□□▸', - '▴□▥▥▥▥□▸', - '▴□▥■■▥□▸', - '▾□▥■■▥□◆', - '▾□▥▥▥▥□◆', - '▾□□□□□□◆', - '▾▾▾▾◆◆◆◆' - ) - ); - }); - - it('blit on middle, with x,y crop', () => { - targetImg - .clone() - .blit(srcImg, 2, 2, 1, 1, 5, 5) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▥▥▥▥□▸', - '▴▴▥■■▥□▸', - '▾▾▥■■▥□◆', - '▾▾▥▥▥▥□◆', - '▾▾□□□□□◆', - '▾▾▾▾◆◆◆◆' - ) - ); - }); - - it('blit on middle, with x,y,w,h crop', () => { - targetImg - .clone() - .blit(srcImg, 2, 2, 1, 1, 4, 4) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▥▥▥▥▸▸', - '▴▴▥■■▥▸▸', - '▾▾▥■■▥◆◆', - '▾▾▥▥▥▥◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ) - ); - }); - - it('blit partially out, on top-left', () => { - targetImg - .clone() - .blit(srcImg, -1, -1) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▥▥▥▥□▸▸▸', - '▥■■▥□▸▸▸', - '▥■■▥□▸▸▸', - '▥▥▥▥□▸▸▸', - '□□□□□◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ) - ); - }); - - it('blit partially out, on bottom-right', () => { - targetImg - .clone() - .blit(srcImg, 3, 3) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴□□□□□', - '▾▾▾□▥▥▥▥', - '▾▾▾□▥■■▥', - '▾▾▾□▥■■▥', - '▾▾▾□▥▥▥▥' - ) - ); - }); - - it('blit alpha', async () => { - const expectedImg = await Jimp.read(testDir + '/images/blit-alpha.png'); - const dice = await Jimp.read(testDir + '/images/dice.png'); - const image = await Jimp.read(testDir + '/images/cops.jpg'); - - image - .blit(dice, 0, 0) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - async function createCat(catNum, len) { - let imgHeight = 60; - - const butt = await Jimp.read(testDir + '/images/cat_butt.png'); - const head = await Jimp.read(testDir + '/images/cat_head.png'); - const fuzz = await Jimp.read(testDir + '/images/cat_fuzz.png'); - - let longCat = len; - longCat = longCat > 20 ? 20 : longCat; - longCat = longCat <= 1 ? 1 : longCat; - - const cat = - Math.floor(catNum * (head.bitmap.height / imgHeight)) * imgHeight; - - const newImage = await Jimp.create( - butt.bitmap.width + head.bitmap.width + fuzz.bitmap.width * longCat, - imgHeight, - 0x00000000 - ); - - newImage.blit(butt, 0, 0, 0, cat, butt.bitmap.width, imgHeight); - for (let i = 0; i < longCat; i++) { - newImage.blit( - fuzz, - butt.bitmap.width + fuzz.bitmap.width * i, - 0, - 0, - cat, - fuzz.bitmap.width, - imgHeight - ); - } - - newImage.blit( - head, - butt.bitmap.width + fuzz.bitmap.width * longCat, - 0, - 0, - cat, - head.bitmap.width, - imgHeight - ); - - return newImage; - } - - it('uses src params correctly', async () => { - const expectedSmall = await Jimp.read( - testDir + '/images/cat-results/small-cat.png' - ); - const small = await createCat(0.3, 1); - small.bitmap.data.should.be.deepEqual(expectedSmall.bitmap.data); - - const expectedMedium = await Jimp.read( - testDir + '/images/cat-results/medium-cat.png' - ); - const medium = await createCat(0.6, 7); - medium.bitmap.data.should.be.deepEqual(expectedMedium.bitmap.data); - - const expectedLarge = await Jimp.read( - testDir + '/images/cat-results/large-cat.png' - ); - const large = await createCat(0.9, 20); - large.bitmap.data.should.be.deepEqual(expectedLarge.bitmap.data); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/README.md b/project starter code/node_modules/@jimp/plugin-blur/README.md deleted file mode 100644 index e0d47697..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/README.md +++ /dev/null @@ -1,25 +0,0 @@ -
- -

@jimp/plugin-blur

-

Blur an image.

-
- -A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - -## Usage - -- @param {number} r the pixel radius of the blur -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.blur(5); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map deleted file mode 100644 index 629f0a0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/dist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AjB","sourcesContent":["export const mulTable = [\n 1,\n 57,\n 41,\n 21,\n 203,\n 34,\n 97,\n 73,\n 227,\n 91,\n 149,\n 62,\n 105,\n 45,\n 39,\n 137,\n 241,\n 107,\n 3,\n 173,\n 39,\n 71,\n 65,\n 238,\n 219,\n 101,\n 187,\n 87,\n 81,\n 151,\n 141,\n 133,\n 249,\n 117,\n 221,\n 209,\n 197,\n 187,\n 177,\n 169,\n 5,\n 153,\n 73,\n 139,\n 133,\n 127,\n 243,\n 233,\n 223,\n 107,\n 103,\n 99,\n 191,\n 23,\n 177,\n 171,\n 165,\n 159,\n 77,\n 149,\n 9,\n 139,\n 135,\n 131,\n 253,\n 245,\n 119,\n 231,\n 224,\n 109,\n 211,\n 103,\n 25,\n 195,\n 189,\n 23,\n 45,\n 175,\n 171,\n 83,\n 81,\n 79,\n 155,\n 151,\n 147,\n 9,\n 141,\n 137,\n 67,\n 131,\n 129,\n 251,\n 123,\n 30,\n 235,\n 115,\n 113,\n 221,\n 217,\n 53,\n 13,\n 51,\n 50,\n 49,\n 193,\n 189,\n 185,\n 91,\n 179,\n 175,\n 43,\n 169,\n 83,\n 163,\n 5,\n 79,\n 155,\n 19,\n 75,\n 147,\n 145,\n 143,\n 35,\n 69,\n 17,\n 67,\n 33,\n 65,\n 255,\n 251,\n 247,\n 243,\n 239,\n 59,\n 29,\n 229,\n 113,\n 111,\n 219,\n 27,\n 213,\n 105,\n 207,\n 51,\n 201,\n 199,\n 49,\n 193,\n 191,\n 47,\n 93,\n 183,\n 181,\n 179,\n 11,\n 87,\n 43,\n 85,\n 167,\n 165,\n 163,\n 161,\n 159,\n 157,\n 155,\n 77,\n 19,\n 75,\n 37,\n 73,\n 145,\n 143,\n 141,\n 35,\n 138,\n 137,\n 135,\n 67,\n 33,\n 131,\n 129,\n 255,\n 63,\n 250,\n 247,\n 61,\n 121,\n 239,\n 237,\n 117,\n 29,\n 229,\n 227,\n 225,\n 111,\n 55,\n 109,\n 216,\n 213,\n 211,\n 209,\n 207,\n 205,\n 203,\n 201,\n 199,\n 197,\n 195,\n 193,\n 48,\n 190,\n 47,\n 93,\n 185,\n 183,\n 181,\n 179,\n 178,\n 176,\n 175,\n 173,\n 171,\n 85,\n 21,\n 167,\n 165,\n 41,\n 163,\n 161,\n 5,\n 79,\n 157,\n 78,\n 154,\n 153,\n 19,\n 75,\n 149,\n 74,\n 147,\n 73,\n 144,\n 143,\n 71,\n 141,\n 140,\n 139,\n 137,\n 17,\n 135,\n 134,\n 133,\n 66,\n 131,\n 65,\n 129,\n 1\n];\n\nexport const shgTable = [\n 0,\n 9,\n 10,\n 10,\n 14,\n 12,\n 14,\n 14,\n 16,\n 15,\n 16,\n 15,\n 16,\n 15,\n 15,\n 17,\n 18,\n 17,\n 12,\n 18,\n 16,\n 17,\n 17,\n 19,\n 19,\n 18,\n 19,\n 18,\n 18,\n 19,\n 19,\n 19,\n 20,\n 19,\n 20,\n 20,\n 20,\n 20,\n 20,\n 20,\n 15,\n 20,\n 19,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 20,\n 20,\n 20,\n 21,\n 18,\n 21,\n 21,\n 21,\n 21,\n 20,\n 21,\n 17,\n 21,\n 21,\n 21,\n 22,\n 22,\n 21,\n 22,\n 22,\n 21,\n 22,\n 21,\n 19,\n 22,\n 22,\n 19,\n 20,\n 22,\n 22,\n 21,\n 21,\n 21,\n 22,\n 22,\n 22,\n 18,\n 22,\n 22,\n 21,\n 22,\n 22,\n 23,\n 22,\n 20,\n 23,\n 22,\n 22,\n 23,\n 23,\n 21,\n 19,\n 21,\n 21,\n 21,\n 23,\n 23,\n 23,\n 22,\n 23,\n 23,\n 21,\n 23,\n 22,\n 23,\n 18,\n 22,\n 23,\n 20,\n 22,\n 23,\n 23,\n 23,\n 21,\n 22,\n 20,\n 22,\n 21,\n 22,\n 24,\n 24,\n 24,\n 24,\n 24,\n 22,\n 21,\n 24,\n 23,\n 23,\n 24,\n 21,\n 24,\n 23,\n 24,\n 22,\n 24,\n 24,\n 22,\n 24,\n 24,\n 22,\n 23,\n 24,\n 24,\n 24,\n 20,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 23,\n 21,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 22,\n 24,\n 24,\n 24,\n 23,\n 22,\n 24,\n 24,\n 25,\n 23,\n 25,\n 25,\n 23,\n 24,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 25,\n 24,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 23,\n 25,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 23,\n 25,\n 25,\n 20,\n 24,\n 25,\n 24,\n 25,\n 25,\n 22,\n 24,\n 25,\n 24,\n 25,\n 24,\n 25,\n 25,\n 24,\n 25,\n 25,\n 25,\n 25,\n 22,\n 25,\n 25,\n 25,\n 24,\n 25,\n 24,\n 25,\n 18\n];\n"],"file":"blur-tables.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js deleted file mode 100644 index e522832f..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js +++ /dev/null @@ -1,182 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _blurTables = require("./blur-tables"); - -/* - Superfast Blur (0.5) - http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js - - Copyright (c) 2011 Mario Klingemann - - 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 _default = function _default() { - return { - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur: function blur(r, cb) { - if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb); - if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb); - var rsum; - var gsum; - var bsum; - var asum; - var x; - var y; - var i; - var p; - var p1; - var p2; - var yp; - var yi; - var yw; - var pa; - var wm = this.bitmap.width - 1; - var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; - - var rad1 = r + 1; - var mulSum = _blurTables.mulTable[r]; - var shgSum = _blurTables.shgTable[r]; - var red = []; - var green = []; - var blue = []; - var alpha = []; - var vmin = []; - var vmax = []; - var iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - yi++; - } - - yw += this.bitmap.width << 2; - } - - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = asum * mulSum >>> shgSum; - this.bitmap.data[yi + 3] = pa; // normalize alpha - - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - yi += this.bitmap.width << 2; - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map deleted file mode 100644 index d1de6f15..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB;;;;;;AAMAA,IAAAA,IAPoB,gBAOfC,CAPe,EAOZC,EAPY,EAOR;AACV,UAAI,OAAOD,CAAP,KAAa,QAAjB,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACF,UAAID,CAAC,GAAG,CAAR,EAAW,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDF,EAAlD,CAAP;AAEX,UAAIG,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AAEA,UAAMC,EAAE,GAAG,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,CAA/B;AACA,UAAMC,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B,EAAjB,IAAuB,CAAvB;AACD;;AAED,gBAAIP,CAAC,KAAK,CAAV,EAAa;AACXwB,cAAAA,IAAI,CAACvB,CAAD,CAAJ,GAAU,CAAC,CAACE,CAAC,GAAGF,CAAC,GAAGc,IAAT,IAAiBF,EAAjB,GAAsBV,CAAtB,GAA0BU,EAA3B,IAAiC,KAAKF,MAAL,CAAYC,KAAvD;AACAa,cAAAA,IAAI,CAACxB,CAAD,CAAJ,GAAU,CAACE,CAAC,GAAGF,CAAC,GAAGT,CAAT,IAAc,CAAd,GAAkBW,CAAC,GAAG,KAAKQ,MAAL,CAAYC,KAAlC,GAA0C,CAApD;AACD;;AAEDR,YAAAA,EAAE,GAAGJ,CAAC,GAAGwB,IAAI,CAACvB,CAAD,CAAb;AACAI,YAAAA,EAAE,GAAGL,CAAC,GAAGyB,IAAI,CAACxB,CAAD,CAAb;AAEAL,YAAAA,IAAI,IAAIwB,GAAG,CAAChB,EAAD,CAAH,GAAUgB,GAAG,CAACf,EAAD,CAArB;AACAR,YAAAA,IAAI,IAAIwB,KAAK,CAACjB,EAAD,CAAL,GAAYiB,KAAK,CAAChB,EAAD,CAAzB;AACAP,YAAAA,IAAI,IAAIwB,IAAI,CAAClB,EAAD,CAAJ,GAAWkB,IAAI,CAACjB,EAAD,CAAvB;AACAN,YAAAA,IAAI,IAAIwB,KAAK,CAACnB,EAAD,CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\nimport { mulTable, shgTable } from './blur-tables';\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== 'number')\n return throwError.call(this, 'r must be a number', cb);\n if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js deleted file mode 100644 index 6d31ea19..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shgTable = exports.mulTable = void 0; -var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; -exports.mulTable = mulTable; -var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; -exports.shgTable = shgTable; -//# sourceMappingURL=blur-tables.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map deleted file mode 100644 index 629f0a0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/blur-tables.js"],"names":["mulTable","shgTable"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG,CACtB,CADsB,EAEtB,EAFsB,EAGtB,EAHsB,EAItB,EAJsB,EAKtB,GALsB,EAMtB,EANsB,EAOtB,EAPsB,EAQtB,EARsB,EAStB,GATsB,EAUtB,EAVsB,EAWtB,GAXsB,EAYtB,EAZsB,EAatB,GAbsB,EActB,EAdsB,EAetB,EAfsB,EAgBtB,GAhBsB,EAiBtB,GAjBsB,EAkBtB,GAlBsB,EAmBtB,CAnBsB,EAoBtB,GApBsB,EAqBtB,EArBsB,EAsBtB,EAtBsB,EAuBtB,EAvBsB,EAwBtB,GAxBsB,EAyBtB,GAzBsB,EA0BtB,GA1BsB,EA2BtB,GA3BsB,EA4BtB,EA5BsB,EA6BtB,EA7BsB,EA8BtB,GA9BsB,EA+BtB,GA/BsB,EAgCtB,GAhCsB,EAiCtB,GAjCsB,EAkCtB,GAlCsB,EAmCtB,GAnCsB,EAoCtB,GApCsB,EAqCtB,GArCsB,EAsCtB,GAtCsB,EAuCtB,GAvCsB,EAwCtB,GAxCsB,EAyCtB,CAzCsB,EA0CtB,GA1CsB,EA2CtB,EA3CsB,EA4CtB,GA5CsB,EA6CtB,GA7CsB,EA8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OtB,EA1OsB,EA2OtB,EA3OsB,EA4OtB,EA5OsB,EA6OtB,EA7OsB,EA8OtB,EA9OsB,EA+OtB,EA/OsB,EAgPtB,EAhPsB,EAiPtB,EAjPsB,EAkPtB,EAlPsB,EAmPtB,EAnPsB,EAoPtB,EApPsB,EAqPtB,EArPsB,EAsPtB,EAtPsB,EAuPtB,EAvPsB,EAwPtB,EAxPsB,EAyPtB,EAzPsB,EA0PtB,EA1PsB,EA2PtB,EA3PsB,EA4PtB,EA5PsB,EA6PtB,EA7PsB,EA8PtB,EA9PsB,EA+PtB,EA/PsB,EAgQtB,EAhQsB,EAiQtB,EAjQsB,CAAjB","sourcesContent":["export const mulTable = [\n 1,\n 57,\n 41,\n 21,\n 203,\n 34,\n 97,\n 73,\n 227,\n 91,\n 149,\n 62,\n 105,\n 45,\n 39,\n 137,\n 241,\n 107,\n 3,\n 173,\n 39,\n 71,\n 65,\n 238,\n 219,\n 101,\n 187,\n 87,\n 81,\n 151,\n 141,\n 133,\n 249,\n 117,\n 221,\n 209,\n 197,\n 187,\n 177,\n 169,\n 5,\n 153,\n 73,\n 139,\n 133,\n 127,\n 243,\n 233,\n 223,\n 107,\n 103,\n 99,\n 191,\n 23,\n 177,\n 171,\n 165,\n 159,\n 77,\n 149,\n 9,\n 139,\n 135,\n 131,\n 253,\n 245,\n 119,\n 231,\n 224,\n 109,\n 211,\n 103,\n 25,\n 195,\n 189,\n 23,\n 45,\n 175,\n 171,\n 83,\n 81,\n 79,\n 155,\n 151,\n 147,\n 9,\n 141,\n 137,\n 67,\n 131,\n 129,\n 251,\n 123,\n 30,\n 235,\n 115,\n 113,\n 221,\n 217,\n 53,\n 13,\n 51,\n 50,\n 49,\n 193,\n 189,\n 185,\n 91,\n 179,\n 175,\n 43,\n 169,\n 83,\n 163,\n 5,\n 79,\n 155,\n 19,\n 75,\n 147,\n 145,\n 143,\n 35,\n 69,\n 17,\n 67,\n 33,\n 65,\n 255,\n 251,\n 247,\n 243,\n 239,\n 59,\n 29,\n 229,\n 113,\n 111,\n 219,\n 27,\n 213,\n 105,\n 207,\n 51,\n 201,\n 199,\n 49,\n 193,\n 191,\n 47,\n 93,\n 183,\n 181,\n 179,\n 11,\n 87,\n 43,\n 85,\n 167,\n 165,\n 163,\n 161,\n 159,\n 157,\n 155,\n 77,\n 19,\n 75,\n 37,\n 73,\n 145,\n 143,\n 141,\n 35,\n 138,\n 137,\n 135,\n 67,\n 33,\n 131,\n 129,\n 255,\n 63,\n 250,\n 247,\n 61,\n 121,\n 239,\n 237,\n 117,\n 29,\n 229,\n 227,\n 225,\n 111,\n 55,\n 109,\n 216,\n 213,\n 211,\n 209,\n 207,\n 205,\n 203,\n 201,\n 199,\n 197,\n 195,\n 193,\n 48,\n 190,\n 47,\n 93,\n 185,\n 183,\n 181,\n 179,\n 178,\n 176,\n 175,\n 173,\n 171,\n 85,\n 21,\n 167,\n 165,\n 41,\n 163,\n 161,\n 5,\n 79,\n 157,\n 78,\n 154,\n 153,\n 19,\n 75,\n 149,\n 74,\n 147,\n 73,\n 144,\n 143,\n 71,\n 141,\n 140,\n 139,\n 137,\n 17,\n 135,\n 134,\n 133,\n 66,\n 131,\n 65,\n 129,\n 1\n];\n\nexport const shgTable = [\n 0,\n 9,\n 10,\n 10,\n 14,\n 12,\n 14,\n 14,\n 16,\n 15,\n 16,\n 15,\n 16,\n 15,\n 15,\n 17,\n 18,\n 17,\n 12,\n 18,\n 16,\n 17,\n 17,\n 19,\n 19,\n 18,\n 19,\n 18,\n 18,\n 19,\n 19,\n 19,\n 20,\n 19,\n 20,\n 20,\n 20,\n 20,\n 20,\n 20,\n 15,\n 20,\n 19,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 20,\n 20,\n 20,\n 21,\n 18,\n 21,\n 21,\n 21,\n 21,\n 20,\n 21,\n 17,\n 21,\n 21,\n 21,\n 22,\n 22,\n 21,\n 22,\n 22,\n 21,\n 22,\n 21,\n 19,\n 22,\n 22,\n 19,\n 20,\n 22,\n 22,\n 21,\n 21,\n 21,\n 22,\n 22,\n 22,\n 18,\n 22,\n 22,\n 21,\n 22,\n 22,\n 23,\n 22,\n 20,\n 23,\n 22,\n 22,\n 23,\n 23,\n 21,\n 19,\n 21,\n 21,\n 21,\n 23,\n 23,\n 23,\n 22,\n 23,\n 23,\n 21,\n 23,\n 22,\n 23,\n 18,\n 22,\n 23,\n 20,\n 22,\n 23,\n 23,\n 23,\n 21,\n 22,\n 20,\n 22,\n 21,\n 22,\n 24,\n 24,\n 24,\n 24,\n 24,\n 22,\n 21,\n 24,\n 23,\n 23,\n 24,\n 21,\n 24,\n 23,\n 24,\n 22,\n 24,\n 24,\n 22,\n 24,\n 24,\n 22,\n 23,\n 24,\n 24,\n 24,\n 20,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 23,\n 21,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 22,\n 24,\n 24,\n 24,\n 23,\n 22,\n 24,\n 24,\n 25,\n 23,\n 25,\n 25,\n 23,\n 24,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 25,\n 24,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 23,\n 25,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 23,\n 25,\n 25,\n 20,\n 24,\n 25,\n 24,\n 25,\n 25,\n 22,\n 24,\n 25,\n 24,\n 25,\n 24,\n 25,\n 25,\n 24,\n 25,\n 25,\n 25,\n 25,\n 22,\n 25,\n 25,\n 25,\n 24,\n 25,\n 24,\n 25,\n 18\n];\n"],"file":"blur-tables.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/index.js b/project starter code/node_modules/@jimp/plugin-blur/es/index.js deleted file mode 100644 index 253aec80..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/es/index.js +++ /dev/null @@ -1,181 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _blurTables = require("./blur-tables"); - -/* - Superfast Blur (0.5) - http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js - - Copyright (c) 2011 Mario Klingemann - - 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 _default = function _default() { - return { - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur: function blur(r, cb) { - if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb); - if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb); - var rsum; - var gsum; - var bsum; - var asum; - var x; - var y; - var i; - var p; - var p1; - var p2; - var yp; - var yi; - var yw; - var pa; - var wm = this.bitmap.width - 1; - var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; - - var rad1 = r + 1; - var mulSum = _blurTables.mulTable[r]; - var shgSum = _blurTables.shgTable[r]; - var red = []; - var green = []; - var blue = []; - var alpha = []; - var vmin = []; - var vmax = []; - var iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - yi++; - } - - yw += this.bitmap.width << 2; - } - - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = asum * mulSum >>> shgSum; - this.bitmap.data[yi + 3] = pa; // normalize alpha - - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - yi += this.bitmap.width << 2; - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map b/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map deleted file mode 100644 index d1de6f15..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB;;;;;;AAMAA,IAAAA,IAPoB,gBAOfC,CAPe,EAOZC,EAPY,EAOR;AACV,UAAI,OAAOD,CAAP,KAAa,QAAjB,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACF,UAAID,CAAC,GAAG,CAAR,EAAW,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB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CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\nimport { mulTable, shgTable } from './blur-tables';\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== 'number')\n return throwError.call(this, 'r must be a number', cb);\n if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/index.d.ts b/project starter code/node_modules/@jimp/plugin-blur/index.d.ts deleted file mode 100644 index f2c1a84e..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Blur { - blur(r: number, cb?: ImageCallback): this; -} - -export default function(): Blur; diff --git a/project starter code/node_modules/@jimp/plugin-blur/package.json b/project starter code/node_modules/@jimp/plugin-blur/package.json deleted file mode 100644 index c0b9190b..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@jimp/plugin-blur", - "version": "0.16.2", - "description": "blur an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js deleted file mode 100644 index 39b3d9a3..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js +++ /dev/null @@ -1,519 +0,0 @@ -export const mulTable = [ - 1, - 57, - 41, - 21, - 203, - 34, - 97, - 73, - 227, - 91, - 149, - 62, - 105, - 45, - 39, - 137, - 241, - 107, - 3, - 173, - 39, - 71, - 65, - 238, - 219, - 101, - 187, - 87, - 81, - 151, - 141, - 133, - 249, - 117, - 221, - 209, - 197, - 187, - 177, - 169, - 5, - 153, - 73, - 139, - 133, - 127, - 243, - 233, - 223, - 107, - 103, - 99, - 191, - 23, - 177, - 171, - 165, - 159, - 77, - 149, - 9, - 139, - 135, - 131, - 253, - 245, - 119, - 231, - 224, - 109, - 211, - 103, - 25, - 195, - 189, - 23, - 45, - 175, - 171, - 83, - 81, - 79, - 155, - 151, - 147, - 9, - 141, - 137, - 67, - 131, - 129, - 251, - 123, - 30, - 235, - 115, - 113, - 221, - 217, - 53, - 13, - 51, - 50, - 49, - 193, - 189, - 185, - 91, - 179, - 175, - 43, - 169, - 83, - 163, - 5, - 79, - 155, - 19, - 75, - 147, - 145, - 143, - 35, - 69, - 17, - 67, - 33, - 65, - 255, - 251, - 247, - 243, - 239, - 59, - 29, - 229, - 113, - 111, - 219, - 27, - 213, - 105, - 207, - 51, - 201, - 199, - 49, - 193, - 191, - 47, - 93, - 183, - 181, - 179, - 11, - 87, - 43, - 85, - 167, - 165, - 163, - 161, - 159, - 157, - 155, - 77, - 19, - 75, - 37, - 73, - 145, - 143, - 141, - 35, - 138, - 137, - 135, - 67, - 33, - 131, - 129, - 255, - 63, - 250, - 247, - 61, - 121, - 239, - 237, - 117, - 29, - 229, - 227, - 225, - 111, - 55, - 109, - 216, - 213, - 211, - 209, - 207, - 205, - 203, - 201, - 199, - 197, - 195, - 193, - 48, - 190, - 47, - 93, - 185, - 183, - 181, - 179, - 178, - 176, - 175, - 173, - 171, - 85, - 21, - 167, - 165, - 41, - 163, - 161, - 5, - 79, - 157, - 78, - 154, - 153, - 19, - 75, - 149, - 74, - 147, - 73, - 144, - 143, - 71, - 141, - 140, - 139, - 137, - 17, - 135, - 134, - 133, - 66, - 131, - 65, - 129, - 1 -]; - -export const shgTable = [ - 0, - 9, - 10, - 10, - 14, - 12, - 14, - 14, - 16, - 15, - 16, - 15, - 16, - 15, - 15, - 17, - 18, - 17, - 12, - 18, - 16, - 17, - 17, - 19, - 19, - 18, - 19, - 18, - 18, - 19, - 19, - 19, - 20, - 19, - 20, - 20, - 20, - 20, - 20, - 20, - 15, - 20, - 19, - 20, - 20, - 20, - 21, - 21, - 21, - 20, - 20, - 20, - 21, - 18, - 21, - 21, - 21, - 21, - 20, - 21, - 17, - 21, - 21, - 21, - 22, - 22, - 21, - 22, - 22, - 21, - 22, - 21, - 19, - 22, - 22, - 19, - 20, - 22, - 22, - 21, - 21, - 21, - 22, - 22, - 22, - 18, - 22, - 22, - 21, - 22, - 22, - 23, - 22, - 20, - 23, - 22, - 22, - 23, - 23, - 21, - 19, - 21, - 21, - 21, - 23, - 23, - 23, - 22, - 23, - 23, - 21, - 23, - 22, - 23, - 18, - 22, - 23, - 20, - 22, - 23, - 23, - 23, - 21, - 22, - 20, - 22, - 21, - 22, - 24, - 24, - 24, - 24, - 24, - 22, - 21, - 24, - 23, - 23, - 24, - 21, - 24, - 23, - 24, - 22, - 24, - 24, - 22, - 24, - 24, - 22, - 23, - 24, - 24, - 24, - 20, - 23, - 22, - 23, - 24, - 24, - 24, - 24, - 24, - 24, - 24, - 23, - 21, - 23, - 22, - 23, - 24, - 24, - 24, - 22, - 24, - 24, - 24, - 23, - 22, - 24, - 24, - 25, - 23, - 25, - 25, - 23, - 24, - 25, - 25, - 24, - 22, - 25, - 25, - 25, - 24, - 23, - 24, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 23, - 25, - 23, - 24, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 24, - 22, - 25, - 25, - 23, - 25, - 25, - 20, - 24, - 25, - 24, - 25, - 25, - 22, - 24, - 25, - 24, - 25, - 24, - 25, - 25, - 24, - 25, - 25, - 25, - 25, - 22, - 25, - 25, - 25, - 24, - 25, - 24, - 25, - 18 -]; diff --git a/project starter code/node_modules/@jimp/plugin-blur/src/index.js b/project starter code/node_modules/@jimp/plugin-blur/src/index.js deleted file mode 100644 index e5ab8ea9..00000000 --- a/project starter code/node_modules/@jimp/plugin-blur/src/index.js +++ /dev/null @@ -1,181 +0,0 @@ -import { throwError, isNodePattern } from '@jimp/utils'; -import { mulTable, shgTable } from './blur-tables'; - -/* - Superfast Blur (0.5) - http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js - - Copyright (c) 2011 Mario Klingemann - - 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. -*/ - -export default () => ({ - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur(r, cb) { - if (typeof r !== 'number') - return throwError.call(this, 'r must be a number', cb); - if (r < 1) return throwError.call(this, 'r must be greater than 0', cb); - - let rsum; - let gsum; - let bsum; - let asum; - let x; - let y; - let i; - let p; - let p1; - let p2; - let yp; - let yi; - let yw; - let pa; - - const wm = this.bitmap.width - 1; - const hm = this.bitmap.height - 1; - // const wh = this.bitmap.width * this.bitmap.height; - const rad1 = r + 1; - - const mulSum = mulTable[r]; - const shgSum = shgTable[r]; - - const red = []; - const green = []; - const blue = []; - const alpha = []; - - const vmin = []; - const vmax = []; - - let iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - - yi++; - } - - yw += this.bitmap.width << 2; - } - - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = (asum * mulSum) >>> shgSum; - this.bitmap.data[yi + 3] = pa; - - // normalize alpha - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa; - this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa; - this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - - yi += this.bitmap.width << 2; - } - } - } - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/README.md b/project starter code/node_modules/@jimp/plugin-circle/README.md deleted file mode 100644 index 5181828e..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/README.md +++ /dev/null @@ -1,25 +0,0 @@ -
- -

@jimp/plugin-circle

-

Creates a circle out of an image.

-
- -## Usage - -- @param {function(Error, Jimp)} options (optional) radius, x, y -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.circle(); - // or - image.circle({ radius: 50, x: 25, y: 25 }); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js deleted file mode 100644 index 91489e42..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) radius, x, y - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - circle: function circle() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; - var center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map deleted file mode 100644 index 195824df..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKN,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DE,CAD0D,EAE1DC,CAF0D,EAG1DE,GAH0D,EAI1D;AACA,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/es/index.js b/project starter code/node_modules/@jimp/plugin-circle/es/index.js deleted file mode 100644 index d710b6d5..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/es/index.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) radius, x, y - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - circle: function circle() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; - var center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map b/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map deleted file mode 100644 index 195824df..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKN,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DE,CAD0D,EAE1DC,CAF0D,EAG1DE,GAH0D,EAI1D;AACA,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/index.d.ts b/project starter code/node_modules/@jimp/plugin-circle/index.d.ts deleted file mode 100644 index 40f24935..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Circle { - circle(options?: { - radius: number, - x: number, - y: number - }, cb?: ImageCallback): this; - circle(cb?: ImageCallback): this; -} - -export default function(): Circle; diff --git a/project starter code/node_modules/@jimp/plugin-circle/package.json b/project starter code/node_modules/@jimp/plugin-circle/package.json deleted file mode 100644 index 56825de4..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/plugin-circle", - "version": "0.16.2", - "description": "Creates a circle out of an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-circle/src/index.js b/project starter code/node_modules/@jimp/plugin-circle/src/index.js deleted file mode 100644 index d917ad1e..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/src/index.js +++ /dev/null @@ -1,49 +0,0 @@ -import { isNodePattern } from '@jimp/utils'; - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) radius, x, y - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - circle(options = {}, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - const radius = - options.radius || - (this.bitmap.width > this.bitmap.height - ? this.bitmap.height - : this.bitmap.width) / 2; - - const center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const curR = Math.sqrt( - Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2) - ); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js b/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js deleted file mode 100644 index 6b42c73e..00000000 --- a/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js +++ /dev/null @@ -1,78 +0,0 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import circle from '../src'; - -const jimp = configure({ plugins: [circle] }, Jimp); - -describe('Circle', () => { - it('makes a circle based on image height and width', async () => { - const expectedImg = await Jimp.read( - getTestDir(__dirname) + '/images/circled.png' - ); - const imgSrc = await jimp.read( - mkJGD( - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦' - ) - ); - - imgSrc.circle().bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - it('makes a circle using provided radius', async () => { - const expectedImg = await Jimp.read( - getTestDir(__dirname) + '/images/radius-3-circle.png' - ); - const imgSrc = await jimp.read( - mkJGD( - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦' - ) - ); - - imgSrc - .circle({ radius: 3 }) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - it('should ', async () => { - const expectedImg = await Jimp.read( - getTestDir(__dirname) + '/images/x-y-circle.png' - ); - const imgSrc = await jimp.read( - mkJGD( - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦' - ) - ); - - imgSrc - .circle({ radius: 5, x: 5, y: 5 }) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/README.md b/project starter code/node_modules/@jimp/plugin-color/README.md deleted file mode 100644 index cad9c7e5..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/README.md +++ /dev/null @@ -1,256 +0,0 @@ -
- -

@jimp/plugin-color

-

Jimp color methods.

-
- -Bitmap manipulation to adjust the color in an image. - -## color - -Apply multiple color modification rules - -- @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.color([{ apply: 'red', params: [100] }]); -} - -main(); -``` - -Jimp supports advanced colour manipulation using a single method as follows: - -```js -image.color([ - { apply: 'hue', params: [-90] }, - { apply: 'lighten', params: [50] }, - { apply: 'xor', params: ['#06D'] } -]); -``` - -The method supports the following modifiers: - -| Modifier | Description | -| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **lighten** {amount} | Lighten the color a given amount, from 0 to 100. Providing 100 will always return white (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **brighten** {amount} | Brighten the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **darken** {amount} | Darken the color a given amount, from 0 to 100. Providing 100 will always return black (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **desaturate** {amount} | Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **saturate** {amount} | Saturate the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **greyscale** {amount} | Completely desaturates a color into greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **spin** {degree} | Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing - since it sets the hue back to what it was before. (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **hue** {degree} | Alias for **spin** | -| **mix** {color, amount} | Mixes colors by their RGB component values. Amount is opacity of overlaying color | -| **tint** {amount} | Same as applying **mix** with white color | -| **shade** {amount} | Same as applying **mix** with black color | -| **xor** {color} | Treats the two colors as bitfields and applies an XOR operation to the red, green, and blue components | -| **red** {amount} | Modify Red component by a given amount | -| **green** {amount} | Modify Green component by a given amount | -| **blue** {amount} | Modify Blue component by a given amount | - -## brightness - -Adjusts the brightness of the image - -- @param {number} val the amount to adjust the brightness, a number between -1 and +1 -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.brightness(20); -} - -main(); -``` - -## contrast - -Adjusts the contrast of the image - -- @param {number} val the amount to adjust the contrast, a number between -1 and +1 -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.contrast(70); -} - -main(); -``` - -## posterize - -Apply a posterize effect - -- @param {number} n the amount to adjust the contrast, minimum threshold is two -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.posterize(5); -} - -main(); -``` - -## opacity - -Multiplies the opacity of each pixel by a factor between 0 and 1 - -- @param {number} f A number, the factor by which to multiply the opacity of each pixel -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.opacity(80); -} - -main(); -``` - -## sepia - -Applies a sepia tone to the image - -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.sepia(); -} - -main(); -``` - -## fade - -Fades each pixel by a factor between 0 and 1 - -- @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.fade(0.7); -} - -main(); -``` - -## convolution - -Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanation with examples at [GIMP's Convolution Matrix plugin](https://docs.gimp.org/2.6/en/plug-in-convmatrix.html) - -- @param {array} kernel a matrix to weight the neighbors sum -- @param {string} edgeHandling (optional) define how to sum pixels from outside the border -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - // make me better - image.convolution(weights); -} - -main(); -``` - -## opaque - -Set the alpha channel on every pixel to fully opaque - -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.opaque(); -} - -main(); -``` - -## pixelate - -Pixelates the image or a region - -- @param {number} size the size of the pixels -- @param {number} x (optional) the x position of the region to pixelate -- @param {number} y (optional) the y position of the region to pixelate -- @param {number} w (optional) the width of the region to pixelate -- @param {number} h (optional) the height of the region to pixelate -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.pixelate(10); -} - -main(); -``` - -## convolute - -Applies a convolution kernel to the image or a region - -- @param {array} kernel the convolution kernel -- @param {number} x (optional) the x position of the region to apply convolution to -- @param {number} y (optional) the y position of the region to apply convolution to -- @param {number} w (optional) the width of the region to apply convolution to -- @param {number} h (optional) the height of the region to apply convolution to -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - // make me better - image.pixelate(kernal); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-color/dist/index.js b/project starter code/node_modules/@jimp/plugin-color/dist/index.js deleted file mode 100644 index a4db2139..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/dist/index.js +++ /dev/null @@ -1,567 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _utils = require("@jimp/utils"); - -function applyKernel(im, kernel, x, y) { - var value = [0, 0, 0]; - var size = (kernel.length - 1) / 2; - - for (var kx = 0; kx < kernel.length; kx += 1) { - for (var ky = 0; ky < kernel[kx].length; ky += 1) { - var idx = im.getPixelIndex(x + kx - size, y + ky - size); - value[0] += im.bitmap.data[idx] * kernel[kx][ky]; - value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; - value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; - } - } - - return value; -} - -var isDef = function isDef(v) { - return typeof v !== 'undefined' && v !== null; -}; - -function greyscale(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -function mix(clr, clr2) { - var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; - return { - r: (clr2.r - clr.r) * (p / 100) + clr.r, - g: (clr2.g - clr.g) * (p / 100) + clr.g, - b: (clr2.b - clr.b) * (p / 100) + clr.b - }; -} - -function colorFn(actions, cb) { - var _this = this; - - if (!actions || !Array.isArray(actions)) { - return _utils.throwError.call(this, 'actions must be an array', cb); - } - - actions = actions.map(function (action) { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); - } - - return action; - }); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var clr = { - r: _this.bitmap.data[idx], - g: _this.bitmap.data[idx + 1], - b: _this.bitmap.data[idx + 2] - }; - - var colorModifier = function colorModifier(i, amount) { - return _this.constructor.limit255(clr[i] + amount); - }; - - actions.forEach(function (action) { - if (action.apply === 'mix') { - clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { - clr = mix(clr, { - r: 255, - g: 255, - b: 255 - }, action.params[0]); - } else if (action.apply === 'shade') { - clr = mix(clr, { - r: 0, - g: 0, - b: 0 - }, action.params[0]); - } else if (action.apply === 'xor') { - clr = { - r: clr.r ^ action.params[0].r, - g: clr.g ^ action.params[0].g, - b: clr.b ^ action.params[0].b - }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); - } else { - var _clr; - - if (action.apply === 'hue') { - action.apply = 'spin'; - } - - clr = (0, _tinycolor["default"])(clr); - - if (!clr[action.apply]) { - return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb); - } - - clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); - } - }); - _this.bitmap.data[idx] = clr.r; - _this.bitmap.data[idx + 1] = clr.g; - _this.bitmap.data[idx + 2] = clr.b; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness: function brightness(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast: function contrast(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - var factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - return value < 0 ? 0 : value > 255 ? 255 : value; - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize: function posterize(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be numbers', cb); - } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale: greyscale, - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity: function opacity(f, cb) { - if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia: function sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var red = this.bitmap.data[idx]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade: function fade(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0 || f > 1) { - return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - } // this method is an alternative to opacity (which may be deprecated) - - - this.opacity(1 - f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution: function convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; - } - - var newData = Buffer.from(this.bitmap.data); - var kRows = kernel.length; - var kCols = kernel[0].length; - var rowEnd = Math.floor(kRows / 2); - var colEnd = Math.floor(kCols / 2); - var rowIni = -rowEnd; - var colIni = -colEnd; - var weight; - var rSum; - var gSum; - var bSum; - var ri; - var gi; - var bi; - var xi; - var yi; - var idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (var row = rowIni; row <= rowEnd; row++) { - for (var col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - this.bitmap.data = newData; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque: function opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx + 3] = 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate: function pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return _utils.throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute: function convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var ksize = (kernel.length - 1) / 2; - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map deleted file mode 100644 index 00325b53..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","ksize","color","colour"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,SAASA,WAAT,CAAqBC,EAArB,EAAyBC,MAAzB,EAAiCC,CAAjC,EAAoCC,CAApC,EAAuC;AACrC,MAAMC,KAAK,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAd;AACA,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAP,GAAgB,CAAjB,IAAsB,CAAnC;;AAEA,OAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGN,MAAM,CAACK,MAA7B,EAAqCC,EAAE,IAAI,CAA3C,EAA8C;AAC5C,SAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGP,MAAM,CAACM,EAAD,CAAN,CAAWD,MAAjC,EAAyCE,EAAE,IAAI,CAA/C,EAAkD;AAChD,UAAMC,GAAG,GAAGT,EAAE,CAACU,aAAH,CAAiBR,CAAC,GAAGK,EAAJ,GAASF,IAA1B,EAAgCF,CAAC,GAAGK,EAAJ,GAASH,IAAzC,CAAZ;AAEAD,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MAAH,CAAUC,IAAV,CAAeH,GAAf,IAAsBR,MAAM,CAACM,EAAD,CAAN,CAAWC,EAAX,CAAlC;AACAJ,MAAAA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KAAK9E,MAAL,CAAYO,KAAZ,GAAoBhB,CAAvC;AACAwF,MAAAA,CAAC,GAAG7E,KAAK,CAAC6E,CAAD,CAAL,GAAWA,CAAX,GAAe,KAAK/E,MAAL,CAAYQ,MAAZ,GAAqBhB,CAAxC;AAEA,UAAMwF,MAAM,GAAG,KAAKC,UAAL,EAAf;AAEA,WAAK3E,SAAL,CAAef,CAAf,EAAkBC,CAAlB,EAAqBsF,CAArB,EAAwBC,CAAxB,EAA2B,UAASG,EAAT,EAAaC,EAAb,EAAiBrF,GAAjB,EAAsB;AAC/C,YAAML,KAAK,GAAGL,WAAW,CAAC4F,MAAD,EAAS1F,MAAT,EAAiB4F,EAAjB,EAAqBC,EAArB,CAAzB;AAEA,aAAKnF,MAAL,CAAYC,IAAZ,CAAiBH,GAAjB,IAAwB,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAAxB;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACD,OAND;;AAQA,UAAI,0BAAcY,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACM,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA9dmB;;AAgepB;;;;;;AAMA2E,IAAAA,KAAK,EAAEnE,OAtea;AAuepBoE,IAAAA,MAAM,EAAEpE;AAveY,GAAP;AAAA,C","sourcesContent":["import tinyColor from 'tinycolor2';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = v => typeof v !== 'undefined' && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, 'actions must be an array', cb);\n }\n\n actions = actions.map(action => {\n if (action.apply === 'xor' || action.apply === 'mix') {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach(action => {\n if (action.apply === 'mix') {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === 'tint') {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === 'shade') {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === 'xor') {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === 'red') {\n clr.r = colorModifier('r', action.params[0]);\n } else if (action.apply === 'green') {\n clr.g = colorModifier('g', action.params[0]);\n } else if (action.apply === 'blue') {\n clr.b = colorModifier('b', action.params[0]);\n } else {\n if (action.apply === 'hue') {\n action.apply = 'spin';\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n 'action ' + action.apply + ' not supported',\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n if (val < 0.0) {\n this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);\n this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);\n this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);\n } else {\n this.bitmap.data[idx] =\n this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] =\n this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] =\n this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be numbers', cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== 'number')\n return throwError.call(this, 'f must be a number', cb);\n if (f < 0 || f > 1)\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx + 3] = 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === 'function') {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== 'number') {\n return throwError.call(this, 'size must be a number', cb);\n }\n\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16]\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, 'the kernel must be an array', cb);\n\n if (typeof x === 'function') {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/es/index.js b/project starter code/node_modules/@jimp/plugin-color/es/index.js deleted file mode 100644 index 2992500a..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/es/index.js +++ /dev/null @@ -1,566 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _utils = require("@jimp/utils"); - -function applyKernel(im, kernel, x, y) { - var value = [0, 0, 0]; - var size = (kernel.length - 1) / 2; - - for (var kx = 0; kx < kernel.length; kx += 1) { - for (var ky = 0; ky < kernel[kx].length; ky += 1) { - var idx = im.getPixelIndex(x + kx - size, y + ky - size); - value[0] += im.bitmap.data[idx] * kernel[kx][ky]; - value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; - value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; - } - } - - return value; -} - -var isDef = function isDef(v) { - return typeof v !== 'undefined' && v !== null; -}; - -function greyscale(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -function mix(clr, clr2) { - var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; - return { - r: (clr2.r - clr.r) * (p / 100) + clr.r, - g: (clr2.g - clr.g) * (p / 100) + clr.g, - b: (clr2.b - clr.b) * (p / 100) + clr.b - }; -} - -function colorFn(actions, cb) { - var _this = this; - - if (!actions || !Array.isArray(actions)) { - return _utils.throwError.call(this, 'actions must be an array', cb); - } - - actions = actions.map(function (action) { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); - } - - return action; - }); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var clr = { - r: _this.bitmap.data[idx], - g: _this.bitmap.data[idx + 1], - b: _this.bitmap.data[idx + 2] - }; - - var colorModifier = function colorModifier(i, amount) { - return _this.constructor.limit255(clr[i] + amount); - }; - - actions.forEach(function (action) { - if (action.apply === 'mix') { - clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { - clr = mix(clr, { - r: 255, - g: 255, - b: 255 - }, action.params[0]); - } else if (action.apply === 'shade') { - clr = mix(clr, { - r: 0, - g: 0, - b: 0 - }, action.params[0]); - } else if (action.apply === 'xor') { - clr = { - r: clr.r ^ action.params[0].r, - g: clr.g ^ action.params[0].g, - b: clr.b ^ action.params[0].b - }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); - } else { - var _clr; - - if (action.apply === 'hue') { - action.apply = 'spin'; - } - - clr = (0, _tinycolor["default"])(clr); - - if (!clr[action.apply]) { - return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb); - } - - clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); - } - }); - _this.bitmap.data[idx] = clr.r; - _this.bitmap.data[idx + 1] = clr.g; - _this.bitmap.data[idx + 2] = clr.b; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness: function brightness(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast: function contrast(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - var factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - return value < 0 ? 0 : value > 255 ? 255 : value; - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize: function posterize(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be numbers', cb); - } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale: greyscale, - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity: function opacity(f, cb) { - if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia: function sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var red = this.bitmap.data[idx]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade: function fade(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0 || f > 1) { - return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - } // this method is an alternative to opacity (which may be deprecated) - - - this.opacity(1 - f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution: function convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; - } - - var newData = Buffer.from(this.bitmap.data); - var kRows = kernel.length; - var kCols = kernel[0].length; - var rowEnd = Math.floor(kRows / 2); - var colEnd = Math.floor(kCols / 2); - var rowIni = -rowEnd; - var colIni = -colEnd; - var weight; - var rSum; - var gSum; - var bSum; - var ri; - var gi; - var bi; - var xi; - var yi; - var idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (var row = rowIni; row <= rowEnd; row++) { - for (var col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - this.bitmap.data = newData; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque: function opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx + 3] = 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate: function pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return _utils.throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute: function convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var ksize = (kernel.length - 1) / 2; - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/es/index.js.map b/project starter code/node_modules/@jimp/plugin-color/es/index.js.map deleted file mode 100644 index 00325b53..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","ksize","color","colour"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,SAASA,WAAT,CAAqBC,EAArB,EAAyBC,MAAzB,EAAiCC,CAAjC,EAAoCC,CAApC,EAAuC;AACrC,MAAMC,KAAK,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAd;AACA,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAP,GAAgB,CAAjB,IAAsB,CAAnC;;AAEA,OAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGN,MAAM,CAACK,MAA7B,EAAqCC,EAAE,IAAI,CAA3C,EAA8C;AAC5C,SAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGP,MAAM,CAACM,EAAD,CAAN,CAAWD,MAAjC,EAAyCE,EAAE,IAAI,CAA/C,EAAkD;AAChD,UAAMC,GAAG,GAAGT,EAAE,CAACU,aAAH,CAAiBR,CAAC,GAAGK,EAAJ,GAASF,IAA1B,EAAgCF,CAAC,GAAGK,EAAJ,GAASH,IAAzC,CAAZ;AAEAD,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MAAH,CAAUC,IAAV,CAAeH,GAAf,IAAsBR,MAAM,CAACM,EAAD,CAAN,CAAWC,EAAX,CAAlC;AACAJ,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MAAH,CAAUC,IAAV,CAAeH,GAAG,GAAG,CAArB,IAA0BR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AL,GAAWA,CAAX,GAAe,KAAK/E,MAAL,CAAYQ,MAAZ,GAAqBhB,CAAxC;AAEA,UAAMwF,MAAM,GAAG,KAAKC,UAAL,EAAf;AAEA,WAAK3E,SAAL,CAAef,CAAf,EAAkBC,CAAlB,EAAqBsF,CAArB,EAAwBC,CAAxB,EAA2B,UAASG,EAAT,EAAaC,EAAb,EAAiBrF,GAAjB,EAAsB;AAC/C,YAAML,KAAK,GAAGL,WAAW,CAAC4F,MAAD,EAAS1F,MAAT,EAAiB4F,EAAjB,EAAqBC,EAArB,CAAzB;AAEA,aAAKnF,MAAL,CAAYC,IAAZ,CAAiBH,GAAjB,IAAwB,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAAxB;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACD,OAND;;AAQA,UAAI,0BAAcY,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACM,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA9dmB;;AAgepB;;;;;;AAMA2E,IAAAA,KAAK,EAAEnE,OAtea;AAuepBoE,IAAAA,MAAM,EAAEpE;AAveY,GAAP;AAAA,C","sourcesContent":["import tinyColor from 'tinycolor2';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = v => typeof v !== 'undefined' && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, 'actions must be an array', cb);\n }\n\n actions = actions.map(action => {\n if (action.apply === 'xor' || action.apply === 'mix') {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach(action => {\n if (action.apply === 'mix') {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === 'tint') {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === 'shade') {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === 'xor') {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === 'red') {\n clr.r = colorModifier('r', action.params[0]);\n } else if (action.apply === 'green') {\n clr.g = colorModifier('g', action.params[0]);\n } else if (action.apply === 'blue') {\n clr.b = colorModifier('b', action.params[0]);\n } else {\n if (action.apply === 'hue') {\n action.apply = 'spin';\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n 'action ' + action.apply + ' not supported',\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n if (val < 0.0) {\n this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);\n this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);\n this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);\n } else {\n this.bitmap.data[idx] =\n this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] =\n this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] =\n this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be numbers', cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== 'number')\n return throwError.call(this, 'f must be a number', cb);\n if (f < 0 || f > 1)\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx + 3] = 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === 'function') {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== 'number') {\n return throwError.call(this, 'size must be a number', cb);\n }\n\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16]\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, 'the kernel must be an array', cb);\n\n if (typeof x === 'function') {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/index.d.ts b/project starter code/node_modules/@jimp/plugin-color/index.d.ts deleted file mode 100644 index c2f897a3..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -type ColorActionName = - | 'mix' - | 'tint' - | 'shade' - | 'xor' - | 'red' - | 'green' - | 'blue' - | 'hue'; - -type ColorAction = { - apply: ColorActionName; - params: any; -}; - -interface Color { - brightness(val: number, cb?: ImageCallback): this; - contrast(val: number, cb?: ImageCallback): this; - posterize(n: number, cb?: ImageCallback): this; - greyscale(cb?: ImageCallback): this; - grayscale(cb?: ImageCallback): this; - opacity(f: number, cb?: ImageCallback): this; - sepia(cb?: ImageCallback): this; - fade(f: number, cb?: ImageCallback): this; - convolution(kernel: number[][], cb?: ImageCallback): this; - convolution( - kernel: number[][], - edgeHandling: string, - cb?: ImageCallback - ): this; - opaque(cb?: ImageCallback): this; - pixelate(size: number, cb?: ImageCallback): this; - pixelate( - size: number, - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - convolute(kernel: number[][], cb?: ImageCallback): this; - convolute( - kernel: number[][], - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - color(actions: ColorAction[], cb?: ImageCallback): this; - colour(actions: ColorAction[], cb?: ImageCallback): this; -} - -export default function(): Color; diff --git a/project starter code/node_modules/@jimp/plugin-color/package.json b/project starter code/node_modules/@jimp/plugin-color/package.json deleted file mode 100644 index 100c3b31..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "@jimp/plugin-color", - "version": "0.16.2", - "description": "Bitmap manipulation to adjust the color in an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2", - "@jimp/types": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-color/src/index.js b/project starter code/node_modules/@jimp/plugin-color/src/index.js deleted file mode 100644 index faec203b..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/src/index.js +++ /dev/null @@ -1,617 +0,0 @@ -import tinyColor from 'tinycolor2'; -import { throwError, isNodePattern } from '@jimp/utils'; - -function applyKernel(im, kernel, x, y) { - const value = [0, 0, 0]; - const size = (kernel.length - 1) / 2; - - for (let kx = 0; kx < kernel.length; kx += 1) { - for (let ky = 0; ky < kernel[kx].length; ky += 1) { - const idx = im.getPixelIndex(x + kx - size, y + ky - size); - - value[0] += im.bitmap.data[idx] * kernel[kx][ky]; - value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; - value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; - } - } - - return value; -} - -const isDef = v => typeof v !== 'undefined' && v !== null; - -function greyscale(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const grey = parseInt( - 0.2126 * this.bitmap.data[idx] + - 0.7152 * this.bitmap.data[idx + 1] + - 0.0722 * this.bitmap.data[idx + 2], - 10 - ); - - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; -} - -function mix(clr, clr2, p = 50) { - return { - r: (clr2.r - clr.r) * (p / 100) + clr.r, - g: (clr2.g - clr.g) * (p / 100) + clr.g, - b: (clr2.b - clr.b) * (p / 100) + clr.b - }; -} - -function colorFn(actions, cb) { - if (!actions || !Array.isArray(actions)) { - return throwError.call(this, 'actions must be an array', cb); - } - - actions = actions.map(action => { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = tinyColor(action.params[0]).toRgb(); - } - - return action; - }); - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { - let clr = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2] - }; - - const colorModifier = (i, amount) => - this.constructor.limit255(clr[i] + amount); - - actions.forEach(action => { - if (action.apply === 'mix') { - clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { - clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]); - } else if (action.apply === 'shade') { - clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]); - } else if (action.apply === 'xor') { - clr = { - r: clr.r ^ action.params[0].r, - g: clr.g ^ action.params[0].g, - b: clr.b ^ action.params[0].b - }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); - } else { - if (action.apply === 'hue') { - action.apply = 'spin'; - } - - clr = tinyColor(clr); - - if (!clr[action.apply]) { - return throwError.call( - this, - 'action ' + action.apply + ' not supported', - cb - ); - } - - clr = clr[action.apply](...action.params).toRgb(); - } - }); - - this.bitmap.data[idx] = clr.r; - this.bitmap.data[idx + 1] = clr.g; - this.bitmap.data[idx + 2] = clr.b; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; -} - -export default () => ({ - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness(val, cb) { - if (typeof val !== 'number') { - return throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return throwError.call( - this, - 'val must be a number between -1 and +1', - cb - ); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = - this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = - this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = - this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; - } - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast(val, cb) { - if (typeof val !== 'number') { - return throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return throwError.call( - this, - 'val must be a number between -1 and +1', - cb - ); - } - - const factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - - return value < 0 ? 0 : value > 255 ? 255 : value; - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize(n, cb) { - if (typeof n !== 'number') { - return throwError.call(this, 'n must be numbers', cb); - } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = - (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255; - this.bitmap.data[idx + 1] = - (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) * - 255; - this.bitmap.data[idx + 2] = - (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) * - 255; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale, - - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity(f, cb) { - if (typeof f !== 'number') - return throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) - return throwError.call(this, 'f must be a number from 0 to 1', cb); - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - let red = this.bitmap.data[idx]; - let green = this.bitmap.data[idx + 1]; - let blue = this.bitmap.data[idx + 2]; - - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade(f, cb) { - if (typeof f !== 'number') { - return throwError.call(this, 'f must be a number', cb); - } - - if (f < 0 || f > 1) { - return throwError.call(this, 'f must be a number from 0 to 1', cb); - } - - // this method is an alternative to opacity (which may be deprecated) - this.opacity(1 - f); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; - } - - const newData = Buffer.from(this.bitmap.data); - const kRows = kernel.length; - const kCols = kernel[0].length; - const rowEnd = Math.floor(kRows / 2); - const colEnd = Math.floor(kCols / 2); - const rowIni = -rowEnd; - const colIni = -colEnd; - - let weight; - let rSum; - let gSum; - let bSum; - let ri; - let gi; - let bi; - let xi; - let yi; - let idxi; - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (let row = rowIni; row <= rowEnd; row++) { - for (let col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - - this.bitmap.data = newData; - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx + 3] = 255; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return throwError.call(this, 'h must be a number', cb); - } - } - - const kernel = [ - [1 / 16, 2 / 16, 1 / 16], - [2 / 16, 4 / 16, 2 / 16], - [1 / 16, 2 / 16, 1 / 16] - ]; - - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - - const source = this.cloneQuiet(); - - this.scanQuiet(x, y, w, h, function(xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - - const value = applyKernel(source, kernel, xx, yx); - - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) - return throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return throwError.call(this, 'h must be a number', cb); - } - } - - const ksize = (kernel.length - 1) / 2; - - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - - const source = this.cloneQuiet(); - - this.scanQuiet(x, y, w, h, function(xx, yx, idx) { - const value = applyKernel(source, kernel, xx, yx); - - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn -}); diff --git a/project starter code/node_modules/@jimp/plugin-color/test/color.test.js b/project starter code/node_modules/@jimp/plugin-color/test/color.test.js deleted file mode 100644 index 8a396f0d..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/test/color.test.js +++ /dev/null @@ -1,49 +0,0 @@ -import { Jimp, donutJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import color from '../src'; - -const jimp = configure({ plugins: [color] }, Jimp); - -describe('canvas color transformation', () => { - const redDonutJGD = donutJGD(0x00000000, 0xff000088, 0xff0000ff); - - it('can apply more than one color transformation', async () => { - const image = await jimp.read(redDonutJGD); - const newJGD = image - .color([ - { apply: 'hue', params: [-180] }, - { apply: 'lighten', params: [25] } - ]) - .getJGDSync(); - - newJGD.should.be.sameJGD(donutJGD(0x40404000, 0x80ffff88, 0x80ffffff)); - }); - - it('lighten', async () => { - const image = await jimp.read(redDonutJGD); - - image - .color([{ apply: 'lighten', params: [25] }]) - .getJGDSync() - .should.be.sameJGD(donutJGD(0x40404000, 0xff808088, 0xff8080ff)); - }); - - it('brighten', async () => { - const image = await jimp.read(redDonutJGD); - - image - .color([{ apply: 'brighten', params: [25] }]) - .getJGDSync() - .should.be.sameJGD(donutJGD(0x40404000, 0xff404088, 0xff4040ff)); - }); - - it('spin hue', async () => { - const image = await jimp.read(redDonutJGD); - - image - .color([{ apply: 'hue', params: [150] }]) - .getJGDSync() - .should.be.sameJGD(donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff)); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js b/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js deleted file mode 100644 index e9e8dd63..00000000 --- a/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js +++ /dev/null @@ -1,184 +0,0 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import types from '@jimp/types'; - -import color from '../src'; - -const jimp = configure({ types: [types], plugins: [color] }, Jimp); - -describe('Convolution', function() { - this.timeout(15000); - - const imgs = [ - jimp.read( - mkJGD( - '22222222', - '22222222', - '22888822', - '22888822', - '22888822', - '22888822', - '22222222', - '22222222' - ) - ), - jimp.read( - mkJGD( - '88222222', - '88222222', - '22222222', - '22222222', - '22222222', - '22222222', - '22222222', - '22222222' - ) - ) - ]; - - let imgMid; - let imgTopLeft; // stores the Jimp instances of the JGD images above. - - before(done => { - Promise.all(imgs) - .then(imgs => { - imgMid = imgs[0]; - imgTopLeft = imgs[1]; - done(); - }) - .catch(done); - }); - - const sharpM = [[-1, -1, 0], [-1, 1, 1], [0, 1, 1]]; - - it('3x3 sharp matrix on EDGE_EXTEND', done => { - imgMid - .clone() - .convolution(sharpM) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '22222222', - '28EEE822', - '2EFFF802', - '2EF88002', - '2EF88002', - '28800002', - '22000002', - '22222222' - ), - 'Mid light block' - ); - imgTopLeft - .clone() - .convolution(sharpM) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '80022222', - '00022222', - '00022222', - '22222222', - '22222222', - '22222222', - '22222222', - '22222222' - ), - 'Top left light block' - ); - done(); - }); - - it('3x3 sharp matrix on EDGE_WRAP', done => { - imgMid - .clone() - .convolution(sharpM, jimp.EDGE_WRAP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '66666666', - '28EEE822', - '2EFFF802', - '2EF88002', - '2EF88002', - '28800002', - '22000002', - '22222222' - ), - 'Mid light block' - ); - imgTopLeft - .clone() - .convolution(sharpM, jimp.EDGE_WRAP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'FC06666F', - '80022228', - '00022222', - '22222222', - '22222222', - '22222222', - '22222222', - 'E8222228' - ), - 'Top left light block' - ); - done(); - }); - - it('3x3 sharp matrix on EDGE_CROP', done => { - imgMid - .clone() - .convolution(sharpM, jimp.EDGE_CROP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '86666662', - '68EEE820', - '6EFFF800', - '6EF88000', - '6EF88000', - '68800000', - '62000000', - '20000000' - ), - 'Mid light block' - ); - imgTopLeft - .clone() - .convolution(sharpM, jimp.EDGE_CROP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'FC066662', - 'C0022220', - '00022220', - '62222220', - '62222220', - '62222220', - '62222220', - '20000000' - ), - 'Top left light block' - ); - done(); - }); - - it('new pixel value is greater than 255', async () => { - const expectedImg = await jimp.read( - getTestDir(__dirname) + '/images/qr-convoluted.png' - ); - const image = await jimp.read(getTestDir(__dirname) + '/images/qr.jpg'); - - image - .convolution([ - [0, 0, 0, 0, 0], - [0, 1, 1, 1, 0], - [0, 1, 0, 1, 0], - [0, 1, 1, 1, 0], - [0, 0, 0, 0, 0] - ]) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/README.md b/project starter code/node_modules/@jimp/plugin-contain/README.md deleted file mode 100644 index 6613e4dd..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/README.md +++ /dev/null @@ -1,59 +0,0 @@ -
- -

@jimp/plugin-contain

-

Contain an image within a height and width.

-
- -Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. - -## Usage - -- @param {number} w the width to resize the image to -- @param {number} h the height to resize the image to -- @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment -- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.contain(150, 100); -} - -main(); -``` - -### Align modes - -The following constants can be passed to `image.contain`: - -```js -Jimp.HORIZONTAL_ALIGN_LEFT; -Jimp.HORIZONTAL_ALIGN_CENTER; -Jimp.HORIZONTAL_ALIGN_RIGHT; - -Jimp.VERTICAL_ALIGN_TOP; -Jimp.VERTICAL_ALIGN_MIDDLE; -Jimp.VERTICAL_ALIGN_BOTTOM; -``` - -For example: - -```js -image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); -image.contain( - 250, - 250, - Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM -); -``` - -Default align mode for `image.contain` is: - -```js -Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; -``` diff --git a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js deleted file mode 100644 index ff05a1a7..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - contain: function contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } // permit any sort of optional parameters combination - - - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { - return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - } - - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - var c = this.cloneQuiet().scale(f, mode); - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map deleted file mode 100644 index 62c5b292..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,OADoB,mBACZC,CADY,EACTC,CADS,EACNC,SADM,EACKC,IADL,EACWC,EADX,EACe;AACjC,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD,OAHgC,CAKjC;;;AACA,UAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;AACjC,YAAI,OAAOC,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6DA,EAAE,GAAGD,IAAL;AAC7DA,QAAAA,IAAI,GAAGD,SAAP;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACD;;AAED,UAAI,OAAOA,SAAP,KAAqB,UAAzB,EAAqC;AACnC,YAAI,OAAOE,EAAP,KAAc,WAAlB,EAA+BA,EAAE,GAAGF,SAAL;AAC/BC,QAAAA,IAAI,GAAG,IAAP;AACAD,QAAAA,SAAS,GAAG,IAAZ;AACD;;AAED,UAAI,OAAOC,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAA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B,KAAKC,WAApC,EAAiDH,GAAjD;AACD,OAND;AAOA,WAAKI,IAAL,CACEX,CADF,EAEG,CAAC,KAAKH,MAAL,CAAYC,KAAZ,GAAoBE,CAAC,CAACH,MAAF,CAASC,KAA9B,IAAuC,CAAxC,GAA6CJ,MAF/C,EAGG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBC,CAAC,CAACH,MAAF,CAASE,MAA/B,IAAyC,CAA1C,GAA+CJ,MAHjD;;AAMA,UAAI,0BAAcT,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAzEmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === 'string') {\n if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === 'function') {\n if (typeof cb === 'undefined') cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/es/index.js b/project starter code/node_modules/@jimp/plugin-contain/es/index.js deleted file mode 100644 index 998bf540..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/es/index.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - contain: function contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } // permit any sort of optional parameters combination - - - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { - return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - } - - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - var c = this.cloneQuiet().scale(f, mode); - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map b/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map deleted file mode 100644 index 62c5b292..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;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oB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAzEmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === 'string') {\n if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === 'function') {\n if (typeof cb === 'undefined') cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/index.d.ts b/project starter code/node_modules/@jimp/plugin-contain/index.d.ts deleted file mode 100644 index 7c5e34b0..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Contain { - contain(w: number, h: number, cb?: ImageCallback): this; - contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; - contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - contain( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; -} - -export default function(): Contain; diff --git a/project starter code/node_modules/@jimp/plugin-contain/package.json b/project starter code/node_modules/@jimp/plugin-contain/package.json deleted file mode 100644 index 6ccbc365..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@jimp/plugin-contain", - "version": "0.16.2", - "description": "contain an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5", - "@jimp/plugin-scale": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-contain/src/index.js b/project starter code/node_modules/@jimp/plugin-contain/src/index.js deleted file mode 100644 index 68ea54b3..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/src/index.js +++ /dev/null @@ -1,86 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); - } - - // permit any sort of optional parameters combination - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = - alignBits || - this.constructor.HORIZONTAL_ALIGN_CENTER | - this.constructor.VERTICAL_ALIGN_MIDDLE; - const hbits = alignBits & ((1 << 3) - 1); - const vbits = alignBits >> 3; - - // check if more flags than one is in the bit sets - if ( - !( - (hbits !== 0 && !(hbits & (hbits - 1))) || - (vbits !== 0 && !(vbits & (vbits - 1))) - ) - ) { - return throwError.call( - this, - 'only use one flag per alignment direction', - cb - ); - } - - const alignH = hbits >> 1; // 0, 1, 2 - const alignV = vbits >> 1; // 0, 1, 2 - - const f = - w / h > this.bitmap.width / this.bitmap.height - ? h / this.bitmap.height - : w / this.bitmap.width; - const c = this.cloneQuiet().scale(f, mode); - - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit( - c, - ((this.bitmap.width - c.bitmap.width) / 2) * alignH, - ((this.bitmap.height - c.bitmap.height) / 2) * alignV - ); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js b/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js deleted file mode 100644 index 154ee358..00000000 --- a/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js +++ /dev/null @@ -1,131 +0,0 @@ -import { Jimp, mkJGD, hasOwnProp } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import blit from '@jimp/plugin-blit'; -import resize from '@jimp/plugin-resize'; -import scale from '@jimp/plugin-scale'; - -import contain from '../src'; - -const jimp = configure({ plugins: [scale, resize, blit, contain] }, Jimp); - -describe('All align combinations for contain', () => { - const verticalJGD = mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ); - - const horizontalJGD = mkJGD( - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆' - ); - - let vertical; - let horizontal; // stores the Jimp instances of the JGD images above. - - before(done => { - const img1 = jimp.read(verticalJGD); - const img2 = jimp.read(horizontalJGD); - Promise.all([img1, img2]) - .then(images => { - vertical = images[0]; - horizontal = images[1]; - done(); - }) - .catch(done); - }); - - const tests = {}; // Stores the expected result for each alignment combination. - tests['LEFT TOP'] = { - contain: { - verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '), - horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ') - } - }; - tests['CENTER TOP'] = { - contain: { - verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '), - horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ') - } - }; - tests['RIGHT TOP'] = { - contain: { - verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'), - horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ') - } - }; - - tests['LEFT MIDDLE'] = { - contain: { - verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '), - horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ') - } - }; - tests['CENTER MIDDLE'] = { - contain: { - verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '), - horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ') - } - }; - tests['RIGHT MIDDLE'] = { - contain: { - verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'), - horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ') - } - }; - - tests['LEFT BOTTOM'] = { - contain: { - verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '), - horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆') - } - }; - tests['CENTER BOTTOM'] = { - contain: { - verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '), - horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆') - } - }; - tests['RIGHT BOTTOM'] = { - contain: { - verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'), - horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆') - } - }; - - function runAlignTest(align) { - const jgdContainV = tests[align].contain.verti; - const jgdContainH = tests[align].contain.horiz; - let a = align.split(' '); - a = Jimp['HORIZONTAL_ALIGN_' + a[0]] | Jimp['VERTICAL_ALIGN_' + a[1]]; - it('contain aligned to ' + align, () => { - vertical - .clone() - .contain(6, 6, a) - .getJGDSync() - .should.be.sameJGD(jgdContainV, 'Vertical image'); - horizontal - .clone() - .contain(6, 6, a) - .getJGDSync() - .should.be.sameJGD(jgdContainH, 'Horizontal image'); - }); - } - - for (const align in tests) if (hasOwnProp(tests, align)) runAlignTest(align); -}); diff --git a/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/README.md b/project starter code/node_modules/@jimp/plugin-cover/README.md deleted file mode 100644 index 22d2ae07..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/README.md +++ /dev/null @@ -1,54 +0,0 @@ -
- -

@jimp/plugin-cover

-
- -Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. - -## Usage - -- @param {number} w the width to resize the image to -- @param {number} h the height to resize the image to -- @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment -- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.cover(150, 100); -} - -main(); -``` - -### Align modes - -The following constants can be passed to `image.cover`: - -```js -Jimp.HORIZONTAL_ALIGN_LEFT; -Jimp.HORIZONTAL_ALIGN_CENTER; -Jimp.HORIZONTAL_ALIGN_RIGHT; - -Jimp.VERTICAL_ALIGN_TOP; -Jimp.VERTICAL_ALIGN_MIDDLE; -Jimp.VERTICAL_ALIGN_BOTTOM; -``` - -For example: - -```js -image.cover(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); -image.cover(250, 250, Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM); -``` - -Default align mode for `image.cover` is: - -```js -Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; -``` diff --git a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js deleted file mode 100644 index b64d9e5e..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - cover: function cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; - this.scale(f, mode); - this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map deleted file mode 100644 index 3e6c688f..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,KADoB,iBACdC,CADc,EACXC,CADW,EACRC,SADQ,EACGC,IADH,EACSC,EADT,EACa;AAC/B,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UACEF,SAAS,IACT,OAAOA,SAAP,KAAqB,UADrB,IAEA,OAAOE,EAAP,KAAc,WAHhB,EAIE;AACAA,QAAAA,EAAE,GAAGF,SAAL;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACAC,QAAAA,IAAI,GAAG,IAAP;AACD,OARD,MAQO,IAAI,OAAOA,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAClEA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAEDD,MAAAA,SAAS,GACPA,SAAS,IACT,KAAKK,WAAL,CAAiBC,uBAAjB,GACE,KAAKD,WAAL,CAAiBE,qBAHrB;AAIA,UAAMC,KAAK,GAAGR,SAAS,GAAI,CAAC,KAAK,CAAN,IAAW,CAAtC;AACA,UAAMS,KAAK,GAAGT,SAAS,IAAI,CAA3B,CAvB+B,CAyB/B;;AACA,UACE,EACGQ,KAAK,KAAK,CAAV,IAAe,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAnB,CAAhB,IACCC,KAAK,KAAK,CAAV,IAAe,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAnB,CAFlB,CADF,EAME,OAAON,kBAAWC,IAAX,CACL,IADK,EAEL,2CAFK,EAGLF,EAHK,CAAP;AAMF,UAAMQ,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAtC+B,CAsCJ;;AAC3B,UAAMG,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAvC+B,CAuCJ;;AAE3B,UAAMG,CAAC,GACLd,CAAC,GAAGC,CAAJ,GAAQ,KAAKc,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAxC,GACIjB,CAAC,GAAG,KAAKe,MAAL,CAAYC,KADpB,GAEIf,CAAC,GAAG,KAAKc,MAAL,CAAYE,MAHtB;AAIA,WAAKC,KAAL,CAAWJ,CAAX,EAAcX,IAAd;AACA,WAAKgB,IAAL,CACG,CAAC,KAAKJ,MAAL,CAAYC,KAAZ,GAAoBhB,CAArB,IAA0B,CAA3B,GAAgCY,MADlC,EAEG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBhB,CAAtB,IAA2B,CAA5B,GAAiCY,MAFnC,EAGEb,CAHF,EAIEC,CAJF;;AAOA,UAAI,0BAAcG,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === 'function' &&\n typeof cb === 'undefined'\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/es/index.js b/project starter code/node_modules/@jimp/plugin-cover/es/index.js deleted file mode 100644 index ffae0743..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/es/index.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - cover: function cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; - this.scale(f, mode); - this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map b/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map deleted file mode 100644 index 3e6c688f..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","h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AMG,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAvC+B,CAuCJ;;AAE3B,UAAMG,CAAC,GACLd,CAAC,GAAGC,CAAJ,GAAQ,KAAKc,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAxC,GACIjB,CAAC,GAAG,KAAKe,MAAL,CAAYC,KADpB,GAEIf,CAAC,GAAG,KAAKc,MAAL,CAAYE,MAHtB;AAIA,WAAKC,KAAL,CAAWJ,CAAX,EAAcX,IAAd;AACA,WAAKgB,IAAL,CACG,CAAC,KAAKJ,MAAL,CAAYC,KAAZ,GAAoBhB,CAArB,IAA0B,CAA3B,GAAgCY,MADlC,EAEG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBhB,CAAtB,IAA2B,CAA5B,GAAiCY,MAFnC,EAGEb,CAHF,EAIEC,CAJF;;AAOA,UAAI,0BAAcG,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === 'function' &&\n typeof cb === 'undefined'\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/index.d.ts b/project starter code/node_modules/@jimp/plugin-cover/index.d.ts deleted file mode 100644 index 19209341..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Cover { - cover(w: number, h: number, cb?: ImageCallback): this; - cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - cover( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; -} - -export default function(): Cover; diff --git a/project starter code/node_modules/@jimp/plugin-cover/package.json b/project starter code/node_modules/@jimp/plugin-cover/package.json deleted file mode 100644 index 81b0bcdd..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@jimp/plugin-cover", - "version": "0.16.2", - "description": "cover an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-crop": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5", - "@jimp/plugin-scale": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-cover/src/index.js b/project starter code/node_modules/@jimp/plugin-cover/src/index.js deleted file mode 100644 index c290481e..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/src/index.js +++ /dev/null @@ -1,72 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); - } - - if ( - alignBits && - typeof alignBits === 'function' && - typeof cb === 'undefined' - ) { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = - alignBits || - this.constructor.HORIZONTAL_ALIGN_CENTER | - this.constructor.VERTICAL_ALIGN_MIDDLE; - const hbits = alignBits & ((1 << 3) - 1); - const vbits = alignBits >> 3; - - // check if more flags than one is in the bit sets - if ( - !( - (hbits !== 0 && !(hbits & (hbits - 1))) || - (vbits !== 0 && !(vbits & (vbits - 1))) - ) - ) - return throwError.call( - this, - 'only use one flag per alignment direction', - cb - ); - - const alignH = hbits >> 1; // 0, 1, 2 - const alignV = vbits >> 1; // 0, 1, 2 - - const f = - w / h > this.bitmap.width / this.bitmap.height - ? w / this.bitmap.width - : h / this.bitmap.height; - this.scale(f, mode); - this.crop( - ((this.bitmap.width - w) / 2) * alignH, - ((this.bitmap.height - h) / 2) * alignV, - w, - h - ); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js b/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js deleted file mode 100644 index fc08ac63..00000000 --- a/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js +++ /dev/null @@ -1,131 +0,0 @@ -import { Jimp, mkJGD, hasOwnProp } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import crop from '@jimp/plugin-crop'; -import scale from '@jimp/plugin-scale'; -import resize from '@jimp/plugin-resize'; - -import cover from '../src'; - -const jimp = configure({ plugins: [resize, scale, crop, cover] }, Jimp); - -describe('All align combinations for cover', () => { - const verticalJGD = mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ); - - const horizontalJGD = mkJGD( - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆' - ); - - let vertical; - let horizontal; // stores the Jimp instances of the JGD images above. - - before(done => { - const img1 = jimp.read(verticalJGD); - const img2 = jimp.read(horizontalJGD); - Promise.all([img1, img2]) - .then(images => { - vertical = images[0]; - horizontal = images[1]; - done(); - }) - .catch(done); - }); - - const tests = {}; // Stores the expected result for each alignment combination. - tests['LEFT TOP'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'), - horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆') - } - }; - tests['CENTER TOP'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'), - horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆') - } - }; - tests['RIGHT TOP'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'), - horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆') - } - }; - - tests['LEFT MIDDLE'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆') - } - }; - tests['CENTER MIDDLE'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆') - } - }; - tests['RIGHT MIDDLE'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆') - } - }; - - tests['LEFT BOTTOM'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆') - } - }; - tests['CENTER BOTTOM'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆') - } - }; - tests['RIGHT BOTTOM'] = { - cover: { - verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆') - } - }; - - function runAlignTest(align) { - const jgdCoverV = tests[align].cover.verti; - const jgdCoverH = tests[align].cover.horiz; - let a = align.split(' '); - a = Jimp['HORIZONTAL_ALIGN_' + a[0]] | Jimp['VERTICAL_ALIGN_' + a[1]]; - it('cover aligned to ' + align, () => { - vertical - .clone() - .cover(4, 4, a) - .getJGDSync() - .should.be.sameJGD(jgdCoverV, 'Vertical image'); - horizontal - .clone() - .cover(4, 4, a) - .getJGDSync() - .should.be.sameJGD(jgdCoverH, 'Horizontal image'); - }); - } - - for (const align in tests) if (hasOwnProp(tests, align)) runAlignTest(align); -}); diff --git a/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md deleted file mode 100644 index d74238e7..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md +++ /dev/null @@ -1,35 +0,0 @@ -# v0.16.0 (Sat Aug 08 2020) - -#### 🚀 Enhancement - -- added ability to ignore sides on autocrop [#924](https://github.com/oliver-moran/jimp/pull/924) ([@cbanfiel](https://github.com/cbanfiel)) - -#### Authors: 1 - -- Chad Banfield ([@cbanfiel](https://github.com/cbanfiel)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/README.md b/project starter code/node_modules/@jimp/plugin-crop/README.md deleted file mode 100644 index 86ea04dd..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/README.md +++ /dev/null @@ -1,56 +0,0 @@ -
- -

@jimp/plugin-crop

-

Crop an image.

-
- -## Crop - -Crops the image at a given point to a give size - -- @param {number} x the x coordinate to crop form -- @param {number} y the y coordinate to crop form -- @param w the width of the crop region -- @param h the height of the crop region -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.crop(150, 150); -} - -main(); -``` - -## AutoCrop - -AutoCrop same color borders from this image - -- @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) -- @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - -or - -- @param {object} options object - - tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) - - cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - - cropSymmetric (optional): flag to force cropping top be symmetric. north and south / east and west are cropped by the same value - - leaveBorder (optional): integer of how many pixels of the background color to leave around the image - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.autocrop(); - image.autocrop({ cropOnlyFrames: false, cropSymmetric: true }); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js deleted file mode 100644 index ea6d0b7d..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js +++ /dev/null @@ -1,287 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = pluginCrop; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/* eslint-disable no-labels */ -function pluginCrop(event) { - /** - * Crops the image at a given point to a give size - * @param {number} x the x coordinate to crop form - * @param {number} y the y coordinate to crop form - * @param w the width of the crop region - * @param h the height of the crop region - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - event('crop', function (x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - if (x === 0 && w === this.bitmap.width) { - // shortcut - var start = w * y + x << 2; - var end = start + h * w << 2; - this.bitmap.data = this.bitmap.data.slice(start, end); - } else { - var bitmap = Buffer.allocUnsafe(w * h * 4); - var offset = 0; - this.scanQuiet(x, y, w, h, function (x, y, idx) { - var data = this.bitmap.data.readUInt32BE(idx, true); - bitmap.writeUInt32BE(data, offset, true); - offset += 4; - }); - this.bitmap.data = bitmap; - } - - this.bitmap.width = w; - this.bitmap.height = h; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }); - return { - "class": { - /** - * Autocrop same color borders from this image - * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) - * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) - * @returns {Jimp} this for chaining of methods - */ - autocrop: function autocrop() { - var w = this.bitmap.width; - var h = this.bitmap.height; - var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - var cb; // callback - - var leaveBorder = 0; // Amount of pixels in border to leave - - var tolerance = 0.0002; // percent of color difference tolerance (default value) - - var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" - // i.e. all 4 sides have some border (default value) - - var cropSymmetric = false; // flag to force cropping top be symmetric. - // i.e. north and south / east and west are cropped by the same value - - var ignoreSides = { - north: false, - south: false, - east: false, - west: false - }; // parse arguments - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - for (var a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { - // tolerance value passed - tolerance = args[a]; - } - - if (typeof args[a] === 'boolean') { - // cropOnlyFrames value passed - cropOnlyFrames = args[a]; - } - - if (typeof args[a] === 'function') { - // callback value passed - cb = args[a]; - } - - if ((0, _typeof2["default"])(args[a]) === 'object') { - // config object passed - var config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - tolerance = config.tolerance; - } - - if (typeof config.cropOnlyFrames !== 'undefined') { - cropOnlyFrames = config.cropOnlyFrames; - } - - if (typeof config.cropSymmetric !== 'undefined') { - cropSymmetric = config.cropSymmetric; - } - - if (typeof config.leaveBorder !== 'undefined') { - leaveBorder = config.leaveBorder; - } - - if (typeof config.ignoreSides !== 'undefined') { - ignoreSides = config.ignoreSides; - } - } - } - /** - * All borders must be of the same color as the top left pixel, to be cropped. - * It should be possible to crop borders each with a different color, - * but since there are many ways for corners to intersect, it would - * introduce unnecessary complexity to the algorithm. - */ - // scan each side for same color borders - - - var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - - var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides - - var northPixelsToCrop = 0; - var eastPixelsToCrop = 0; - var southPixelsToCrop = 0; - var westPixelsToCrop = 0; // north side (scan rows from north to south) - - colorTarget = this.getPixelColor(0, 0); - - if (!ignoreSides.north) { - north: for (var y = 0; y < h - minPixelsPerSide; y++) { - for (var x = 0; x < w; x++) { - var colorXY = this.getPixelColor(x, y); - var rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break north; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - northPixelsToCrop++; - } - } // east side (scan columns from east to west) - - - colorTarget = this.getPixelColor(w, 0); - - if (!ignoreSides.east) { - east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { - for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { - var _colorXY = this.getPixelColor(_x, _y); - - var _rgba = this.constructor.intToRGBA(_colorXY); - - if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break east; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - eastPixelsToCrop++; - } - } // south side (scan rows from south to north) - - - colorTarget = this.getPixelColor(0, h); - - if (!ignoreSides.south) { - south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { - for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { - var _colorXY2 = this.getPixelColor(_x2, _y2); - - var _rgba2 = this.constructor.intToRGBA(_colorXY2); - - if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break south; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - southPixelsToCrop++; - } - } // west side (scan columns from west to east) - - - colorTarget = this.getPixelColor(w, h); - - if (!ignoreSides.west) { - west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { - for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { - var _colorXY3 = this.getPixelColor(_x3, _y3); - - var _rgba3 = this.constructor.intToRGBA(_colorXY3); - - if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break west; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - westPixelsToCrop++; - } - } // decide if a crop is needed - - - var doCrop = false; // apply leaveBorder - - westPixelsToCrop -= leaveBorder; - eastPixelsToCrop -= leaveBorder; - northPixelsToCrop -= leaveBorder; - southPixelsToCrop -= leaveBorder; - - if (cropSymmetric) { - var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); - westPixelsToCrop = horizontal; - eastPixelsToCrop = horizontal; - northPixelsToCrop = vertical; - southPixelsToCrop = vertical; - } // make sure that crops are >= 0 - - - westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; - eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; - northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks - - var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); - var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); - - if (cropOnlyFrames) { - // crop image if all sides should be cropped - doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; - } else { - // crop image if at least one side should be cropped - doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; - } - - if (doCrop) { - // do the real crop - this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -} - -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map deleted file mode 100644 index 0a3441ca..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorX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AED,YAAIK,MAAJ,EAAY;AACV;AACA,eAAKM,IAAL,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event('crop', function(x, y, w, h, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n if (typeof w !== 'number' || typeof h !== 'number')\n return throwError.call(this, 'w and h must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = (start + h * w) << 2;\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function(x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === 'number') {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === 'boolean') {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === 'function') {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === 'object') {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== 'undefined') {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== 'undefined') {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== 'undefined') {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== 'undefined') {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== 'undefined') {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n };\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/es/index.js b/project starter code/node_modules/@jimp/plugin-crop/es/index.js deleted file mode 100644 index f8e38329..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/es/index.js +++ /dev/null @@ -1,285 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = pluginCrop; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/* eslint-disable no-labels */ -function pluginCrop(event) { - /** - * Crops the image at a given point to a give size - * @param {number} x the x coordinate to crop form - * @param {number} y the y coordinate to crop form - * @param w the width of the crop region - * @param h the height of the crop region - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - event('crop', function (x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - if (x === 0 && w === this.bitmap.width) { - // shortcut - var start = w * y + x << 2; - var end = start + h * w << 2; - this.bitmap.data = this.bitmap.data.slice(start, end); - } else { - var bitmap = Buffer.allocUnsafe(w * h * 4); - var offset = 0; - this.scanQuiet(x, y, w, h, function (x, y, idx) { - var data = this.bitmap.data.readUInt32BE(idx, true); - bitmap.writeUInt32BE(data, offset, true); - offset += 4; - }); - this.bitmap.data = bitmap; - } - - this.bitmap.width = w; - this.bitmap.height = h; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }); - return { - "class": { - /** - * Autocrop same color borders from this image - * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) - * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) - * @returns {Jimp} this for chaining of methods - */ - autocrop: function autocrop() { - var w = this.bitmap.width; - var h = this.bitmap.height; - var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - var cb; // callback - - var leaveBorder = 0; // Amount of pixels in border to leave - - var tolerance = 0.0002; // percent of color difference tolerance (default value) - - var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" - // i.e. all 4 sides have some border (default value) - - var cropSymmetric = false; // flag to force cropping top be symmetric. - // i.e. north and south / east and west are cropped by the same value - - var ignoreSides = { - north: false, - south: false, - east: false, - west: false - }; // parse arguments - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - for (var a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { - // tolerance value passed - tolerance = args[a]; - } - - if (typeof args[a] === 'boolean') { - // cropOnlyFrames value passed - cropOnlyFrames = args[a]; - } - - if (typeof args[a] === 'function') { - // callback value passed - cb = args[a]; - } - - if ((0, _typeof2["default"])(args[a]) === 'object') { - // config object passed - var config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - tolerance = config.tolerance; - } - - if (typeof config.cropOnlyFrames !== 'undefined') { - cropOnlyFrames = config.cropOnlyFrames; - } - - if (typeof config.cropSymmetric !== 'undefined') { - cropSymmetric = config.cropSymmetric; - } - - if (typeof config.leaveBorder !== 'undefined') { - leaveBorder = config.leaveBorder; - } - - if (typeof config.ignoreSides !== 'undefined') { - ignoreSides = config.ignoreSides; - } - } - } - /** - * All borders must be of the same color as the top left pixel, to be cropped. - * It should be possible to crop borders each with a different color, - * but since there are many ways for corners to intersect, it would - * introduce unnecessary complexity to the algorithm. - */ - // scan each side for same color borders - - - var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - - var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides - - var northPixelsToCrop = 0; - var eastPixelsToCrop = 0; - var southPixelsToCrop = 0; - var westPixelsToCrop = 0; // north side (scan rows from north to south) - - colorTarget = this.getPixelColor(0, 0); - - if (!ignoreSides.north) { - north: for (var y = 0; y < h - minPixelsPerSide; y++) { - for (var x = 0; x < w; x++) { - var colorXY = this.getPixelColor(x, y); - var rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break north; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - northPixelsToCrop++; - } - } // east side (scan columns from east to west) - - - colorTarget = this.getPixelColor(w, 0); - - if (!ignoreSides.east) { - east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { - for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { - var _colorXY = this.getPixelColor(_x, _y); - - var _rgba = this.constructor.intToRGBA(_colorXY); - - if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break east; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - eastPixelsToCrop++; - } - } // south side (scan rows from south to north) - - - colorTarget = this.getPixelColor(0, h); - - if (!ignoreSides.south) { - south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { - for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { - var _colorXY2 = this.getPixelColor(_x2, _y2); - - var _rgba2 = this.constructor.intToRGBA(_colorXY2); - - if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break south; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - southPixelsToCrop++; - } - } // west side (scan columns from west to east) - - - colorTarget = this.getPixelColor(w, h); - - if (!ignoreSides.west) { - west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { - for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { - var _colorXY3 = this.getPixelColor(_x3, _y3); - - var _rgba3 = this.constructor.intToRGBA(_colorXY3); - - if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break west; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - westPixelsToCrop++; - } - } // decide if a crop is needed - - - var doCrop = false; // apply leaveBorder - - westPixelsToCrop -= leaveBorder; - eastPixelsToCrop -= leaveBorder; - northPixelsToCrop -= leaveBorder; - southPixelsToCrop -= leaveBorder; - - if (cropSymmetric) { - var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); - westPixelsToCrop = horizontal; - eastPixelsToCrop = horizontal; - northPixelsToCrop = vertical; - southPixelsToCrop = vertical; - } // make sure that crops are >= 0 - - - westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; - eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; - northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks - - var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); - var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); - - if (cropOnlyFrames) { - // crop image if all sides should be cropped - doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; - } else { - // crop image if at least one side should be cropped - doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; - } - - if (doCrop) { - // do the real crop - this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map b/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map deleted file mode 100644 index 0a3441ca..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"mappings":";;;;;;;;;;;AAEA;;AAFA;AAIe,SAASA,UAAT,CAAoBC,KAApB,EAA2B;AACxC;;;;;;;;;AASAA,EAAAA,KAAK,CAAC,MAAD,EAAS,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,CAAlB,EAAqBC,EAArB,EAAyB;AACrC,QAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACF,QAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP,CAJmC,CAMrC;;AACAJ,IAAAA,CAAC,GAAGO,IAAI,CAACC,KAAL,CAAWR,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC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CAAC,IAAI6C,gBAAgB,GAAGF,gBAAvB,CADH;AAEA,YAAMW,uBAAuB,GAC3BrD,CAAC,IAAI2C,iBAAiB,GAAGF,iBAAxB,CADH;;AAGA,YAAIjB,cAAJ,EAAoB;AAClB;AACAwB,UAAAA,MAAM,GACJN,gBAAgB,KAAK,CAArB,IACAD,iBAAiB,KAAK,CADtB,IAEAG,gBAAgB,KAAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD,SAPD,MAOO;AACL;AACAK,UAAAA,MAAM,GACJN,gBAAgB,KAAK,CAArB,IACAD,iBAAiB,KAAK,CADtB,IAEAG,gBAAgB,KAAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD;;AAED,YAAIK,MAAJ,EAAY;AACV;AACA,eAAKM,IAAL,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event('crop', function(x, y, w, h, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n if (typeof w !== 'number' || typeof h !== 'number')\n return throwError.call(this, 'w and h must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = (start + h * w) << 2;\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function(x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === 'number') {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === 'boolean') {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === 'function') {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === 'object') {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== 'undefined') {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== 'undefined') {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== 'undefined') {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== 'undefined') {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== 'undefined') {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n };\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/index.d.ts b/project starter code/node_modules/@jimp/plugin-crop/index.d.ts deleted file mode 100644 index 5dc5c83e..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Jimp, ImageCallback } from '@jimp/core'; - -interface CropClass { - crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this; - cropQuiet( - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - autocrop(tolerance?: number, cb?: ImageCallback): this; - autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): this; - autocrop( - tolerance?: number, - cropOnlyFrames?: boolean, - cb?: ImageCallback - ): this; - autocrop( - options: { - tolerance?: number; - cropOnlyFrames?: boolean; - cropSymmetric?: boolean; - leaveBorder?: number; - ignoreSides?: { - north: boolean; - south: boolean; - east: boolean; - west: boolean; - } - }, - cb?: ImageCallback - ): this; -} - -interface Crop { - class: CropClass -} - -export default function(): Crop; diff --git a/project starter code/node_modules/@jimp/plugin-crop/package.json b/project starter code/node_modules/@jimp/plugin-crop/package.json deleted file mode 100644 index fd888526..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/plugin-crop", - "version": "0.16.2", - "description": "crop an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-crop/src/index.js b/project starter code/node_modules/@jimp/plugin-crop/src/index.js deleted file mode 100644 index 4d1f78ad..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/src/index.js +++ /dev/null @@ -1,293 +0,0 @@ -/* eslint-disable no-labels */ - -import { throwError, isNodePattern } from '@jimp/utils'; - -export default function pluginCrop(event) { - /** - * Crops the image at a given point to a give size - * @param {number} x the x coordinate to crop form - * @param {number} y the y coordinate to crop form - * @param w the width of the crop region - * @param h the height of the crop region - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - event('crop', function(x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') - return throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') - return throwError.call(this, 'w and h must be numbers', cb); - - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - if (x === 0 && w === this.bitmap.width) { - // shortcut - const start = (w * y + x) << 2; - const end = (start + h * w) << 2; - - this.bitmap.data = this.bitmap.data.slice(start, end); - } else { - const bitmap = Buffer.allocUnsafe(w * h * 4); - let offset = 0; - - this.scanQuiet(x, y, w, h, function(x, y, idx) { - const data = this.bitmap.data.readUInt32BE(idx, true); - bitmap.writeUInt32BE(data, offset, true); - offset += 4; - }); - - this.bitmap.data = bitmap; - } - - this.bitmap.width = w; - this.bitmap.height = h; - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }); - - return { - class: { - /** - * Autocrop same color borders from this image - * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) - * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) - * @returns {Jimp} this for chaining of methods - */ - autocrop(...args) { - const w = this.bitmap.width; - const h = this.bitmap.height; - const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - let cb; // callback - let leaveBorder = 0; // Amount of pixels in border to leave - let tolerance = 0.0002; // percent of color difference tolerance (default value) - let cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" - // i.e. all 4 sides have some border (default value) - let cropSymmetric = false; // flag to force cropping top be symmetric. - // i.e. north and south / east and west are cropped by the same value - let ignoreSides = { - north: false, - south: false, - east: false, - west: false - }; - - // parse arguments - for (let a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { - // tolerance value passed - tolerance = args[a]; - } - - if (typeof args[a] === 'boolean') { - // cropOnlyFrames value passed - cropOnlyFrames = args[a]; - } - - if (typeof args[a] === 'function') { - // callback value passed - cb = args[a]; - } - - if (typeof args[a] === 'object') { - // config object passed - const config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - ({ tolerance } = config); - } - - if (typeof config.cropOnlyFrames !== 'undefined') { - ({ cropOnlyFrames } = config); - } - - if (typeof config.cropSymmetric !== 'undefined') { - ({ cropSymmetric } = config); - } - - if (typeof config.leaveBorder !== 'undefined') { - ({ leaveBorder } = config); - } - - if (typeof config.ignoreSides !== 'undefined') { - ({ ignoreSides } = config); - } - } - } - - /** - * All borders must be of the same color as the top left pixel, to be cropped. - * It should be possible to crop borders each with a different color, - * but since there are many ways for corners to intersect, it would - * introduce unnecessary complexity to the algorithm. - */ - - // scan each side for same color borders - let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - const rgba1 = this.constructor.intToRGBA(colorTarget); - - // for north and east sides - let northPixelsToCrop = 0; - let eastPixelsToCrop = 0; - let southPixelsToCrop = 0; - let westPixelsToCrop = 0; - - // north side (scan rows from north to south) - colorTarget = this.getPixelColor(0, 0); - if (!ignoreSides.north) { - north: for (let y = 0; y < h - minPixelsPerSide; y++) { - for (let x = 0; x < w; x++) { - const colorXY = this.getPixelColor(x, y); - const rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break north; - } - } - - // this row contains all pixels with the same color: increment this side pixels to crop - northPixelsToCrop++; - } - } - - // east side (scan columns from east to west) - colorTarget = this.getPixelColor(w, 0); - if (!ignoreSides.east) { - east: for (let x = 0; x < w - minPixelsPerSide; x++) { - for (let y = 0 + northPixelsToCrop; y < h; y++) { - const colorXY = this.getPixelColor(x, y); - const rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break east; - } - } - - // this column contains all pixels with the same color: increment this side pixels to crop - eastPixelsToCrop++; - } - } - - // south side (scan rows from south to north) - colorTarget = this.getPixelColor(0, h); - - if (!ignoreSides.south) { - south: for ( - let y = h - 1; - y >= northPixelsToCrop + minPixelsPerSide; - y-- - ) { - for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) { - const colorXY = this.getPixelColor(x, y); - const rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break south; - } - } - - // this row contains all pixels with the same color: increment this side pixels to crop - southPixelsToCrop++; - } - } - - // west side (scan columns from west to east) - colorTarget = this.getPixelColor(w, h); - if (!ignoreSides.west) { - west: for ( - let x = w - 1; - x >= 0 + eastPixelsToCrop + minPixelsPerSide; - x-- - ) { - for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) { - const colorXY = this.getPixelColor(x, y); - const rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break west; - } - } - - // this column contains all pixels with the same color: increment this side pixels to crop - westPixelsToCrop++; - } - } - - // decide if a crop is needed - let doCrop = false; - - // apply leaveBorder - westPixelsToCrop -= leaveBorder; - eastPixelsToCrop -= leaveBorder; - northPixelsToCrop -= leaveBorder; - southPixelsToCrop -= leaveBorder; - - if (cropSymmetric) { - const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - const vertical = Math.min(northPixelsToCrop, southPixelsToCrop); - westPixelsToCrop = horizontal; - eastPixelsToCrop = horizontal; - northPixelsToCrop = vertical; - southPixelsToCrop = vertical; - } - - // make sure that crops are >= 0 - westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; - eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; - northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; - - // safety checks - const widthOfRemainingPixels = - w - (westPixelsToCrop + eastPixelsToCrop); - const heightOfRemainingPixels = - h - (southPixelsToCrop + northPixelsToCrop); - - if (cropOnlyFrames) { - // crop image if all sides should be cropped - doCrop = - eastPixelsToCrop !== 0 && - northPixelsToCrop !== 0 && - westPixelsToCrop !== 0 && - southPixelsToCrop !== 0; - } else { - // crop image if at least one side should be cropped - doCrop = - eastPixelsToCrop !== 0 || - northPixelsToCrop !== 0 || - westPixelsToCrop !== 0 || - southPixelsToCrop !== 0; - } - - if (doCrop) { - // do the real crop - this.crop( - eastPixelsToCrop, - northPixelsToCrop, - widthOfRemainingPixels, - heightOfRemainingPixels - ); - } - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -} diff --git a/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js b/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js deleted file mode 100644 index 395af91e..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js +++ /dev/null @@ -1,429 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import crop from '../src'; - -const jimp = configure({ plugins: [crop] }, Jimp); - -describe('Autocrop', () => { - it('image with transparent surround color', async () => { - const imgSrc = await jimp.read( - mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); - - imgSrc - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('image with opaque surround color', async () => { - const imgSrc = await jimp.read( - mkJGD( - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥◆◆▥▥▥▥', - '▥▥▥◆▦▦◆▥▥▥', - '▥▥◆▦▦▦▦◆▥▥', - '▥▥▥◆▦▦◆▥▥▥', - '▥▥▥▥◆◆▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); - - imgSrc - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD('▥▥◆◆▥▥', '▥◆▦▦◆▥', '◆▦▦▦▦◆', '▥◆▦▦◆▥', '▥▥◆◆▥▥') - ); - }); - - it('image with one color border', async () => { - const imgSrc = await jimp.read( - mkJGD( - '▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥ ◆◆ ▥▥', - '▥▥ ◆▦▦◆ ▥▥', - '▥▥ ◆▦▦▦▦◆ ▥▥', - '▥▥ ◆▦▦◆ ▥▥', - '▥▥ ◆◆ ▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥' - ) - ); - - imgSrc - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('image border with small variation', async () => { - const imgSrc = await jimp.read( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - imgSrc - .clone() - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - imgSrc - .clone() - .autocrop(0.005) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('image border with small variation configured by options', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - imgSrc - .clone() - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - imgSrc - .clone() - .autocrop({ tolerance: 0.005 }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('image without frame', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '▥▥ ◆◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆▦▦▦▦◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆◆ ', - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); - - imgSrc - .autocrop(false) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('image without frame configured by options', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '▥▥ ◆◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆▦▦▦▦◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆◆ ', - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); - - imgSrc - .autocrop({ cropOnlyFrames: false }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('image with symmetric border configured by options', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥ ◆◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆◆ ▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥' - ) - ); - - imgSrc - .autocrop({ cropSymmetric: true }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆▦▦▦▦◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆◆ ▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); - }); - - it('image without frame and with symmetric border configured by options', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '▥▥ ◆◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆◆ ▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥' - ) - ); - imgSrc - .autocrop({ cropSymmetric: true, cropOnlyFrames: false }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆▦▦▦▦◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆◆ ▥▥', - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); - }); - - it('image without frame and with some border left', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - - imgSrc - .autocrop({ - tolerance: 0.005, - leaveBorder: 1 - }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '3232323232', - '2 ◆◆ 3', - '3 ◆▦▦◆ 2', - '2 ◆▦▦▦▦◆ 3', - '3 ◆▦▦◆ 2', - '2 ◆◆ 3', - '3232323232' - ) - ); - }); - - it('image not cropped given an out of bounds "leaveBorder" value ', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - - imgSrc - .autocrop({ - tolerance: 0.005, - leaveBorder: 100 - }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - }); - - it('image with top and bottom frame and leaveBorder', async () => { - const imgSrc = await Jimp.read( - mkJGD( - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥' - ) - ); - imgSrc - .autocrop({ cropSymmetric: true, cropOnlyFrames: false, leaveBorder: 2 }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥' - ) - ); - }); - - it('ignore sides north', async () => { - const imgSrc = await jimp.read( - mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); - - imgSrc - .autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ', ' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); - - it('ignore sides south and west', async () => { - const imgSrc = await jimp.read( - mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); - - imgSrc - .autocrop({ - cropOnlyFrames: false, - ignoreSides: { west: true, south: true } - }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ', - ' ◆▦▦◆ ', - '◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); - }); - - it('ignore sides east', async () => { - const imgSrc = await jimp.read( - mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); - - imgSrc - .autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ') - ); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js b/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js deleted file mode 100644 index 88f64973..00000000 --- a/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js +++ /dev/null @@ -1,65 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import crop from '../src'; - -const jimp = configure({ plugins: [crop] }, Jimp); - -describe('crop', () => { - // 6x5 size - const testImage = mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ '); - - it('full width from top', async () => { - const imgSrc = await jimp.read(testImage); - - imgSrc - .crop(0, 0, 6, 2) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ◆◆ ', ' ◆▦▦◆ ')); - }); - - it('full width from bottom', async () => { - const imgSrc = await jimp.read(testImage); - - imgSrc - .crop(0, 3, 6, 2) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ◆▦▦◆ ', ' ◆◆ ')); - }); - - it('full width from middle', async () => { - const imgSrc = await jimp.read(testImage); - - imgSrc - .crop(0, 2, 6, 2) - .getJGDSync() - .should.be.sameJGD(mkJGD('◆▦▦▦▦◆', ' ◆▦▦◆ ')); - }); - - it('full height from left', async () => { - const imgSrc = await jimp.read(testImage); - - imgSrc - .crop(0, 0, 2, 5) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ', ' ◆', '◆▦', ' ◆', ' ')); - }); - - it('full height from right', async () => { - const imgSrc = await jimp.read(testImage); - - imgSrc - .crop(4, 0, 2, 5) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ', '◆ ', '▦◆', '◆ ', ' ')); - }); - - it('full height from middle', async () => { - const imgSrc = await jimp.read(testImage); - - imgSrc - .crop(2, 0, 2, 5) - .getJGDSync() - .should.be.sameJGD(mkJGD('◆◆', '▦▦', '▦▦', '▦▦', '◆◆')); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/README.md b/project starter code/node_modules/@jimp/plugin-displace/README.md deleted file mode 100644 index fe3a7bc3..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/README.md +++ /dev/null @@ -1,27 +0,0 @@ -
- -

@jimp/plugin-displace

-

Displace an image.

-
- -Displaces the image based on the provided displacement map - -## Usage - -- @param {object} map the source Jimp instance -- @param {number} offset the maximum displacement value -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - // Make me better! - image.displace(map, 10); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js deleted file mode 100644 index c5d30800..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/** - * Displaces the image based on the provided displacement map - * @param {object} map the source Jimp instance - * @param {number} offset the maximum displacement value - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - displace: function displace(map, offset, cb) { - if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return _utils.throwError.call(this, 'factor must be a number', cb); - } - - var source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var displacement = map.bitmap.data[idx] / 256 * offset; - displacement = Math.round(displacement); - var ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map deleted file mode 100644 index 4bf4208a..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBAC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BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/es/index.js b/project starter code/node_modules/@jimp/plugin-displace/es/index.js deleted file mode 100644 index b5e9d289..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/es/index.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/** - * Displaces the image based on the provided displacement map - * @param {object} map the source Jimp instance - * @param {number} offset the maximum displacement value - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - displace: function displace(map, offset, cb) { - if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return _utils.throwError.call(this, 'factor must be a number', cb); - } - - var source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var displacement = map.bitmap.data[idx] / 256 * offset; - displacement = Math.round(displacement); - var ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map b/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map deleted file mode 100644 index 4bf4208a..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,yBAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,CAACG,WAAJ,KAAoB,KAAKA,WAAxD,EAAqE;AACnE,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAMI,MAAM,GAAG,KAAKC,UAAL,EAAf;AACA,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,YAAIC,YAAY,GAAIf,GAAG,CAACS,MAAJ,CAAWO,IAAX,CAAgBF,GAAhB,IAAuB,GAAxB,GAA+Bb,MAAlD;AACAc,QAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAWH,YAAX,CAAf;AAEA,YAAMI,GAAG,GAAG,KAAKC,aAAL,CAAmBR,CAAC,GAAGG,YAAvB,EAAqCF,CAArC,CAAZ;AACA,aAAKJ,MAAL,CAAYO,IAAZ,CAAiBG,GAAjB,IAAwBb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAnB,CAAxB;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACD,OAZD;;AAcA,UAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/index.d.ts b/project starter code/node_modules/@jimp/plugin-displace/index.d.ts deleted file mode 100644 index d9f8652f..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Jimp, ImageCallback } from '@jimp/core'; - -interface Displace { - displace(map: Jimp, offset: number, cb?: ImageCallback): this; -} - -export default function(): Displace; diff --git a/project starter code/node_modules/@jimp/plugin-displace/package.json b/project starter code/node_modules/@jimp/plugin-displace/package.json deleted file mode 100644 index 2f273c69..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@jimp/plugin-displace", - "version": "0.16.2", - "description": "displace an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-displace/src/index.js b/project starter code/node_modules/@jimp/plugin-displace/src/index.js deleted file mode 100644 index 0e5c5b5c..00000000 --- a/project starter code/node_modules/@jimp/plugin-displace/src/index.js +++ /dev/null @@ -1,41 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Displaces the image based on the provided displacement map - * @param {object} map the source Jimp instance - * @param {number} offset the maximum displacement value - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - displace(map, offset, cb) { - if (typeof map !== 'object' || map.constructor !== this.constructor) { - return throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return throwError.call(this, 'factor must be a number', cb); - } - - const source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - let displacement = (map.bitmap.data[idx] / 256) * offset; - displacement = Math.round(displacement); - - const ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/README.md b/project starter code/node_modules/@jimp/plugin-dither/README.md deleted file mode 100644 index f578dc8f..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/README.md +++ /dev/null @@ -1,26 +0,0 @@ -
- -

@jimp/plugin-dither

-

Apply a dither effect to an image.

-
- -> Dither - is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often one of the last stages of mastering audio to a CD. - -## Usage - -Apply a ordered dithering effect - -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.dither565(); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map deleted file mode 100644 index 8e9cf9e3..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,MAAT,CAAgBC,EAAhB,EAAoB;AAClB,MAAMC,YAAY,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,EAAV,EAAc,EAAd,EAAkB,CAAlB,EAAqB,EAArB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,EAA/B,EAAmC,CAAnC,EAAsC,EAAtC,EAA0C,EAA1C,EAA8C,CAA9C,EAAiD,EAAjD,EAAqD,CAArD,CAArB;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAL,KAAW,CAAZ,IAAkBD,CAAC,GAAG,CAA1C;AACA,QAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAD,CAA3B;AACA,SAAKN,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBG,IAAI,CAACC,GAAL,CAAS,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBT,MAAjC,EAAyC,IAAzC,CAAxB;AACA,SAAKI,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BG,IAAI,CAACC,GAAL,CAC1B,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BT,MADF,EAE1B,IAF0B,CAA5B;AAIA,SAAKI,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BG,IAAI,CAACC,GAAL,CAC1B,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BT,MADF,EAE1B,IAF0B,CAA5B;AAID,GAhBD;;AAkBA,MAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACa,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBC,IAAAA,SAAS,EAAEf,MADS;AAEpBgB,IAAAA,QAAQ,EAAEhB;AAFU,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/es/index.js b/project starter code/node_modules/@jimp/plugin-dither/es/index.js deleted file mode 100644 index 17b6b6a7..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/es/index.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Apply a ordered dithering effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function dither(cb) { - var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var thresholdId = ((y & 3) << 2) + x % 4; - var dither = rgb565Matrix[thresholdId]; - this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); - this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff); - this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - dither565: dither, - dither16: dither - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map b/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map deleted file mode 100644 index 8e9cf9e3..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"mappings":";;;;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,EAAE,CAACa,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBC,IAAAA,SAAS,EAAEf,MADS;AAEpBgB,IAAAA,QAAQ,EAAEhB;AAFU,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/index.d.ts b/project starter code/node_modules/@jimp/plugin-dither/index.d.ts deleted file mode 100644 index 5b00858c..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Dither { - dither565(cb?: ImageCallback): this; - dither16(cb?: ImageCallback): this; -} - -export default function(): Dither; diff --git a/project starter code/node_modules/@jimp/plugin-dither/package.json b/project starter code/node_modules/@jimp/plugin-dither/package.json deleted file mode 100644 index 20abf485..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@jimp/plugin-dither", - "version": "0.16.2", - "description": "Dither an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-dither/src/index.js b/project starter code/node_modules/@jimp/plugin-dither/src/index.js deleted file mode 100644 index 59019faa..00000000 --- a/project starter code/node_modules/@jimp/plugin-dither/src/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import { isNodePattern } from '@jimp/utils'; - -/** - * Apply a ordered dithering effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function dither(cb) { - const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const thresholdId = ((y & 3) << 2) + (x % 4); - const dither = rgb565Matrix[thresholdId]; - this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); - this.bitmap.data[idx + 1] = Math.min( - this.bitmap.data[idx + 1] + dither, - 0xff - ); - this.bitmap.data[idx + 2] = Math.min( - this.bitmap.data[idx + 2] + dither, - 0xff - ); - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; -} - -export default () => ({ - dither565: dither, - dither16: dither -}); diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md deleted file mode 100644 index 25346d5c..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md +++ /dev/null @@ -1,35 +0,0 @@ -# v0.16.2 (Thu Sep 15 2022) - -#### 📝 Documentation - -- added the "e" back to @jimp/plugin-fisheye [#947](https://github.com/oliver-moran/jimp/pull/947) ([@mynameismax](https://github.com/mynameismax)) - -#### Authors: 1 - -- Max ([@mynameismax](https://github.com/mynameismax)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/README.md b/project starter code/node_modules/@jimp/plugin-fisheye/README.md deleted file mode 100644 index 97a86b6a..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/README.md +++ /dev/null @@ -1,27 +0,0 @@ -
- -

@jimp/plugin-fisheye

-

Apply a fisheye effect to an image

-
- -## Usage - -- @param {function(Error, Jimp)} options (optional) radius -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.fisheye(); - // or - image.fisheye({ r: 1.6 }); -} - -main(); -``` - -Produces nice images with [@jimp/plugin-circle](../plugin-circle). diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js b/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js deleted file mode 100644 index 60a6d805..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = api => { - api.cache(true); - - return { - presets: [ - [ - '@babel/env', - { - useBuiltIns: 'usage' - } - ] - ], - - plugins: [ - '@babel/proposal-class-properties', - '@babel/syntax-object-rest-spread', - process.env.BABEL_ENV !== 'module' && 'add-module-exports', - [ - 'transform-inline-environment-variables', - { include: ['BABEL_ENV', 'ENV'] } - ] - ].filter(Boolean), - - env: { - test: { - plugins: ['istanbul'] - }, - development: { - plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter( - Boolean - ) - }, - module: { - presets: [['@babel/env', { modules: false }]] - } - } - }; -}; diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js deleted file mode 100644 index 82e4d8c2..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {object} options (optional) r: radius of effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - fisheye: function fisheye() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - r: 2.5 - }; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = { - r: 2.5 - }; - } - - var source = this.cloneQuiet(); - var _source$bitmap = source.bitmap, - width = _source$bitmap.width, - height = _source$bitmap.height; - source.scanQuiet(0, 0, width, height, function (x, y) { - var hx = x / width; - var hy = y / height; - var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - var rn = 2 * Math.pow(r, options.r); - var cosA = (hx - 0.5) / r; - var sinA = (hy - 0.5) / r; - var newX = Math.round((rn * cosA + 0.5) * width); - var newY = Math.round((rn * sinA + 0.5) * height); - var color = source.getPixelColor(newX, newY); - - _this.setPixelColor(color, x, y); - }); - /* Set center pixel color, otherwise it will be transparent */ - - this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map deleted file mode 100644 index e31c3f43..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","r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Y,GAAb,IAAoBX,KAA/B,CAAb;AACA,YAAMe,IAAI,GAAGR,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGE,IAAL,GAAY,GAAb,IAAoBX,MAA/B,CAAb;AACA,YAAMe,KAAK,GAAGnB,MAAM,CAACoB,aAAP,CAAqBJ,IAArB,EAA2BE,IAA3B,CAAd;;AAEA,QAAA,KAAI,CAACG,aAAL,CAAmBF,KAAnB,EAA0Bb,CAA1B,EAA6BC,CAA7B;AACD,OAZD;AAcA;;AACA,WAAKc,aAAL,CACErB,MAAM,CAACoB,aAAP,CAAqBjB,KAAK,GAAG,CAA7B,EAAgCC,MAAM,GAAG,CAAzC,CADF,EAEED,KAAK,GAAG,CAFV,EAGEC,MAAM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js deleted file mode 100644 index 71ff0b9d..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {object} options (optional) r: radius of effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - fisheye: function fisheye() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - r: 2.5 - }; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = { - r: 2.5 - }; - } - - var source = this.cloneQuiet(); - var _source$bitmap = source.bitmap, - width = _source$bitmap.width, - height = _source$bitmap.height; - source.scanQuiet(0, 0, width, height, function (x, y) { - var hx = x / width; - var hy = y / height; - var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - var rn = 2 * Math.pow(r, options.r); - var cosA = (hx - 0.5) / r; - var sinA = (hy - 0.5) / r; - var newX = Math.round((rn * cosA + 0.5) * width); - var newY = Math.round((rn * sinA + 0.5) * height); - var color = source.getPixelColor(newX, newY); - - _this.setPixelColor(color, x, y); - }); - /* Set center pixel color, otherwise it will be transparent */ - - this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map deleted file mode 100644 index e31c3f43..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,OADoB,qBACc;AAAA;;AAAA,UAA1BC,OAA0B,uEAAhB;AAAEC,QAAAA,CAAC,EAAE;AAAL,OAAgB;AAAA,UAAJC,EAAI;;AAChC,UAAI,OAAOF,OAAP,KAAmB,UAAvB,EAAmC;AACjCE,QAAAA,EAAE,GAAGF,OAAL;AACAA,QAAAA,OAAO,GAAG;AAAEC,UAAAA,CAAC,EAAE;AAAL,SAAV;AACD;;AAED,UAAME,MAAM,GAAG,KAAKC,UAAL,EAAf;AANgC,2BAOND,MAAM,CAACE,MAPD;AAAA,UAOxBC,KAPwB,kBAOxBA,KAPwB;AAAA,UAOjBC,MAPiB,kBAOjBA,MAPiB;AAShCJ,MAAAA,MAAM,CAACK,SAAP,CAAiB,CAAjB,EAAoB,CAApB,EAAuBF,KAAvB,EAA8BC,MAA9B,EAAsC,UAACE,CAAD,EAAIC,CAAJ,EAAU;AAC9C,YAAMC,EAAE,GAAGF,CAAC,GAAGH,KAAf;AACA,YAAMM,EAAE,GAAGF,CAAC,GAAGH,MAAf;AACA,YAAMN,CAAC,GAAGY,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACE,GAAL,CAASJ,EAAE,GAAG,GAAd,EAAmB,CAAnB,IAAwBE,IAAI,CAACE,GAAL,CAASH,EAAE,GAAG,GAAd,EAAmB,CAAnB,CAAlC,CAAV;AACA,YAAMI,EAAE,GAAG,IAAIH,IAAI,CAACE,GAAL,CAASd,CAAT,EAAYD,OAAO,CAACC,CAApB,CAAf;AACA,YAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAN,IAAaV,CAA1B;AACA,YAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAN,IAAaX,CAA1B;AACA,YAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGC,IAAL,GAAY,GAAb,IAAoBX,KAA/B,CAAb;AACA,YAAMe,IAAI,GAAGR,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGE,IAAL,GAAY,GAAb,IAAoBX,MAA/B,CAAb;AACA,YAAMe,KAAK,GAAGnB,MAAM,CAACoB,aAAP,CAAqBJ,IAArB,EAA2BE,IAA3B,CAAd;;AAEA,QAAA,KAAI,CAACG,aAAL,CAAmBF,KAAnB,EAA0Bb,CAA1B,EAA6BC,CAA7B;AACD,OAZD;AAcA;;AACA,WAAKc,aAAL,CACErB,MAAM,CAACoB,aAAP,CAAqBjB,KAAK,GAAG,CAA7B,EAAgCC,MAAM,GAAG,CAAzC,CADF,EAEED,KAAK,GAAG,CAFV,EAGEC,MAAM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts b/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts deleted file mode 100644 index d8140192..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Fisheye { - fishEye(opts?: { r: number }, cb?: ImageCallback): this; - fishEye(cb?: ImageCallback): this; -} - -export default function(): Fisheye; diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/package.json b/project starter code/node_modules/@jimp/plugin-fisheye/package.json deleted file mode 100644 index b461826e..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/plugin-fisheye", - "version": "0.16.2", - "description": "Apply a fisheye effect to an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js deleted file mode 100644 index 33aeb10d..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import { isNodePattern } from '@jimp/utils'; - -/** - * Creates a circle out of an image. - * @param {object} options (optional) r: radius of effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - fisheye(options = { r: 2.5 }, cb) { - if (typeof options === 'function') { - cb = options; - options = { r: 2.5 }; - } - - const source = this.cloneQuiet(); - const { width, height } = source.bitmap; - - source.scanQuiet(0, 0, width, height, (x, y) => { - const hx = x / width; - const hy = y / height; - const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - const rn = 2 * Math.pow(r, options.r); - const cosA = (hx - 0.5) / r; - const sinA = (hy - 0.5) / r; - const newX = Math.round((rn * cosA + 0.5) * width); - const newY = Math.round((rn * sinA + 0.5) * height); - const color = source.getPixelColor(newX, newY); - - this.setPixelColor(color, x, y); - }); - - /* Set center pixel color, otherwise it will be transparent */ - this.setPixelColor( - source.getPixelColor(width / 2, height / 2), - width / 2, - height / 2 - ); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js b/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js deleted file mode 100644 index 8c37b771..00000000 --- a/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js +++ /dev/null @@ -1,80 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import fisheye from '../src'; - -const jimp = configure({ plugins: [fisheye] }, Jimp); - -describe('Fisheye', () => { - it('should create fisheye lens to image', async () => { - const imgNormal = await jimp.read( - mkJGD( - '0000000000', - '0001221000', - '0022222200', - '0122112210', - '0221001220', - '0221001220', - '0122112210', - '0022222200', - '0001221000', - '0000000000' - ) - ); - const imgBulged = await jimp.read( - mkJGD( - '0001221000', - '0221112220', - '0220000121', - '1100000112', - '2100000012', - '2100000012', - '1200000012', - '0211000222', - '0221111220', - '0012222200' - ) - ); - - imgNormal - .fisheye() - .getJGDSync() - .should.be.sameJGD(imgBulged.getJGDSync()); - }); - - it('should create fisheye lens to image with radius', async () => { - const imgNormal = await jimp.read( - mkJGD( - '0000000000', - '0000000000', - '0000000000', - '0000000000', - '0001111000', - '0001111000', - '0000000000', - '0000000000', - '0000000000', - '0000000000' - ) - ); - const imgBulged = await jimp.read( - mkJGD( - '■■■■■■■■■■', - '■■■■■■■■■■', - '■■■■■■■■■■', - '■■■11111■■', - '■■111111■■', - '■■111111■■', - '■■■■111■■■', - '■■■■■■■■■■', - '■■■■■■■■■■', - '■■■■■■■■■■' - ) - ); - - imgNormal - .fisheye({ r: 1.8 }) - .getJGDSync() - .should.be.sameJGD(imgBulged.getJGDSync()); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md deleted file mode 100644 index 8e115c85..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md +++ /dev/null @@ -1,35 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.3 (Mon Apr 20 2020) - -#### 🐛 Bug Fix - -- Simplify and fix flip [#879](https://github.com/oliver-moran/jimp/pull/879) ([@skalee](https://github.com/skalee)) - -#### Authors: 1 - -- Sebastian Skałacki ([@skalee](https://github.com/skalee)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/README.md b/project starter code/node_modules/@jimp/plugin-flip/README.md deleted file mode 100644 index 4dfe3206..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/README.md +++ /dev/null @@ -1,30 +0,0 @@ -
- -

@jimp/plugin-flip

-

flip an image.

-
- -Flip the image horizontally or vertically. Defaults to horizontal. - -Also aliased as `mirror` - -## Usage - -- @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally -- @param {boolean} vertical a Boolean, if true the image will be flipped vertically -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.flip(); - image.mirror(); - image.flip(false, true); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js deleted file mode 100644 index 5a85279a..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Flip the image horizontally - * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally - * @param {boolean} vertical a Boolean, if true the image will be flipped vertically - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb); - var bitmap = Buffer.alloc(this.bitmap.data.length); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var _x = horizontal ? this.bitmap.width - 1 - x : x; - - var _y = vertical ? this.bitmap.height - 1 - y : y; - - var _idx = this.bitmap.width * _y + _x << 2; - - var data = this.bitmap.data.readUInt32BE(idx); - bitmap.writeUInt32BE(data, _idx); - }); - this.bitmap.data = Buffer.from(bitmap); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - flip: flipFn, - mirror: flipFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map deleted file mode 100644 index bf47a102..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/index.js b/project starter code/node_modules/@jimp/plugin-flip/es/index.js deleted file mode 100644 index 241787ff..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/es/index.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Flip the image horizontally - * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally - * @param {boolean} vertical a Boolean, if true the image will be flipped vertically - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb); - var bitmap = Buffer.alloc(this.bitmap.data.length); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var _x = horizontal ? this.bitmap.width - 1 - x : x; - - var _y = vertical ? this.bitmap.height - 1 - y : y; - - var _idx = this.bitmap.width * _y + _x << 2; - - var data = this.bitmap.data.readUInt32BE(idx); - bitmap.writeUInt32BE(data, _idx); - }); - this.bitmap.data = Buffer.from(bitmap); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - flip: flipFn, - mirror: flipFn - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map b/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map deleted file mode 100644 index bf47a102..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACx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esContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/index.d.ts b/project starter code/node_modules/@jimp/plugin-flip/index.d.ts deleted file mode 100644 index 17b107d4..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Flip { - flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; -} - -export default function(): Flip; diff --git a/project starter code/node_modules/@jimp/plugin-flip/package.json b/project starter code/node_modules/@jimp/plugin-flip/package.json deleted file mode 100644 index 9285c679..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@jimp/plugin-flip", - "version": "0.16.2", - "description": "flip an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-rotate": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-flip/src/index.js b/project starter code/node_modules/@jimp/plugin-flip/src/index.js deleted file mode 100644 index 212fb848..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/src/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Flip the image horizontally - * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally - * @param {boolean} vertical a Boolean, if true the image will be flipped vertically - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') - return throwError.call( - this, - 'horizontal and vertical must be Booleans', - cb - ); - - const bitmap = Buffer.alloc(this.bitmap.data.length); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const _x = horizontal ? this.bitmap.width - 1 - x : x; - const _y = vertical ? this.bitmap.height - 1 - y : y; - const _idx = (this.bitmap.width * _y + _x) << 2; - const data = this.bitmap.data.readUInt32BE(idx); - - bitmap.writeUInt32BE(data, _idx); - }); - - this.bitmap.data = Buffer.from(bitmap); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; -} - -export default () => ({ - flip: flipFn, - mirror: flipFn -}); diff --git a/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js b/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js deleted file mode 100644 index de9a1e49..00000000 --- a/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js +++ /dev/null @@ -1,99 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; - -import configure from '@jimp/custom'; - -import flip from '../src'; - -const jimp = configure({ plugins: [flip] }, Jimp); - -describe('Flipping plugin', () => { - it('can flip horizontally', async () => { - const src = await jimp.read( - mkJGD( - 'AAAABBBB', - 'AAABAAAB', - 'ABABABAB', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' - ) - ); - - const result = src.flip(true, false); - - result - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'BBBBAAAA', - 'BAAABAAA', - 'BABABABA', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' - ) - ); - }); - - it('can flip vertically', async () => { - const src = await jimp.read( - mkJGD( - 'AAAABBBB', - 'AAABAAAB', - 'ABABABAB', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' - ) - ); - - const result = src.flip(false, true); - - result - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'AACCCCAA', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'ABABABAB', - 'AAABAAAB', - 'AAAABBBB' - ) - ); - }); - - it('can flip both horizontally and vertically at once', async () => { - const src = await jimp.read( - mkJGD( - 'AAAABBBB', - 'AAABAAAB', - 'ABABABAB', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' - ) - ); - - const result = src.flip(true, true); - - result - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'AACCCCAA', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'BABABABA', - 'BAAABAAA', - 'BBBBAAAA' - ) - ); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/README.md b/project starter code/node_modules/@jimp/plugin-gaussian/README.md deleted file mode 100644 index 116ea741..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/README.md +++ /dev/null @@ -1,25 +0,0 @@ -
- -

@jimp/plugin-gaussian

-

Gaussian blur an image.

-
- -Applies a true Gaussian blur to the image (warning: this is VERY slow) - -## Usage - -- @param {number} r the pixel radius of the blur -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.gaussian(15); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js deleted file mode 100644 index 9502e1f9..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a true Gaussian blur to the image (warning: this is VERY slow) - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - gaussian: function gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return _utils.throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return _utils.throwError.call(this, 'r must be greater than 0', cb); - } - - var rs = Math.ceil(r * 2.57); // significant radius - - var range = rs * 2 + 1; - var rr2 = r * r * 2; - var rr2pi = rr2 * Math.PI; - var weights = []; - - for (var y = 0; y < range; y++) { - weights[y] = []; - - for (var x = 0; x < range; x++) { - var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } - } - - for (var _y = 0; _y < this.bitmap.height; _y++) { - for (var _x = 0; _x < this.bitmap.width; _x++) { - var red = 0; - var green = 0; - var blue = 0; - var alpha = 0; - var wsum = 0; - - for (var iy = 0; iy < range; iy++) { - for (var ix = 0; ix < range; ix++) { - var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); - var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); - var weight = weights[iy][ix]; - - var _idx = y1 * this.bitmap.width + x1 << 2; - - red += this.bitmap.data[_idx] * weight; - green += this.bitmap.data[_idx + 1] * weight; - blue += this.bitmap.data[_idx + 2] * weight; - alpha += this.bitmap.data[_idx + 3] * weight; - wsum += weight; - } - - var idx = _y * this.bitmap.width + _x << 2; - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map deleted file mode 100644 index 95add697..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,CADW,EACRC,EADQ,EACJ;AACd;AACA,UAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CA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;AAED,gBAAMC,GAAG,GAAInB,EAAC,GAAG,KAAKI,MAAL,CAAYE,KAAhB,GAAwBL,EAAzB,IAA+B,CAA3C;AAEA,iBAAKG,MAAL,CAAYgB,IAAZ,CAAiBD,GAAjB,IAAwB1B,IAAI,CAAC4B,KAAL,CAAWd,GAAG,GAAGI,IAAjB,CAAxB;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWb,KAAK,GAAGG,IAAnB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWZ,IAAI,GAAGE,IAAlB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWX,KAAK,GAAGC,IAAnB,CAA5B;AACD;AACF;AACF;;AAED,UAAI,0BAActB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js deleted file mode 100644 index f18ae1e1..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a true Gaussian blur to the image (warning: this is VERY slow) - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - gaussian: function gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return _utils.throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return _utils.throwError.call(this, 'r must be greater than 0', cb); - } - - var rs = Math.ceil(r * 2.57); // significant radius - - var range = rs * 2 + 1; - var rr2 = r * r * 2; - var rr2pi = rr2 * Math.PI; - var weights = []; - - for (var y = 0; y < range; y++) { - weights[y] = []; - - for (var x = 0; x < range; x++) { - var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } - } - - for (var _y = 0; _y < this.bitmap.height; _y++) { - for (var _x = 0; _x < this.bitmap.width; _x++) { - var red = 0; - var green = 0; - var blue = 0; - var alpha = 0; - var wsum = 0; - - for (var iy = 0; iy < range; iy++) { - for (var ix = 0; ix < range; ix++) { - var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); - var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); - var weight = weights[iy][ix]; - - var _idx = y1 * this.bitmap.width + x1 << 2; - - red += this.bitmap.data[_idx] * weight; - green += this.bitmap.data[_idx + 1] * weight; - blue += this.bitmap.data[_idx + 2] * weight; - alpha += this.bitmap.data[_idx + 3] * weight; - wsum += weight; - } - - var idx = _y * this.bitmap.width + _x << 2; - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map deleted file mode 100644 index 95add697..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,CADW,EACRC,EADQ,EACJ;AACd;AACA,UAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAID,CAAC,GAAG,CAAR,EAAW;AACT,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDF,EAAlD,CAAP;AACD;;AAED,UAAMG,EAAE,GAAGC,IAAI,CAACC,IAAL,CAAUN,CAAC,GAAG,IAAd,CAAX,CAVc,CAUkB;;AAChC,UAAMO,KAAK,GAAGH,EAAE,GAAG,CAAL,GAAS,CAAvB;AACA,UAAMI,GAAG,GAAGR,CAAC,GAAGA,CAAJ,GAAQ,CAApB;AACA,UAAMS,KAAK,GAAGD,GAAG,GAAGH,IAAI,CAACK,EAAzB;AAEA,UAAMC,OAAO,GAAG,EAAhB;;AAEA,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,KAApB,EAA2BK,CAAC,EAA5B,EAAgC;AAC9BD,QAAAA,OAAO,CAACC,CAAD,CAAP,GAAa,EAAb;;AACA,aAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAApB,EAA2BM,CAAC,EAA5B,EAAgC;AAC9B,cAAMC,GAAG,GAAG,SAACD,CAAC,GAAGT,EAAL,EAAY,CAAZ,aAAiBQ,CAAC,GAAGR,EAArB,EAA4B,CAA5B,CAAZ;AACAO,UAAAA,OAAO,CAACC,CAAD,CAAP,CAAWC,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a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts b/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts deleted file mode 100644 index 7f415775..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Gaussian { - gaussian(r: number, cb?: ImageCallback): this; -} - -export default function(): Gaussian; diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/package.json b/project starter code/node_modules/@jimp/plugin-gaussian/package.json deleted file mode 100644 index f73fdcf8..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@jimp/plugin-gaussian", - "version": "0.16.2", - "description": "gaussian blur an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js deleted file mode 100644 index 2a7c25df..00000000 --- a/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js +++ /dev/null @@ -1,73 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Applies a true Gaussian blur to the image (warning: this is VERY slow) - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return throwError.call(this, 'r must be greater than 0', cb); - } - - const rs = Math.ceil(r * 2.57); // significant radius - const range = rs * 2 + 1; - const rr2 = r * r * 2; - const rr2pi = rr2 * Math.PI; - - const weights = []; - - for (let y = 0; y < range; y++) { - weights[y] = []; - for (let x = 0; x < range; x++) { - const dsq = (x - rs) ** 2 + (y - rs) ** 2 ; - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } - } - - for (let y = 0; y < this.bitmap.height; y++) { - for (let x = 0; x < this.bitmap.width; x++) { - let red = 0; - let green = 0; - let blue = 0; - let alpha = 0; - let wsum = 0; - - for (let iy = 0; iy < range; iy++) { - for (let ix = 0; ix < range; ix++) { - const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs )); - const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs)); - const weight = weights[iy][ix]; - const idx = (y1 * this.bitmap.width + x1) << 2; - - red += this.bitmap.data[idx] * weight; - green += this.bitmap.data[idx + 1] * weight; - blue += this.bitmap.data[idx + 2] * weight; - alpha += this.bitmap.data[idx + 3] * weight; - wsum += weight; - } - - const idx = (y * this.bitmap.width + x) << 2; - - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); - } - } - } - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/README.md b/project starter code/node_modules/@jimp/plugin-invert/README.md deleted file mode 100644 index 51585dec..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/README.md +++ /dev/null @@ -1,24 +0,0 @@ -
- -

@jimp/plugin-invert

-

Invert an image's colors.

-
- -Invert an image's colors. - -## Usage - -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.invert(); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map deleted file mode 100644 index df886979..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OARD;;AAUA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/es/index.js b/project starter code/node_modules/@jimp/plugin-invert/es/index.js deleted file mode 100644 index 4d4ce18d..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/es/index.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Inverts the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - invert: function invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map b/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map deleted file mode 100644 index df886979..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OARD;;AAUA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/index.d.ts b/project starter code/node_modules/@jimp/plugin-invert/index.d.ts deleted file mode 100644 index 654051c3..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Invert { - invert(cb?: ImageCallback): this; -} - -export default function(): Invert; diff --git a/project starter code/node_modules/@jimp/plugin-invert/package.json b/project starter code/node_modules/@jimp/plugin-invert/package.json deleted file mode 100644 index 863a4c18..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@jimp/plugin-invert", - "version": "0.16.2", - "description": "invert an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-invert/src/index.js b/project starter code/node_modules/@jimp/plugin-invert/src/index.js deleted file mode 100644 index 24565842..00000000 --- a/project starter code/node_modules/@jimp/plugin-invert/src/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import { isNodePattern } from '@jimp/utils'; - -/** - * Inverts the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/README.md b/project starter code/node_modules/@jimp/plugin-mask/README.md deleted file mode 100644 index 97720717..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/README.md +++ /dev/null @@ -1,26 +0,0 @@ -
- -

@jimp/plugin-mask

-

mask an image with another image.

-
- -Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. - -## Usage - -- @param {Jimp} src the source Jimp instance -- @param {number} x the horizontal position to blit the image -- @param {number} y the vertical position to blit the image -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - const mask = await jimp.read('test/mask.png'); - - image.mask(mask); -} -``` diff --git a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js deleted file mode 100644 index 7c1c03a7..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. - * @param {Jimp} src the source Jimp instance - * @param {number} x the horizontal position to blit the image - * @param {number} y the vertical position to blit the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - mask: function mask(src) { - var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cb = arguments.length > 3 ? arguments[3] : undefined; - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - var w = this.bitmap.width; - var h = this.bitmap.height; - var baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var destX = x + sx; - var destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - var dstIdx = baseImage.getPixelIndex(destX, destY); - var data = this.bitmap.data; - var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map deleted file mode 100644 index 4a01d592..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;eAQe;AAAA,SAAO;AACpBA,IAAAA,IADoB,gBACfC,GADe,EACQ;AAAA,UAAlBC,CAAkB,uEAAd,CAAc;AAAA,UAAXC,CAAW,uEAAP,CAAO;AAAA,UAAJC,EAAI;;AAC1B,UAAI,EAAEH,GAAG,YAAY,KAAKI,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOG,kB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AAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAxCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/es/index.js b/project starter code/node_modules/@jimp/plugin-mask/es/index.js deleted file mode 100644 index 2bb7a119..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/es/index.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. - * @param {Jimp} src the source Jimp instance - * @param {number} x the horizontal position to blit the image - * @param {number} y the vertical position to blit the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - mask: function mask(src) { - var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cb = arguments.length > 3 ? arguments[3] : undefined; - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - var w = this.bitmap.width; - var h = this.bitmap.height; - var baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var destX = x + sx; - var destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - var dstIdx = baseImage.getPixelIndex(destX, destY); - var data = this.bitmap.data; - var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map b/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map deleted file mode 100644 index 4a01d592..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;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AA/B,CAAf;AADsD,cAE9CG,IAF8C,GAErC,KAAKb,MAFgC,CAE9Ca,IAF8C;AAGtD,cAAMC,GAAG,GAAG,CAACD,IAAI,CAACL,GAAG,GAAG,CAAP,CAAJ,GAAgBK,IAAI,CAACL,GAAG,GAAG,CAAP,CAApB,GAAgCK,IAAI,CAACL,GAAG,GAAG,CAAP,CAArC,IAAkD,CAA9D;AAEAJ,UAAAA,SAAS,CAACJ,MAAV,CAAiBa,IAAjB,CAAsBF,MAAM,GAAG,CAA/B,KAAqCG,GAAG,GAAG,GAA3C;AACD;AACF,OAfD;;AAiBA,UAAI,0BAAcrB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAxCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/index.d.ts b/project starter code/node_modules/@jimp/plugin-mask/index.d.ts deleted file mode 100644 index 01092b81..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ImageCallback, Jimp } from '@jimp/core'; - -interface Mask { - mask(src: Jimp, x: number, y: number, cb?: ImageCallback): this; -} - -export default function(): Mask; diff --git a/project starter code/node_modules/@jimp/plugin-mask/package.json b/project starter code/node_modules/@jimp/plugin-mask/package.json deleted file mode 100644 index 6b10d9eb..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/plugin-mask", - "version": "0.16.2", - "description": "mask an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-mask/src/index.js b/project starter code/node_modules/@jimp/plugin-mask/src/index.js deleted file mode 100644 index 92a5f5f1..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/src/index.js +++ /dev/null @@ -1,52 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. - * @param {Jimp} src the source Jimp instance - * @param {number} x the horizontal position to blit the image - * @param {number} y the vertical position to blit the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - mask(src, x = 0, y = 0, cb) { - if (!(src instanceof this.constructor)) { - return throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return throwError.call(this, 'x and y must be numbers', cb); - } - - // round input - x = Math.round(x); - y = Math.round(y); - - const w = this.bitmap.width; - const h = this.bitmap.height; - const baseImage = this; - - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function( - sx, - sy, - idx - ) { - const destX = x + sx; - const destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - const dstIdx = baseImage.getPixelIndex(destX, destY); - const { data } = this.bitmap; - const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js b/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js deleted file mode 100644 index eebcf15e..00000000 --- a/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js +++ /dev/null @@ -1,305 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import mask from '../src'; - -const jimp = configure({ plugins: [mask] }, Jimp); - -describe('Mask', () => { - let imgSrcOpaq; - let imgSrcAlpa; - let maskGrayBig; - let maskGraySmall; - let maskColor; - - before(done => { - Promise.all([ - jimp.read(mkJGD('▴□▾□■□', '■▴■▾■□', '■□▴□▾□', '■□■▴■▾')), - jimp.read(mkJGD('▴▵▾▿', '▴▵▾▿', '▴▵▾▿')), - jimp.read(mkJGD('048840', '8CFFC8', '8CFFC8', '048840')), - jimp.read(mkJGD('0369', '369C', '69CF')), - jimp.read(mkJGD('▴▴▾▾', '▪▪▰▰', '□□□□')) - ]) - .then(imgs => { - imgSrcOpaq = imgs[0]; - imgSrcAlpa = imgs[1]; - maskGrayBig = imgs[2]; - maskGraySmall = imgs[3]; - maskColor = imgs[4]; - done(); - }) - .catch(done); - }); - - it('Affect opaque image with a gray mask with the same size', () => { - imgSrcOpaq - .clone() - .mask(maskGrayBig) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff000000, - 0xffffff44, - 0x0000ff88, - 0xffffff88, - 0x00000044, - 0xffffff00, - 0x00000088, - 0xff0000cc, - 0x000000ff, - 0x0000ffff, - 0x000000cc, - 0xffffff88, - 0x00000088, - 0xffffffcc, - 0xff0000ff, - 0xffffffff, - 0x0000ffcc, - 0xffffff88, - 0x00000000, - 0xffffff44, - 0x00000088, - 0xff000088, - 0x00000044, - 0x0000ff00 - ] - }); - }); - - it('Affect opaque image with a gray mask with the same size, blited', () => { - imgSrcOpaq - .clone() - .mask(maskGrayBig, 1, 1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000ff, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff000000, - 0x00000044, - 0x0000ff88, - 0x00000088, - 0xffffff44, - 0x000000ff, - 0xffffff88, - 0xff0000cc, - 0xffffffff, - 0x0000ffff, - 0xffffffcc, - 0x000000ff, - 0xffffff88, - 0x000000cc, - 0xff0000ff, - 0x000000ff, - 0x0000ffcc - ] - }); - }); - - it('Affect opaque image with a gray mask with the same size, blited negative', () => { - imgSrcOpaq - .clone() - .mask(maskGrayBig, -1, -1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000cc, - 0xffffffff, - 0x0000ffff, - 0xffffffcc, - 0x00000088, - 0xffffffff, - 0x000000cc, - 0xff0000ff, - 0x000000ff, - 0x0000ffcc, - 0x00000088, - 0xffffffff, - 0x00000044, - 0xffffff88, - 0xff000088, - 0xffffff44, - 0x0000ff00, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff0000ff, - 0x000000ff, - 0x0000ffff - ] - }); - }); - - it('Affect opaque image with a smaller gray mask', () => { - imgSrcOpaq - .clone() - .mask(maskGraySmall) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff000000, - 0xffffff33, - 0x0000ff66, - 0xffffff99, - 0x000000ff, - 0xffffffff, - 0x00000033, - 0xff000066, - 0x00000099, - 0x0000ffcc, - 0x000000ff, - 0xffffffff, - 0x00000066, - 0xffffff99, - 0xff0000cc, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff0000ff, - 0x000000ff, - 0x0000ffff - ] - }); - }); - - it('Affect opaque image with a smaller gray mask, blited', () => { - imgSrcOpaq - .clone() - .mask(maskGraySmall, 1, 1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000ff, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff000000, - 0x00000033, - 0x0000ff66, - 0x00000099, - 0xffffffff, - 0x000000ff, - 0xffffff33, - 0xff000066, - 0xffffff99, - 0x0000ffcc, - 0xffffffff, - 0x000000ff, - 0xffffff66, - 0x00000099, - 0xff0000cc, - 0x000000ff, - 0x0000ffff - ] - }); - }); - - it('Affect alpha image with a bigger gray mask', () => { - imgSrcAlpa - .clone() - .mask(maskGrayBig) - .getJGDSync() - .should.be.sameJGD({ - width: 4, - height: 3, - data: [ - 0xff000000, - 0xff000021, - 0x0000ff88, - 0x0000ff43, - 0xff000088, - 0xff000065, - 0x0000ffff, - 0x0000ff7f, - 0xff000088, - 0xff000065, - 0x0000ffff, - 0x0000ff7f - ] - }); - }); - - it('Affect alpha image with a bigger gray mask, blited', () => { - imgSrcAlpa - .clone() - .mask(maskGrayBig, -1, -1) - .getJGDSync() - .should.be.sameJGD({ - width: 4, - height: 3, - data: [ - 0xff0000cc, - 0xff00007f, - 0x0000ffff, - 0x0000ff65, - 0xff0000cc, - 0xff00007f, - 0x0000ffff, - 0x0000ff65, - 0xff000044, - 0xff000043, - 0x0000ff88, - 0x0000ff21 - ] - }); - }); - - it('Affect opaque image with a colored mask', () => { - imgSrcOpaq - .clone() - .mask(maskColor, 1, 1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000ff, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff000055, - 0x00000055, - 0x0000ff55, - 0x00000055, - 0xffffffff, - 0x000000ff, - 0xffffffaa, - 0xff0000aa, - 0xffffffaa, - 0x0000ffaa, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff0000ff, - 0x000000ff, - 0x0000ffff - ] - }); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/README.md b/project starter code/node_modules/@jimp/plugin-normalize/README.md deleted file mode 100644 index bca72509..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/README.md +++ /dev/null @@ -1,24 +0,0 @@ -
- -

@jimp/plugin-normalize

-

Normalize an image's colors.

-
- -Normalizes an images color by computing a histogram. - -## Usage - -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.normalize(); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map deleted file mode 100644 index 4d6f08af..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIA,SAASA,SAAT,GAAqB;AACnB,MAAMA,SAAS,GAAG;AAChBC,IAAAA,CAAC,EAAE,IAAIC,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CADa;AAEhBC,IAAAA,CAAC,EAAE,IAAIF,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CAFa;AAGhBE,IAAAA,CAAC,EAAE,IAAIH,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB;AAHa,GAAlB;AAMA,OAAKG,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,KAH0D,EAI1D;AACAZ,IAAAA,SAAS,CAACC,CAAV,CAAY,KAAKM,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACAZ,IAAAA,SAAS,CAACI,CAAV,CAAY,KAAKG,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACAZ,IAAAA,SAAS,CAACK,CAAV,CAAY,KAAKE,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACD,GARD;AAUA,SAAOZ,SAAP;AACD;AAED;;;;;;;;;AAOA,IAAMc,UAAS,GAAG,SAAZA,SAAY,CAASC,KAAT,EAAgBC,GAAhB,EAAqBC,GAArB,EAA0B;AAC1C,SAAQ,CAACF,KAAK,GAAGC,GAAT,IAAgB,GAAjB,IAAyBC,GAAG,GAAGD,GA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UAAS,CAACb,CAAD,EAAIyB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAJ,EAAiByB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKM,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACV,CAAD,EAAIsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAJ,EAAiBsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACT,CAAD,EAAIqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAJ,EAAiBqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACD,OAZD;;AAcA,UAAI,0BAAckB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n index\n ) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function(value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function(histogramChannel) {\n return [\n histogramChannel.findIndex(value => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex(value => value > 0)\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js deleted file mode 100644 index 7333fa33..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Get an image's histogram - * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) - */ -function histogram() { - var histogram = { - r: new Array(256).fill(0), - g: new Array(256).fill(0), - b: new Array(256).fill(0) - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, index) { - histogram.r[this.bitmap.data[index + 0]]++; - histogram.g[this.bitmap.data[index + 1]]++; - histogram.b[this.bitmap.data[index + 2]]++; - }); - return histogram; -} -/** - * Normalize values - * @param {integer} value Pixel channel value. - * @param {integer} min Minimum value for channel - * @param {integer} max Maximum value for channel - * @return {integer} normalized values - */ - - -var _normalize = function normalize(value, min, max) { - return (value - min) * 255 / (max - min); -}; - -var getBounds = function getBounds(histogramChannel) { - return [histogramChannel.findIndex(function (value) { - return value > 0; - }), 255 - histogramChannel.slice().reverse().findIndex(function (value) { - return value > 0; - })]; -}; -/** - * Normalizes the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -var _default = function _default() { - return { - normalize: function normalize(cb) { - var h = histogram.call(this); // store bounds (minimum and maximum values) - - var bounds = { - r: getBounds(h.r), - g: getBounds(h.g), - b: getBounds(h.b) - }; // apply value transformations - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var r = this.bitmap.data[idx + 0]; - var g = this.bitmap.data[idx + 1]; - var b = this.bitmap.data[idx + 2]; - this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map deleted file mode 100644 index 4d6f08af..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIA,SAASA,SAAT,GAAqB;AACnB,MAAMA,SAAS,GAAG;AAChBC,IAAAA,CAAC,EAAE,IAAIC,KAAJ,CAAU,GAAV,EAA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M,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACT,CAAD,EAAIqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAJ,EAAiBqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACD,OAZD;;AAcA,UAAI,0BAAckB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n index\n ) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function(value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function(histogramChannel) {\n return [\n histogramChannel.findIndex(value => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex(value => value > 0)\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts b/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts deleted file mode 100644 index abdf1839..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Normalize { - normalize(cb ?: ImageCallback): this; -} - -export default function(): Normalize; diff --git a/project starter code/node_modules/@jimp/plugin-normalize/package.json b/project starter code/node_modules/@jimp/plugin-normalize/package.json deleted file mode 100644 index 4f66a0f0..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/plugin-normalize", - "version": "0.16.2", - "description": "normalize an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-normalize/src/index.js b/project starter code/node_modules/@jimp/plugin-normalize/src/index.js deleted file mode 100644 index ba73ff42..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/src/index.js +++ /dev/null @@ -1,86 +0,0 @@ -import { isNodePattern } from '@jimp/utils'; - -/** - * Get an image's histogram - * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) - */ -function histogram() { - const histogram = { - r: new Array(256).fill(0), - g: new Array(256).fill(0), - b: new Array(256).fill(0) - }; - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - index - ) { - histogram.r[this.bitmap.data[index + 0]]++; - histogram.g[this.bitmap.data[index + 1]]++; - histogram.b[this.bitmap.data[index + 2]]++; - }); - - return histogram; -} - -/** - * Normalize values - * @param {integer} value Pixel channel value. - * @param {integer} min Minimum value for channel - * @param {integer} max Maximum value for channel - * @return {integer} normalized values - */ -const normalize = function(value, min, max) { - return ((value - min) * 255) / (max - min); -}; - -const getBounds = function(histogramChannel) { - return [ - histogramChannel.findIndex(value => value > 0), - 255 - - histogramChannel - .slice() - .reverse() - .findIndex(value => value > 0) - ]; -}; - -/** - * Normalizes the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - normalize(cb) { - const h = histogram.call(this); - - // store bounds (minimum and maximum values) - const bounds = { - r: getBounds(h.r), - g: getBounds(h.g), - b: getBounds(h.b) - }; - - // apply value transformations - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const r = this.bitmap.data[idx + 0]; - const g = this.bitmap.data[idx + 1]; - const b = this.bitmap.data[idx + 2]; - - this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]); - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js b/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js deleted file mode 100644 index 858f4189..00000000 --- a/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js +++ /dev/null @@ -1,48 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import normalize from '../src'; - -const jimp = configure({ plugins: [normalize] }, Jimp); - -describe('Normalize', () => { - it('change grayscale image', async () => { - const image = await jimp.read(mkJGD('36▦', '6▦9', '▦9C')); - - image - .normalize() - .getJGDSync() - .should.be.sameJGD(mkJGD('■5▦', '5▦A', '▦A□')); - }); - - it('change red/blue image', async () => { - const image = await jimp.read({ - width: 3, - height: 2, - data: [ - 0x000000ff, - 0x400022ff, - 0x40002200, - 0x400000ff, - 0x000022ff, - 0x800055ff - ] - }); - - image - .normalize() - .getJGDSync() - .should.be.sameJGD({ - width: 3, - height: 2, - data: [ - 0x000000ff, - 0x7f0066ff, - 0x7f006600, - 0x7f0000ff, - 0x000066ff, - 0xff00ffff - ] - }); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md deleted file mode 100644 index 8db97314..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md +++ /dev/null @@ -1,53 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.1 (Sun Apr 05 2020) - -#### 📝 Documentation - -- Fix a `loadFont` and case inconsistency of `jimp` [#868](https://github.com/oliver-moran/jimp/pull/868) ([@xinbenlv](https://github.com/xinbenlv)) - -#### Authors: 1 - -- xinbenlv ([@xinbenlv](https://github.com/xinbenlv)) - ---- - -# v0.9.5 (Tue Mar 03 2020) - -#### 🐛 Bug Fix - -- `@jimp/plugin-print` - - Export font type [#838](https://github.com/oliver-moran/jimp/pull/838) ([@DomiR](https://github.com/DomiR)) - -#### 📝 Documentation - -- `@jimp/plugin-print` - - Added ttf2fnt.com to the list [#845](https://github.com/oliver-moran/jimp/pull/845) ([@mbejda](https://github.com/mbejda)) - -#### Authors: 1 - -- Dominique Rau ([@DomiR](https://github.com/DomiR)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/README.md b/project starter code/node_modules/@jimp/plugin-print/README.md deleted file mode 100644 index ebbb1d31..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/README.md +++ /dev/null @@ -1,173 +0,0 @@ -
- -

@jimp/plugin-print

-

Print text on an image.

-
- -Jimp supports basic typography using BMFont format (.fnt) even ones in different languages! Just find a bitmap font that is suitable [bitmap fonts](https://en.wikipedia.org/wiki/Bitmap_fonts). - -Online tools are also available to convert TTF fonts to BMFont format. They can be used to create color font or sprite packs. - - -:star: [ttf2fnt](https://ttf2fnt.com/) - -:star: [Littera](http://kvazars.com/littera/) - -:star: [Hiero](https://github.com/libgdx/libgdx/wiki/Hiero) - -## Included Fonts - -- `Jimp.FONT_SANS_8_BLACK` -- `Jimp.FONT_SANS_10_BLACK` -- `Jimp.FONT_SANS_12_BLACK` -- `Jimp.FONT_SANS_14_BLACK` -- `Jimp.FONT_SANS_16_BLACK` -- `Jimp.FONT_SANS_32_BLACK` -- `Jimp.FONT_SANS_64_BLACK` -- `Jimp.FONT_SANS_128_BLACK` -- `Jimp.FONT_SANS_8_WHITE` -- `Jimp.FONT_SANS_16_WHITE` -- `Jimp.FONT_SANS_32_WHITE` -- `Jimp.FONT_SANS_64_WHITE` -- `Jimp.FONT_SANS_128_WHITE` - -## loadFont - -Loads a bitmap font from a file - -- @param {string} file the file path of a .fnt file -- @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded -- @returns {Promise} a promise - -```js -import Jimp from 'jimp'; - -async function main() { - const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); -} - -main(); -``` - -## print - -Draws a text on a image on a given boundary - -- @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command -- @param {number} x the x position to start drawing the text -- @param {number} y the y position to start drawing the text -- @param {string} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) -- @param {number} maxWidth (optional) the boundary width to draw in -- @param {number} maxHeight (optional) the boundary height to draw in - @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - -```js -import Jimp from 'jimp'; - -async function main() { - const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); - const image = await Jimp.read(1000, 1000, 0x0000ffff); - - image.print(font, 10, 10, 'Hello World!'); -} - -main(); -``` - -### Alignment - -Alignment modes are supported by replacing the `str` argument with an object containing `text`, `alignmentX` and `alignmentY`. `alignmentX` defaults to `Jimp.HORIZONTAL_ALIGN_LEFT` and `alignmentY` defaults to `Jimp.VERTICAL_ALIGN_TOP`. - -You can align text using the following constants. - -```js -Jimp.HORIZONTAL_ALIGN_LEFT; -Jimp.HORIZONTAL_ALIGN_CENTER; -Jimp.HORIZONTAL_ALIGN_RIGHT; - -Jimp.VERTICAL_ALIGN_TOP; -Jimp.VERTICAL_ALIGN_MIDDLE; -Jimp.VERTICAL_ALIGN_BOTTOM; -``` - -Default align modes for `image.print` are: - -```js -{ - alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT, - alignmentY: Jimp.VERTICAL_ALIGN_TOP -} -``` - -```js -const font = await Jimp.loadFont(pathOrURL); - -// prints 'Hello world!' on an image, middle and center-aligned -image.print( - font, - x, - y, - { - text: 'Hello world!', - alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE - }, - maxWidth, - maxHeight -); -``` -__Note__: although `maxWidth` and `maxHeight` parameters are optional to `print()`, they are needed to correctly align the text using the requested alignment mode. - - -#### Staggering Text - -If you need to stagger text position along the x or y-axis the print method also returns the final coordinates as an argument to the callback. - -```js -const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); - -image.print( - font, - 10, - 10, - 'Hello world that wraps!', - 50, - (err, image, { x, y }) => { - image.print(font, x, y + 20, 'More text on another line', 50); - } -); -``` - -## measureText - -Measure how wide a piece of text will be. - -```js -import Jimp from 'jimp'; - -async function main() { - const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); - const image = await Jimp.read(1000, 1000, 0x0000ffff); - - Jimp.measureText(font, 'Hello World!'); -} - -main(); -``` - -## measureTextHeight - -Measure how tall a piece of text will be. - -```js -import Jimp from 'jimp'; - -async function main() { - const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); - const image = await Jimp.read(1000, 1000, 0x0000ffff); - - Jimp.measureTextHeight(font, 'Hello World!', 100); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/index.js b/project starter code/node_modules/@jimp/plugin-print/dist/index.js deleted file mode 100644 index 8392c072..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/dist/index.js +++ /dev/null @@ -1,261 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _path = _interopRequireDefault(require("path")); - -var _loadBmfont = _interopRequireDefault(require("load-bmfont")); - -var _utils = require("@jimp/utils"); - -var _measureText = require("./measure-text"); - -function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { - if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { - return 0; - } - - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { - return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; - } - - return maxWidth - (0, _measureText.measureText)(font, line); -} - -function drawCharacter(image, font, x, y, _char) { - if (_char.width > 0 && _char.height > 0) { - var characterPage = font.pages[_char.page]; - image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); - } - - return image; -} - -function printText(font, x, y, text, defaultCharWidth) { - for (var i = 0; i < text.length; i++) { - var _char2 = void 0; - - if (font.chars[text[i]]) { - _char2 = text[i]; - } else if (/\s/.test(text[i])) { - _char2 = ''; - } else { - _char2 = '?'; - } - - var fontChar = font.chars[_char2] || {}; - var fontKerning = font.kernings[_char2]; - drawCharacter(this, font, x, y, fontChar || {}); - var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; - x += kerning + (fontChar.xadvance || defaultCharWidth); - } -} - -function splitLines(font, text, maxWidth) { - var words = text.split(' '); - var lines = []; - var currentLine = []; - var longestLine = 0; - words.forEach(function (word) { - var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' '); - var length = (0, _measureText.measureText)(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - lines.push(currentLine); - return { - lines: lines, - longestLine: longestLine - }; -} - -function loadPages(Jimp, dir, pages) { - var newPages = pages.map(function (page) { - return Jimp.read(dir + '/' + page); - }); - return Promise.all(newPages); -} - -var dir = process.env.DIRNAME || "".concat(__dirname, "/../"); - -var _default = function _default() { - return { - constants: { - measureText: _measureText.measureText, - measureTextHeight: _measureText.measureTextHeight, - FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'), - FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'), - FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'), - FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'), - FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'), - FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'), - FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'), - FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'), - FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'), - FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'), - FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'), - FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'), - FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont: function loadFont(file, cb) { - var _this = this; - - if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb); - return new Promise(function (resolve, reject) { - cb = cb || function (err, font) { - if (err) reject(err);else resolve(font); - }; - - (0, _loadBmfont["default"])(file, function (err, font) { - var chars = {}; - var kernings = {}; - - if (err) { - return _utils.throwError.call(_this, err, cb); - } - - for (var i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (var _i = 0; _i < font.kernings.length; _i++) { - var firstString = String.fromCharCode(font.kernings[_i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; - } - - loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { - cb(null, { - chars: chars, - kernings: kernings, - pages: pages, - common: font.common, - info: font.info - }); - }); - }); - }); - } - }, - "class": { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print: function print(font, x, y, text, maxWidth, maxHeight, cb) { - var _this2 = this; - - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if ((0, _typeof2["default"])(font) !== 'object') { - return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return _utils.throwError.call(this, 'maxHeight must be a number', cb); - } - - var alignmentX; - var alignmentY; - - if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - var _text = text; - text = _text.text; - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { - y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); - } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { - y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; - } - - var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - - var _splitLines = splitLines(font, text, maxWidth), - lines = _splitLines.lines, - longestLine = _splitLines.longestLine; - - lines.forEach(function (line) { - var lineString = line.join(' '); - var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); - printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); - y += font.common.lineHeight; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this, { - x: x + longestLine, - y: y - }); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map deleted file mode 100644 index e5583103..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","l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,GAAgB,oCAAkBzF,IAAlB,EAAwBoB,IAAxB,EAA8BlB,QAA9B,IAA0C,CAA/D;AACD;;AAED,YAAMmB,gBAAgB,GAAG8E,MAAM,CAACC,OAAP,CAAepG,IAAI,CAACwB,KAApB,EAA2B,CAA3B,EAA8B,CAA9B,EAAiCM,QAA1D;;AApE+C,0BAqEhBC,UAAU,CAAC/B,IAAD,EAAOoB,IAAP,EAAalB,QAAb,CArEM;AAAA,YAqEvCgC,KArEuC,eAqEvCA,KArEuC;AAAA,YAqEhCE,WArEgC,eAqEhCA,WArEgC;;AAuE/CF,QAAAA,KAAK,CAACG,OAAN,CAAc,UAAApC,IAAI,EAAI;AACpB,cAAMoG,UAAU,GAAGpG,IAAI,CAACsC,IAAL,CAAU,GAAV,CAAnB;AACA,cAAM+D,cAAc,GAAGxG,uBAAuB,CAC5C,MAAI,CAACgG,WADuC,EAE5C9F,IAF4C,EAG5CqG,UAH4C,EAI5CnG,QAJ4C,EAK5CyF,UAL4C,CAA9C;AAQAxE,UAAAA,SAAS,CAACsD,IAAV,CACE,MADF,EAEEzE,IAFF,EAGEQ,CAAC,GAAG8F,cAHN,EAIE7F,CAJF,EAKE4F,UALF,EAMEhF,gBANF;AASAZ,UAAAA,CAAC,IAAIT,IAAI,CAACsF,MAAL,CAAYiB,UAAjB;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from 'path';\nimport bMFont from 'load-bmfont';\nimport { isNodePattern, throwError } from '@jimp/utils';\nimport { measureText, measureTextHeight } from './measure-text';\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = '';\n } else {\n char = '?';\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(' ');\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach(word => {\n const line = [...currentLine, word].join(' ');\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + '/' + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== 'string')\n return throwError.call(this, 'file must be a string', cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function(err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === 'function' && typeof cb === 'undefined') {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === 'undefined') {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === 'function' && typeof cb === 'undefined') {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === 'undefined') {\n maxHeight = Infinity;\n }\n\n if (typeof font !== 'object') {\n return throwError.call(this, 'font must be a Jimp loadFont', cb);\n }\n\n if (\n typeof x !== 'number' ||\n typeof y !== 'number' ||\n typeof maxWidth !== 'number'\n ) {\n return throwError.call(this, 'x, y and maxWidth must be numbers', cb);\n }\n\n if (typeof maxWidth !== 'number') {\n return throwError.call(this, 'maxWidth must be a number', cb);\n }\n\n if (typeof maxHeight !== 'number') {\n return throwError.call(this, 'maxHeight must be a number', cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === 'object' &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach(line => {\n const lineString = line.join(' ');\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js deleted file mode 100644 index b75ac795..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.measureText = measureText; -exports.measureTextHeight = measureTextHeight; - -function measureText(font, text) { - var x = 0; - - for (var i = 0; i < text.length; i++) { - if (font.chars[text[i]]) { - var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; - x += (font.chars[text[i]].xadvance || 0) + kerning; - } - } - - return x; -} - -function measureTextHeight(font, text, maxWidth) { - var words = text.split(' '); - var line = ''; - var textTotalHeight = font.common.lineHeight; - - for (var n = 0; n < words.length; n++) { - var testLine = line + words[n] + ' '; - var testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; - } else { - line = testLine; - } - } - - return textTotalHeight; -} -//# sourceMappingURL=measure-text.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map deleted file mode 100644 index 56209773..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,CAAJ,EAAyB;AACvB,UAAMG,OAAO,GACXN,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,KAA0BH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CAA1B,GACIH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CADJ,GAEI,CAHN;AAKAD,MAAAA,CAAC,IAAI,CAACF,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,EAAoBK,QAApB,IAAgC,CAAjC,IAAsCF,OAA3C;AACD;AACF;;AAED,SAAOJ,CAAP;AACD;;AAEM,SAASO,iBAAT,CAA2BT,IAA3B,EAAiCC,IAAjC,EAAuCS,QAAvC,EAAiD;AACtD,MAAMC,KAAK,GAAGV,IAAI,CAACW,KAAL,CAAW,GAAX,CAAd;AACA,MAAIC,IAAI,GAAG,EAAX;AACA,MAAIC,eAAe,GAAGd,IAAI,CAACe,MAAL,CAAYC,UAAlC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAAK,CAACP,MAA1B,EAAkCa,CAAC,EAAnC,EAAuC;AACrC,QAAMC,QAAQ,GAAGL,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAZ,GAAkB,GAAnC;AACA,QAAME,SAAS,GAAGpB,WAAW,CAACC,IAAD,EAAOkB,QAAP,CAA7B;;AAEA,QAAIC,SAAS,GAAGT,QAAZ,IAAwBO,CAAC,GAAG,CAAhC,EAAmC;AACjCH,MAAAA,eAAe,IAAId,IAAI,CAACe,MAAL,CAAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(' ');\n let line = '';\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + ' ';\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + ' ';\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/index.js b/project starter code/node_modules/@jimp/plugin-print/es/index.js deleted file mode 100644 index 28011073..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/es/index.js +++ /dev/null @@ -1,260 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _path = _interopRequireDefault(require("path")); - -var _loadBmfont = _interopRequireDefault(require("load-bmfont")); - -var _utils = require("@jimp/utils"); - -var _measureText = require("./measure-text"); - -function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { - if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { - return 0; - } - - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { - return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; - } - - return maxWidth - (0, _measureText.measureText)(font, line); -} - -function drawCharacter(image, font, x, y, _char) { - if (_char.width > 0 && _char.height > 0) { - var characterPage = font.pages[_char.page]; - image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); - } - - return image; -} - -function printText(font, x, y, text, defaultCharWidth) { - for (var i = 0; i < text.length; i++) { - var _char2 = void 0; - - if (font.chars[text[i]]) { - _char2 = text[i]; - } else if (/\s/.test(text[i])) { - _char2 = ''; - } else { - _char2 = '?'; - } - - var fontChar = font.chars[_char2] || {}; - var fontKerning = font.kernings[_char2]; - drawCharacter(this, font, x, y, fontChar || {}); - var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; - x += kerning + (fontChar.xadvance || defaultCharWidth); - } -} - -function splitLines(font, text, maxWidth) { - var words = text.split(' '); - var lines = []; - var currentLine = []; - var longestLine = 0; - words.forEach(function (word) { - var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' '); - var length = (0, _measureText.measureText)(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - lines.push(currentLine); - return { - lines: lines, - longestLine: longestLine - }; -} - -function loadPages(Jimp, dir, pages) { - var newPages = pages.map(function (page) { - return Jimp.read(dir + '/' + page); - }); - return Promise.all(newPages); -} - -var dir = process.env.DIRNAME || "".concat(__dirname, "/../"); - -var _default = function _default() { - return { - constants: { - measureText: _measureText.measureText, - measureTextHeight: _measureText.measureTextHeight, - FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'), - FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'), - FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'), - FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'), - FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'), - FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'), - FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'), - FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'), - FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'), - FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'), - FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'), - FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'), - FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont: function loadFont(file, cb) { - var _this = this; - - if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb); - return new Promise(function (resolve, reject) { - cb = cb || function (err, font) { - if (err) reject(err);else resolve(font); - }; - - (0, _loadBmfont["default"])(file, function (err, font) { - var chars = {}; - var kernings = {}; - - if (err) { - return _utils.throwError.call(_this, err, cb); - } - - for (var i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (var _i = 0; _i < font.kernings.length; _i++) { - var firstString = String.fromCharCode(font.kernings[_i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; - } - - loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { - cb(null, { - chars: chars, - kernings: kernings, - pages: pages, - common: font.common, - info: font.info - }); - }); - }); - }); - } - }, - "class": { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print: function print(font, x, y, text, maxWidth, maxHeight, cb) { - var _this2 = this; - - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if ((0, _typeof2["default"])(font) !== 'object') { - return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return _utils.throwError.call(this, 'maxHeight must be a number', cb); - } - - var alignmentX; - var alignmentY; - - if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - var _text = text; - text = _text.text; - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { - y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); - } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { - y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; - } - - var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - - var _splitLines = splitLines(font, text, maxWidth), - lines = _splitLines.lines, - longestLine = _splitLines.longestLine; - - lines.forEach(function (line) { - var lineString = line.join(' '); - var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); - printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); - y += font.common.lineHeight; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this, { - x: x + longestLine, - y: y - }); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/index.js.map b/project starter code/node_modules/@jimp/plugin-print/es/index.js.map deleted file mode 100644 index e5583103..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","lineHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,SAASA,uBAAT,CAAiCC,SAAjC,EAA4CC,IAA5C,EAAkDC,IAAl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CAACC,OAAP,CAAepG,IAAI,CAACwB,KAApB,EAA2B,CAA3B,EAA8B,CAA9B,EAAiCM,QAA1D;;AApE+C,0BAqEhBC,UAAU,CAAC/B,IAAD,EAAOoB,IAAP,EAAalB,QAAb,CArEM;AAAA,YAqEvCgC,KArEuC,eAqEvCA,KArEuC;AAAA,YAqEhCE,WArEgC,eAqEhCA,WArEgC;;AAuE/CF,QAAAA,KAAK,CAACG,OAAN,CAAc,UAAApC,IAAI,EAAI;AACpB,cAAMoG,UAAU,GAAGpG,IAAI,CAACsC,IAAL,CAAU,GAAV,CAAnB;AACA,cAAM+D,cAAc,GAAGxG,uBAAuB,CAC5C,MAAI,CAACgG,WADuC,EAE5C9F,IAF4C,EAG5CqG,UAH4C,EAI5CnG,QAJ4C,EAK5CyF,UAL4C,CAA9C;AAQAxE,UAAAA,SAAS,CAACsD,IAAV,CACE,MADF,EAEEzE,IAFF,EAGEQ,CAAC,GAAG8F,cAHN,EAIE7F,CAJF,EAKE4F,UALF,EAMEhF,gBANF;AASAZ,UAAAA,CAAC,IAAIT,IAAI,CAACsF,MAAL,CAAYiB,UAAjB;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from 'path';\nimport bMFont from 'load-bmfont';\nimport { isNodePattern, throwError } from '@jimp/utils';\nimport { measureText, measureTextHeight } from './measure-text';\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = '';\n } else {\n char = '?';\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(' ');\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach(word => {\n const line = [...currentLine, word].join(' ');\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + '/' + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== 'string')\n return throwError.call(this, 'file must be a string', cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function(err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === 'function' && typeof cb === 'undefined') {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === 'undefined') {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === 'function' && typeof cb === 'undefined') {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === 'undefined') {\n maxHeight = Infinity;\n }\n\n if (typeof font !== 'object') {\n return throwError.call(this, 'font must be a Jimp loadFont', cb);\n }\n\n if (\n typeof x !== 'number' ||\n typeof y !== 'number' ||\n typeof maxWidth !== 'number'\n ) {\n return throwError.call(this, 'x, y and maxWidth must be numbers', cb);\n }\n\n if (typeof maxWidth !== 'number') {\n return throwError.call(this, 'maxWidth must be a number', cb);\n }\n\n if (typeof maxHeight !== 'number') {\n return throwError.call(this, 'maxHeight must be a number', cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === 'object' &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach(line => {\n const lineString = line.join(' ');\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js deleted file mode 100644 index b75ac795..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.measureText = measureText; -exports.measureTextHeight = measureTextHeight; - -function measureText(font, text) { - var x = 0; - - for (var i = 0; i < text.length; i++) { - if (font.chars[text[i]]) { - var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; - x += (font.chars[text[i]].xadvance || 0) + kerning; - } - } - - return x; -} - -function measureTextHeight(font, text, maxWidth) { - var words = text.split(' '); - var line = ''; - var textTotalHeight = font.common.lineHeight; - - for (var n = 0; n < words.length; n++) { - var testLine = line + words[n] + ' '; - var testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; - } else { - line = testLine; - } - } - - return textTotalHeight; -} -//# sourceMappingURL=measure-text.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map deleted file mode 100644 index 56209773..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,CAAJ,EAAyB;AACvB,UAAMG,OAAO,GACXN,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,KAA0BH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CAA1B,GACIH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CADJ,GAEI,CAHN;AAKAD,MAAAA,CAAC,IAAI,CAACF,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,EAAoBK,QAApB,IAAgC,CAAjC,IAAsCF,OAA3C;AACD;AACF;;AAED,SAAOJ,CAAP;AACD;;AAEM,SAASO,iBAAT,CAA2BT,IAA3B,EAAiCC,IAAjC,EAAuCS,QAAvC,EAAiD;AACtD,MAAMC,KAAK,GAAGV,IAAI,CAACW,KAAL,CAAW,GAAX,CAAd;AACA,MAAIC,IAAI,GAAG,EAAX;AACA,MAAIC,eAAe,GAAGd,IAAI,CAACe,MAAL,CAAYC,UAAlC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAAK,CAACP,MAA1B,EAAkCa,CAAC,EAAnC,EAAuC;AACrC,QAAMC,QAAQ,GAAGL,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAZ,GAAkB,GAAnC;AACA,QAAME,SAAS,GAAGpB,WAAW,CAACC,IAAD,EAAOkB,QAAP,CAA7B;;AAEA,QAAIC,SAAS,GAAGT,QAAZ,IAAwBO,CAAC,GAAG,CAAhC,EAAmC;AACjCH,MAAAA,eAAe,IAAId,IAAI,CAACe,MAAL,CAAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(' ');\n let line = '';\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + ' ';\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + ' ';\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/index.d.ts b/project starter code/node_modules/@jimp/plugin-print/index.d.ts deleted file mode 100644 index 5d0273bb..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/index.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { GenericCallback, ImageCallback } from '@jimp/core'; - -export interface FontChar { - id: number; - x: number; - y: number; - width: number; - height: number; - xoffset: number; - yoffset: number; - xadvance: number; - page: number; - chnl: number; -} - -export interface FontInfo { - face: string; - size: number; - bold: number; - italic: number; - charset: string; - unicode: number; - stretchH: number; - smooth: number; - aa: number; - padding: [number, number, number, number]; - spacing: [number, number]; -} - -export interface FontCommon { - lineHeight: number; - base: number; - scaleW: number; - scaleH: number; - pages: number; - packed: number; - alphaChnl: number; - redChnl: number; - greenChnl: number; - blueChnl: number; -} - -export interface Font { - chars: { - [char: string]: FontChar; - }; - kernings: { - [firstString: string]: { - [secondString: string]: number; - }; - }; - pages: string[]; - common: FontCommon; - info: FontInfo; -} - -type PrintableText = - | any - | { - text: string; - alignmentX: number; - alignmentY: number; -}; - -interface PrintClass { - // Text methods - print( - font: Font, - x: number, - y: number, - text: PrintableText, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - maxHeight?: number, - cb?: ImageCallback - ): this; -} - -interface Print { - constants: { - measureText(font: Font, text: PrintableText): number; - measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; - - // Font locations - FONT_SANS_8_BLACK: string; - FONT_SANS_10_BLACK: string; - FONT_SANS_12_BLACK: string; - FONT_SANS_14_BLACK: string; - FONT_SANS_16_BLACK: string; - FONT_SANS_32_BLACK: string; - FONT_SANS_64_BLACK: string; - FONT_SANS_128_BLACK: string; - - FONT_SANS_8_WHITE: string; - FONT_SANS_16_WHITE: string; - FONT_SANS_32_WHITE: string; - FONT_SANS_64_WHITE: string; - FONT_SANS_128_WHITE: string; - - loadFont(file: string): Promise; - loadFont(file: string, cb: GenericCallback): Promise; - } - - class: PrintClass -} - -export default function(): Print; diff --git a/project starter code/node_modules/@jimp/plugin-print/package.json b/project starter code/node_modules/@jimp/plugin-print/package.json deleted file mode 100644 index e48e4e63..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@jimp/plugin-print", - "version": "0.16.2", - "description": "print an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-print/src/index.js b/project starter code/node_modules/@jimp/plugin-print/src/index.js deleted file mode 100644 index c8e97936..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/src/index.js +++ /dev/null @@ -1,322 +0,0 @@ -import Path from 'path'; -import bMFont from 'load-bmfont'; -import { isNodePattern, throwError } from '@jimp/utils'; -import { measureText, measureTextHeight } from './measure-text'; - -function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { - if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { - return 0; - } - - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { - return (maxWidth - measureText(font, line)) / 2; - } - - return maxWidth - measureText(font, line); -} - -function drawCharacter(image, font, x, y, char) { - if (char.width > 0 && char.height > 0) { - const characterPage = font.pages[char.page]; - - image.blit( - characterPage, - x + char.xoffset, - y + char.yoffset, - char.x, - char.y, - char.width, - char.height - ); - } - - return image; -} - -function printText(font, x, y, text, defaultCharWidth) { - for (let i = 0; i < text.length; i++) { - let char; - - if (font.chars[text[i]]) { - char = text[i]; - } else if (/\s/.test(text[i])) { - char = ''; - } else { - char = '?'; - } - - const fontChar = font.chars[char] || {}; - const fontKerning = font.kernings[char]; - - drawCharacter(this, font, x, y, fontChar || {}); - - const kerning = - fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; - - x += kerning + (fontChar.xadvance || defaultCharWidth); - } -} - -function splitLines(font, text, maxWidth) { - const words = text.split(' '); - const lines = []; - let currentLine = []; - let longestLine = 0; - - words.forEach(word => { - const line = [...currentLine, word].join(' '); - const length = measureText(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - - lines.push(currentLine); - - return { - lines, - longestLine - }; -} - -function loadPages(Jimp, dir, pages) { - const newPages = pages.map(page => { - return Jimp.read(dir + '/' + page); - }); - - return Promise.all(newPages); -} - -const dir = process.env.DIRNAME || `${__dirname}/../`; - -export default () => ({ - constants: { - measureText, - measureTextHeight, - FONT_SANS_8_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt' - ), - FONT_SANS_10_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt' - ), - FONT_SANS_12_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt' - ), - FONT_SANS_14_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt' - ), - FONT_SANS_16_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt' - ), - FONT_SANS_32_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt' - ), - FONT_SANS_64_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt' - ), - FONT_SANS_128_BLACK: Path.join( - dir, - 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt' - ), - - FONT_SANS_8_WHITE: Path.join( - dir, - 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt' - ), - FONT_SANS_16_WHITE: Path.join( - dir, - 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt' - ), - FONT_SANS_32_WHITE: Path.join( - dir, - 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt' - ), - FONT_SANS_64_WHITE: Path.join( - dir, - 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt' - ), - FONT_SANS_128_WHITE: Path.join( - dir, - 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt' - ), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont(file, cb) { - if (typeof file !== 'string') - return throwError.call(this, 'file must be a string', cb); - - return new Promise((resolve, reject) => { - cb = - cb || - function(err, font) { - if (err) reject(err); - else resolve(font); - }; - - bMFont(file, (err, font) => { - const chars = {}; - const kernings = {}; - - if (err) { - return throwError.call(this, err, cb); - } - - for (let i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (let i = 0; i < font.kernings.length; i++) { - const firstString = String.fromCharCode(font.kernings[i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][ - String.fromCharCode(font.kernings[i].second) - ] = font.kernings[i].amount; - } - - loadPages(this, Path.dirname(file), font.pages).then(pages => { - cb(null, { - chars, - kernings, - pages, - common: font.common, - info: font.info - }); - }); - }); - }); - } - }, - - class: { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print(font, x, y, text, maxWidth, maxHeight, cb) { - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if (typeof font !== 'object') { - return throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if ( - typeof x !== 'number' || - typeof y !== 'number' || - typeof maxWidth !== 'number' - ) { - return throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return throwError.call(this, 'maxHeight must be a number', cb); - } - - let alignmentX; - let alignmentY; - - if ( - typeof text === 'object' && - text.text !== null && - text.text !== undefined - ) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - ({ text } = text); - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if ( - maxHeight !== Infinity && - alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM - ) { - y += maxHeight - measureTextHeight(font, text, maxWidth); - } else if ( - maxHeight !== Infinity && - alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE - ) { - y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2; - } - - const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - const { lines, longestLine } = splitLines(font, text, maxWidth); - - lines.forEach(line => { - const lineString = line.join(' '); - const alignmentWidth = xOffsetBasedOnAlignment( - this.constructor, - font, - lineString, - maxWidth, - alignmentX - ); - - printText.call( - this, - font, - x + alignmentWidth, - y, - lineString, - defaultCharWidth - ); - - y += font.common.lineHeight; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this, { x: x + longestLine, y }); - } - - return this; - } - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js deleted file mode 100644 index bf14bed8..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js +++ /dev/null @@ -1,36 +0,0 @@ -export function measureText(font, text) { - let x = 0; - - for (let i = 0; i < text.length; i++) { - if (font.chars[text[i]]) { - const kerning = - font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] - ? font.kernings[text[i]][text[i + 1]] - : 0; - - x += (font.chars[text[i]].xadvance || 0) + kerning; - } - } - - return x; -} - -export function measureTextHeight(font, text, maxWidth) { - const words = text.split(' '); - let line = ''; - let textTotalHeight = font.common.lineHeight; - - for (let n = 0; n < words.length; n++) { - const testLine = line + words[n] + ' '; - const testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; - } else { - line = testLine; - } - } - - return textTotalHeight; -} diff --git a/project starter code/node_modules/@jimp/plugin-print/test/print.test.js b/project starter code/node_modules/@jimp/plugin-print/test/print.test.js deleted file mode 100644 index 36a16669..00000000 --- a/project starter code/node_modules/@jimp/plugin-print/test/print.test.js +++ /dev/null @@ -1,284 +0,0 @@ -/* eslint key-spacing: ["error", { "align": "value" }] */ - -import { Jimp, getTestDir, hasOwnProp } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import blit from '@jimp/plugin-blit'; - -import print from '../src'; - -const jimp = configure({ plugins: [print, blit] }, Jimp); - -async function createTextImage( - width, - height, - font, - { x = 0, y = 0, text, maxWidth, maxHeight } -) { - const loadedFont = await jimp.loadFont(font); - const image = await Jimp.create(width, height, 0xffffffff); - - return image.print(loadedFont, x, y, text, maxWidth, maxHeight); -} - -describe('Write text over image', function() { - this.timeout(30000); - - const fontDefs = { - SANS_8_BLACK: { w: 28, h: 28, bg: 0xffffffff }, - - SANS_16_BLACK: { w: 54, h: 54, bg: 0xffffffff }, - SANS_32_BLACK: { w: 114, h: 114, bg: 0xffffffff }, - SANS_64_BLACK: { w: 220, h: 220, bg: 0xffffffff }, - - SANS_8_WHITE: { w: 28, h: 28, bg: 0x000000ff }, - - SANS_16_WHITE: { w: 54, h: 54, bg: 0x000000ff }, - SANS_32_WHITE: { w: 114, h: 114, bg: 0x000000ff }, - SANS_64_WHITE: { w: 220, h: 220, bg: 0x000000ff } - }; - - for (const fontName in fontDefs) - if (hasOwnProp(fontDefs, fontName)) - ((fontName, conf) => { - it('Jimp preset ' + fontName + ' bitmap font', async () => { - const font = await jimp.loadFont(Jimp['FONT_' + fontName]); - const expected = - getTestDir(__dirname) + '/images/' + fontName + '.png'; - - const expectedImg = await Jimp.read(expected); - const image = await Jimp.create(conf.w, conf.h, conf.bg); - - image - .print(font, 0, 0, 'This is only a test.', image.bitmap.width) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - })(fontName, fontDefs[fontName]); - - it('Jimp preset SANS_16_BLACK bitmap font positioned', async () => { - const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); - const expected = - getTestDir(__dirname) + '/images/SANS_16_BLACK-positioned.png'; - const expectedImg = await Jimp.read(expected); - const image = await Jimp.create('300', '100', 0xff8800ff); - - image - .print(font, 150, 50, 'This is only a test.', 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - it('Jimp loads font from URL', async () => { - const font = await Jimp.loadFont( - 'https://raw.githubusercontent.com/oliver-moran/jimp/master/packages/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt' - ); - const expected = - getTestDir(__dirname) + '/images/SANS_16_BLACK-positioned.png'; - const expectedImg = await Jimp.read(expected); - const image = await Jimp.create('300', '100', 0xff8800ff); - - image - .print(font, 150, 50, 'This is only a test.', 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - it('Jimp renders ? for unknown characters', async () => { - const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); - - const expected = getTestDir(__dirname) + '/images/unknown-char-test.png'; - const expectedImg = await Jimp.read(expected); - const image = await Jimp.read('300', '100', 0xff8800ff); - - image - .print(font, 0, 0, 'ツ ツ ツ', 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - it('Jimp can print numbers too', async () => { - const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK); - - const expected = getTestDir(__dirname) + '/images/print-number.png'; - const expectedImg = await Jimp.read(expected); - const image = await Jimp.read('300', '100', 0xff8800ff); - - image - .print(font, 0, 0, 12345678, 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); - - it('left-align text by default', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/left-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: 'This is only a test.', - - maxWidth: 100 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('left-align text by default when passing object', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/left-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { text: 'This is only a test.' }, - - maxWidth: 100 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('left-align text when passing object with alignmentX', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/left-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { - text: 'This is only a test.', - - alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT - }, - maxWidth: 100 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('center-align text when passing object with alignmentX', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/center-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { - text: 'This is only a test.', - - alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER - }, - maxWidth: 100 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('right-align text when passing object with alignmentX', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/right-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { - text: 'This is only a test.', - - alignmentX: Jimp.HORIZONTAL_ALIGN_RIGHT - }, - maxWidth: 100 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('middle-align text when passing object with alignmentY', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/middle-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { - text: 'This is only a test.', - - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE - }, - maxWidth: 100, - - maxHeight: 240 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('middle-align text when passing object with alignmentY can offset y', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/middle-aligned-y.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - y: 50, - - text: { - text: 'This is only a test.', - - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE - }, - maxWidth: 100, - - maxHeight: 240 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('bottom-align text when passing object with alignmentY', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/bottom-aligned.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { - text: 'This is only a test.', - - alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM - }, - maxWidth: 100, - - maxHeight: 240 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('bottom-align text when passing object with alignmentY offset y', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/bottom-aligned-y.png' - ); - const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - y: 100, - - text: { - text: 'This is only a test.', - - alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM - }, - maxWidth: 100, - - maxHeight: 100 - }); - - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); - }); - - it('exposes print y position in cb', async () => { - const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/spacing.png' - ); - - const loadedFont = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); - const image = await Jimp.create(500, 500, 0xffffffff); - - image.print( - loadedFont, - 0, - 0, - 'One two three four fix six seven eight nine ten eleven twelve', - 250, - (err, image, { x, y }) => { - image.print( - loadedFont, - x, - y + 50, - 'thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty', - 250 - ); - } - ); - - expectedImage.bitmap.data.should.be.deepEqual(image.bitmap.data); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/README.md b/project starter code/node_modules/@jimp/plugin-resize/README.md deleted file mode 100644 index 9185cc83..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/README.md +++ /dev/null @@ -1,61 +0,0 @@ -
- -

@jimp/plugin-resize

-

Resize an image.

-
- -Resizes the image to a set width and height using a 2-pass bilinear algorithm/ - -## Usage - -- @param {number} w the width to resize the image to (or Jimp.AUTO) -- @param {number} h the height to resize the image to (or Jimp.AUTO) -- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - // Read the image. - const image = await jimp.read('test/image.png'); - - // Resize the image to width 150 and auto height. - await image.resize(150, jimp.AUTO); - - // Save and overwrite the image - await image.writeAsync('test/image.png'); -} - -main(); -``` - -## Auto - -`Jimp.AUTO` can be passes to either the height or width and jimp will scale the image accordingly. `Jimp.AUTO` cannot be both height and width. - -```js -// resize the height to 250 and scale the width accordingly -image.resize(Jimp.AUTO, 250); -// resize the width to 250 and scale the height accordingly -image.resize(250, Jimp.AUTO); -``` - -### Resize modes - -The default resizing algorithm uses a bilinear method. - -Optionally, the following constants can be passed to choose a particular resizing algorithm: - -```js -Jimp.RESIZE_NEAREST_NEIGHBOR; -Jimp.RESIZE_BILINEAR; -Jimp.RESIZE_BICUBIC; -Jimp.RESIZE_HERMITE; -Jimp.RESIZE_BEZIER; -``` - -```js -image.resize(250, 250, Jimp.RESIZE_BEZIER); -``` diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js deleted file mode 100644 index 8d645992..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _resize = _interopRequireDefault(require("./modules/resize")); - -var _resize2 = _interopRequireDefault(require("./modules/resize2")); - -var _default = function _default() { - return { - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - "class": { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize: function resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return _utils.throwError.call(this, 'w and h must be positive numbers', cb); - } // round inputs - - - w = Math.round(w); - h = Math.round(h); - - if (typeof _resize2["default"][mode] === 'function') { - var dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - _resize2["default"][mode](this.bitmap, dst); - - this.bitmap = dst; - } else { - var image = this; - var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - }); - resize.resize(this.bitmap.data); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map deleted file mode 100644 index 36caf764..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe;AAAA,SAAO;AACpBA,IAAAA,SAAS,EAAE;AACTC,MAAAA,uBAAuB,EAAE,iBADhB;AAETC,MAAAA,eAAe,EAAE,uBAFR;AAGTC,MAAAA,cAAc,EAAE,sBAHP;AAITC,MAAAA,cAAc,EAAE,sBAJP;AAKTC,MAAAA,aAAa,EAAE;AALN,KADS;AASpB,aAAO;AACL;;;;;;;;AAQAC,MAAAA,MATK,kBASEC,CATF,EASKC,CATL,EASQC,IATR,EAScC,EATd,EASkB;AACrB,YAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,iBAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,YAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,UAAAA,EAAE,GAAGD,IAAL;AACAA,UAAAA,IAAI,GAAG,IAAP;AACD;;AAED,YAAIF,CAAC,KAAK,KAAKM,WAAL,CAAiBC,IAAvB,IAA+BN,CAAC,KAAK,KAAKK,WAAL,CAAiBC,IAA1D,EAAgE;AAC9D,iBAAOH,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAED,YAAIH,CAAC,KAAK,KAAKM,WAAL,CAAiBC,IAA3B,EAAiC;AAC/BP,UAAAA,CAAC,GAAG,KAAKQ,MAAL,CAAYC,KAAZ,IAAqBR,CAAC,GAAG,KAAKO,MAAL,CAAYE,MAArC,CAAJ;AACD;;AAED,YAAIT,CAAC,KAAK,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;AACD,WAXY,CAAf;AAaAF,UAAAA,MAAM,CAACA,MAAP,CAAc,KAAKS,MAAL,CAAYO,IAA1B;AACD;;AAED,YAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtEI;AATa,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nimport Resize from './modules/resize';\nimport Resize2 from './modules/resize2';\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',\n RESIZE_BILINEAR: 'bilinearInterpolation',\n RESIZE_BICUBIC: 'bicubicInterpolation',\n RESIZE_HERMITE: 'hermiteInterpolation',\n RESIZE_BEZIER: 'bezierInterpolation'\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, 'w and h cannot both be set to auto', cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, 'w and h must be positive numbers', cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === 'function') {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js deleted file mode 100644 index 8dbb005b..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js +++ /dev/null @@ -1,406 +0,0 @@ -"use strict"; - -// JavaScript Image Resizer (c) 2012 - Grant Galitz -// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 -function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { - this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); - this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); - this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); - this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); - this.colorChannels = blendAlpha ? 4 : 3; - this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {}; - this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; - this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; - this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; - this.widthPassResultSize = this.targetWidthMultipliedByChannels * this.heightOriginal; - this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; - this.initialize(); -} - -Resize.prototype.initialize = function () { - // Perform some checks: - if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { - this.configurePasses(); - } else { - throw new Error('Invalid settings specified for the resizer.'); - } -}; - -Resize.prototype.configurePasses = function () { - if (this.widthOriginal === this.targetWidth) { - // Bypass the width resizer pass: - this.resizeWidth = this.bypassResizer; - } else { - // Setup the width resizer pass: - this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { - this.initializeFirstPassBuffers(true); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; - } else { - this.initializeFirstPassBuffers(false); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; - } - } - - if (this.heightOriginal === this.targetHeight) { - // Bypass the height resizer pass: - this.resizeHeight = this.bypassResizer; - } else { - // Setup the height resizer pass: - this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { - this.initializeSecondPassBuffers(true); - this.resizeHeight = this.resizeHeightInterpolated; - } else { - this.initializeSecondPassBuffers(false); - this.resizeHeight = this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; - } - } -}; - -Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var outputBuffer = this.widthBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var firstWeight = 0; - var secondWeight = 0; - var targetPosition; // Handle for only one interpolation input being valid for start calculation: - - for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { - for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - var interpolationWidthSourceReadStop; - - for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; - } - } // Handle for only one interpolation input being valid for end calculation: - - - for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { - for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } - - return outputBuffer; -}; - -Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var ratioWeightDivisor = 1 / ratioWeight; - var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; - var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; - var output = this.outputWidthWorkBench; - var outputBuffer = this.widthBuffer; - var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var line = 0; - var pixelOffset = 0; - var outputOffset = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (line = 0; line < this.originalHeightMultipliedByChannels;) { - output[line++] = 0; - output[line++] = 0; - output[line++] = 0; - - if (fourthChannel) { - output[line++] = 0; - trustworthyColorsCount[line / channelsNum - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - - for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { - r = buffer[pixelOffset]; - g = buffer[++pixelOffset]; - b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent - - output[line++] += (a ? r : 0) * multiplier; - output[line++] += (a ? g : 0) * multiplier; - output[line++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[line++] += a * multiplier; - trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition += channelsNum; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); - - for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { - weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; - } - - outputOffset += channelsNum; - } while (outputOffset < this.targetWidthMultipliedByChannels); - - return outputBuffer; -}; - -Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { - var ratioWeight = this.ratioWeightHeightPass; - var ratioWeightDivisor = 1 / ratioWeight; - var output = this.outputHeightWorkBench; - var outputBuffer = this.heightBuffer; - var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var pixelOffset = 0; - var outputOffset = 0; - var caret = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - - if (fourthChannel) { - output[pixelOffset++] = 0; - trustworthyColorsCount[pixelOffset / 4 - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - caret = actualPosition; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - r = buffer[caret++]; - g = buffer[caret++]; - b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent - - output[pixelOffset++] += (a ? r : 0) * multiplier; - output[pixelOffset++] += (a ? g : 0) * multiplier; - output[pixelOffset++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[pixelOffset++] += a * multiplier; - trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition = caret; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.widthPassResultSize); - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - - if (fourthChannel) { - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); - } - } - } while (outputOffset < this.finalResultSize); - - return outputBuffer; -}; - -Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, true); -}; - -Resize.prototype.resizeWidthRGB = function (buffer) { - return this._resizeWidthRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthRGBA = function (buffer) { - return this._resizeWidthRGBChannels(buffer, true); -}; - -Resize.prototype.resizeHeightInterpolated = function (buffer) { - var ratioWeight = this.ratioWeightHeightPass; - var outputBuffer = this.heightBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var pixelOffsetAccumulated = 0; - var pixelOffsetAccumulated2 = 0; - var firstWeight = 0; - var secondWeight = 0; - var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: - - for (; weight < 1 / 3; weight += ratioWeight) { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - - for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; - pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); - } - } // Handle for only one interpolation input being valid for end calculation: - - - while (finalOffset < this.finalResultSize) { - for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); - } - } - - return outputBuffer; -}; - -Resize.prototype.resizeHeightRGB = function (buffer) { - return this._resizeHeightRGBChannels(buffer, false); -}; - -Resize.prototype.resizeHeightRGBA = function (buffer) { - return this._resizeHeightRGBChannels(buffer, true); -}; - -Resize.prototype.resize = function (buffer) { - this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); -}; - -Resize.prototype.bypassResizer = function (buffer) { - // Just return the buffer passed: - return buffer; -}; - -Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { - // Initialize the internal width pass buffers: - this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - - if (!BILINEARAlgo) { - this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); - } - } -}; - -Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { - // Initialize the internal height pass buffers: - this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - - if (!BILINEARAlgo) { - this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); - } - } -}; - -Resize.prototype.generateFloatBuffer = function (bufferLength) { - // Generate a float32 typed array buffer: - try { - return new Float32Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateFloat64Buffer = function (bufferLength) { - // Generate a float64 typed array buffer: - try { - return new Float64Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateUint8Buffer = function (bufferLength) { - // Generate a uint8 typed array buffer: - try { - return new Uint8Array(bufferLength); - } catch (error) { - return []; - } -}; - -module.exports = Resize; -//# sourceMappingURL=resize.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map deleted file mode 100644 index 39e5ae34..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,aADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,cAPF,EAQE;AACA,OAAKN,aAAL,GAAqBO,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWT,aAAX,KAA6B,CAAtC,CAArB;AACA,OAAKC,cAAL,GAAsBM,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWR,cAAX,KAA8B,CAAvC,CAAtB;AACA,OAAKC,WAAL,GAAmBK,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWP,WAAX,KAA2B,CAApC,CAAnB;AACA,OAAKC,YAAL,GAAoBI,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWN,YAAX,KAA4B,CAArC,CAApB;AACA,OAAKO,aAAL,GAAqBN,UAAU,GAAG,CAAH,GAAO,CAAtC;AACA,OAAKC,iBAAL,GAAyBM,OAAO,CAACN,iBAAD,CAAhC;AACA,OAAKC,cAAL,GACE,OAAOA,cAAP,KAA0B,UAA1B,GAAuCA,cAAvC,GAAwD,YAAW,CAAE,CADvE;AAGA,OAAKM,+BAAL,GAAuC,KAAKV,WAAL,GAAmB,KAAKQ,aAA/D;AACA,OAAKG,iCAAL,GACE,KAAKb,aAAL,GAAqB,KAAKU,aAD5B;AAEA,OAAKI,kCAAL,GACE,KAAKb,cAAL,GAAsB,KAAKS,aAD7B;AAEA,OAAKK,mBAAL,GACE,KAAKH,+BAAL,GAAuC,KAAKX,cAD9C;AAEA,OAAKe,eAAL,GACE,KA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E,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASAG,MAAM,CAACC,OAAP,GAAiBzF,MAAjB","sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === 'function' ? resizeCallback : function() {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function() {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error('Invalid settings specified for the resizer.');\n }\n};\n\nResize.prototype.configurePasses = function() {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function(\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function(buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function(buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function(buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function(bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function(bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function(bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map deleted file mode 100644 index 4f96dcce..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,eADe,2BACCC,GADD,EACMC,GADN,EACW;AACxB,QAAMC,IAAI,GAAGF,GAAG,CAACG,KAAjB;AACA,QAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAjB;AAEA,QAAMC,IAAI,GAAGL,GAAG,CAACE,KAAjB;AACA,QAAMI,IAAI,GAAGN,GAAG,CAACI,MAAjB;AAEA,QAAMG,MAAM,GAAGR,GAAG,CAACS,IAAnB;AACA,QAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAnB;;AAEA,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,IAApB,EAA0BI,CAAC,EAA3B,EAA+B;AAC7B,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,IAApB,EAA0BM,CAAC,EAA3B,EAA+B;AAC7B,YAAIC,MAAM,GAAG,CAACF,CAAC,GAAGL,IAAJ,GAAWM,CAAZ,IAAiB,CAA9B;AAEA,YAAME,IAAI,GAAGC,IAAI,CAACC,KAAL,CAAYL,CAAC,GAAGP,IAAL,GAAaG,IAAxB,CAAb;AACA,YAAMU,IAAI,GAAGF,IAAI,CAACC,KAAL,CAAYJ,CAAC,GAAGV,IAAL,GAAaI,IAAxB,CAAb;AACA,YAAIY,MAAM,GAAG,CAACJ,IAAI,GAAGZ,IAAP,GAAce,IAAf,IAAuB,CAApC;AAEAP,QAAAA,MAAM,CAACG,MAAM,EAAP,CAAN,GAAmBL,MAAM,CAACU,MAAM,EAAP,CAAzB;AACAR,QAAAA,MAAM,CAACG,MAAM,EAAP,CAAN,GAAmBL,MAAM,CAACU,MAAM,EAAP,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AN,IAAY,CAA7B;AACA,UAAMkC,GAAG,GAAGhC,EAAE,GAAG,CAACC,EAAE,GAAGF,EAAN,IAAY,CAA7B;AACA,UAAMkC,EAAE,GAAG,IAAIvC,CAAf;AACA,UAAM+B,EAAE,GAAG1B,EAAE,GAAGkC,EAAL,GAAUA,EAAV,GAAeA,EAA1B;AACA,UAAMP,EAAE,GAAG,IAAIK,GAAJ,GAAUE,EAAV,GAAeA,EAAf,GAAoBvC,CAA/B;AACA,UAAMiC,EAAE,GAAG,IAAIK,GAAJ,GAAUC,EAAV,GAAevC,CAAf,GAAmBA,CAA9B;AACA,UAAMkC,EAAE,GAAG5B,EAAE,GAAGN,CAAL,GAASA,CAAT,GAAaA,CAAxB;AACA,aAAOpC,IAAI,CAAC4B,GAAL,CAAS,CAAT,EAAY5B,IAAI,CAACuB,GAAL,CAAS,GAAT,EAAcvB,IAAI,CAACW,KAAL,CAAWwD,EAAE,GAAGC,EAAL,GAAUC,EAAV,GAAeC,EAA1B,CAAd,CAAZ,CAAP;AACD,KAVD;;AAYA,WAAO,KAAK7C,cAAL,CAAoBxC,GAApB,EAAyBC,GAAzB,EAA8BwC,OAA9B,EAAuC8C,iBAAvC,CAAP;AACD;AA7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function(k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function(x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function(x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function(x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\n"],"file":"resize2.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/index.js b/project starter code/node_modules/@jimp/plugin-resize/es/index.js deleted file mode 100644 index eb848757..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/es/index.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _resize = _interopRequireDefault(require("./modules/resize")); - -var _resize2 = _interopRequireDefault(require("./modules/resize2")); - -var _default = function _default() { - return { - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - "class": { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize: function resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return _utils.throwError.call(this, 'w and h must be positive numbers', cb); - } // round inputs - - - w = Math.round(w); - h = Math.round(h); - - if (typeof _resize2["default"][mode] === 'function') { - var dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - _resize2["default"][mode](this.bitmap, dst); - - this.bitmap = dst; - } else { - var image = this; - var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - }); - resize.resize(this.bitmap.data); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map deleted file mode 100644 index 36caf764..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe;AAAA,SAAO;AACpBA,IAAAA,SAAS,EAAE;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,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nimport Resize from './modules/resize';\nimport Resize2 from './modules/resize2';\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',\n RESIZE_BILINEAR: 'bilinearInterpolation',\n RESIZE_BICUBIC: 'bicubicInterpolation',\n RESIZE_HERMITE: 'hermiteInterpolation',\n RESIZE_BEZIER: 'bezierInterpolation'\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, 'w and h cannot both be set to auto', cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, 'w and h must be positive numbers', cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === 'function') {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js deleted file mode 100644 index 8dbb005b..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js +++ /dev/null @@ -1,406 +0,0 @@ -"use strict"; - -// JavaScript Image Resizer (c) 2012 - Grant Galitz -// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 -function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { - this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); - this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); - this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); - this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); - this.colorChannels = blendAlpha ? 4 : 3; - this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {}; - this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; - this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; - this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; - this.widthPassResultSize = this.targetWidthMultipliedByChannels * this.heightOriginal; - this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; - this.initialize(); -} - -Resize.prototype.initialize = function () { - // Perform some checks: - if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { - this.configurePasses(); - } else { - throw new Error('Invalid settings specified for the resizer.'); - } -}; - -Resize.prototype.configurePasses = function () { - if (this.widthOriginal === this.targetWidth) { - // Bypass the width resizer pass: - this.resizeWidth = this.bypassResizer; - } else { - // Setup the width resizer pass: - this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { - this.initializeFirstPassBuffers(true); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; - } else { - this.initializeFirstPassBuffers(false); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; - } - } - - if (this.heightOriginal === this.targetHeight) { - // Bypass the height resizer pass: - this.resizeHeight = this.bypassResizer; - } else { - // Setup the height resizer pass: - this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { - this.initializeSecondPassBuffers(true); - this.resizeHeight = this.resizeHeightInterpolated; - } else { - this.initializeSecondPassBuffers(false); - this.resizeHeight = this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; - } - } -}; - -Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var outputBuffer = this.widthBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var firstWeight = 0; - var secondWeight = 0; - var targetPosition; // Handle for only one interpolation input being valid for start calculation: - - for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { - for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - var interpolationWidthSourceReadStop; - - for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; - } - } // Handle for only one interpolation input being valid for end calculation: - - - for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { - for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } - - return outputBuffer; -}; - -Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var ratioWeightDivisor = 1 / ratioWeight; - var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; - var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; - var output = this.outputWidthWorkBench; - var outputBuffer = this.widthBuffer; - var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var line = 0; - var pixelOffset = 0; - var outputOffset = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (line = 0; line < this.originalHeightMultipliedByChannels;) { - output[line++] = 0; - output[line++] = 0; - output[line++] = 0; - - if (fourthChannel) { - output[line++] = 0; - trustworthyColorsCount[line / channelsNum - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - - for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { - r = buffer[pixelOffset]; - g = buffer[++pixelOffset]; - b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent - - output[line++] += (a ? r : 0) * multiplier; - output[line++] += (a ? g : 0) * multiplier; - output[line++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[line++] += a * multiplier; - trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition += channelsNum; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); - - for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { - weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; - } - - outputOffset += channelsNum; - } while (outputOffset < this.targetWidthMultipliedByChannels); - - return outputBuffer; -}; - -Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { - var ratioWeight = this.ratioWeightHeightPass; - var ratioWeightDivisor = 1 / ratioWeight; - var output = this.outputHeightWorkBench; - var outputBuffer = this.heightBuffer; - var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var pixelOffset = 0; - var outputOffset = 0; - var caret = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - - if (fourthChannel) { - output[pixelOffset++] = 0; - trustworthyColorsCount[pixelOffset / 4 - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - caret = actualPosition; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - r = buffer[caret++]; - g = buffer[caret++]; - b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent - - output[pixelOffset++] += (a ? r : 0) * multiplier; - output[pixelOffset++] += (a ? g : 0) * multiplier; - output[pixelOffset++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[pixelOffset++] += a * multiplier; - trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition = caret; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.widthPassResultSize); - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - - if (fourthChannel) { - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); - } - } - } while (outputOffset < this.finalResultSize); - - return outputBuffer; -}; - -Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, true); -}; - -Resize.prototype.resizeWidthRGB = function (buffer) { - return this._resizeWidthRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthRGBA = function (buffer) { - return this._resizeWidthRGBChannels(buffer, true); -}; - -Resize.prototype.resizeHeightInterpolated = function (buffer) { - var ratioWeight = this.ratioWeightHeightPass; - var outputBuffer = this.heightBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var pixelOffsetAccumulated = 0; - var pixelOffsetAccumulated2 = 0; - var firstWeight = 0; - var secondWeight = 0; - var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: - - for (; weight < 1 / 3; weight += ratioWeight) { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - - for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; - pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); - } - } // Handle for only one interpolation input being valid for end calculation: - - - while (finalOffset < this.finalResultSize) { - for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); - } - } - - return outputBuffer; -}; - -Resize.prototype.resizeHeightRGB = function (buffer) { - return this._resizeHeightRGBChannels(buffer, false); -}; - -Resize.prototype.resizeHeightRGBA = function (buffer) { - return this._resizeHeightRGBChannels(buffer, true); -}; - -Resize.prototype.resize = function (buffer) { - this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); -}; - -Resize.prototype.bypassResizer = function (buffer) { - // Just return the buffer passed: - return buffer; -}; - -Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { - // Initialize the internal width pass buffers: - this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - - if (!BILINEARAlgo) { - this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); - } - } -}; - -Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { - // Initialize the internal height pass buffers: - this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - - if (!BILINEARAlgo) { - this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); - } - } -}; - -Resize.prototype.generateFloatBuffer = function (bufferLength) { - // Generate a float32 typed array buffer: - try { - return new Float32Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateFloat64Buffer = function (bufferLength) { - // Generate a float64 typed array buffer: - try { - return new Float64Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateUint8Buffer = function (bufferLength) { - // Generate a uint8 typed array buffer: - try { - return new Uint8Array(bufferLength); - } catch (error) { - return []; - } -}; - -module.exports = Resize; -//# sourceMappingURL=resize.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map deleted file mode 100644 index 39e5ae34..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,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CAfD;;AAiBAF,MAAM,CAACmB,SAAP,CAAiBa,2BAAjB,GAA+C,UAAS+C,YAAT,EAAuB;AACpE;AACA,OAAKR,YAAL,GAAoB,KAAKW,mBAAL,CAAyB,KAAKjE,eAA9B,CAApB;;AAEA,MAAI,CAAC8D,YAAL,EAAmB;AACjB,SAAKT,qBAAL,GAA6B,KAAKU,mBAAL,CAC3B,KAAKnE,+BADsB,CAA7B;;AAIA,QAAI,KAAKF,aAAL,GAAqB,CAAzB,EAA4B;AAC1B,WAAK6D,sCAAL,GAA8C,KAAKS,qBAAL,CAC5C,KAAK9E,WADuC,CAA9C;AAGD;AACF;AACF,CAfD;;AAiBAH,MAAM,CAACmB,SAAP,CAAiB6D,mBAAjB,GAAuC,UAASG,YAAT,EAAuB;AAC5D;AACA,MAAI;AACF,WAAO,IAAIC,YAAJ,CAAiBD,YAAjB,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASArF,MAAM,CAACmB,SAAP,CAAiB8D,qBAAjB,GAAyC,UAASE,YAAT,EAAuB;AAC9D;AACA,MAAI;AACF,WAAO,IAAIG,YAAJ,CAAiBH,YAAjB,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASArF,MAAM,CAACmB,SAAP,CAAiB+D,mBAAjB,GAAuC,UAASC,YAAT,EAAuB;AAC5D;AACA,MAAI;AACF,WAAO,IAAII,UAAJ,CAAeJ,YAAf,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASAG,MAAM,CAACC,OAAP,GAAiBzF,MAAjB","sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === 'function' ? resizeCallback : function() {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function() {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error('Invalid settings specified for the resizer.');\n }\n};\n\nResize.prototype.configurePasses = function() {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function(\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function(buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function(buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function(buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function(bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function(bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function(bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js deleted file mode 100644 index a1b6abdc..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js +++ /dev/null @@ -1,266 +0,0 @@ -"use strict"; - -/** - * Copyright (c) 2015 Guyon Roche - * - * 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 = { - nearestNeighbor: function nearestNeighbor(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; - var iSrc = Math.floor(i * hSrc / hDst); - var jSrc = Math.floor(j * wSrc / wDst); - var posSrc = (iSrc * wSrc + jSrc) * 4; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - } - } - }, - bilinearInterpolation: function bilinearInterpolation(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) { - // special case - k is integer - if (kMin === kMax) { - return vMin; - } - - return Math.round((k - kMin) * vMax + (kMax - k) * vMin); - }; - - var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) { - var posMin = (yMin * wSrc + xMin) * 4 + offset; - var posMax = (yMin * wSrc + xMax) * 4 + offset; - var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer - - if (yMax === yMin) { - bufDst[pos + offset] = vMin; - } else { - posMin = (yMax * wSrc + xMin) * 4 + offset; - posMax = (yMax * wSrc + xMax) * 4 + offset; - var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); - } - }; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; // x & y in src coordinates - - var x = j * wSrc / wDst; - var xMin = Math.floor(x); - var xMax = Math.min(Math.ceil(x), wSrc - 1); - var y = i * hSrc / hDst; - var yMin = Math.floor(y); - var yMax = Math.min(Math.ceil(y), hSrc - 1); - assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 3, x, xMin, xMax, y, yMin, yMax); - } - } - }, - _interpolate2D: function _interpolate2D(src, dst, options, interpolate) { - var bufSrc = src.data; - var bufDst = dst.data; - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares - - var wM = Math.max(1, Math.floor(wSrc / wDst)); - var wDst2 = wDst * wM; - var hM = Math.max(1, Math.floor(hSrc / hDst)); - var hDst2 = hDst * hM; // =========================================================== - // Pass 1 - interpolate rows - // buf1 has width of dst2 and height of src - - var buf1 = Buffer.alloc(wDst2 * hSrc * 4); - - for (var i = 0; i < hSrc; i++) { - for (var j = 0; j < wDst2; j++) { - // i in src coords, j in dst coords - // calculate x in src coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (wSrc-1)/wDst2 - var x = j * (wSrc - 1) / wDst2; - var xPos = Math.floor(x); - var t = x - xPos; - var srcPos = (i * wSrc + xPos) * 4; - var buf1Pos = (i * wDst2 + j) * 4; - - for (var k = 0; k < 4; k++) { - var kPos = srcPos + k; - var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; - var x1 = bufSrc[kPos]; - var x2 = bufSrc[kPos + 4]; - var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; - buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); - } - } - } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); - // =========================================================== - // Pass 2 - interpolate columns - // buf2 has width and height of dst2 - - - var buf2 = Buffer.alloc(wDst2 * hDst2 * 4); - - for (var _i = 0; _i < hDst2; _i++) { - for (var _j = 0; _j < wDst2; _j++) { - // i&j in dst2 coords - // calculate y in buf1 coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (hSrc-1)/hDst2 - var y = _i * (hSrc - 1) / hDst2; - var yPos = Math.floor(y); - - var _t = y - yPos; - - var _buf1Pos = (yPos * wDst2 + _j) * 4; - - var buf2Pos = (_i * wDst2 + _j) * 4; - - for (var _k = 0; _k < 4; _k++) { - var _kPos = _buf1Pos + _k; - - var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4]; - var y1 = buf1[_kPos]; - var y2 = buf1[_kPos + wDst2 * 4]; - var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos]; - buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t); - } - } - } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); - // =========================================================== - // Pass 3 - scale to dst - - - var m = wM * hM; - - if (m > 1) { - for (var _i2 = 0; _i2 < hDst; _i2++) { - for (var _j2 = 0; _j2 < wDst; _j2++) { - // i&j in dst bounded coords - var r = 0; - var g = 0; - var b = 0; - var a = 0; - var realColors = 0; - - for (var _y = 0; _y < hM; _y++) { - var _yPos = _i2 * hM + _y; - - for (var _x = 0; _x < wM; _x++) { - var _xPos = _j2 * wM + _x; - - var xyPos = (_yPos * wDst2 + _xPos) * 4; - var pixelAlpha = buf2[xyPos + 3]; - - if (pixelAlpha) { - r += buf2[xyPos]; - g += buf2[xyPos + 1]; - b += buf2[xyPos + 2]; - realColors++; - } - - a += pixelAlpha; - } - } - - var pos = (_i2 * wDst + _j2) * 4; - bufDst[pos] = realColors ? Math.round(r / realColors) : 0; - bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; - bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; - bufDst[pos + 3] = Math.round(a / m); - } - } - } else { - // replace dst buffer with buf2 - dst.data = buf2; - } - }, - bicubicInterpolation: function bicubicInterpolation(src, dst, options) { - var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) { - var a0 = x3 - x2 - x0 + x1; - var a1 = x0 - x1 - a0; - var a2 = x2 - x0; - var a3 = x1; - return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)); - }; - - return this._interpolate2D(src, dst, options, interpolateCubic); - }, - hermiteInterpolation: function hermiteInterpolation(src, dst, options) { - var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) { - var c0 = x1; - var c1 = 0.5 * (x2 - x0); - var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; - var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); - return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))); - }; - - return this._interpolate2D(src, dst, options, interpolateHermite); - }, - bezierInterpolation: function bezierInterpolation(src, dst, options) { - // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) - // to predict control points (a & b) to be placed at n+0.5 - // ya(n) = y(n) + (y(n+1)-y(n-1))/4 - // yb(n) = y(n+1) - (y(n+2)-y(n))/4 - // then use std bezier to interpolate [n,n+1) - // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3 - // note the 3* factor for the two control points - // for edge cases, can choose: - // y(-1) = y(0) - 2*(y(1)-y(0)) - // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) - // but can go with y(-1) = y(0) and y(w) = y(w-1) - var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) { - // x1, x2 are the knots, use x0 and x3 to calculate control points - var cp1 = x1 + (x2 - x0) / 4; - var cp2 = x2 - (x3 - x1) / 4; - var nt = 1 - t; - var c0 = x1 * nt * nt * nt; - var c1 = 3 * cp1 * nt * nt * t; - var c2 = 3 * cp2 * nt * t * t; - var c3 = x2 * t * t * t; - return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); - }; - - return this._interpolate2D(src, dst, options, interpolateBezier); - } -}; -//# sourceMappingURL=resize2.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map deleted file mode 100644 index 4f96dcce..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,eADe,2BACCC,GADD,EACMC,GADN,EACW;AACxB,QAAMC,IAAI,GAAGF,GAAG,CAACG,KAAjB;AACA,QAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAjB;AAEA,QAAMC,IAAI,GAAGL,GAAG,CAACE,KAAjB;AACA,QAAMI,IAAI,GAAGN,GAAG,CAACI,MAAjB;AAEA,QAAMG,MAAM,GAAGR,GAAG,CAACS,IAAnB;AACA,QAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAnB;;AAEA,SAAK,IA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AL,CAAWwD,EAAE,GAAGC,EAAL,GAAUC,EAAV,GAAeC,EAA1B,CAAd,CAAZ,CAAP;AACD,KAVD;;AAYA,WAAO,KAAK7C,cAAL,CAAoBxC,GAApB,EAAyBC,GAAzB,EAA8BwC,OAA9B,EAAuC8C,iBAAvC,CAAP;AACD;AA7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function(k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function(x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function(x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function(x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\n"],"file":"resize2.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/index.d.ts b/project starter code/node_modules/@jimp/plugin-resize/index.d.ts deleted file mode 100644 index 24349ad2..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface ResizeClass { - resize(w: number, h: number, cb?: ImageCallback): this; - resize(w: number, h: number, mode?: string, cb?: ImageCallback): this; -} - -interface Resize { - constants: { - // resize methods - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor'; - RESIZE_BILINEAR: 'bilinearInterpolation'; - RESIZE_BICUBIC: 'bicubicInterpolation'; - RESIZE_HERMITE: 'hermiteInterpolation'; - RESIZE_BEZIER: 'bezierInterpolation'; - } - - class: ResizeClass -} - -export default function(): Resize; diff --git a/project starter code/node_modules/@jimp/plugin-resize/package.json b/project starter code/node_modules/@jimp/plugin-resize/package.json deleted file mode 100644 index c34c3cad..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/plugin-resize", - "version": "0.16.2", - "description": "Resize an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/index.js b/project starter code/node_modules/@jimp/plugin-resize/src/index.js deleted file mode 100644 index fb6e05ab..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/src/index.js +++ /dev/null @@ -1,87 +0,0 @@ -import { throwError, isNodePattern } from '@jimp/utils'; - -import Resize from './modules/resize'; -import Resize2 from './modules/resize2'; - -export default () => ({ - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - - class: { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return throwError.call(this, 'w and h must be positive numbers', cb); - } - - // round inputs - w = Math.round(w); - h = Math.round(h); - - if (typeof Resize2[mode] === 'function') { - const dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - Resize2[mode](this.bitmap, dst); - this.bitmap = dst; - } else { - const image = this; - const resize = new Resize( - this.bitmap.width, - this.bitmap.height, - w, - h, - true, - true, - buffer => { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - } - ); - resize.resize(this.bitmap.data); - } - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js deleted file mode 100644 index 3e6de412..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js +++ /dev/null @@ -1,548 +0,0 @@ -// JavaScript Image Resizer (c) 2012 - Grant Galitz -// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 - -function Resize( - widthOriginal, - heightOriginal, - targetWidth, - targetHeight, - blendAlpha, - interpolationPass, - resizeCallback -) { - this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); - this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); - this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); - this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); - this.colorChannels = blendAlpha ? 4 : 3; - this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = - typeof resizeCallback === 'function' ? resizeCallback : function() {}; - - this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; - this.originalWidthMultipliedByChannels = - this.widthOriginal * this.colorChannels; - this.originalHeightMultipliedByChannels = - this.heightOriginal * this.colorChannels; - this.widthPassResultSize = - this.targetWidthMultipliedByChannels * this.heightOriginal; - this.finalResultSize = - this.targetWidthMultipliedByChannels * this.targetHeight; - this.initialize(); -} - -Resize.prototype.initialize = function() { - // Perform some checks: - if ( - this.widthOriginal > 0 && - this.heightOriginal > 0 && - this.targetWidth > 0 && - this.targetHeight > 0 - ) { - this.configurePasses(); - } else { - throw new Error('Invalid settings specified for the resizer.'); - } -}; - -Resize.prototype.configurePasses = function() { - if (this.widthOriginal === this.targetWidth) { - // Bypass the width resizer pass: - this.resizeWidth = this.bypassResizer; - } else { - // Setup the width resizer pass: - this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { - this.initializeFirstPassBuffers(true); - this.resizeWidth = - this.colorChannels === 4 - ? this.resizeWidthInterpolatedRGBA - : this.resizeWidthInterpolatedRGB; - } else { - this.initializeFirstPassBuffers(false); - this.resizeWidth = - this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; - } - } - - if (this.heightOriginal === this.targetHeight) { - // Bypass the height resizer pass: - this.resizeHeight = this.bypassResizer; - } else { - // Setup the height resizer pass: - this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { - this.initializeSecondPassBuffers(true); - this.resizeHeight = this.resizeHeightInterpolated; - } else { - this.initializeSecondPassBuffers(false); - this.resizeHeight = - this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; - } - } -}; - -Resize.prototype._resizeWidthInterpolatedRGBChannels = function( - buffer, - fourthChannel -) { - const channelsNum = fourthChannel ? 4 : 3; - const ratioWeight = this.ratioWeightWidthPass; - const outputBuffer = this.widthBuffer; - - let weight = 0; - let finalOffset = 0; - let pixelOffset = 0; - let firstWeight = 0; - let secondWeight = 0; - let targetPosition; - - // Handle for only one interpolation input being valid for start calculation: - for ( - targetPosition = 0; - weight < 1 / 3; - targetPosition += channelsNum, weight += ratioWeight - ) { - for ( - finalOffset = targetPosition, pixelOffset = 0; - finalOffset < this.widthPassResultSize; - pixelOffset += this.originalWidthMultipliedByChannels, - finalOffset += this.targetWidthMultipliedByChannels - ) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) - outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } - - // Adjust for overshoot of the last pass's counter: - weight -= 1 / 3; - let interpolationWidthSourceReadStop; - - for ( - interpolationWidthSourceReadStop = this.widthOriginal - 1; - weight < interpolationWidthSourceReadStop; - targetPosition += channelsNum, weight += ratioWeight - ) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; - // Interpolate: - for ( - finalOffset = targetPosition, - pixelOffset = Math.floor(weight) * channelsNum; - finalOffset < this.widthPassResultSize; - pixelOffset += this.originalWidthMultipliedByChannels, - finalOffset += this.targetWidthMultipliedByChannels - ) { - outputBuffer[finalOffset + 0] = - buffer[pixelOffset + 0] * firstWeight + - buffer[pixelOffset + channelsNum + 0] * secondWeight; - outputBuffer[finalOffset + 1] = - buffer[pixelOffset + 1] * firstWeight + - buffer[pixelOffset + channelsNum + 1] * secondWeight; - outputBuffer[finalOffset + 2] = - buffer[pixelOffset + 2] * firstWeight + - buffer[pixelOffset + channelsNum + 2] * secondWeight; - if (fourthChannel) - outputBuffer[finalOffset + 3] = - buffer[pixelOffset + 3] * firstWeight + - buffer[pixelOffset + channelsNum + 3] * secondWeight; - } - } - - // Handle for only one interpolation input being valid for end calculation: - for ( - interpolationWidthSourceReadStop = - this.originalWidthMultipliedByChannels - channelsNum; - targetPosition < this.targetWidthMultipliedByChannels; - targetPosition += channelsNum - ) { - for ( - finalOffset = targetPosition, - pixelOffset = interpolationWidthSourceReadStop; - finalOffset < this.widthPassResultSize; - pixelOffset += this.originalWidthMultipliedByChannels, - finalOffset += this.targetWidthMultipliedByChannels - ) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) - outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } - - return outputBuffer; -}; - -Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) { - const channelsNum = fourthChannel ? 4 : 3; - const ratioWeight = this.ratioWeightWidthPass; - const ratioWeightDivisor = 1 / ratioWeight; - const nextLineOffsetOriginalWidth = - this.originalWidthMultipliedByChannels - channelsNum + 1; - const nextLineOffsetTargetWidth = - this.targetWidthMultipliedByChannels - channelsNum + 1; - const output = this.outputWidthWorkBench; - const outputBuffer = this.widthBuffer; - const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - - let weight = 0; - let amountToNext = 0; - let actualPosition = 0; - let currentPosition = 0; - let line = 0; - let pixelOffset = 0; - let outputOffset = 0; - let multiplier = 1; - let r = 0; - let g = 0; - let b = 0; - let a = 0; - - do { - for (line = 0; line < this.originalHeightMultipliedByChannels; ) { - output[line++] = 0; - output[line++] = 0; - output[line++] = 0; - if (fourthChannel) { - output[line++] = 0; - trustworthyColorsCount[line / channelsNum - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - for ( - line = 0, pixelOffset = actualPosition; - line < this.originalHeightMultipliedByChannels; - pixelOffset += nextLineOffsetOriginalWidth - ) { - r = buffer[pixelOffset]; - g = buffer[++pixelOffset]; - b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; - // Ignore RGB values if pixel is completely transparent - output[line++] += (a ? r : 0) * multiplier; - output[line++] += (a ? g : 0) * multiplier; - output[line++] += (a ? b : 0) * multiplier; - if (fourthChannel) { - output[line++] += a * multiplier; - trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition += channelsNum; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while ( - weight > 0 && - actualPosition < this.originalWidthMultipliedByChannels - ); - - for ( - line = 0, pixelOffset = outputOffset; - line < this.originalHeightMultipliedByChannels; - pixelOffset += nextLineOffsetTargetWidth - ) { - weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; - multiplier = fourthChannel - ? weight - ? 1 / weight - : 0 - : ratioWeightDivisor; - outputBuffer[pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - if (fourthChannel) - outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; - } - - outputOffset += channelsNum; - } while (outputOffset < this.targetWidthMultipliedByChannels); - - return outputBuffer; -}; - -Resize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) { - const ratioWeight = this.ratioWeightHeightPass; - const ratioWeightDivisor = 1 / ratioWeight; - const output = this.outputHeightWorkBench; - const outputBuffer = this.heightBuffer; - const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - - let weight = 0; - let amountToNext = 0; - let actualPosition = 0; - let currentPosition = 0; - let pixelOffset = 0; - let outputOffset = 0; - let caret = 0; - let multiplier = 1; - let r = 0; - let g = 0; - let b = 0; - let a = 0; - - do { - for ( - pixelOffset = 0; - pixelOffset < this.targetWidthMultipliedByChannels; - - ) { - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - - if (fourthChannel) { - output[pixelOffset++] = 0; - trustworthyColorsCount[pixelOffset / 4 - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - caret = actualPosition; - - for ( - pixelOffset = 0; - pixelOffset < this.targetWidthMultipliedByChannels; - - ) { - r = buffer[caret++]; - g = buffer[caret++]; - b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; - // Ignore RGB values if pixel is completely transparent - output[pixelOffset++] += (a ? r : 0) * multiplier; - output[pixelOffset++] += (a ? g : 0) * multiplier; - output[pixelOffset++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[pixelOffset++] += a * multiplier; - trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition = caret; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.widthPassResultSize); - - for ( - pixelOffset = 0; - pixelOffset < this.targetWidthMultipliedByChannels; - - ) { - weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; - multiplier = fourthChannel - ? weight - ? 1 / weight - : 0 - : ratioWeightDivisor; - outputBuffer[outputOffset++] = Math.round( - output[pixelOffset++] * multiplier - ); - outputBuffer[outputOffset++] = Math.round( - output[pixelOffset++] * multiplier - ); - outputBuffer[outputOffset++] = Math.round( - output[pixelOffset++] * multiplier - ); - - if (fourthChannel) { - outputBuffer[outputOffset++] = Math.round( - output[pixelOffset++] * ratioWeightDivisor - ); - } - } - } while (outputOffset < this.finalResultSize); - - return outputBuffer; -}; - -Resize.prototype.resizeWidthInterpolatedRGB = function(buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthInterpolatedRGBA = function(buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, true); -}; - -Resize.prototype.resizeWidthRGB = function(buffer) { - return this._resizeWidthRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthRGBA = function(buffer) { - return this._resizeWidthRGBChannels(buffer, true); -}; - -Resize.prototype.resizeHeightInterpolated = function(buffer) { - const ratioWeight = this.ratioWeightHeightPass; - const outputBuffer = this.heightBuffer; - - let weight = 0; - let finalOffset = 0; - let pixelOffset = 0; - let pixelOffsetAccumulated = 0; - let pixelOffsetAccumulated2 = 0; - let firstWeight = 0; - let secondWeight = 0; - let interpolationHeightSourceReadStop; - - // Handle for only one interpolation input being valid for start calculation: - for (; weight < 1 / 3; weight += ratioWeight) { - for ( - pixelOffset = 0; - pixelOffset < this.targetWidthMultipliedByChannels; - - ) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); - } - } - - // Adjust for overshoot of the last pass's counter: - weight -= 1 / 3; - - for ( - interpolationHeightSourceReadStop = this.heightOriginal - 1; - weight < interpolationHeightSourceReadStop; - weight += ratioWeight - ) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; - // Interpolate: - pixelOffsetAccumulated = - Math.floor(weight) * this.targetWidthMultipliedByChannels; - pixelOffsetAccumulated2 = - pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - for ( - pixelOffset = 0; - pixelOffset < this.targetWidthMultipliedByChannels; - ++pixelOffset - ) { - outputBuffer[finalOffset++] = Math.round( - buffer[pixelOffsetAccumulated++] * firstWeight + - buffer[pixelOffsetAccumulated2++] * secondWeight - ); - } - } - - // Handle for only one interpolation input being valid for end calculation: - while (finalOffset < this.finalResultSize) { - for ( - pixelOffset = 0, - pixelOffsetAccumulated = - interpolationHeightSourceReadStop * - this.targetWidthMultipliedByChannels; - pixelOffset < this.targetWidthMultipliedByChannels; - ++pixelOffset - ) { - outputBuffer[finalOffset++] = Math.round( - buffer[pixelOffsetAccumulated++] - ); - } - } - - return outputBuffer; -}; - -Resize.prototype.resizeHeightRGB = function(buffer) { - return this._resizeHeightRGBChannels(buffer, false); -}; - -Resize.prototype.resizeHeightRGBA = function(buffer) { - return this._resizeHeightRGBChannels(buffer, true); -}; - -Resize.prototype.resize = function(buffer) { - this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); -}; - -Resize.prototype.bypassResizer = function(buffer) { - // Just return the buffer passed: - return buffer; -}; - -Resize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) { - // Initialize the internal width pass buffers: - this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - - if (!BILINEARAlgo) { - this.outputWidthWorkBench = this.generateFloatBuffer( - this.originalHeightMultipliedByChannels - ); - - if (this.colorChannels > 3) { - this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer( - this.heightOriginal - ); - } - } -}; - -Resize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) { - // Initialize the internal height pass buffers: - this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - - if (!BILINEARAlgo) { - this.outputHeightWorkBench = this.generateFloatBuffer( - this.targetWidthMultipliedByChannels - ); - - if (this.colorChannels > 3) { - this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer( - this.targetWidth - ); - } - } -}; - -Resize.prototype.generateFloatBuffer = function(bufferLength) { - // Generate a float32 typed array buffer: - try { - return new Float32Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateFloat64Buffer = function(bufferLength) { - // Generate a float64 typed array buffer: - try { - return new Float64Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateUint8Buffer = function(bufferLength) { - // Generate a uint8 typed array buffer: - try { - return new Uint8Array(bufferLength); - } catch (error) { - return []; - } -}; - -module.exports = Resize; diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js deleted file mode 100644 index 1e54df8c..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js +++ /dev/null @@ -1,293 +0,0 @@ -/** - * Copyright (c) 2015 Guyon Roche - * - * 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 = { - nearestNeighbor(src, dst) { - const wSrc = src.width; - const hSrc = src.height; - - const wDst = dst.width; - const hDst = dst.height; - - const bufSrc = src.data; - const bufDst = dst.data; - - for (let i = 0; i < hDst; i++) { - for (let j = 0; j < wDst; j++) { - let posDst = (i * wDst + j) * 4; - - const iSrc = Math.floor((i * hSrc) / hDst); - const jSrc = Math.floor((j * wSrc) / wDst); - let posSrc = (iSrc * wSrc + jSrc) * 4; - - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - } - } - }, - - bilinearInterpolation(src, dst) { - const wSrc = src.width; - const hSrc = src.height; - - const wDst = dst.width; - const hDst = dst.height; - - const bufSrc = src.data; - const bufDst = dst.data; - - const interpolate = function(k, kMin, vMin, kMax, vMax) { - // special case - k is integer - if (kMin === kMax) { - return vMin; - } - - return Math.round((k - kMin) * vMax + (kMax - k) * vMin); - }; - - const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) { - let posMin = (yMin * wSrc + xMin) * 4 + offset; - let posMax = (yMin * wSrc + xMax) * 4 + offset; - const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - - // special case, y is integer - if (yMax === yMin) { - bufDst[pos + offset] = vMin; - } else { - posMin = (yMax * wSrc + xMin) * 4 + offset; - posMax = (yMax * wSrc + xMax) * 4 + offset; - const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - - bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); - } - }; - - for (let i = 0; i < hDst; i++) { - for (let j = 0; j < wDst; j++) { - const posDst = (i * wDst + j) * 4; - // x & y in src coordinates - const x = (j * wSrc) / wDst; - const xMin = Math.floor(x); - const xMax = Math.min(Math.ceil(x), wSrc - 1); - - const y = (i * hSrc) / hDst; - const yMin = Math.floor(y); - const yMax = Math.min(Math.ceil(y), hSrc - 1); - - assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 3, x, xMin, xMax, y, yMin, yMax); - } - } - }, - - _interpolate2D(src, dst, options, interpolate) { - const bufSrc = src.data; - const bufDst = dst.data; - - const wSrc = src.width; - const hSrc = src.height; - - const wDst = dst.width; - const hDst = dst.height; - - // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares - const wM = Math.max(1, Math.floor(wSrc / wDst)); - const wDst2 = wDst * wM; - const hM = Math.max(1, Math.floor(hSrc / hDst)); - const hDst2 = hDst * hM; - - // =========================================================== - // Pass 1 - interpolate rows - // buf1 has width of dst2 and height of src - const buf1 = Buffer.alloc(wDst2 * hSrc * 4); - for (let i = 0; i < hSrc; i++) { - for (let j = 0; j < wDst2; j++) { - // i in src coords, j in dst coords - - // calculate x in src coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (wSrc-1)/wDst2 - const x = (j * (wSrc - 1)) / wDst2; - const xPos = Math.floor(x); - const t = x - xPos; - const srcPos = (i * wSrc + xPos) * 4; - const buf1Pos = (i * wDst2 + j) * 4; - - for (let k = 0; k < 4; k++) { - const kPos = srcPos + k; - const x0 = - xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; - const x1 = bufSrc[kPos]; - const x2 = bufSrc[kPos + 4]; - const x3 = - xPos < wSrc - 2 - ? bufSrc[kPos + 8] - : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; - buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); - } - } - } - // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); - - // =========================================================== - // Pass 2 - interpolate columns - // buf2 has width and height of dst2 - const buf2 = Buffer.alloc(wDst2 * hDst2 * 4); - for (let i = 0; i < hDst2; i++) { - for (let j = 0; j < wDst2; j++) { - // i&j in dst2 coords - - // calculate y in buf1 coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (hSrc-1)/hDst2 - const y = (i * (hSrc - 1)) / hDst2; - const yPos = Math.floor(y); - const t = y - yPos; - const buf1Pos = (yPos * wDst2 + j) * 4; - const buf2Pos = (i * wDst2 + j) * 4; - for (let k = 0; k < 4; k++) { - const kPos = buf1Pos + k; - const y0 = - yPos > 0 - ? buf1[kPos - wDst2 * 4] - : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4]; - const y1 = buf1[kPos]; - const y2 = buf1[kPos + wDst2 * 4]; - const y3 = - yPos < hSrc - 2 - ? buf1[kPos + wDst2 * 8] - : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos]; - - buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t); - } - } - } - // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); - - // =========================================================== - // Pass 3 - scale to dst - const m = wM * hM; - if (m > 1) { - for (let i = 0; i < hDst; i++) { - for (let j = 0; j < wDst; j++) { - // i&j in dst bounded coords - let r = 0; - let g = 0; - let b = 0; - let a = 0; - let realColors = 0; - - for (let y = 0; y < hM; y++) { - const yPos = i * hM + y; - - for (let x = 0; x < wM; x++) { - const xPos = j * wM + x; - const xyPos = (yPos * wDst2 + xPos) * 4; - const pixelAlpha = buf2[xyPos + 3]; - - if (pixelAlpha) { - r += buf2[xyPos]; - g += buf2[xyPos + 1]; - b += buf2[xyPos + 2]; - realColors++; - } - - a += pixelAlpha; - } - } - - const pos = (i * wDst + j) * 4; - bufDst[pos] = realColors ? Math.round(r / realColors) : 0; - bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; - bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; - bufDst[pos + 3] = Math.round(a / m); - } - } - } else { - // replace dst buffer with buf2 - dst.data = buf2; - } - }, - - bicubicInterpolation(src, dst, options) { - const interpolateCubic = function(x0, x1, x2, x3, t) { - const a0 = x3 - x2 - x0 + x1; - const a1 = x0 - x1 - a0; - const a2 = x2 - x0; - const a3 = x1; - return Math.max( - 0, - Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3) - ); - }; - - return this._interpolate2D(src, dst, options, interpolateCubic); - }, - - hermiteInterpolation(src, dst, options) { - const interpolateHermite = function(x0, x1, x2, x3, t) { - const c0 = x1; - const c1 = 0.5 * (x2 - x0); - const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; - const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); - return Math.max( - 0, - Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0)) - ); - }; - - return this._interpolate2D(src, dst, options, interpolateHermite); - }, - - bezierInterpolation(src, dst, options) { - // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) - // to predict control points (a & b) to be placed at n+0.5 - // ya(n) = y(n) + (y(n+1)-y(n-1))/4 - // yb(n) = y(n+1) - (y(n+2)-y(n))/4 - // then use std bezier to interpolate [n,n+1) - // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3 - // note the 3* factor for the two control points - // for edge cases, can choose: - // y(-1) = y(0) - 2*(y(1)-y(0)) - // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) - // but can go with y(-1) = y(0) and y(w) = y(w-1) - const interpolateBezier = function(x0, x1, x2, x3, t) { - // x1, x2 are the knots, use x0 and x3 to calculate control points - const cp1 = x1 + (x2 - x0) / 4; - const cp2 = x2 - (x3 - x1) / 4; - const nt = 1 - t; - const c0 = x1 * nt * nt * nt; - const c1 = 3 * cp1 * nt * nt * t; - const c2 = 3 * cp2 * nt * t * t; - const c3 = x2 * t * t * t; - return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); - }; - - return this._interpolate2D(src, dst, options, interpolateBezier); - } -}; diff --git a/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js b/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js deleted file mode 100644 index 93f58706..00000000 --- a/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js +++ /dev/null @@ -1,613 +0,0 @@ -import { Jimp, mkJGD, hashForEach } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import resize from '../src'; - -const jimp = configure({ plugins: [resize] }, Jimp); - -describe('Resize images', () => { - const testImages = [ - { - title: 'max contrast 8x8', - src: jimp.read( - mkJGD( - '■■■■□□□□', - '■■■■□□□□', - '■■■■□□□□', - '■■■■□□□□', - '□□□□■■■■', - '□□□□■■■■', - '□□□□■■■■', - '□□□□■■■■' - ) - ), - results: { - 'default 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'), - 'NEAREST_NEIGHBOR 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'), - 'BILINEAR 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'), - 'BICUBIC 4x4': { - width: 4, - height: 4, - data: [ - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x5f5f5fff, - 0x404040ff, - 0xffffffff, - 0xffffffff, - 0x404040ff, - 0x000000ff - ] - }, - 'HERMITE 4x4': { - width: 4, - height: 4, - data: [ - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0xffffffff, - 0xffffffff, - 0x404040ff, - 0x000000ff - ] - }, - 'BEZIER 4x4': { - width: 4, - height: 4, - data: [ - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0xffffffff, - 0xffffffff, - 0x404040ff, - 0x000000ff - ] - }, - 'default 5x2': mkJGD('■■▦□□', '□□▦■■'), - 'NEAREST_NEIGHBOR 5x2': mkJGD('■■■□□', '□□□■■'), - 'BILINEAR 5x2': mkJGD('■■3□□', '□□C■■'), - 'BICUBIC 5x2': { - width: 5, - height: 2, - data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xffffffff, - 0xffffffff, - 0xdfdfdfff, - 0xdfdfdfff, - 0xdfdfdfff, - 0x202020ff, - 0x202020ff - ] - }, - 'HERMITE 5x2': { - width: 5, - height: 2, - data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xffffffff, - 0xffffffff, - 0xdfdfdfff, - 0xdfdfdfff, - 0xdfdfdfff, - 0x202020ff, - 0x202020ff - ] - }, - 'BEZIER 5x2': { - width: 5, - height: 2, - data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xffffffff, - 0xffffffff, - 0xdfdfdfff, - 0xdfdfdfff, - 0xdfdfdfff, - 0x202020ff, - 0x202020ff - ] - } - } - }, - /**********************************************************************/ - { - title: 'max contrast 12x12 with dots', - src: jimp.read( - mkJGD( - '■■■■■■□□□□□□', - '■■■■■■□□□□□□', - '■■■□■■□□■□□□', - '■■■■■■□□□□□□', - '■■■■■■□□□□□□', - '■■■■■■□□□□□□', - '□□□□□□■■■■■■', - '□□□□□□■■■■■■', - '□□□□□□■■■■■■', - '□□□■□□■■□■■■', - '□□□□□□■■■■■■', - '□□□□□□■■■■■■' - ) - ), - results: { - 'default 6x6': mkJGD( - '■■■□□□', - '■▩■□▥□', - '■■■□□□', - '□□□■■■', - '□▥□■▩■', - '□□□■■■' - ), - 'NEAREST_NEIGHBOR 6x6': mkJGD( - '■■■□□□', - '■■■□■□', - '■■■□□□', - '□□□■■■', - '□□□■■■', - '□□□■■■' - ), - 'BILINEAR 6x6': mkJGD( - '■■■□□□', - '■■■□■□', - '■■■□□□', - '□□□■■■', - '□□□■■■', - '□□□■■■' - ), - 'BICUBIC 6x6': { - width: 6, - height: 6, - data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0xffffffff, - 0x000000ff, - 0x474747ff, - 0x202020ff, - 0xbfbfbfff, - 0x979797ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0xffffffff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x5f5f5fff, - 0x404040ff, - 0x404040ff, - 0xffffffff, - 0xeeeeeeff, - 0xf7f7f7ff, - 0x404040ff, - 0x181818ff, - 0x000000ff, - 0xffffffff, - 0xc9c9c9ff, - 0xe6e6e6ff, - 0x404040ff, - 0x4e4e4eff, - 0x000000ff - ] - }, - 'HERMITE 6x6': { - width: 6, - height: 6, - data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0x000000ff, - 0x404040ff, - 0x191919ff, - 0xc0c0c0ff, - 0xa6a6a6ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0x404040ff, - 0xffffffff, - 0xf3f3f3ff, - 0xfafafaff, - 0x404040ff, - 0x111111ff, - 0x000000ff, - 0xffffffff, - 0xcbcbcbff, - 0xebebebff, - 0x404040ff, - 0x484848ff, - 0x000000ff - ] - }, - 'BEZIER 6x6': { - width: 6, - height: 6, - data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0x000000ff, - 0x444444ff, - 0x1d1d1dff, - 0xc0c0c0ff, - 0x9f9f9fff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0x404040ff, - 0xffffffff, - 0xf0f0f0ff, - 0xf9f9f9ff, - 0x404040ff, - 0x151515ff, - 0x000000ff, - 0xffffffff, - 0xcacacaff, - 0xe9e9e9ff, - 0x404040ff, - 0x4b4b4bff, - 0x000000ff - ] - } - } - }, - /**********************************************************************/ - { - title: 'mutch contrast 4x4', - src: jimp.read(mkJGD('▩▩▥▥', '▩▩▥▥', '▥▥▩▩', '▥▥▩▩')), - results: { - 'default 6x6': { - width: 6, - height: 6, - data: [ - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x959595ff, - 0x959595ff, - 0x787878ff, - 0x6a6a6aff, - 0x6a6a6aff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x6a6a6aff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x6a6a6aff, - 0x404040ff, - 0x404040ff - ] - }, - 'NEAREST_NEIGHBOR 6x6': { - width: 6, - height: 6, - data: [ - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff - ] - }, - 'BILINEAR 6x6': { - width: 6, - height: 6, - data: [ - 0x404040ff, - 0x404040ff, - 0x6a6a6aff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x6a6a6aff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x6a6a6aff, - 0x6a6a6aff, - 0x787878ff, - 0x959595ff, - 0x959595ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x404040ff, - 0x404040ff, - 0x404040ff - ] - }, - 'BICUBIC 6x6': { - width: 6, - height: 6, - data: [ - 0x404040ff, - 0x303030ff, - 0x404040ff, - 0x7f7f7fff, - 0xbfbfbfff, - 0xcececeff, - 0x303030ff, - 0x1c1c1cff, - 0x303030ff, - 0x7f7f7fff, - 0xcececeff, - 0xe1e1e1ff, - 0x404040ff, - 0x303030ff, - 0x404040ff, - 0x7f7f7fff, - 0xbfbfbfff, - 0xcececeff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0xbfbfbfff, - 0xcececeff, - 0xbfbfbfff, - 0x7f7f7fff, - 0x404040ff, - 0x303030ff, - 0xcececeff, - 0xe1e1e1ff, - 0xcececeff, - 0x7f7f7fff, - 0x303030ff, - 0x1c1c1cff - ] - }, - 'HERMITE 6x6': { - width: 6, - height: 6, - data: [ - 0x404040ff, - 0x383838ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xc7c7c7ff, - 0x383838ff, - 0x2f2f2fff, - 0x383838ff, - 0x808080ff, - 0xc7c7c7ff, - 0xd0d0d0ff, - 0x404040ff, - 0x383838ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xc7c7c7ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0xbfbfbfff, - 0xc7c7c7ff, - 0xbfbfbfff, - 0x808080ff, - 0x404040ff, - 0x383838ff, - 0xc7c7c7ff, - 0xd0d0d0ff, - 0xc7c7c7ff, - 0x808080ff, - 0x383838ff, - 0x2f2f2fff - ] - }, - 'BEZIER 6x6': { - width: 6, - height: 6, - data: [ - 0x404040ff, - 0x343434ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xcbcbcbff, - 0x343434ff, - 0x262626ff, - 0x343434ff, - 0x808080ff, - 0xcbcbcbff, - 0xd9d9d9ff, - 0x404040ff, - 0x343434ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xcbcbcbff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0xbfbfbfff, - 0xcbcbcbff, - 0xbfbfbfff, - 0x808080ff, - 0x404040ff, - 0x343434ff, - 0xcbcbcbff, - 0xd9d9d9ff, - 0xcbcbcbff, - 0x808080ff, - 0x343434ff, - 0x262626ff - ] - } - } - } - ]; - - before(done => { - const srcImgs = testImages.map(test => test.src); - Promise.all(srcImgs) - .then(imgsJimp => { - for (let i = 0; i < imgsJimp.length; i++) { - testImages[i].src = imgsJimp[i]; - } - - done(); - }) - .catch(done); - }); - - function testEach(test) { - describe(test.title, () => { - hashForEach(test.results, (expectedTitle, expectedJgd) => { - const mode = Jimp['RESIZE_' + expectedTitle.split(' ')[0]]; - const size = expectedTitle - .split(' ')[1] - .split('x') - .map(n => parseInt(n, 10)); - it('to ' + expectedTitle, () => { - test.src - .clone() - .resize(size[0], size[1], mode) - .getJGDSync() - .should.be.sameJGD(expectedJgd); - }); - }); - }); - } - - testImages.forEach(testEach); -}); diff --git a/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/README.md b/project starter code/node_modules/@jimp/plugin-rotate/README.md deleted file mode 100644 index 648613df..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/README.md +++ /dev/null @@ -1,26 +0,0 @@ -
- -

@jimp/plugin-rotate

-

Rotate an image.

-
- -Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - -## Usage - -- @param {number} deg the number of degrees to rotate the image by -- @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.rotate(90); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js deleted file mode 100644 index c2d2afff..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - */ -function advancedRotate(deg, mode) { - deg %= 360; - var rad = deg * Math.PI / 180; - var cosine = Math.cos(rad); - var sine = Math.sin(rad); // the final width and height will change if resize == true - - var w = this.bitmap.width; - var h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { - // resize the image to it maximum dimension and blit the existing image - // onto the center so that when it is rotated the image is kept in bounds - // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle - // Plus 1 border pixel to ensure to show all rotated result for some cases. - w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; - h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. - - if (w % 2 !== 0) { - w++; - } - - if (h % 2 !== 0) { - h++; - } - - var c = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); - this.resize(max, max, mode); - this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); - } - - var bW = this.bitmap.width; - var bH = this.bitmap.height; - var dstBuffer = Buffer.alloc(this.bitmap.data.length); - - function createTranslationFunction(deltaX, deltaY) { - return function (x, y) { - return { - x: x + deltaX, - y: y + deltaY - }; - }; - } - - var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); - - for (var y = 1; y <= bH; y++) { - for (var x = 1; x <= bW; x++) { - var cartesian = translate2Cartesian(x, y); - var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); - var dstIdx = bW * (y - 1) + x - 1 << 2; - - if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; - var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); - dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); - } else { - // reset off-image pixels - dstBuffer.writeUInt32BE(this._background, dstIdx); - } - } - } - - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { - // now crop the image to the final size - var _x = bW / 2 - w / 2; - - var _y = bH / 2 - h / 2; - - this.crop(_x, _y, w, h); - } -} - -var _default = function _default() { - return { - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate: function rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return _utils.throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return _utils.throwError.call(this, 'mode must be a boolean or a string', cb); - } - - advancedRotate.call(this, deg, mode, cb); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map deleted file mode 100644 index 57e7d894..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAAAA,GAAG,IAAI,GAAP;AACA,MAAME,GAAG,GAAIF,GAAG,GAAGG,IAAI,CAACC,EAAZ,GAAkB,GAA9B;AACA,MAAMC,MAAM,GAAGF,IAAI,CAACG,GAAL,CAASJ,GAAT,CAAf;AACA,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAL,CAASN,GAAT,CAAb,CAJiC,CAMjC;;AACA,MAAIO,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAApB;AACA,MAAIC,CAAC,GAAG,KAAKF,MAAL,CAAY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AACpB;;;;;;;AAOAkC,IAAAA,MARoB,kBAQb9C,GARa,EAQRC,IARQ,EAQF8C,EARE,EAQE;AACpB;AACA,UAAI,OAAO9C,IAAP,KAAgB,WAAhB,IAA+BA,IAAI,KAAK,IAA5C,EAAkD;AAChD;AACA;AACA;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAI,OAAOA,IAAP,KAAgB,UAAhB,IAA8B,OAAO8C,EAAP,KAAc,WAAhD,EAA6D;AAC3D;AACAA,QAAAA,EAAE,GAAG9C,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAI,OAAOD,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOgD,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CF,EAA9C,CAAP;AACD;;AAED,UAAI,OAAO9C,IAAP,KAAgB,SAAhB,IAA6B,OAAOA,IAAP,KAAgB,QAAjD,EAA2D;AACzD,eAAO+C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAEDhD,MAAAA,cAAc,CAACkD,IAAf,CAAoB,IAApB,EAA0BjD,GAA1B,EAA+BC,IAA/B,EAAqC8C,EAArC;;AAEA,UAAI,0BAAcA,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAtCmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === 'string') {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function(x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === 'string') {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === 'undefined' || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== 'number') {\n return throwError.call(this, 'deg must be a number', cb);\n }\n\n if (typeof mode !== 'boolean' && typeof mode !== 'string') {\n return throwError.call(this, 'mode must be a boolean or a string', cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js deleted file mode 100644 index ebb25b9f..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js +++ /dev/null @@ -1,138 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - */ -function advancedRotate(deg, mode) { - deg %= 360; - var rad = deg * Math.PI / 180; - var cosine = Math.cos(rad); - var sine = Math.sin(rad); // the final width and height will change if resize == true - - var w = this.bitmap.width; - var h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { - // resize the image to it maximum dimension and blit the existing image - // onto the center so that when it is rotated the image is kept in bounds - // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle - // Plus 1 border pixel to ensure to show all rotated result for some cases. - w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; - h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. - - if (w % 2 !== 0) { - w++; - } - - if (h % 2 !== 0) { - h++; - } - - var c = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); - this.resize(max, max, mode); - this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); - } - - var bW = this.bitmap.width; - var bH = this.bitmap.height; - var dstBuffer = Buffer.alloc(this.bitmap.data.length); - - function createTranslationFunction(deltaX, deltaY) { - return function (x, y) { - return { - x: x + deltaX, - y: y + deltaY - }; - }; - } - - var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); - - for (var y = 1; y <= bH; y++) { - for (var x = 1; x <= bW; x++) { - var cartesian = translate2Cartesian(x, y); - var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); - var dstIdx = bW * (y - 1) + x - 1 << 2; - - if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; - var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); - dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); - } else { - // reset off-image pixels - dstBuffer.writeUInt32BE(this._background, dstIdx); - } - } - } - - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { - // now crop the image to the final size - var _x = bW / 2 - w / 2; - - var _y = bH / 2 - h / 2; - - this.crop(_x, _y, w, h); - } -} - -var _default = function _default() { - return { - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate: function rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return _utils.throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return _utils.throwError.call(this, 'mode must be a boolean or a string', cb); - } - - advancedRotate.call(this, deg, mode, cb); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map deleted file mode 100644 index 57e7d894..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAAAA,GAAG,IAAI,GAAP;AACA,MAAME,GAAG,GAAIF,GAAG,GAAGG,IAAI,CAACC,EAAZ,GAAkB,GAA9B;AACA,MAAMC,MAAM,GAAGF,IAAI,CAACG,GAAL,CAASJ,GAAT,CAAf;AACA,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAL,CAASN,GAAT,CAAb,CAJiC,CAMjC;;AACA,MAAIO,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAApB;AACA,MAAIC,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAApB;;AAEA,MAAIZ,IAAI,KAAK,IAAT,IAAiB,OAAOA,IAAP,KAAgB,QAArC,EAA+C;AAC7C;AACA;AAEA;AACA;AACAQ,IAAAA,CAAC,GACCN,IAAI,CAACW,IAAL,CACEX,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYC,KAAZ,GAAoBN,MAA7B,IACEF,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYG,MAAZ,GAAqBN,IAA9B,CAFJ,IAGI,CAJN;AAKAK,IAAAA,CAAC,GACCT,IAAI,CAACW,IAAL,CACEX,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYC,KAAZ,GAAoBJ,IAA7B,IACEJ,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYG,MAAZ,GAAqBR,MAA9B,CAFJ,IAGI,CAJN,CAX6C,CAgB7C;;AACA,QAAII,CAAC,GAAG,CAAJ,KAAU,CAAd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;AACzD,eAAO+C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAEDhD,MAAAA,cAAc,CAACkD,IAAf,CAAoB,IAApB,EAA0BjD,GAA1B,EAA+BC,IAA/B,EAAqC8C,EAArC;;AAEA,UAAI,0BAAcA,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAtCmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === 'string') {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function(x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === 'string') {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === 'undefined' || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== 'number') {\n return throwError.call(this, 'deg must be a number', cb);\n }\n\n if (typeof mode !== 'boolean' && typeof mode !== 'string') {\n return throwError.call(this, 'mode must be a boolean or a string', cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts b/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts deleted file mode 100644 index 8cc783de..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Rotate { - rotate(deg: number, cb?: ImageCallback): this; - rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; -} - -export default function(): Rotate; diff --git a/project starter code/node_modules/@jimp/plugin-rotate/package.json b/project starter code/node_modules/@jimp/plugin-rotate/package.json deleted file mode 100644 index a6c4676f..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@jimp/plugin-rotate", - "version": "0.16.2", - "description": "Rotate an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5", - "@jimp/plugin-crop": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-rotate/src/index.js b/project starter code/node_modules/@jimp/plugin-rotate/src/index.js deleted file mode 100644 index 80570fda..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/src/index.js +++ /dev/null @@ -1,150 +0,0 @@ -import { throwError, isNodePattern } from '@jimp/utils'; - -/** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - */ -function advancedRotate(deg, mode) { - deg %= 360; - const rad = (deg * Math.PI) / 180; - const cosine = Math.cos(rad); - const sine = Math.sin(rad); - - // the final width and height will change if resize == true - let w = this.bitmap.width; - let h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { - // resize the image to it maximum dimension and blit the existing image - // onto the center so that when it is rotated the image is kept in bounds - - // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle - // Plus 1 border pixel to ensure to show all rotated result for some cases. - w = - Math.ceil( - Math.abs(this.bitmap.width * cosine) + - Math.abs(this.bitmap.height * sine) - ) + 1; - h = - Math.ceil( - Math.abs(this.bitmap.width * sine) + - Math.abs(this.bitmap.height * cosine) - ) + 1; - // Ensure destination to have even size to a better result. - if (w % 2 !== 0) { - w++; - } - - if (h % 2 !== 0) { - h++; - } - - const c = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - - const max = Math.max(w, h, this.bitmap.width, this.bitmap.height); - this.resize(max, max, mode); - - this.blit( - c, - this.bitmap.width / 2 - c.bitmap.width / 2, - this.bitmap.height / 2 - c.bitmap.height / 2 - ); - } - - const bW = this.bitmap.width; - const bH = this.bitmap.height; - const dstBuffer = Buffer.alloc(this.bitmap.data.length); - - function createTranslationFunction(deltaX, deltaY) { - return function(x, y) { - return { - x: x + deltaX, - y: y + deltaY - }; - }; - } - - const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - const translate2Screen = createTranslationFunction( - bW / 2 + 0.5, - bH / 2 + 0.5 - ); - - for (let y = 1; y <= bH; y++) { - for (let x = 1; x <= bW; x++) { - const cartesian = translate2Cartesian(x, y); - const source = translate2Screen( - cosine * cartesian.x - sine * cartesian.y, - cosine * cartesian.y + sine * cartesian.x - ); - const dstIdx = (bW * (y - 1) + x - 1) << 2; - - if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2; - const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); - dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); - } else { - // reset off-image pixels - dstBuffer.writeUInt32BE(this._background, dstIdx); - } - } - } - - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { - // now crop the image to the final size - const x = bW / 2 - w / 2; - const y = bH / 2 - h / 2; - this.crop(x, y, w, h); - } -} - -export default () => ({ - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return throwError.call(this, 'mode must be a boolean or a string', cb); - } - - advancedRotate.call(this, deg, mode, cb); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js b/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js deleted file mode 100644 index 380b6a18..00000000 --- a/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js +++ /dev/null @@ -1,636 +0,0 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import blit from '@jimp/plugin-blit'; -import crop from '@jimp/plugin-crop'; -import resize from '@jimp/plugin-resize'; - -import rotate from '../src'; - -const jimp = configure({ plugins: [rotate, blit, crop, resize] }, Jimp); - -describe('Rotate a image with even size', () => { - let imgSrc = null; - - before(done => { - jimp - .read( - mkJGD( - '▰▴▴▴▪▪▪▰', - '▴▴▴▴▪▪▪▪', - '▴▴▴▴▪▪▪▪', - '▴▴▴▴▪▪▪▪', - '▪▪▪▪▴▴▴▴', - '▪▪▪▪▴▴▴▴', - '▪▪▪▪▴▴▴▴', - '▦▪▪▪▴▴▴▦' - ) - ) - .then(imgJimp => { - imgSrc = imgJimp; - done(); - }) - .catch(done); - }); - - it('1 degrees', () => { - imgSrc - .clone() - .rotate(1, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▰▴▴▴▪▪▪▰ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▦▪▪▪▴▴▴▦ ', - ' ', - ' ' - ) - ); - }); - - it('91 degrees', () => { - imgSrc - .clone() - .rotate(91, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '▰▪▪▪▴▴▴▦ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▰▴▴▴▪▪▪▦ ', - ' ' - ) - ); - }); - - it('30 degrees', () => { - imgSrc - .clone() - .rotate(30, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▰▰ ', - ' ▪▪▪▪ ', - ' ▴▪▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▴▴▴ ', - '▴▴▴▴▪▴▴▴▴▴ ', - ' ▴▴▪▪▴▴▴▴▦ ', - ' ▪▪▪▪▪▴▴▴ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪ ', - ' ▦ ', - ' ' - ) - ); - }); - - it('45 degrees', () => { - imgSrc - .clone() - .rotate(45, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▰ ', - ' ▪▪▪ ', - ' ▪▪▪▪▪ ', - ' ▴▴▪▪▪▪▴ ', - ' ▴▴▴▴▪▪▴▴▴ ', - '▰▰▴▴▴▴▴▴▴▴▦ ', - ' ▴▴▴▴▪▪▴▴▴ ', - ' ▴▴▪▪▪▪▴ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪ ', - ' ▦ ', - ' ', - ' ' - ) - ); - }); - - it('60 degrees', () => { - imgSrc - .clone() - .rotate(60, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▰ ', - ' ▪▪▪ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪▪▪▴▴▴ ', - ' ▴▴▪▪▴▴▴▴▦ ', - '▴▴▴▴▪▴▴▴▴▴ ', - '▴▴▴▴▪▪▴▴▴ ', - '▴▴▴▴▪▪▪▪ ', - ' ▴▪▪▪▪▪ ', - ' ▪▪▪▪ ', - ' ▦▦ ', - ' ' - ) - ); - }); - - it('90 degrees', () => { - imgSrc - .clone() - .rotate(90, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '▰▪▪▪▴▴▴▦ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▰▴▴▴▪▪▪▦ ', - ' ' - ) - ); - }); - - it('120 degrees', () => { - imgSrc - .clone() - .rotate(120, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴▦ ', - ' ▴▴▴▴ ', - ' ▪▪▴▴▴▴ ', - '▰▪▪▪▴▴▴▴▪ ', - '▰▪▪▪▪▴▴▪▪▪ ', - ' ▪▪▪▪▪▪▪▪▪ ', - ' ▪▪▴▴▴▪▪▪▪▦ ', - ' ▴▴▴▴▴▪▪ ', - ' ▴▴▴▴▪ ', - ' ▴▴▴ ', - ' ' - ) - ); - }); - - it('135 degrees', () => { - imgSrc - .clone() - .rotate(135, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ', - ' ▦ ', - ' ▴▴▴ ', - ' ▴▴▴▴▴ ', - ' ▪▪▴▴▴▪▪ ', - ' ▪▪▪▪▴▪▪▪▪ ', - ' ▰▪▪▪▪▴▪▪▪▪▦ ', - ' ▪▪▪▴▴▴▪▪▪ ', - ' ▪▴▴▴▴▴▪ ', - ' ▴▴▴▴▴ ', - ' ▴▰▴ ', - ' ▰ ', - ' ' - ) - ); - }); - - it('180 degrees', () => { - imgSrc - .clone() - .rotate(180, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▦▴▴▴▪▪▪▦ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▰▪▪▪▴▴▴▰ ', - ' ' - ) - ); - }); - - it('225 degrees', () => { - imgSrc - .clone() - .rotate(225, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▦ ', - ' ▪▪▪ ', - ' ▪▪▪▪▪ ', - ' ▴▪▪▪▪▴▴ ', - ' ▴▴▴▪▪▴▴▴▴ ', - ' ▦▴▴▴▴▴▴▴▴▰▰ ', - ' ▴▴▴▪▪▴▴▴▴ ', - ' ▴▪▪▪▪▴▴ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪ ', - ' ▰ ', - ' ', - ' ' - ) - ); - }); - - it('270 degrees', () => { - imgSrc - .clone() - .rotate(270, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▦▪▪▪▴▴▴▰ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▦▴▴▴▪▪▪▰ ', - ' ', - ' ' - ) - ); - }); - - it('315 degrees', () => { - imgSrc - .clone() - .rotate(315, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▰ ', - ' ▴▰▴ ', - ' ▴▴▴▴▴ ', - ' ▪▴▴▴▴▴▪ ', - ' ▪▪▪▴▴▴▪▪▪ ', - ' ▦▪▪▪▪▴▪▪▪▪▰ ', - ' ▪▪▪▪▴▪▪▪▪ ', - ' ▪▪▴▴▴▪▪ ', - ' ▴▴▴▴▴ ', - ' ▴▴▴ ', - ' ▦ ', - ' ', - ' ', - ' ' - ) - ); - }); - - it('360 degrees', () => { - imgSrc - .clone() - .rotate(360, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▰▴▴▴▪▪▪▰ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▦▪▪▪▴▴▴▦ ', - ' ', - ' ' - ) - ); - }); -}); - -describe('Rotate a image with odd size', () => { - let imgSrc = null; - before(done => { - jimp - .read( - mkJGD( - '▴▴▴▦▪▪▪', - '▴▴▴▦▪▪▪', - '▴▴▴▦▪▪▪', - '▦▦▦▦▦▦▦', - '▴▴▴▦▴▴▴', - '▴▴▴▦▴▴▴', - '▴▴▴▦▴▴▴' - ) - ) - .then(imgJimp => { - imgSrc = imgJimp; - done(); - }) - .catch(done); - }); - - it('45 degrees', () => { - imgSrc - .clone() - .rotate(45, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▪ ', - ' ▪▪▪ ', - ' ▦▪▪▪▦ ', - ' ▴▴▦▪▦▴▴ ', - ' ▴▴▴▴▦▴▴▴▴ ', - ' ▴▴▦▴▦▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); - }); - - it('135 degrees', () => { - imgSrc - .clone() - .rotate(135, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▦▴▴▴▦ ', - ' ▪▪▦▴▦▴▴ ', - ' ▪▪▪▪▦▴▴▴▴ ', - ' ▪▪▦▴▦▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); - }); - - it('225 degrees', () => { - imgSrc - .clone() - .rotate(225, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▦▴▦▴▴ ', - ' ▴▴▴▴▦▴▴▴▴ ', - ' ▴▴▦▪▦▴▴ ', - ' ▦▪▪▪▦ ', - ' ▪▪▪ ', - ' ▪ ', - ' ', - ' ' - ) - ); - }); - - it('315 degrees', () => { - imgSrc - .clone() - .rotate(315, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▦▴▦▪▪ ', - ' ▴▴▴▴▦▪▪▪▪ ', - ' ▴▴▦▴▦▪▪ ', - ' ▦▴▴▴▦ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); - }); -}); - -describe('Rotate a non-square image', () => { - let imgSrc = null; - before(done => { - jimp - .read(mkJGD('▴▴▴▴▪▪▪▪', '▴▴▴▴▪▪▪▪', '▦▦▦▦▴▴▴▴', '▦▦▦▦▴▴▴▴')) - .then(imgJimp => { - imgSrc = imgJimp; - done(); - }) - .catch(done); - }); - - it('1 degrees', () => { - imgSrc - .clone() - .rotate(1, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▦▦▦▦▴▴▴▴ ', - '▦▦▦▦▴▴▴▴ ', - ' ', - ' ' - ) - ); - }); - - it('10 degrees', () => { - imgSrc - .clone() - .rotate(10, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▪ ', - ' ▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▴ ', - '▴▴▦▦▴▴▴▴ ', - '▦▦▦▦▴▴▴ ', - '▦▦ ', - ' ', - ' ' - ) - ); - }); - - it('30 degrees', () => { - imgSrc - .clone() - .rotate(30, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▪▪ ', - ' ▪▪▪▪ ', - ' ▴▴▪▪▴▴▴ ', - '▴▴▴▦▴▴▴ ', - '▴▴▦▦▴▴ ', - '▦▦▦▦ ', - ' ▦ ', - ' ', - ' ' - ) - ); - }); - - it('45 degrees', () => { - imgSrc - .clone() - .rotate(45, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▪▪ ', - ' ▪▪▪▴ ', - ' ▴▪▪▴▴▴ ', - ' ▴▴▴▴▴▴ ', - '▴▴▴▦▦▴ ', - '▴▴▦▦▦ ', - ' ▦▦▦ ', - ' ▦ ', - ' ' - ) - ); - }); - - it('90 degrees', () => { - imgSrc - .clone() - .rotate(90, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '▪▪▴▴ ', - '▪▪▴▴ ', - '▪▪▴▴ ', - '▪▪▴▴ ', - '▴▴▦▦ ', - '▴▴▦▦ ', - '▴▴▦▦ ', - '▴▴▦▦ ', - ' ' - ) - ); - }); - - it('135 degrees', () => { - imgSrc - .clone() - .rotate(135, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▪▪▴▴▴ ', - ' ▪▪▪▴▦▦ ', - ' ▪▪▴▦▦▦ ', - ' ▴▴▴▦▦▦ ', - ' ▴▴▴▦ ', - ' ▴▴ ', - ' ' - ) - ); - }); - - it('180 degrees', () => { - imgSrc - .clone() - .rotate(180, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴▴▴▴▦▦▦▦ ', - ' ▴▴▴▴▦▦▦▦ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ' - ) - ); - }); - - it('225 degrees', () => { - imgSrc - .clone() - .rotate(225, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▦ ', - ' ▦▦▦ ', - ' ▦▦▦▴▴ ', - ' ▴▦▦▴▴▴ ', - ' ▴▴▴▴▴▴ ', - ' ▴▴▴▪▪▴ ', - ' ▴▪▪▪ ', - ' ▪▪ ', - ' ', - ' ' - ) - ); - }); - - it('315 degrees', () => { - imgSrc - .clone() - .rotate(315, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▴▴ ', - ' ▦▴▴▴ ', - '▦▦▦▴▴▴ ', - ' ▦▦▦▴▪▪ ', - ' ▦▦▴▪▪▪ ', - ' ▴▴▴▪▪ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/README.md b/project starter code/node_modules/@jimp/plugin-scale/README.md deleted file mode 100644 index d887b4d2..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/README.md +++ /dev/null @@ -1,48 +0,0 @@ -
- -

@jimp/plugin-scale

-

Scale an image.

-
- -## scale - -Uniformly scales the image by a factor. - -- @param {number} f the factor to scale the image by -- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.scale(2); - image.scale(2, jimp.RESIZE_BEZIER); -} - -main(); -``` - -## scaleToFit - -Scale the image to the largest size that fits inside the rectangle that has the given width and height. - -- @param {number} w the width to resize the image to -- @param {number} h the height to resize the image to -- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.scaleToFit(100, 100); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js deleted file mode 100644 index 635255a5..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale: function scale(f, mode, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return _utils.throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var w = this.bitmap.width * f; - var h = this.bitmap.height * f; - this.resize(w, h, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit: function scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - this.scale(f, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map deleted file mode 100644 index 28aeaa90..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,C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,GAAoB,KAAKD,MAAL,CAAYG,MAAxC,GACID,CAAC,GAAG,KAAKF,MAAL,CAAYG,MADpB,GAEIJ,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAHtB;AAIA,WAAKR,KAAL,CAAWC,CAAX,EAAcC,IAAd;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0) {\n return throwError.call(this, 'f must be a positive number', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/es/index.js b/project starter code/node_modules/@jimp/plugin-scale/es/index.js deleted file mode 100644 index 80050107..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/es/index.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale: function scale(f, mode, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return _utils.throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var w = this.bitmap.width * f; - var h = this.bitmap.height * f; - this.resize(w, h, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit: function scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - this.scale(f, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map b/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map deleted file mode 100644 index 28aeaa90..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAIF,CAAC,GAAG,CAAR,EAAW;AACT,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,6BAAtB,EAAqDF,EAArD,CAAP;AACD;;AAED,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAMI,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAAZ,GAAoBP,CAA9B;AACA,UAAMQ,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAAZ,GAAqBT,CAA/B;AACA,WAAKU,MAAL,CAAYL,CAAZ,EAAeG,CAAf,EAAkBP,IAAlB;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA/BmB;;AAiCpB;;;;;;;;AAQAO,IAAAA,UAzCoB,sBAyCTN,CAzCS,EAyCNG,CAzCM,EAyCHP,IAzCG,EAyCGC,EAzCH,EAyCO;AACzB,UAAI,OAAOG,CAAP,KAAa,QAAb,IAAyB,OAAOG,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOL,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAMD,CAAC,GACLK,CAAC,GAAGG,CAAJ,GAAQ,KAAKF,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYG,MAAxC,GACID,CAAC,GAAG,KAAKF,MAAL,CAAYG,MADpB,GAEIJ,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAHtB;AAIA,WAAKR,KAAL,CAAWC,CAAX,EAAcC,IAAd;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0) {\n return throwError.call(this, 'f must be a positive number', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/index.d.ts b/project starter code/node_modules/@jimp/plugin-scale/index.d.ts deleted file mode 100644 index dcf58180..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Scale { - scale(f: number, cb?: ImageCallback): this; - scale(f: number, mode?: string, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; -} - -export default function(): Scale; diff --git a/project starter code/node_modules/@jimp/plugin-scale/package.json b/project starter code/node_modules/@jimp/plugin-scale/package.json deleted file mode 100644 index edc84ff5..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@jimp/plugin-scale", - "version": "0.16.2", - "description": "scale an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-scale/src/index.js b/project starter code/node_modules/@jimp/plugin-scale/src/index.js deleted file mode 100644 index 4670f228..00000000 --- a/project starter code/node_modules/@jimp/plugin-scale/src/index.js +++ /dev/null @@ -1,66 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -export default () => ({ - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale(f, mode, cb) { - if (typeof f !== 'number') { - return throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - const w = this.bitmap.width * f; - const h = this.bitmap.height * f; - this.resize(w, h, mode); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - const f = - w / h > this.bitmap.width / this.bitmap.height - ? h / this.bitmap.height - : w / this.bitmap.width; - this.scale(f, mode); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md deleted file mode 100644 index 4642075d..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md +++ /dev/null @@ -1,36 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.4 (Tue Mar 03 2020) - -#### 🐛 Bug Fix - -- `@jimp/plugin-shadow` - - Update plugin-shadow type definition. [#841](https://github.com/oliver-moran/jimp/pull/841) ([@lekoaf](https://github.com/lekoaf)) - -#### Authors: 1 - -- Martin ([@lekoaf](https://github.com/lekoaf)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/README.md b/project starter code/node_modules/@jimp/plugin-shadow/README.md deleted file mode 100644 index 5258bc38..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/README.md +++ /dev/null @@ -1,30 +0,0 @@ -
- -

@jimp/plugin-shadow

-

Creates a shadow on an image.

-
- -## Usage - -- @param {function(Error, Jimp)} options (optional) - - opacity - opacity of the shadow between 0 and 1 - - size,- of the shadow - - blur - how blurry the shadow is - - x - x position of shadow - - y - y position of shadow -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.shadow(); - // or - image.shadow({ opacity: 0.8, size: 1.2, blur: 10, x: -75, y: -75 }); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js b/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js deleted file mode 100644 index 60a6d805..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = api => { - api.cache(true); - - return { - presets: [ - [ - '@babel/env', - { - useBuiltIns: 'usage' - } - ] - ], - - plugins: [ - '@babel/proposal-class-properties', - '@babel/syntax-object-rest-spread', - process.env.BABEL_ENV !== 'module' && 'add-module-exports', - [ - 'transform-inline-environment-variables', - { include: ['BABEL_ENV', 'ENV'] } - ] - ].filter(Boolean), - - env: { - test: { - plugins: ['istanbul'] - }, - development: { - plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter( - Boolean - ) - }, - module: { - presets: [['@babel/env', { modules: false }]] - } - } - }; -}; diff --git a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js deleted file mode 100644 index 2979db55..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) - * opacity - opacity of the shadow between 0 and 1 - * size,- of the shadow - * blur - how blurry the shadow is - * x- x position of shadow - * y - y position of shadow - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - shadow: function shadow() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var _options = options, - _options$opacity = _options.opacity, - opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, - _options$size = _options.size, - size = _options$size === void 0 ? 1.1 : _options$size, - _options$x = _options.x, - x = _options$x === void 0 ? -25 : _options$x, - _options$y = _options.y, - y = _options$y === void 0 ? 25 : _options$y, - _options$blur = _options.blur, - blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image - - var orig = this.clone(); - var shadow = this.clone(); // turn all it's pixels black - - shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, - - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); - _this.bitmap.data[idx] = 0x00; - _this.bitmap.data[idx + 1] = 0x00; - _this.bitmap.data[idx + 2] = 0x00; - _this.bitmap.data[idx + 3] = 0x00; - }); // enlarge it. This creates a "shadow". - - shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. - - this.composite(shadow, x, y); - this.composite(orig, 0, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map deleted file mode 100644 index 7f483603..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAJsB,qBAM0CA,OAN1C;AAAA,sCAMfE,OANe;AAAA,UAMfA,OANe,iCAML,GANK;AAAA,mCAMAC,IANA;AAAA,UAMAA,IANA,8BAMO,GANP;AAAA,gCAMYC,CANZ;AAAA,UAMYA,CANZ,2BAMgB,CAAC,EANjB;AAAA,gCAMqBC,CANrB;AAAA,UAMqBA,CANrB,2BAMyB,EANzB;AAAA,mCAM6BC,IAN7B;AAAA,UAM6BA,IAN7B,8BAMoC,CANpC,kBAQvB;;AACA,UAAM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AAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js deleted file mode 100644 index 038b3ee1..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) - * opacity - opacity of the shadow between 0 and 1 - * size,- of the shadow - * blur - how blurry the shadow is - * x- x position of shadow - * y - y position of shadow - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - shadow: function shadow() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var _options = options, - _options$opacity = _options.opacity, - opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, - _options$size = _options.size, - size = _options$size === void 0 ? 1.1 : _options$size, - _options$x = _options.x, - x = _options$x === void 0 ? -25 : _options$x, - _options$y = _options.y, - y = _options$y === void 0 ? 25 : _options$y, - _options$blur = _options.blur, - blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image - - var orig = this.clone(); - var shadow = this.clone(); // turn all it's pixels black - - shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, - - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); - _this.bitmap.data[idx] = 0x00; - _this.bitmap.data[idx + 1] = 0x00; - _this.bitmap.data[idx + 2] = 0x00; - _this.bitmap.data[idx + 3] = 0x00; - }); // enlarge it. This creates a "shadow". - - shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. - - this.composite(shadow, x, y); - this.composite(orig, 0, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map deleted file mode 100644 index 7f483603..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAJsB,qBAM0CA,OAN1C;AAAA,sCAMfE,OANe;AAAA,UAMfA,OANe,iCAML,GANK;AAAA,mCAMAC,IANA;AAAA,UAMAA,IANA,8BAMO,GANP;AAAA,gCAMYC,CANZ;AAAA,UAMYA,CANZ,2BAMgB,CAAC,EANjB;AAAA,gCAMqBC,CANrB;AAAA,UAMqBA,CANrB,2BAMyB,EANzB;AAAA,mCAM6BC,IAN7B;AAAA,UAM6BA,IAN7B,8BAMoC,CANpC,kBAQvB;;AACA,UAAMC,IAAI,GAAG,KAAKC,KAAL,EAAb;AACA,UAAMT,MAAM,GAAG,KAAK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,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts b/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts deleted file mode 100644 index 75f6bae0..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Shadow { - shadow(options?: { - size?: number, - opacity?: number, - blur: number, - x?: number, - y?: number - }, - cb?: ImageCallback): this; - shadow(cb?: ImageCallback): this; -} - -export default function(): Shadow; diff --git a/project starter code/node_modules/@jimp/plugin-shadow/package.json b/project starter code/node_modules/@jimp/plugin-shadow/package.json deleted file mode 100644 index d384ab69..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@jimp/plugin-shadow", - "version": "0.16.2", - "description": "Creates a shadow on an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blur": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-shadow/src/index.js b/project starter code/node_modules/@jimp/plugin-shadow/src/index.js deleted file mode 100644 index be696b8c..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/src/index.js +++ /dev/null @@ -1,64 +0,0 @@ -import { isNodePattern } from '@jimp/utils'; - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) - * opacity - opacity of the shadow between 0 and 1 - * size,- of the shadow - * blur - how blurry the shadow is - * x- x position of shadow - * y - y position of shadow - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -export default () => ({ - shadow(options = {}, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options; - - // clone the image - const orig = this.clone(); - const shadow = this.clone(); - - // turn all it's pixels black - shadow.scan( - 0, - 0, - shadow.bitmap.width, - shadow.bitmap.height, - (x, y, idx) => { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; - // up the opacity a little, - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255( - shadow.bitmap.data[idx + 3] * opacity - ); - - this.bitmap.data[idx] = 0x00; - this.bitmap.data[idx + 1] = 0x00; - this.bitmap.data[idx + 2] = 0x00; - this.bitmap.data[idx + 3] = 0x00; - } - ); - - // enlarge it. This creates a "shadow". - shadow - .resize(shadow.bitmap.width * size, shadow.bitmap.height * size) - .blur(blur); - - // Then blit the "shadow" onto the background and the image on top of that. - this.composite(shadow, x, y); - this.composite(orig, 0, 0); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js b/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js deleted file mode 100644 index 6ef36184..00000000 --- a/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import resize from '@jimp/plugin-resize'; -import blur from '@jimp/plugin-blur'; - -import shadow from '../src'; - -const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp); - -describe('Shadow', () => { - it('creates a shadow', async () => { - const expectedImg = await jimp.read( - getTestDir(__dirname) + '/images/shadow.png' - ); - const testImage = await jimp.read( - mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); - - testImage - .shadow({ x: -1, y: 1, blur: 1 }) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md deleted file mode 100644 index 7cd6c3ac..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md +++ /dev/null @@ -1,35 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.7 (Fri Mar 27 2020) - -#### 🐛 Bug Fix - -- Relax version range of plugin-threshold peerDependencies [#859](https://github.com/oliver-moran/jimp/pull/859) ([@pasieronen](https://github.com/pasieronen)) - -#### Authors: 1 - -- Pasi Eronen ([@pasieronen](https://github.com/pasieronen)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/README.md b/project starter code/node_modules/@jimp/plugin-threshold/README.md deleted file mode 100644 index 04cc3eb2..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/README.md +++ /dev/null @@ -1,30 +0,0 @@ -
- -

@jimp/plugin-threshold

-

Lightens an image.

-
- -This is useful as a simplified method for processing scanned drawings, signatures, etc - -## Usage - -- @param {number} options object - - max: A number auto limited between 0 - 255 - - replace: (optional) A number auto limited between 0 - 255 (default 255) - - autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) -- @param {function(Error, Jimp)} cb (optional) a callback for when complete - -```js -import jimp from 'jimp'; - -async function main() { - const image = await jimp.read('test/image.png'); - - image.threshold({ max: 150 }); - // or - image.threshold({ max: 200, replace: 200, autoGreyscale: false }); -} - -main(); -``` diff --git a/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js b/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js deleted file mode 100644 index 60a6d805..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = api => { - api.cache(true); - - return { - presets: [ - [ - '@babel/env', - { - useBuiltIns: 'usage' - } - ] - ], - - plugins: [ - '@babel/proposal-class-properties', - '@babel/syntax-object-rest-spread', - process.env.BABEL_ENV !== 'module' && 'add-module-exports', - [ - 'transform-inline-environment-variables', - { include: ['BABEL_ENV', 'ENV'] } - ] - ].filter(Boolean), - - env: { - test: { - plugins: ['istanbul'] - }, - development: { - plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter( - Boolean - ) - }, - module: { - presets: [['@babel/env', { modules: false }]] - } - } - }; -}; diff --git a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js deleted file mode 100644 index bf1d7ef0..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default - * @param {number} options object - * max: A number auto limited between 0 - 255 - * replace: (optional) A number auto limited between 0 - 255 (default 255) - * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) - * @param {number} cb (optional) a callback for when complete - * @return {this} this for chaining of methods - */ -var _default = function _default() { - return { - threshold: function threshold(_ref, cb) { - var _this = this; - - var max = _ref.max, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? 255 : _ref$replace, - _ref$autoGreyscale = _ref.autoGreyscale, - autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; - - if (typeof max !== 'number') { - return _utils.throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return _utils.throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; - _this.bitmap.data[idx] = grey; - _this.bitmap.data[idx + 1] = grey; - _this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map deleted file mode 100644 index 7b0f4ece..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,SADoB,2BACoCC,EADpC,EACwC;AAAA;;AAAA,UAAhDC,GAAgD,QAAhDA,GAAgD;AAAA,8BAA3CC,OAA2C;AAAA,UAA3CA,OAA2C,6BAAjC,GAAiC;AAAA,oCAA5BC,aAA4B;AAAA,UAA5BA,aAA4B,mCAAZ,IAAY;;AAC1D,UAAI,OAAOF,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CL,EAA9C,CAAP;AACD;;AAED,UAAI,OAAOE,OAAP,KAAmB,QAAvB,EAAiC;AAC/B,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDL,EAAlD,CAAP;AACD;;AAED,UAAI,OAAOG,aAAP,KAAyB,SAA7B,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDL,EAAzD,CAAP;AACD;;AAEDC,MAAAA,GAAG,GAAG,KAAKK,WAAL,CAAiBC,QAAjB,CAA0BN,GAA1B,CAAN;AACAC,MAAAA,OAAO,GAAG,KAAKI,WAAL,CAAiBC,QAAjB,CAA0BL,OAA1B,CAAV;;AAEA,UAAIC,aAAJ,EAAmB;AACjB,aAAKK,SAAL;AACD;;AAED,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAACC,CAAD,EAAIC,CAAJ,EAAOC,GAAP,EAAe;AACzE,YAAMC,IAAI,GACR,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBd,GAAxB,GAA8B,KAAI,CAACS,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,CAA9B,GAAsDb,OADxD;AAGA,QAAA,KAAI,CAACQ,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBC,IAAxB;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACD,OAPD;;AASA,UAAI,0BAAchB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAnCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== 'number') {\n return throwError.call(this, 'max must be a number', cb);\n }\n\n if (typeof replace !== 'number') {\n return throwError.call(this, 'replace must be a number', cb);\n }\n\n if (typeof autoGreyscale !== 'boolean') {\n return throwError.call(this, 'autoGreyscale must be a boolean', cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js deleted file mode 100644 index dea3677f..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default - * @param {number} options object - * max: A number auto limited between 0 - 255 - * replace: (optional) A number auto limited between 0 - 255 (default 255) - * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) - * @param {number} cb (optional) a callback for when complete - * @return {this} this for chaining of methods - */ -var _default = function _default() { - return { - threshold: function threshold(_ref, cb) { - var _this = this; - - var max = _ref.max, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? 255 : _ref$replace, - _ref$autoGreyscale = _ref.autoGreyscale, - autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; - - if (typeof max !== 'number') { - return _utils.throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return _utils.throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; - _this.bitmap.data[idx] = grey; - _this.bitmap.data[idx + 1] = grey; - _this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map deleted file mode 100644 index 7b0f4ece..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,SADoB,2BACoCC,EADpC,EACwC;AAAA;;AAAA,UAAhDC,GAAgD,QAAhDA,GAAgD;AAAA,8BAA3CC,OAA2C;AAAA,UAA3CA,OAA2C,6BAAjC,GAAiC;AAAA,oCAA5BC,aAA4B;AAAA,UAA5BA,aAA4B,mCAAZ,IAAY;;AAC1D,UAAI,OAAOF,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOG,kBAAWC,IAAX,CAAgB,IAAh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AAO,IAAP;AACD;AAnCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== 'number') {\n return throwError.call(this, 'max must be a number', cb);\n }\n\n if (typeof replace !== 'number') {\n return throwError.call(this, 'replace must be a number', cb);\n }\n\n if (typeof autoGreyscale !== 'boolean') {\n return throwError.call(this, 'autoGreyscale must be a boolean', cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts b/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts deleted file mode 100644 index 4b2a6cbe..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ImageCallback } from '@jimp/core'; - -interface Threshold { - threshold(opts: { - max: number, - replace?: number, - autoGreyscale?: boolean - }, cb?: ImageCallback): this; -} - -export default function(): Threshold; diff --git a/project starter code/node_modules/@jimp/plugin-threshold/package.json b/project starter code/node_modules/@jimp/plugin-threshold/package.json deleted file mode 100644 index 3578426d..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@jimp/plugin-threshold", - "version": "0.16.2", - "description": "Lightens an image.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-color": ">=0.8.0", - "@jimp/plugin-resize": ">=0.8.0" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugin-threshold/src/index.js b/project starter code/node_modules/@jimp/plugin-threshold/src/index.js deleted file mode 100644 index 583c8410..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/src/index.js +++ /dev/null @@ -1,48 +0,0 @@ -import { isNodePattern, throwError } from '@jimp/utils'; - -/** - * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default - * @param {number} options object - * max: A number auto limited between 0 - 255 - * replace: (optional) A number auto limited between 0 - 255 (default 255) - * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) - * @param {number} cb (optional) a callback for when complete - * @return {this} this for chaining of methods - */ -export default () => ({ - threshold({ max, replace = 255, autoGreyscale = true }, cb) { - if (typeof max !== 'number') { - return throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { - const grey = - this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace; - - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } -}); diff --git a/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js b/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js deleted file mode 100644 index f1dbf809..00000000 --- a/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js +++ /dev/null @@ -1,30 +0,0 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import jpeg from '@jimp/jpeg'; -import color from '@jimp/plugin-color'; -import resize from '@jimp/plugin-resize'; - -import threshold from '../src'; - -const jimp = configure( - { types: [jpeg], plugins: [threshold, color, resize] }, - Jimp -); - -describe('Threshold', function() { - this.timeout(15000); - - it('defines default threshold for lighter backgrounds', async () => { - const expectedImage = await jimp.read( - getTestDir(__dirname) + '/images/hands_mx200_rp255.jpg' - ); - const testImage = await jimp.read( - getTestDir(__dirname) + '/images/hands.jpg' - ); - - testImage - .threshold({ max: 200, replace: 255 }) - .hash() - .should.be.equal(expectedImage.hash()); - }); -}); diff --git a/project starter code/node_modules/@jimp/plugins/CHANGELOG.md b/project starter code/node_modules/@jimp/plugins/CHANGELOG.md deleted file mode 100644 index 09abcd9e..00000000 --- a/project starter code/node_modules/@jimp/plugins/CHANGELOG.md +++ /dev/null @@ -1,47 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.8 (Sat Mar 28 2020) - -#### 🐛 Bug Fix - -- Export the four missing plugins from plugin package [#866](https://github.com/oliver-moran/jimp/pull/866) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 1 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.7 (Fri Mar 27 2020) - -#### 🐛 Bug Fix - -- Added missing plugins to the types [#863](https://github.com/oliver-moran/jimp/pull/863) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 1 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/dist/index.js.map b/project starter code/node_modules/@jimp/plugins/dist/index.js.map deleted file mode 100644 index 29e45149..00000000 --- a/project starter code/node_modules/@jimp/plugins/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAAAC,YAAY,EAAI;AAC7B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAAAC,YAAY,EAAI;AACrD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport blit from '@jimp/plugin-blit';\nimport blur from '@jimp/plugin-blur';\nimport circle from '@jimp/plugin-circle';\nimport color from '@jimp/plugin-color';\nimport contain from '@jimp/plugin-contain';\nimport cover from '@jimp/plugin-cover';\nimport crop from '@jimp/plugin-crop';\nimport displace from '@jimp/plugin-displace';\nimport dither from '@jimp/plugin-dither';\nimport fisheye from '@jimp/plugin-fisheye';\nimport flip from '@jimp/plugin-flip';\nimport gaussian from '@jimp/plugin-gaussian';\nimport invert from '@jimp/plugin-invert';\nimport mask from '@jimp/plugin-mask';\nimport normalize from '@jimp/plugin-normalize';\nimport print from '@jimp/plugin-print';\nimport resize from '@jimp/plugin-resize';\nimport rotate from '@jimp/plugin-rotate';\nimport scale from '@jimp/plugin-scale';\nimport shadow from '@jimp/plugin-shadow';\nimport threshold from '@jimp/plugin-threshold';\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold\n];\n\nexport default jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/es/index.js b/project starter code/node_modules/@jimp/plugins/es/index.js deleted file mode 100644 index fa3c22c9..00000000 --- a/project starter code/node_modules/@jimp/plugins/es/index.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _timm = require("timm"); - -var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit")); - -var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur")); - -var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle")); - -var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color")); - -var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain")); - -var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover")); - -var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop")); - -var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace")); - -var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither")); - -var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye")); - -var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip")); - -var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian")); - -var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert")); - -var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask")); - -var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize")); - -var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print")); - -var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize")); - -var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate")); - -var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale")); - -var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow")); - -var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold")); - -var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]]; - -var _default = function _default(jimpEvChange) { - var initializedPlugins = plugins.map(function (pluginModule) { - var plugin = pluginModule(jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { - // Default to class function - plugin = { - "class": plugin - }; - } - - return plugin; - }); - return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins)); -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/es/index.js.map b/project starter code/node_modules/@jimp/plugins/es/index.js.map deleted file mode 100644 index 29e45149..00000000 --- a/project starter code/node_modules/@jimp/plugins/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAAAC,YAAY,EAAI;AAC7B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAAAC,YAAY,EAAI;AACrD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport blit from '@jimp/plugin-blit';\nimport blur from '@jimp/plugin-blur';\nimport circle from '@jimp/plugin-circle';\nimport color from '@jimp/plugin-color';\nimport contain from '@jimp/plugin-contain';\nimport cover from '@jimp/plugin-cover';\nimport crop from '@jimp/plugin-crop';\nimport displace from '@jimp/plugin-displace';\nimport dither from '@jimp/plugin-dither';\nimport fisheye from '@jimp/plugin-fisheye';\nimport flip from '@jimp/plugin-flip';\nimport gaussian from '@jimp/plugin-gaussian';\nimport invert from '@jimp/plugin-invert';\nimport mask from '@jimp/plugin-mask';\nimport normalize from '@jimp/plugin-normalize';\nimport print from '@jimp/plugin-print';\nimport resize from '@jimp/plugin-resize';\nimport rotate from '@jimp/plugin-rotate';\nimport scale from '@jimp/plugin-scale';\nimport shadow from '@jimp/plugin-shadow';\nimport threshold from '@jimp/plugin-threshold';\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold\n];\n\nexport default jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/index.d.ts b/project starter code/node_modules/@jimp/plugins/index.d.ts deleted file mode 100644 index 07e46e0d..00000000 --- a/project starter code/node_modules/@jimp/plugins/index.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -import blit from '@jimp/plugin-blit'; -import blur from '@jimp/plugin-blur'; -import circle from '@jimp/plugin-circle'; -import color from '@jimp/plugin-color'; -import contain from '@jimp/plugin-contain'; -import cover from '@jimp/plugin-cover'; -import crop from '@jimp/plugin-crop'; -import displace from '@jimp/plugin-displace'; -import dither from '@jimp/plugin-dither'; -import fisheye from '@jimp/plugin-fisheye'; -import flip from '@jimp/plugin-flip'; -import gaussian from '@jimp/plugin-gaussian'; -import invert from '@jimp/plugin-invert'; -import mask from '@jimp/plugin-mask'; -import normalize from '@jimp/plugin-normalize'; -import print from '@jimp/plugin-print'; -import resize from '@jimp/plugin-resize'; -import rotate from '@jimp/plugin-rotate'; -import scale from '@jimp/plugin-scale'; -import shadow from '@jimp/plugin-shadow'; -import threshold from '@jimp/plugin-threshold'; - -type BlitRet = ReturnType; -type BlurRet = ReturnType; -type CircleRet = ReturnType; -type ColorRet = ReturnType; -type ContainRet = ReturnType; -type CoverRet = ReturnType; -type CropRet = ReturnType; -type DisplaceRet = ReturnType; -type DitherRet = ReturnType; -type FlipRet = ReturnType; -type FisheyeRet = ReturnType; -type GaussianRet = ReturnType; -type InvertRet = ReturnType; -type MaskRet = ReturnType; -type NormalizeRet = ReturnType; -type PrintRet = ReturnType; -type ResizeRet = ReturnType; -type RotateRet = ReturnType; -type ScaleRet = ReturnType; -type ShadowRet = ReturnType; -type ThresholdRet = ReturnType; - -/** - * This is made union and not intersection to avoid issues with - * `IllformedPlugin` and `WellFormedPlugin` when using typings with Jimp - * generic - * - * In reality, this should be an intersection but our type data isn't - * clever enough to figure out what's a class and what's not/etc - */ -type Plugins = - | BlitRet - | BlurRet - | CircleRet - | ColorRet - | ContainRet - | CoverRet - | CropRet - | DisplaceRet - | DitherRet - | FlipRet - | FisheyeRet - | GaussianRet - | InvertRet - | MaskRet - | NormalizeRet - | PrintRet - | ResizeRet - | RotateRet - | ScaleRet - | ShadowRet - | ThresholdRet; - -export default function(): Plugins; diff --git a/project starter code/node_modules/@jimp/plugins/package.json b/project starter code/node_modules/@jimp/plugins/package.json deleted file mode 100644 index 3f4fd145..00000000 --- a/project starter code/node_modules/@jimp/plugins/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "@jimp/plugins", - "version": "0.16.2", - "description": "Default Jimp plugin.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", - "timm": "^1.6.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/plugins/src/index.js b/project starter code/node_modules/@jimp/plugins/src/index.js deleted file mode 100644 index 56cc2243..00000000 --- a/project starter code/node_modules/@jimp/plugins/src/index.js +++ /dev/null @@ -1,62 +0,0 @@ -import { mergeDeep } from 'timm'; - -import blit from '@jimp/plugin-blit'; -import blur from '@jimp/plugin-blur'; -import circle from '@jimp/plugin-circle'; -import color from '@jimp/plugin-color'; -import contain from '@jimp/plugin-contain'; -import cover from '@jimp/plugin-cover'; -import crop from '@jimp/plugin-crop'; -import displace from '@jimp/plugin-displace'; -import dither from '@jimp/plugin-dither'; -import fisheye from '@jimp/plugin-fisheye'; -import flip from '@jimp/plugin-flip'; -import gaussian from '@jimp/plugin-gaussian'; -import invert from '@jimp/plugin-invert'; -import mask from '@jimp/plugin-mask'; -import normalize from '@jimp/plugin-normalize'; -import print from '@jimp/plugin-print'; -import resize from '@jimp/plugin-resize'; -import rotate from '@jimp/plugin-rotate'; -import scale from '@jimp/plugin-scale'; -import shadow from '@jimp/plugin-shadow'; -import threshold from '@jimp/plugin-threshold'; - -const plugins = [ - blit, - blur, - circle, - color, - contain, - cover, - crop, - displace, - dither, - fisheye, - flip, - gaussian, - invert, - mask, - normalize, - print, - resize, - rotate, - scale, - shadow, - threshold -]; - -export default jimpEvChange => { - const initializedPlugins = plugins.map(pluginModule => { - let plugin = pluginModule(jimpEvChange) || {}; - - if (!plugin.class && !plugin.constants) { - // Default to class function - plugin = { class: plugin }; - } - - return plugin; - }); - - return mergeDeep(...initializedPlugins); -}; diff --git a/project starter code/node_modules/@jimp/png/CHANGELOG.md b/project starter code/node_modules/@jimp/png/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/png/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/dist/index.js b/project starter code/node_modules/@jimp/png/dist/index.js deleted file mode 100644 index 3d5ffc60..00000000 --- a/project starter code/node_modules/@jimp/png/dist/index.js +++ /dev/null @@ -1,162 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _pngjs = require("pngjs"); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/png'; // PNG filter types - -var PNG_FILTER_AUTO = -1; -var PNG_FILTER_NONE = 0; -var PNG_FILTER_SUB = 1; -var PNG_FILTER_UP = 2; -var PNG_FILTER_AVERAGE = 3; -var PNG_FILTER_PATH = 4; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']), - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO: PNG_FILTER_AUTO, - PNG_FILTER_NONE: PNG_FILTER_NONE, - PNG_FILTER_SUB: PNG_FILTER_SUB, - PNG_FILTER_UP: PNG_FILTER_UP, - PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, - PNG_FILTER_PATH: PNG_FILTER_PATH - }, - hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var png = new _pngjs.PNG({ - width: data.bitmap.width, - height: data.bitmap.height - }); - png.data = data.bitmap.data; - return _pngjs.PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, - deflateLevel: data._deflateLevel, - deflateStrategy: data._deflateStrategy, - filterType: data._filterType, - colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2, - inputHasAlpha: data._rgba - }); - }), - "class": { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel: function deflateLevel(l, cb) { - if (typeof l !== 'number') { - return _utils.throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return _utils.throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy: function deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return _utils.throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType: function filterType(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb); - } - - this._filterType = Math.round(f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - colorType: function colorType(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/dist/index.js.map b/project starter code/node_modules/@jimp/png/dist/index.js.map deleted file mode 100644 index e5a9771f..00000000 --- a/project starter code/node_modules/@jimp/png/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB,C,CAEA;;AACA,IAAMC,eAAe,GAAG,CAAC,CAAzB;AACA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,cAAc,GAAG,CAAvB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,kBAAkB,GAAG,CAA3B;AACA,IAAMC,eAAe,GAAG,CAAxB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKP,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBQ,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAET,SADD;AAETC,MAAAA,eAAe,EAAfA,eAFS;AAGTC,MAAAA,eAAe,EAAfA,eAHS;AAITC,MAAAA,cAAc,EAAdA,cAJS;AAKTC,MAAAA,aAAa,EAAbA,aALS;AAMTC,MAAAA,kBAAkB,EAAlBA,kBANS;AAOTC,MAAAA,eAAe,EAAfA;AAPS,KAHS;AAapBI,IAAAA,QAAQ,uCAAKV,SAAL,EAAiB,IAAjB,CAbY;AAcpBW,IAAAA,QAAQ,uCAAKX,SAAL,EAAiBY,WAAIC,IAAJ,CAASC,IA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CAFK,EAGLF,EAHK,CAAP;AAKD;;AAED,aAAKN,WAAL,GAAmBS,IAAI,CAACC,KAAL,CAAWE,CAAX,CAAnB;;AAEA,YAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD,OAhFI;;AAiFL;;;;;;AAKIP,MAAAA,SAtFC,qBAsFSU,CAtFT,EAsFYL,EAtFZ,EAsFgB;AACnB,YAAI,OAAOK,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAIK,CAAC,KAAK,CAAN,IAAWA,CAAC,KAAK,CAAjB,IAAsBA,CAAC,KAAK,CAA5B,IAAiCA,CAAC,KAAK,CAA3C,EAA8C;AAC5C,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,gCAAtB,EAAwDF,EAAxD,CAAP;AACD;;AAED,aAAKJ,UAAL,GAAkBO,IAAI,CAACC,KAAL,CAAWC,CAAX,CAAlB;;AAEA,YAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtGI;AAzCa,GAAP;AAAA,C","sourcesContent":["import { PNG } from 'pngjs';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/png';\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['png'] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE]: data => {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === 'number'\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== 'number') {\n return throwError.call(this, 'l must be a number', cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, 'l must be a number 0 - 9', cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, 's must be a number 0 - 3', cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n 'n must be -1 (auto) or a number 0 - 4',\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/es/index.js b/project starter code/node_modules/@jimp/png/es/index.js deleted file mode 100644 index 95f2855e..00000000 --- a/project starter code/node_modules/@jimp/png/es/index.js +++ /dev/null @@ -1,161 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _pngjs = require("pngjs"); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/png'; // PNG filter types - -var PNG_FILTER_AUTO = -1; -var PNG_FILTER_NONE = 0; -var PNG_FILTER_SUB = 1; -var PNG_FILTER_UP = 2; -var PNG_FILTER_AVERAGE = 3; -var PNG_FILTER_PATH = 4; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']), - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO: PNG_FILTER_AUTO, - PNG_FILTER_NONE: PNG_FILTER_NONE, - PNG_FILTER_SUB: PNG_FILTER_SUB, - PNG_FILTER_UP: PNG_FILTER_UP, - PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, - PNG_FILTER_PATH: PNG_FILTER_PATH - }, - hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var png = new _pngjs.PNG({ - width: data.bitmap.width, - height: data.bitmap.height - }); - png.data = data.bitmap.data; - return _pngjs.PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, - deflateLevel: data._deflateLevel, - deflateStrategy: data._deflateStrategy, - filterType: data._filterType, - colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2, - inputHasAlpha: data._rgba - }); - }), - "class": { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel: function deflateLevel(l, cb) { - if (typeof l !== 'number') { - return _utils.throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return _utils.throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy: function deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return _utils.throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType: function filterType(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb); - } - - this._filterType = Math.round(f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - colorType: function colorType(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/es/index.js.map b/project starter code/node_modules/@jimp/png/es/index.js.map deleted file mode 100644 index e5a9771f..00000000 --- a/project starter code/node_modules/@jimp/png/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB,C,CAEA;;AACA,IAAMC,eAAe,GAAG,CAAC,CAAzB;AACA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,cAAc,GAAG,CAAvB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,kBAAkB,GAAG,CAA3B;AACA,IAAMC,eAAe,GAAG,CAAxB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKP,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBQ,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAET,SADD;AAETC,MAAAA,eAAe,EAAfA,eAFS;AAGTC,MAAAA,eAAe,EAAfA,eAHS;AAITC,MAAAA,cAAc,EAAdA,cAJS;AAKTC,MAAAA,aAAa,EAAbA,aALS;AAMTC,MAAAA,kBAAkB,EAAlBA,kBANS;AAOTC,MAAAA,eAAe,EAAfA;AAPS,KAHS;AAapBI,IAAAA,QAAQ,uCAAKV,SAAL,EAAiB,IAAjB,CAbY;AAcpBW,IAAAA,QAAQ,uCAAKX,SAAL,EAAiBY,WAAIC,IAAJ,CAASC,IAA1B,CAdY;AAepBC,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAgB,IAAI,EAAI;AACnB,UAAMC,GAAG,GAAG,IAAIL,UAAJ,CAAQ;AAClBM,QAAAA,KAAK,EAAEF,IAAI,CAACG,MAAL,CAAYD,KADD;AAElBE,QAAAA,MAAM,EAAEJ,IAAI,CAACG,MAAL,CAAYC;AAFF,OAAR,CAAZ;AAKAH,MAAAA,GAAG,CAACD,IAAJ,GAAWA,IAAI,CAACG,MAAL,CAAYH,IAAvB;AAEA,a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,YAAI,OAAOK,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAIK,CAAC,KAAK,CAAN,IAAWA,CAAC,KAAK,CAAjB,IAAsBA,CAAC,KAAK,CAA5B,IAAiCA,CAAC,KAAK,CAA3C,EAA8C;AAC5C,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,gCAAtB,EAAwDF,EAAxD,CAAP;AACD;;AAED,aAAKJ,UAAL,GAAkBO,IAAI,CAACC,KAAL,CAAWC,CAAX,CAAlB;;AAEA,YAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtGI;AAzCa,GAAP;AAAA,C","sourcesContent":["import { PNG } from 'pngjs';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/png';\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['png'] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE]: data => {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === 'number'\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== 'number') {\n return throwError.call(this, 'l must be a number', cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, 'l must be a number 0 - 9', cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, 's must be a number 0 - 3', cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n 'n must be -1 (auto) or a number 0 - 4',\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/index.d.ts b/project starter code/node_modules/@jimp/png/index.d.ts deleted file mode 100644 index 945db8ec..00000000 --- a/project starter code/node_modules/@jimp/png/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core'; - -interface PNGClass { - _deflateLevel: number, - _deflateStrategy: number, - _filterType: number, - _colorType: number, - deflateLevel(l: number, cb?: ImageCallback): this; - deflateStrategy(s: number, cb?: ImageCallback): this; - filterType(f: number, cb?: ImageCallback): this; - colorType(s: number, cb?: ImageCallback): this; -} - -interface PNG { - - mime: { 'image/png': string[] }, - - hasAlpha: { 'image/png': true }, - - decoders: { - 'image/png': DecoderFn - } - encoders: { - 'image/png': EncoderFn - } - - class: PNGClass - - constants: { - MIME_PNG: 'image/png'; - // PNG filter types - PNG_FILTER_AUTO: -1; - PNG_FILTER_NONE: 0; - PNG_FILTER_SUB: 1; - PNG_FILTER_UP: 2; - PNG_FILTER_AVERAGE: 3; - PNG_FILTER_PATH: 4; - } -} - -export default function(): PNG; diff --git a/project starter code/node_modules/@jimp/png/package.json b/project starter code/node_modules/@jimp/png/package.json deleted file mode 100644 index 8d64d22d..00000000 --- a/project starter code/node_modules/@jimp/png/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jimp/png", - "version": "0.16.2", - "description": "Default Jimp png encoder/decoder.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/png/src/index.js b/project starter code/node_modules/@jimp/png/src/index.js deleted file mode 100644 index 0e9c7477..00000000 --- a/project starter code/node_modules/@jimp/png/src/index.js +++ /dev/null @@ -1,159 +0,0 @@ -import { PNG } from 'pngjs'; -import { throwError, isNodePattern } from '@jimp/utils'; - -const MIME_TYPE = 'image/png'; - -// PNG filter types -const PNG_FILTER_AUTO = -1; -const PNG_FILTER_NONE = 0; -const PNG_FILTER_SUB = 1; -const PNG_FILTER_UP = 2; -const PNG_FILTER_AVERAGE = 3; -const PNG_FILTER_PATH = 4; - -export default () => ({ - mime: { [MIME_TYPE]: ['png'] }, - - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO, - PNG_FILTER_NONE, - PNG_FILTER_SUB, - PNG_FILTER_UP, - PNG_FILTER_AVERAGE, - PNG_FILTER_PATH - }, - - hasAlpha: { [MIME_TYPE]: true }, - decoders: { [MIME_TYPE]: PNG.sync.read }, - encoders: { - [MIME_TYPE]: data => { - const png = new PNG({ - width: data.bitmap.width, - height: data.bitmap.height - }); - - png.data = data.bitmap.data; - - return PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, - deflateLevel: data._deflateLevel, - deflateStrategy: data._deflateStrategy, - filterType: data._filterType, - colorType: - typeof data._colorType === 'number' - ? data._colorType - : data._rgba - ? 6 - : 2, - inputHasAlpha: data._rgba - }); - } - }, - - class: { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel(l, cb) { - if (typeof l !== 'number') { - return throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType(f, cb) { - if (typeof f !== 'number') { - return throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return throwError.call( - this, - 'n must be -1 (auto) or a number 0 - 4', - cb - ); - } - - this._filterType = Math.round(f); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - }, - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ colorType(s, cb) { - if (typeof s !== 'number') { - return throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if (isNodePattern(cb)) { - cb.call(this, null, this); - } - - return this; - } - } -}); diff --git a/project starter code/node_modules/@jimp/png/test/png.test.js b/project starter code/node_modules/@jimp/png/test/png.test.js deleted file mode 100644 index 30a297d6..00000000 --- a/project starter code/node_modules/@jimp/png/test/png.test.js +++ /dev/null @@ -1,97 +0,0 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import png from '../src'; - -const jimp = configure({ types: [png] }, Jimp); - -describe('PNG', () => { - const imagesDir = getTestDir(__dirname) + '/images'; - - it('load PNG', async () => { - const image = await jimp.read(imagesDir + '/dice.png'); - - image.getPixelColor(10, 10).should.be.equal(0x00000000); - image.getPixelColor(160, 80).should.be.equal(0x1c1cd4ff); - image.getPixelColor(400, 250).should.be.equal(0x7e0c0cda); - }); - - it('export PNG', async () => { - const jgd = await jimp.read({ - width: 3, - height: 3, - data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] - }); - const buffer = await jgd.getBufferAsync('image/png'); - - buffer.toString().should.match(/^.PNG\r\n/); - }); - - it('should use png options', async () => { - const jgd = await jimp.read({ - width: 20, - height: 20, - data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff, - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff, - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff, - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] - }); - - const image = await jgd - .deflateStrategy(0) - .colorType(0) - .getBufferAsync(Jimp.MIME_PNG); - - const expected = await jimp.read(imagesDir + '/options.png'); - const expectedBuffer = await expected - .deflateStrategy(0) - .colorType(0) - .getBufferAsync(Jimp.MIME_PNG); - - image.should.be.deepEqual(expectedBuffer); - }); -}); diff --git a/project starter code/node_modules/@jimp/tiff/CHANGELOG.md b/project starter code/node_modules/@jimp/tiff/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/tiff/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/dist/index.js b/project starter code/node_modules/@jimp/tiff/dist/index.js deleted file mode 100644 index cf242ccb..00000000 --- a/project starter code/node_modules/@jimp/tiff/dist/index.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _utif = _interopRequireDefault(require("utif")); - -var MIME_TYPE = 'image/tiff'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']), - constants: { - MIME_TIFF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var ifds = _utif["default"].decode(data); - - var page = ifds[0]; - - _utif["default"].decodeImages(data, ifds); - - var rgba = _utif["default"].toRGBA8(page); - - return { - data: Buffer.from(rgba), - width: page.t256[0], - height: page.t257[0] - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); - - return Buffer.from(tiff); - }) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/dist/index.js.map b/project starter code/node_modules/@jimp/tiff/dist/index.js.map deleted file mode 100644 index 639a6f4f..00000000 --- a/project starter code/node_modules/@jimp/tiff/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAAAoB,KAAK,EAAI;AACpB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from 'utif';\n\nconst MIME_TYPE = 'image/tiff';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['tiff', 'tif'] },\n\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/es/index.js b/project starter code/node_modules/@jimp/tiff/es/index.js deleted file mode 100644 index 3233d0e7..00000000 --- a/project starter code/node_modules/@jimp/tiff/es/index.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _utif = _interopRequireDefault(require("utif")); - -var MIME_TYPE = 'image/tiff'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']), - constants: { - MIME_TIFF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var ifds = _utif["default"].decode(data); - - var page = ifds[0]; - - _utif["default"].decodeImages(data, ifds); - - var rgba = _utif["default"].toRGBA8(page); - - return { - data: Buffer.from(rgba), - width: page.t256[0], - height: page.t257[0] - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); - - return Buffer.from(tiff); - }) - }; -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/es/index.js.map b/project starter code/node_modules/@jimp/tiff/es/index.js.map deleted file mode 100644 index 639a6f4f..00000000 --- a/project starter code/node_modules/@jimp/tiff/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAAAoB,KAAK,EAAI;AACpB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from 'utif';\n\nconst MIME_TYPE = 'image/tiff';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['tiff', 'tif'] },\n\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/index.d.ts b/project starter code/node_modules/@jimp/tiff/index.d.ts deleted file mode 100644 index fdd0c5fe..00000000 --- a/project starter code/node_modules/@jimp/tiff/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { DecoderFn, EncoderFn } from '@jimp/core'; - -interface Tiff { - mime: { 'image/tiff': string[] } - decoders: { - 'image/tiff': DecoderFn - } - encoders: { - 'image/tiff': EncoderFn - } - constants: { - MIME_TIFF: 'image/tiff'; - } -} - -export default function(): Tiff; diff --git a/project starter code/node_modules/@jimp/tiff/package.json b/project starter code/node_modules/@jimp/tiff/package.json deleted file mode 100644 index 157805ef..00000000 --- a/project starter code/node_modules/@jimp/tiff/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@jimp/tiff", - "version": "0.16.2", - "description": "Default Jimp tiff encoder/decoder.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/tiff/src/index.js b/project starter code/node_modules/@jimp/tiff/src/index.js deleted file mode 100644 index c8dc3ee4..00000000 --- a/project starter code/node_modules/@jimp/tiff/src/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import UTIF from 'utif'; - -const MIME_TYPE = 'image/tiff'; - -export default () => ({ - mime: { [MIME_TYPE]: ['tiff', 'tif'] }, - - constants: { - MIME_TIFF: MIME_TYPE - }, - - decoders: { - [MIME_TYPE]: data => { - const ifds = UTIF.decode(data); - const page = ifds[0]; - UTIF.decodeImages(data, ifds); - const rgba = UTIF.toRGBA8(page); - - return { - data: Buffer.from(rgba), - width: page.t256[0], - height: page.t257[0] - }; - } - }, - - encoders: { - [MIME_TYPE]: image => { - const tiff = UTIF.encodeImage( - image.bitmap.data, - image.bitmap.width, - image.bitmap.height - ); - - return Buffer.from(tiff); - } - } -}); diff --git a/project starter code/node_modules/@jimp/tiff/test/tiff.test.js b/project starter code/node_modules/@jimp/tiff/test/tiff.test.js deleted file mode 100644 index 84cb9720..00000000 --- a/project starter code/node_modules/@jimp/tiff/test/tiff.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import tiff from '../src'; - -const jimp = configure({ types: [tiff] }, Jimp); - -describe('TIFF', () => { - const imagesDir = getTestDir(__dirname) + '/images'; - - it('load TIFF', async () => { - const image = await jimp.read(imagesDir + '/rgb.tiff'); - - image.getPixelColor(10, 10).should.be.equal(0xa4988bff); - image.getPixelColor(220, 190).should.be.equal(0xe0d7ddff); - image.getPixelColor(350, 130).should.be.equal(0x565433ff); - }); - - const simpleJGD = { - width: 3, - height: 3, - data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] - }; - - it('export TIFF', async () => { - const image = await jimp.read(simpleJGD); - const buffer = await image.getBufferAsync('image/tiff'); - - buffer.toString().should.match(/^MM\u0000*\u0000/); - }); -}); diff --git a/project starter code/node_modules/@jimp/types/CHANGELOG.md b/project starter code/node_modules/@jimp/types/CHANGELOG.md deleted file mode 100644 index 26394e0f..00000000 --- a/project starter code/node_modules/@jimp/types/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/dist/index.js.map b/project starter code/node_modules/@jimp/types/dist/index.js.map deleted file mode 100644 index 197bdb02..00000000 --- a/project starter code/node_modules/@jimp/types/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport jpeg from '@jimp/jpeg';\nimport png from '@jimp/png';\nimport bmp from '@jimp/bmp';\nimport tiff from '@jimp/tiff';\nimport gif from '@jimp/gif';\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/es/index.js b/project starter code/node_modules/@jimp/types/es/index.js deleted file mode 100644 index 01ce8be9..00000000 --- a/project starter code/node_modules/@jimp/types/es/index.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _timm = require("timm"); - -var _jpeg = _interopRequireDefault(require("@jimp/jpeg")); - -var _png = _interopRequireDefault(require("@jimp/png")); - -var _bmp = _interopRequireDefault(require("@jimp/bmp")); - -var _tiff = _interopRequireDefault(require("@jimp/tiff")); - -var _gif = _interopRequireDefault(require("@jimp/gif")); - -var _default = function _default() { - return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])()); -}; - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/es/index.js.map b/project starter code/node_modules/@jimp/types/es/index.js.map deleted file mode 100644 index 197bdb02..00000000 --- a/project starter code/node_modules/@jimp/types/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport jpeg from '@jimp/jpeg';\nimport png from '@jimp/png';\nimport bmp from '@jimp/bmp';\nimport tiff from '@jimp/tiff';\nimport gif from '@jimp/gif';\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/index.d.ts b/project starter code/node_modules/@jimp/types/index.d.ts deleted file mode 100644 index ec2df4ec..00000000 --- a/project starter code/node_modules/@jimp/types/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import jpeg from '@jimp/jpeg'; -import png from '@jimp/png'; -import bmp from '@jimp/bmp'; -import tiff from '@jimp/tiff'; -import gif from '@jimp/gif'; - -type JpegRet = ReturnType -type PngRet = ReturnType -type BmpRet = ReturnType -type TiffRet = ReturnType -type GifRet = ReturnType - -/** - * This is made union and not intersection to avoid issues with - * `IllformedPlugin` and `WellFormedPlugin` when using typings with Jimp - * generic - * - * In reality, this should be an intersection but our type data isn't - * clever enough to figure out what's a class and what's not/etc - */ -type Types = JpegRet | - PngRet | - BmpRet | - TiffRet | - GifRet - -export default function(): Types; diff --git a/project starter code/node_modules/@jimp/types/package.json b/project starter code/node_modules/@jimp/types/package.json deleted file mode 100644 index 7d7f6817..00000000 --- a/project starter code/node_modules/@jimp/types/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@jimp/types", - "version": "0.16.2", - "description": "Default Jimp encoder/decoders.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", - "timm": "^1.6.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - }, - "devDependencies": { - "@types/node": "^12.7.5" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/types/src/index.js b/project starter code/node_modules/@jimp/types/src/index.js deleted file mode 100644 index 313982c6..00000000 --- a/project starter code/node_modules/@jimp/types/src/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import { mergeDeep } from 'timm'; - -import jpeg from '@jimp/jpeg'; -import png from '@jimp/png'; -import bmp from '@jimp/bmp'; -import tiff from '@jimp/tiff'; -import gif from '@jimp/gif'; - -export default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif()); diff --git a/project starter code/node_modules/@jimp/utils/CHANGELOG.md b/project starter code/node_modules/@jimp/utils/CHANGELOG.md deleted file mode 100644 index 5ba04890..00000000 --- a/project starter code/node_modules/@jimp/utils/CHANGELOG.md +++ /dev/null @@ -1,34 +0,0 @@ -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.1 (Sun Apr 05 2020) - -#### 🐛 Bug Fix - -- Update package.json [#870](https://github.com/oliver-moran/jimp/pull/870) ([@arcanis](https://github.com/arcanis)) - -#### Authors: 1 - -- Maël Nison ([@arcanis](https://github.com/arcanis)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/README.md b/project starter code/node_modules/@jimp/utils/README.md deleted file mode 100644 index 98cbfb74..00000000 --- a/project starter code/node_modules/@jimp/utils/README.md +++ /dev/null @@ -1,67 +0,0 @@ -
- -

@jimp/utils

-

Utils for jimp extensions.

-
- -## Available Methods - -### isNodePattern - -Determines if function was passed an node callback. - -```js -if (isNodePattern(cb)) { - cb.call(this, null, this); -} -``` - -### throwError - -Either throws the error or calls the callback with the error. - -```js -if (/* check for error */) { - return throwError.call(this, 'someError', cb); -} -``` - -### scan - -Scans through a region of the bitmap, calling a function for each pixel. - -```js -function removeRed(image) { - return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function( - x, - y, - index - ) { - const red = this.bitmap.data[index + 0]; - const green = this.bitmap.data[index + 1]; - const blue = this.bitmap.data[index + 2]; - const alpha = this.bitmap.data[index + 3]; - - this.bitmap.data[index + 0] = 0; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = alpha; - }); -} -``` - -### scanIterator - -It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication: - -```js -for (const { x, y, idx, image } of scanIterator( - image, - 0, - 0, - image.bitmap.width, - image.bitmap.height -)) { -} -``` diff --git a/project starter code/node_modules/@jimp/utils/dist/index.js b/project starter code/node_modules/@jimp/utils/dist/index.js deleted file mode 100644 index a3b9af90..00000000 --- a/project starter code/node_modules/@jimp/utils/dist/index.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNodePattern = isNodePattern; -exports.throwError = throwError; -exports.scan = scan; -exports.scanIterator = scanIterator; - -var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); - -var _marked = -/*#__PURE__*/ -_regenerator["default"].mark(scanIterator); - -function isNodePattern(cb) { - if (typeof cb === 'undefined') { - return false; - } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); - } - - return true; -} - -function throwError(error, cb) { - if (typeof error === 'string') { - error = new Error(error); - } - - if (typeof cb === 'function') { - return cb.call(this, error); - } - - throw error; -} - -function scan(image, x, y, w, h, f) { - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - for (var _y = y; _y < y + h; _y++) { - for (var _x = x; _x < x + w; _x++) { - var idx = image.bitmap.width * _y + _x << 2; - f.call(image, _x, _y, idx); - } - } - - return image; -} - -function scanIterator(image, x, y, w, h) { - var _y, _x, idx; - - return _regenerator["default"].wrap(function scanIterator$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - _y = y; - - case 5: - if (!(_y < y + h)) { - _context.next = 17; - break; - } - - _x = x; - - case 7: - if (!(_x < x + w)) { - _context.next = 14; - break; - } - - idx = image.bitmap.width * _y + _x << 2; - _context.next = 11; - return { - x: _x, - y: _y, - idx: idx, - image: image - }; - - case 11: - _x++; - _context.next = 7; - break; - - case 14: - _y++; - _context.next = 5; - break; - - case 17: - case "end": - return _context.stop(); - } - } - }, _marked); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/dist/index.js.map b/project starter code/node_modules/@jimp/utils/dist/index.js.map deleted file mode 100644 index 14f767df..00000000 --- a/project starter code/node_modules/@jimp/utils/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,WAAlB,EAA+B;AAC7B,WAAO,KAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,6BAAd,CAAN;AACD;;AAED,SA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AApC,EAAuCC,CAAvC;AAAA;;AAAA;AAAA;AAAA;AAAA;AACL;AACAH,UAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGI,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGG,IAAI,CAACC,KAAL,CAAWJ,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGE,IAAI,CAACC,KAAL,CAAWH,CAAX,CAAJ;AAESI,UAAAA,EAPJ,GAOSN,CAPT;;AAAA;AAAA,gBAOYM,EAAE,GAAGN,CAAC,GAAGE,CAPrB;AAAA;AAAA;AAAA;;AAQMK,UAAAA,EARN,GAQWR,CARX;;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === 'undefined') {\n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/es/index.js b/project starter code/node_modules/@jimp/utils/es/index.js deleted file mode 100644 index a3b9af90..00000000 --- a/project starter code/node_modules/@jimp/utils/es/index.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNodePattern = isNodePattern; -exports.throwError = throwError; -exports.scan = scan; -exports.scanIterator = scanIterator; - -var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); - -var _marked = -/*#__PURE__*/ -_regenerator["default"].mark(scanIterator); - -function isNodePattern(cb) { - if (typeof cb === 'undefined') { - return false; - } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); - } - - return true; -} - -function throwError(error, cb) { - if (typeof error === 'string') { - error = new Error(error); - } - - if (typeof cb === 'function') { - return cb.call(this, error); - } - - throw error; -} - -function scan(image, x, y, w, h, f) { - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - for (var _y = y; _y < y + h; _y++) { - for (var _x = x; _x < x + w; _x++) { - var idx = image.bitmap.width * _y + _x << 2; - f.call(image, _x, _y, idx); - } - } - - return image; -} - -function scanIterator(image, x, y, w, h) { - var _y, _x, idx; - - return _regenerator["default"].wrap(function scanIterator$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - _y = y; - - case 5: - if (!(_y < y + h)) { - _context.next = 17; - break; - } - - _x = x; - - case 7: - if (!(_x < x + w)) { - _context.next = 14; - break; - } - - idx = image.bitmap.width * _y + _x << 2; - _context.next = 11; - return { - x: _x, - y: _y, - idx: idx, - image: image - }; - - case 11: - _x++; - _context.next = 7; - break; - - case 14: - _y++; - _context.next = 5; - break; - - case 17: - case "end": - return _context.stop(); - } - } - }, _marked); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/es/index.js.map b/project starter code/node_modules/@jimp/utils/es/index.js.map deleted file mode 100644 index 14f767df..00000000 --- a/project starter code/node_modules/@jimp/utils/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,WAAlB,EAA+B;AAC7B,WAAO,KAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,6BAAd,CAAN;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAASC,UAAT,CAAoBC,KAApB,EAA2BH,EAA3B,EAA+B;AACpC,MAAI,OAAOG,KAAP,KAAiB,QAArB,EAA+B;AAC7BA,IAAAA,KAAK,GAAG,IAAIC,KAAJ,CAAUD,KAAV,CAAR;AACD;;AAED,MAAI,OAAOH,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAcF,KAAd,CAAP;AACD;;AAED,QAAMA,KAAN;AACD;;AAEM,SAASG,IAAT,CAA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CAPT;;AAAA;AAAA,gBAOYM,EAAE,GAAGN,CAAC,GAAGE,CAPrB;AAAA;AAAA;AAAA;;AAQMK,UAAAA,EARN,GAQWR,CARX;;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === 'undefined') {\n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/index.d.ts b/project starter code/node_modules/@jimp/utils/index.d.ts deleted file mode 100644 index 79fbeaa4..00000000 --- a/project starter code/node_modules/@jimp/utils/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Image, Omit } from '@jimp/core'; -import { ThrowStatement } from 'typescript'; - -export function isNodePattern(cb: Function): true; -export function isNodePattern(cb: Omit): false; - -export function throwError(error: string | Error, cb?: (err: Error) => void): ThrowStatement; - -export function scan(image: Image, x: number, y: number, w: number, h: number, f: (image: Image, _x: number, _y: number, idx: number) => void): Image; diff --git a/project starter code/node_modules/@jimp/utils/package.json b/project starter code/node_modules/@jimp/utils/package.json deleted file mode 100644 index f54b6b99..00000000 --- a/project starter code/node_modules/@jimp/utils/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@jimp/utils", - "version": "0.16.2", - "description": "Utils for jimp extensions.", - "main": "dist/index.js", - "module": "es/index.js", - "types": "index.d.ts", - "scripts": { - "build": "npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node" - }, - "author": "", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@babel/runtime": "^7.7.2", - "regenerator-runtime": "^0.13.3" - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/@jimp/utils/src/index.js b/project starter code/node_modules/@jimp/utils/src/index.js deleted file mode 100644 index 8f51fd35..00000000 --- a/project starter code/node_modules/@jimp/utils/src/index.js +++ /dev/null @@ -1,55 +0,0 @@ -export function isNodePattern(cb) { - if (typeof cb === 'undefined') { - return false; - } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); - } - - return true; -} - -export function throwError(error, cb) { - if (typeof error === 'string') { - error = new Error(error); - } - - if (typeof cb === 'function') { - return cb.call(this, error); - } - - throw error; -} - -export function scan(image, x, y, w, h, f) { - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - for (let _y = y; _y < y + h; _y++) { - for (let _x = x; _x < x + w; _x++) { - const idx = (image.bitmap.width * _y + _x) << 2; - f.call(image, _x, _y, idx); - } - } - - return image; -} - -export function* scanIterator(image, x, y, w, h) { - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - for (let _y = y; _y < y + h; _y++) { - for (let _x = x; _x < x + w; _x++) { - const idx = (image.bitmap.width * _y + _x) << 2; - yield { x: _x, y: _y, idx, image }; - } - } -} diff --git a/project starter code/node_modules/body-parser/HISTORY.md b/project starter code/node_modules/body-parser/HISTORY.md deleted file mode 100644 index fb212b36..00000000 --- a/project starter code/node_modules/body-parser/HISTORY.md +++ /dev/null @@ -1,657 +0,0 @@ -1.20.1 / 2022-10-06 -=================== - - * deps: qs@6.11.0 - * perf: remove unnecessary object clone - -1.20.0 / 2022-04-02 -=================== - - * Fix error message for json parse whitespace in `strict` - * Fix internal error when inflated body exceeds limit - * Prevent loss of async hooks context - * Prevent hanging when request already read - * deps: depd@2.0.0 - - Replace internal `eval` usage with `Function` constructor - - Use instance methods on `process` to check for listeners - * deps: http-errors@2.0.0 - - deps: depd@2.0.0 - - deps: statuses@2.0.1 - * deps: on-finished@2.4.1 - * deps: qs@6.10.3 - * deps: raw-body@2.5.1 - - deps: http-errors@2.0.0 - -1.19.2 / 2022-02-15 -=================== - - * deps: bytes@3.1.2 - * deps: qs@6.9.7 - * Fix handling of `__proto__` keys - * deps: raw-body@2.4.3 - - deps: bytes@3.1.2 - -1.19.1 / 2021-12-10 -=================== - - * deps: bytes@3.1.1 - * deps: http-errors@1.8.1 - - deps: inherits@2.0.4 - - deps: toidentifier@1.0.1 - - deps: setprototypeof@1.2.0 - * deps: qs@6.9.6 - * deps: raw-body@2.4.2 - - deps: bytes@3.1.1 - - deps: http-errors@1.8.1 - * deps: safe-buffer@5.2.1 - * deps: type-is@~1.6.18 - -1.19.0 / 2019-04-25 -=================== - - * deps: bytes@3.1.0 - - Add petabyte (`pb`) support - * deps: http-errors@1.7.2 - - Set constructor name when possible - - deps: setprototypeof@1.1.1 - - deps: statuses@'>= 1.5.0 < 2' - * deps: iconv-lite@0.4.24 - - Added encoding MIK - * deps: qs@6.7.0 - - Fix parsing array brackets after index - * deps: raw-body@2.4.0 - - deps: bytes@3.1.0 - - deps: http-errors@1.7.2 - - deps: iconv-lite@0.4.24 - * deps: type-is@~1.6.17 - - deps: mime-types@~2.1.24 - - perf: prevent internal `throw` on invalid type - -1.18.3 / 2018-05-14 -=================== - - * Fix stack trace for strict json parse error - * deps: depd@~1.1.2 - - perf: remove argument reassignment - * deps: http-errors@~1.6.3 - - deps: depd@~1.1.2 - - deps: setprototypeof@1.1.0 - - deps: statuses@'>= 1.3.1 < 2' - * deps: iconv-lite@0.4.23 - - Fix loading encoding with year appended - - Fix deprecation warnings on Node.js 10+ - * deps: qs@6.5.2 - * deps: raw-body@2.3.3 - - deps: http-errors@1.6.3 - - deps: iconv-lite@0.4.23 - * deps: type-is@~1.6.16 - - deps: mime-types@~2.1.18 - -1.18.2 / 2017-09-22 -=================== - - * deps: debug@2.6.9 - * perf: remove argument reassignment - -1.18.1 / 2017-09-12 -=================== - - * deps: content-type@~1.0.4 - - perf: remove argument reassignment - - perf: skip parameter parsing when no parameters - * deps: iconv-lite@0.4.19 - - Fix ISO-8859-1 regression - - Update Windows-1255 - * deps: qs@6.5.1 - - Fix parsing & compacting very deep objects - * deps: raw-body@2.3.2 - - deps: iconv-lite@0.4.19 - -1.18.0 / 2017-09-08 -=================== - - * Fix JSON strict violation error to match native parse error - * Include the `body` property on verify errors - * Include the `type` property on all generated errors - * Use `http-errors` to set status code on errors - * deps: bytes@3.0.0 - * deps: debug@2.6.8 - * deps: depd@~1.1.1 - - Remove unnecessary `Buffer` loading - * deps: http-errors@~1.6.2 - - deps: depd@1.1.1 - * deps: iconv-lite@0.4.18 - - Add support for React Native - - Add a warning if not loaded as utf-8 - - Fix CESU-8 decoding in Node.js 8 - - Improve speed of ISO-8859-1 encoding - * deps: qs@6.5.0 - * deps: raw-body@2.3.1 - - Use `http-errors` for standard emitted errors - - deps: bytes@3.0.0 - - deps: iconv-lite@0.4.18 - - perf: skip buffer decoding on overage chunk - * perf: prevent internal `throw` when missing charset - -1.17.2 / 2017-05-17 -=================== - - * deps: debug@2.6.7 - - Fix `DEBUG_MAX_ARRAY_LENGTH` - - deps: ms@2.0.0 - * deps: type-is@~1.6.15 - - deps: mime-types@~2.1.15 - -1.17.1 / 2017-03-06 -=================== - - * deps: qs@6.4.0 - - Fix regression parsing keys starting with `[` - -1.17.0 / 2017-03-01 -=================== - - * deps: http-errors@~1.6.1 - - Make `message` property enumerable for `HttpError`s - - deps: setprototypeof@1.0.3 - * deps: qs@6.3.1 - - Fix compacting nested arrays - -1.16.1 / 2017-02-10 -=================== - - * deps: debug@2.6.1 - - Fix deprecation messages in WebStorm and other editors - - Undeprecate `DEBUG_FD` set to `1` or `2` - -1.16.0 / 2017-01-17 -=================== - - * deps: debug@2.6.0 - - Allow colors in workers - - Deprecated `DEBUG_FD` environment variable - - Fix error when running under React Native - - Use same color for same namespace - - deps: ms@0.7.2 - * deps: http-errors@~1.5.1 - - deps: inherits@2.0.3 - - deps: setprototypeof@1.0.2 - - deps: statuses@'>= 1.3.1 < 2' - * deps: iconv-lite@0.4.15 - - Added encoding MS-31J - - Added encoding MS-932 - - Added encoding MS-936 - - Added encoding MS-949 - - Added encoding MS-950 - - Fix GBK/GB18030 handling of Euro character - * deps: qs@6.2.1 - - Fix array parsing from skipping empty values - * deps: raw-body@~2.2.0 - - deps: iconv-lite@0.4.15 - * deps: type-is@~1.6.14 - - deps: mime-types@~2.1.13 - -1.15.2 / 2016-06-19 -=================== - - * deps: bytes@2.4.0 - * deps: content-type@~1.0.2 - - perf: enable strict mode - * deps: http-errors@~1.5.0 - - Use `setprototypeof` module to replace `__proto__` setting - - deps: statuses@'>= 1.3.0 < 2' - - perf: enable strict mode - * deps: qs@6.2.0 - * deps: raw-body@~2.1.7 - - deps: bytes@2.4.0 - - perf: remove double-cleanup on happy path - * deps: type-is@~1.6.13 - - deps: mime-types@~2.1.11 - -1.15.1 / 2016-05-05 -=================== - - * deps: bytes@2.3.0 - - Drop partial bytes on all parsed units - - Fix parsing byte string that looks like hex - * deps: raw-body@~2.1.6 - - deps: bytes@2.3.0 - * deps: type-is@~1.6.12 - - deps: mime-types@~2.1.10 - -1.15.0 / 2016-02-10 -=================== - - * deps: http-errors@~1.4.0 - - Add `HttpError` export, for `err instanceof createError.HttpError` - - deps: inherits@2.0.1 - - deps: statuses@'>= 1.2.1 < 2' - * deps: qs@6.1.0 - * deps: type-is@~1.6.11 - - deps: mime-types@~2.1.9 - -1.14.2 / 2015-12-16 -=================== - - * deps: bytes@2.2.0 - * deps: iconv-lite@0.4.13 - * deps: qs@5.2.0 - * deps: raw-body@~2.1.5 - - deps: bytes@2.2.0 - - deps: iconv-lite@0.4.13 - * deps: type-is@~1.6.10 - - deps: mime-types@~2.1.8 - -1.14.1 / 2015-09-27 -=================== - - * Fix issue where invalid charset results in 400 when `verify` used - * deps: iconv-lite@0.4.12 - - Fix CESU-8 decoding in Node.js 4.x - * deps: raw-body@~2.1.4 - - Fix masking critical errors from `iconv-lite` - - deps: iconv-lite@0.4.12 - * deps: type-is@~1.6.9 - - deps: mime-types@~2.1.7 - -1.14.0 / 2015-09-16 -=================== - - * Fix JSON strict parse error to match syntax errors - * Provide static `require` analysis in `urlencoded` parser - * deps: depd@~1.1.0 - - Support web browser loading - * deps: qs@5.1.0 - * deps: raw-body@~2.1.3 - - Fix sync callback when attaching data listener causes sync read - * deps: type-is@~1.6.8 - - Fix type error when given invalid type to match against - - deps: mime-types@~2.1.6 - -1.13.3 / 2015-07-31 -=================== - - * deps: type-is@~1.6.6 - - deps: mime-types@~2.1.4 - -1.13.2 / 2015-07-05 -=================== - - * deps: iconv-lite@0.4.11 - * deps: qs@4.0.0 - - Fix dropping parameters like `hasOwnProperty` - - Fix user-visible incompatibilities from 3.1.0 - - Fix various parsing edge cases - * deps: raw-body@~2.1.2 - - Fix error stack traces to skip `makeError` - - deps: iconv-lite@0.4.11 - * deps: type-is@~1.6.4 - - deps: mime-types@~2.1.2 - - perf: enable strict mode - - perf: remove argument reassignment - -1.13.1 / 2015-06-16 -=================== - - * deps: qs@2.4.2 - - Downgraded from 3.1.0 because of user-visible incompatibilities - -1.13.0 / 2015-06-14 -=================== - - * Add `statusCode` property on `Error`s, in addition to `status` - * Change `type` default to `application/json` for JSON parser - * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser - * Provide static `require` analysis - * Use the `http-errors` module to generate errors - * deps: bytes@2.1.0 - - Slight optimizations - * deps: iconv-lite@0.4.10 - - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails - - Leading BOM is now removed when decoding - * deps: on-finished@~2.3.0 - - Add defined behavior for HTTP `CONNECT` requests - - Add defined behavior for HTTP `Upgrade` requests - - deps: ee-first@1.1.1 - * deps: qs@3.1.0 - - Fix dropping parameters like `hasOwnProperty` - - Fix various parsing edge cases - - Parsed object now has `null` prototype - * deps: raw-body@~2.1.1 - - Use `unpipe` module for unpiping requests - - deps: iconv-lite@0.4.10 - * deps: type-is@~1.6.3 - - deps: mime-types@~2.1.1 - - perf: reduce try block size - - perf: remove bitwise operations - * perf: enable strict mode - * perf: remove argument reassignment - * perf: remove delete call - -1.12.4 / 2015-05-10 -=================== - - * deps: debug@~2.2.0 - * deps: qs@2.4.2 - - Fix allowing parameters like `constructor` - * deps: on-finished@~2.2.1 - * deps: raw-body@~2.0.1 - - Fix a false-positive when unpiping in Node.js 0.8 - - deps: bytes@2.0.1 - * deps: type-is@~1.6.2 - - deps: mime-types@~2.0.11 - -1.12.3 / 2015-04-15 -=================== - - * Slight efficiency improvement when not debugging - * deps: depd@~1.0.1 - * deps: iconv-lite@0.4.8 - - Add encoding alias UNICODE-1-1-UTF-7 - * deps: raw-body@1.3.4 - - Fix hanging callback if request aborts during read - - deps: iconv-lite@0.4.8 - -1.12.2 / 2015-03-16 -=================== - - * deps: qs@2.4.1 - - Fix error when parameter `hasOwnProperty` is present - -1.12.1 / 2015-03-15 -=================== - - * deps: debug@~2.1.3 - - Fix high intensity foreground color for bold - - deps: ms@0.7.0 - * deps: type-is@~1.6.1 - - deps: mime-types@~2.0.10 - -1.12.0 / 2015-02-13 -=================== - - * add `debug` messages - * accept a function for the `type` option - * use `content-type` to parse `Content-Type` headers - * deps: iconv-lite@0.4.7 - - Gracefully support enumerables on `Object.prototype` - * deps: raw-body@1.3.3 - - deps: iconv-lite@0.4.7 - * deps: type-is@~1.6.0 - - fix argument reassignment - - fix false-positives in `hasBody` `Transfer-Encoding` check - - support wildcard for both type and subtype (`*/*`) - - deps: mime-types@~2.0.9 - -1.11.0 / 2015-01-30 -=================== - - * make internal `extended: true` depth limit infinity - * deps: type-is@~1.5.6 - - deps: mime-types@~2.0.8 - -1.10.2 / 2015-01-20 -=================== - - * deps: iconv-lite@0.4.6 - - Fix rare aliases of single-byte encodings - * deps: raw-body@1.3.2 - - deps: iconv-lite@0.4.6 - -1.10.1 / 2015-01-01 -=================== - - * deps: on-finished@~2.2.0 - * deps: type-is@~1.5.5 - - deps: mime-types@~2.0.7 - -1.10.0 / 2014-12-02 -=================== - - * make internal `extended: true` array limit dynamic - -1.9.3 / 2014-11-21 -================== - - * deps: iconv-lite@0.4.5 - - Fix Windows-31J and X-SJIS encoding support - * deps: qs@2.3.3 - - Fix `arrayLimit` behavior - * deps: raw-body@1.3.1 - - deps: iconv-lite@0.4.5 - * deps: type-is@~1.5.3 - - deps: mime-types@~2.0.3 - -1.9.2 / 2014-10-27 -================== - - * deps: qs@2.3.2 - - Fix parsing of mixed objects and values - -1.9.1 / 2014-10-22 -================== - - * deps: on-finished@~2.1.1 - - Fix handling of pipelined requests - * deps: qs@2.3.0 - - Fix parsing of mixed implicit and explicit arrays - * deps: type-is@~1.5.2 - - deps: mime-types@~2.0.2 - -1.9.0 / 2014-09-24 -================== - - * include the charset in "unsupported charset" error message - * include the encoding in "unsupported content encoding" error message - * deps: depd@~1.0.0 - -1.8.4 / 2014-09-23 -================== - - * fix content encoding to be case-insensitive - -1.8.3 / 2014-09-19 -================== - - * deps: qs@2.2.4 - - Fix issue with object keys starting with numbers truncated - -1.8.2 / 2014-09-15 -================== - - * deps: depd@0.4.5 - -1.8.1 / 2014-09-07 -================== - - * deps: media-typer@0.3.0 - * deps: type-is@~1.5.1 - -1.8.0 / 2014-09-05 -================== - - * make empty-body-handling consistent between chunked requests - - empty `json` produces `{}` - - empty `raw` produces `new Buffer(0)` - - empty `text` produces `''` - - empty `urlencoded` produces `{}` - * deps: qs@2.2.3 - - Fix issue where first empty value in array is discarded - * deps: type-is@~1.5.0 - - fix `hasbody` to be true for `content-length: 0` - -1.7.0 / 2014-09-01 -================== - - * add `parameterLimit` option to `urlencoded` parser - * change `urlencoded` extended array limit to 100 - * respond with 413 when over `parameterLimit` in `urlencoded` - -1.6.7 / 2014-08-29 -================== - - * deps: qs@2.2.2 - - Remove unnecessary cloning - -1.6.6 / 2014-08-27 -================== - - * deps: qs@2.2.0 - - Array parsing fix - - Performance improvements - -1.6.5 / 2014-08-16 -================== - - * deps: on-finished@2.1.0 - -1.6.4 / 2014-08-14 -================== - - * deps: qs@1.2.2 - -1.6.3 / 2014-08-10 -================== - - * deps: qs@1.2.1 - -1.6.2 / 2014-08-07 -================== - - * deps: qs@1.2.0 - - Fix parsing array of objects - -1.6.1 / 2014-08-06 -================== - - * deps: qs@1.1.0 - - Accept urlencoded square brackets - - Accept empty values in implicit array notation - -1.6.0 / 2014-08-05 -================== - - * deps: qs@1.0.2 - - Complete rewrite - - Limits array length to 20 - - Limits object depth to 5 - - Limits parameters to 1,000 - -1.5.2 / 2014-07-27 -================== - - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - -1.5.1 / 2014-07-26 -================== - - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - -1.5.0 / 2014-07-20 -================== - - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - * deps: iconv-lite@0.4.4 - - Added encoding UTF-7 - * deps: raw-body@1.3.0 - - deps: iconv-lite@0.4.4 - - Added encoding UTF-7 - - Fix `Cannot switch to old mode now` error on Node.js 0.10+ - * deps: type-is@~1.3.2 - -1.4.3 / 2014-06-19 -================== - - * deps: type-is@1.3.1 - - fix global variable leak - -1.4.2 / 2014-06-19 -================== - - * deps: type-is@1.3.0 - - improve type parsing - -1.4.1 / 2014-06-19 -================== - - * fix urlencoded extended deprecation message - -1.4.0 / 2014-06-19 -================== - - * add `text` parser - * add `raw` parser - * check accepted charset in content-type (accepts utf-8) - * check accepted encoding in content-encoding (accepts identity) - * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed - * deprecate `urlencoded()` without provided `extended` option - * lazy-load urlencoded parsers - * parsers split into files for reduced mem usage - * support gzip and deflate bodies - - set `inflate: false` to turn off - * deps: raw-body@1.2.2 - - Support all encodings from `iconv-lite` - -1.3.1 / 2014-06-11 -================== - - * deps: type-is@1.2.1 - - Switch dependency from mime to mime-types@1.0.0 - -1.3.0 / 2014-05-31 -================== - - * add `extended` option to urlencoded parser - -1.2.2 / 2014-05-27 -================== - - * deps: raw-body@1.1.6 - - assert stream encoding on node.js 0.8 - - assert stream encoding on node.js < 0.10.6 - - deps: bytes@1 - -1.2.1 / 2014-05-26 -================== - - * invoke `next(err)` after request fully read - - prevents hung responses and socket hang ups - -1.2.0 / 2014-05-11 -================== - - * add `verify` option - * deps: type-is@1.2.0 - - support suffix matching - -1.1.2 / 2014-05-11 -================== - - * improve json parser speed - -1.1.1 / 2014-05-11 -================== - - * fix repeated limit parsing with every request - -1.1.0 / 2014-05-10 -================== - - * add `type` option - * deps: pin for safety and consistency - -1.0.2 / 2014-04-14 -================== - - * use `type-is` module - -1.0.1 / 2014-03-20 -================== - - * lower default limits to 100kb diff --git a/project starter code/node_modules/body-parser/README.md b/project starter code/node_modules/body-parser/README.md deleted file mode 100644 index c507cbb0..00000000 --- a/project starter code/node_modules/body-parser/README.md +++ /dev/null @@ -1,464 +0,0 @@ -# body-parser - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][github-actions-ci-image]][github-actions-ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Node.js body parsing middleware. - -Parse incoming request bodies in a middleware before your handlers, available -under the `req.body` property. - -**Note** As `req.body`'s shape is based on user-controlled input, all -properties and values in this object are untrusted and should be validated -before trusting. For example, `req.body.foo.toString()` may fail in multiple -ways, for example the `foo` property may not be there or may not be a string, -and `toString` may not be a function and instead a string or other user input. - -[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/). - -_This does not handle multipart bodies_, due to their complex and typically -large nature. For multipart bodies, you may be interested in the following -modules: - - * [busboy](https://www.npmjs.org/package/busboy#readme) and - [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme) - * [multiparty](https://www.npmjs.org/package/multiparty#readme) and - [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme) - * [formidable](https://www.npmjs.org/package/formidable#readme) - * [multer](https://www.npmjs.org/package/multer#readme) - -This module provides the following parsers: - - * [JSON body parser](#bodyparserjsonoptions) - * [Raw body parser](#bodyparserrawoptions) - * [Text body parser](#bodyparsertextoptions) - * [URL-encoded form body parser](#bodyparserurlencodedoptions) - -Other body parsers you might be interested in: - -- [body](https://www.npmjs.org/package/body#readme) -- [co-body](https://www.npmjs.org/package/co-body#readme) - -## Installation - -```sh -$ npm install body-parser -``` - -## API - -```js -var bodyParser = require('body-parser') -``` - -The `bodyParser` object exposes various factories to create middlewares. All -middlewares will populate the `req.body` property with the parsed body when -the `Content-Type` request header matches the `type` option, or an empty -object (`{}`) if there was no body to parse, the `Content-Type` was not matched, -or an error occurred. - -The various errors returned by this module are described in the -[errors section](#errors). - -### bodyParser.json([options]) - -Returns middleware that only parses `json` and only looks at requests where -the `Content-Type` header matches the `type` option. This parser accepts any -Unicode encoding of the body and supports automatic inflation of `gzip` and -`deflate` encodings. - -A new `body` object containing the parsed data is populated on the `request` -object after the middleware (i.e. `req.body`). - -#### Options - -The `json` function takes an optional `options` object that may contain any of -the following keys: - -##### inflate - -When set to `true`, then deflated (compressed) bodies will be inflated; when -`false`, deflated bodies are rejected. Defaults to `true`. - -##### limit - -Controls the maximum request body size. If this is a number, then the value -specifies the number of bytes; if it is a string, the value is passed to the -[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults -to `'100kb'`. - -##### reviver - -The `reviver` option is passed directly to `JSON.parse` as the second -argument. You can find more information on this argument -[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter). - -##### strict - -When set to `true`, will only accept arrays and objects; when `false` will -accept anything `JSON.parse` accepts. Defaults to `true`. - -##### type - -The `type` option is used to determine what media type the middleware will -parse. This option can be a string, array of strings, or a function. If not a -function, `type` option is passed directly to the -[type-is](https://www.npmjs.org/package/type-is#readme) library and this can -be an extension name (like `json`), a mime type (like `application/json`), or -a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type` -option is called as `fn(req)` and the request is parsed if it returns a truthy -value. Defaults to `application/json`. - -##### verify - -The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, -where `buf` is a `Buffer` of the raw request body and `encoding` is the -encoding of the request. The parsing can be aborted by throwing an error. - -### bodyParser.raw([options]) - -Returns middleware that parses all bodies as a `Buffer` and only looks at -requests where the `Content-Type` header matches the `type` option. This -parser supports automatic inflation of `gzip` and `deflate` encodings. - -A new `body` object containing the parsed data is populated on the `request` -object after the middleware (i.e. `req.body`). This will be a `Buffer` object -of the body. - -#### Options - -The `raw` function takes an optional `options` object that may contain any of -the following keys: - -##### inflate - -When set to `true`, then deflated (compressed) bodies will be inflated; when -`false`, deflated bodies are rejected. Defaults to `true`. - -##### limit - -Controls the maximum request body size. If this is a number, then the value -specifies the number of bytes; if it is a string, the value is passed to the -[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults -to `'100kb'`. - -##### type - -The `type` option is used to determine what media type the middleware will -parse. This option can be a string, array of strings, or a function. -If not a function, `type` option is passed directly to the -[type-is](https://www.npmjs.org/package/type-is#readme) library and this -can be an extension name (like `bin`), a mime type (like -`application/octet-stream`), or a mime type with a wildcard (like `*/*` or -`application/*`). If a function, the `type` option is called as `fn(req)` -and the request is parsed if it returns a truthy value. Defaults to -`application/octet-stream`. - -##### verify - -The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, -where `buf` is a `Buffer` of the raw request body and `encoding` is the -encoding of the request. The parsing can be aborted by throwing an error. - -### bodyParser.text([options]) - -Returns middleware that parses all bodies as a string and only looks at -requests where the `Content-Type` header matches the `type` option. This -parser supports automatic inflation of `gzip` and `deflate` encodings. - -A new `body` string containing the parsed data is populated on the `request` -object after the middleware (i.e. `req.body`). This will be a string of the -body. - -#### Options - -The `text` function takes an optional `options` object that may contain any of -the following keys: - -##### defaultCharset - -Specify the default character set for the text content if the charset is not -specified in the `Content-Type` header of the request. Defaults to `utf-8`. - -##### inflate - -When set to `true`, then deflated (compressed) bodies will be inflated; when -`false`, deflated bodies are rejected. Defaults to `true`. - -##### limit - -Controls the maximum request body size. If this is a number, then the value -specifies the number of bytes; if it is a string, the value is passed to the -[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults -to `'100kb'`. - -##### type - -The `type` option is used to determine what media type the middleware will -parse. This option can be a string, array of strings, or a function. If not -a function, `type` option is passed directly to the -[type-is](https://www.npmjs.org/package/type-is#readme) library and this can -be an extension name (like `txt`), a mime type (like `text/plain`), or a mime -type with a wildcard (like `*/*` or `text/*`). If a function, the `type` -option is called as `fn(req)` and the request is parsed if it returns a -truthy value. Defaults to `text/plain`. - -##### verify - -The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, -where `buf` is a `Buffer` of the raw request body and `encoding` is the -encoding of the request. The parsing can be aborted by throwing an error. - -### bodyParser.urlencoded([options]) - -Returns middleware that only parses `urlencoded` bodies and only looks at -requests where the `Content-Type` header matches the `type` option. This -parser accepts only UTF-8 encoding of the body and supports automatic -inflation of `gzip` and `deflate` encodings. - -A new `body` object containing the parsed data is populated on the `request` -object after the middleware (i.e. `req.body`). This object will contain -key-value pairs, where the value can be a string or array (when `extended` is -`false`), or any type (when `extended` is `true`). - -#### Options - -The `urlencoded` function takes an optional `options` object that may contain -any of the following keys: - -##### extended - -The `extended` option allows to choose between parsing the URL-encoded data -with the `querystring` library (when `false`) or the `qs` library (when -`true`). The "extended" syntax allows for rich objects and arrays to be -encoded into the URL-encoded format, allowing for a JSON-like experience -with URL-encoded. For more information, please -[see the qs library](https://www.npmjs.org/package/qs#readme). - -Defaults to `true`, but using the default has been deprecated. Please -research into the difference between `qs` and `querystring` and choose the -appropriate setting. - -##### inflate - -When set to `true`, then deflated (compressed) bodies will be inflated; when -`false`, deflated bodies are rejected. Defaults to `true`. - -##### limit - -Controls the maximum request body size. If this is a number, then the value -specifies the number of bytes; if it is a string, the value is passed to the -[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults -to `'100kb'`. - -##### parameterLimit - -The `parameterLimit` option controls the maximum number of parameters that -are allowed in the URL-encoded data. If a request contains more parameters -than this value, a 413 will be returned to the client. Defaults to `1000`. - -##### type - -The `type` option is used to determine what media type the middleware will -parse. This option can be a string, array of strings, or a function. If not -a function, `type` option is passed directly to the -[type-is](https://www.npmjs.org/package/type-is#readme) library and this can -be an extension name (like `urlencoded`), a mime type (like -`application/x-www-form-urlencoded`), or a mime type with a wildcard (like -`*/x-www-form-urlencoded`). If a function, the `type` option is called as -`fn(req)` and the request is parsed if it returns a truthy value. Defaults -to `application/x-www-form-urlencoded`. - -##### verify - -The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, -where `buf` is a `Buffer` of the raw request body and `encoding` is the -encoding of the request. The parsing can be aborted by throwing an error. - -## Errors - -The middlewares provided by this module create errors using the -[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors -will typically have a `status`/`statusCode` property that contains the suggested -HTTP response code, an `expose` property to determine if the `message` property -should be displayed to the client, a `type` property to determine the type of -error without matching against the `message`, and a `body` property containing -the read body, if available. - -The following are the common errors created, though any error can come through -for various reasons. - -### content encoding unsupported - -This error will occur when the request had a `Content-Encoding` header that -contained an encoding but the "inflation" option was set to `false`. The -`status` property is set to `415`, the `type` property is set to -`'encoding.unsupported'`, and the `charset` property will be set to the -encoding that is unsupported. - -### entity parse failed - -This error will occur when the request contained an entity that could not be -parsed by the middleware. The `status` property is set to `400`, the `type` -property is set to `'entity.parse.failed'`, and the `body` property is set to -the entity value that failed parsing. - -### entity verify failed - -This error will occur when the request contained an entity that could not be -failed verification by the defined `verify` option. The `status` property is -set to `403`, the `type` property is set to `'entity.verify.failed'`, and the -`body` property is set to the entity value that failed verification. - -### request aborted - -This error will occur when the request is aborted by the client before reading -the body has finished. The `received` property will be set to the number of -bytes received before the request was aborted and the `expected` property is -set to the number of expected bytes. The `status` property is set to `400` -and `type` property is set to `'request.aborted'`. - -### request entity too large - -This error will occur when the request body's size is larger than the "limit" -option. The `limit` property will be set to the byte limit and the `length` -property will be set to the request body's length. The `status` property is -set to `413` and the `type` property is set to `'entity.too.large'`. - -### request size did not match content length - -This error will occur when the request's length did not match the length from -the `Content-Length` header. This typically occurs when the request is malformed, -typically when the `Content-Length` header was calculated based on characters -instead of bytes. The `status` property is set to `400` and the `type` property -is set to `'request.size.invalid'`. - -### stream encoding should not be set - -This error will occur when something called the `req.setEncoding` method prior -to this middleware. This module operates directly on bytes only and you cannot -call `req.setEncoding` when using this module. The `status` property is set to -`500` and the `type` property is set to `'stream.encoding.set'`. - -### stream is not readable - -This error will occur when the request is no longer readable when this middleware -attempts to read it. This typically means something other than a middleware from -this module read the request body already and the middleware was also configured to -read the same request. The `status` property is set to `500` and the `type` -property is set to `'stream.not.readable'`. - -### too many parameters - -This error will occur when the content of the request exceeds the configured -`parameterLimit` for the `urlencoded` parser. The `status` property is set to -`413` and the `type` property is set to `'parameters.too.many'`. - -### unsupported charset "BOGUS" - -This error will occur when the request had a charset parameter in the -`Content-Type` header, but the `iconv-lite` module does not support it OR the -parser does not support it. The charset is contained in the message as well -as in the `charset` property. The `status` property is set to `415`, the -`type` property is set to `'charset.unsupported'`, and the `charset` property -is set to the charset that is unsupported. - -### unsupported content encoding "bogus" - -This error will occur when the request had a `Content-Encoding` header that -contained an unsupported encoding. The encoding is contained in the message -as well as in the `encoding` property. The `status` property is set to `415`, -the `type` property is set to `'encoding.unsupported'`, and the `encoding` -property is set to the encoding that is unsupported. - -## Examples - -### Express/Connect top-level generic - -This example demonstrates adding a generic JSON and URL-encoded parser as a -top-level middleware, which will parse the bodies of all incoming requests. -This is the simplest setup. - -```js -var express = require('express') -var bodyParser = require('body-parser') - -var app = express() - -// parse application/x-www-form-urlencoded -app.use(bodyParser.urlencoded({ extended: false })) - -// parse application/json -app.use(bodyParser.json()) - -app.use(function (req, res) { - res.setHeader('Content-Type', 'text/plain') - res.write('you posted:\n') - res.end(JSON.stringify(req.body, null, 2)) -}) -``` - -### Express route-specific - -This example demonstrates adding body parsers specifically to the routes that -need them. In general, this is the most recommended way to use body-parser with -Express. - -```js -var express = require('express') -var bodyParser = require('body-parser') - -var app = express() - -// create application/json parser -var jsonParser = bodyParser.json() - -// create application/x-www-form-urlencoded parser -var urlencodedParser = bodyParser.urlencoded({ extended: false }) - -// POST /login gets urlencoded bodies -app.post('/login', urlencodedParser, function (req, res) { - res.send('welcome, ' + req.body.username) -}) - -// POST /api/users gets JSON bodies -app.post('/api/users', jsonParser, function (req, res) { - // create user in req.body -}) -``` - -### Change accepted type for parsers - -All the parsers accept a `type` option which allows you to change the -`Content-Type` that the middleware will parse. - -```js -var express = require('express') -var bodyParser = require('body-parser') - -var app = express() - -// parse various different custom JSON types as JSON -app.use(bodyParser.json({ type: 'application/*+json' })) - -// parse some custom thing into a Buffer -app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })) - -// parse an HTML body into a string -app.use(bodyParser.text({ type: 'text/html' })) -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/body-parser.svg -[npm-url]: https://npmjs.org/package/body-parser -[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg -[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master -[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg -[downloads-url]: https://npmjs.org/package/body-parser -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/expressjs/body-parser/ci/master?label=ci -[github-actions-ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml diff --git a/project starter code/node_modules/body-parser/index.js b/project starter code/node_modules/body-parser/index.js deleted file mode 100644 index b2b48221..00000000 --- a/project starter code/node_modules/body-parser/index.js +++ /dev/null @@ -1,156 +0,0 @@ -/*! - * body-parser - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var deprecate = require('depd')('body-parser') - -/** - * Cache of loaded parsers. - * @private - */ - -var parsers = Object.create(null) - -/** - * @typedef Parsers - * @type {function} - * @property {function} json - * @property {function} raw - * @property {function} text - * @property {function} urlencoded - */ - -/** - * Module exports. - * @type {Parsers} - */ - -exports = module.exports = deprecate.function(bodyParser, - 'bodyParser: use individual json/urlencoded middlewares') - -/** - * JSON parser. - * @public - */ - -Object.defineProperty(exports, 'json', { - configurable: true, - enumerable: true, - get: createParserGetter('json') -}) - -/** - * Raw parser. - * @public - */ - -Object.defineProperty(exports, 'raw', { - configurable: true, - enumerable: true, - get: createParserGetter('raw') -}) - -/** - * Text parser. - * @public - */ - -Object.defineProperty(exports, 'text', { - configurable: true, - enumerable: true, - get: createParserGetter('text') -}) - -/** - * URL-encoded parser. - * @public - */ - -Object.defineProperty(exports, 'urlencoded', { - configurable: true, - enumerable: true, - get: createParserGetter('urlencoded') -}) - -/** - * Create a middleware to parse json and urlencoded bodies. - * - * @param {object} [options] - * @return {function} - * @deprecated - * @public - */ - -function bodyParser (options) { - // use default type for parsers - var opts = Object.create(options || null, { - type: { - configurable: true, - enumerable: true, - value: undefined, - writable: true - } - }) - - var _urlencoded = exports.urlencoded(opts) - var _json = exports.json(opts) - - return function bodyParser (req, res, next) { - _json(req, res, function (err) { - if (err) return next(err) - _urlencoded(req, res, next) - }) - } -} - -/** - * Create a getter for loading a parser. - * @private - */ - -function createParserGetter (name) { - return function get () { - return loadParser(name) - } -} - -/** - * Load a parser module. - * @private - */ - -function loadParser (parserName) { - var parser = parsers[parserName] - - if (parser !== undefined) { - return parser - } - - // this uses a switch for static require analysis - switch (parserName) { - case 'json': - parser = require('body-parser/lib/types/json') - break - case 'raw': - parser = require('body-parser/lib/types/raw') - break - case 'text': - parser = require('body-parser/lib/types/text') - break - case 'urlencoded': - parser = require('body-parser/lib/types/urlencoded') - break - } - - // store to prevent invoking require() - return (parsers[parserName] = parser) -} diff --git a/project starter code/node_modules/body-parser/package.json b/project starter code/node_modules/body-parser/package.json deleted file mode 100644 index 9cd2ccbb..00000000 --- a/project starter code/node_modules/body-parser/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "body-parser", - "description": "Node.js body parsing middleware", - "version": "1.20.1", - "contributors": [ - "Douglas Christopher Wilson ", - "Jonathan Ong (http://jongleberry.com)" - ], - "license": "MIT", - "repository": "expressjs/body-parser", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "devDependencies": { - "eslint": "8.24.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-markdown": "3.0.0", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.0.1", - "eslint-plugin-standard": "4.1.0", - "methods": "1.1.2", - "mocha": "10.0.0", - "nyc": "15.1.0", - "safe-buffer": "5.2.1", - "supertest": "6.3.0" - }, - "files": [ - "lib/", - "LICENSE", - "HISTORY.md", - "SECURITY.md", - "index.js" - ], - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/", - "test-ci": "nyc --reporter=lcov --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" - } -} diff --git a/project starter code/node_modules/content-type/HISTORY.md b/project starter code/node_modules/content-type/HISTORY.md deleted file mode 100644 index 8f5cb703..00000000 --- a/project starter code/node_modules/content-type/HISTORY.md +++ /dev/null @@ -1,24 +0,0 @@ -1.0.4 / 2017-09-11 -================== - - * perf: skip parameter parsing when no parameters - -1.0.3 / 2017-09-10 -================== - - * perf: remove argument reassignment - -1.0.2 / 2016-05-09 -================== - - * perf: enable strict mode - -1.0.1 / 2015-02-13 -================== - - * Improve missing `Content-Type` header error message - -1.0.0 / 2015-02-01 -================== - - * Initial implementation, derived from `media-typer@0.3.0` diff --git a/project starter code/node_modules/content-type/README.md b/project starter code/node_modules/content-type/README.md deleted file mode 100644 index 3ed67413..00000000 --- a/project starter code/node_modules/content-type/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# content-type - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Create and parse HTTP Content-Type header according to RFC 7231 - -## Installation - -```sh -$ npm install content-type -``` - -## API - -```js -var contentType = require('content-type') -``` - -### contentType.parse(string) - -```js -var obj = contentType.parse('image/svg+xml; charset=utf-8') -``` - -Parse a content type string. This will return an object with the following -properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): - - - `type`: The media type (the type and subtype, always lower case). - Example: `'image/svg+xml'` - - - `parameters`: An object of the parameters in the media type (name of parameter - always lower case). Example: `{charset: 'utf-8'}` - -Throws a `TypeError` if the string is missing or invalid. - -### contentType.parse(req) - -```js -var obj = contentType.parse(req) -``` - -Parse the `content-type` header from the given `req`. Short-cut for -`contentType.parse(req.headers['content-type'])`. - -Throws a `TypeError` if the `Content-Type` header is missing or invalid. - -### contentType.parse(res) - -```js -var obj = contentType.parse(res) -``` - -Parse the `content-type` header set on the given `res`. Short-cut for -`contentType.parse(res.getHeader('content-type'))`. - -Throws a `TypeError` if the `Content-Type` header is missing or invalid. - -### contentType.format(obj) - -```js -var str = contentType.format({type: 'image/svg+xml'}) -``` - -Format an object into a content type string. This will return a string of the -content type for the given object with the following properties (examples are -shown that produce the string `'image/svg+xml; charset=utf-8'`): - - - `type`: The media type (will be lower-cased). Example: `'image/svg+xml'` - - - `parameters`: An object of the parameters in the media type (name of the - parameter will be lower-cased). Example: `{charset: 'utf-8'}` - -Throws a `TypeError` if the object contains an invalid type or parameter names. - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/content-type.svg -[npm-url]: https://npmjs.org/package/content-type -[node-version-image]: https://img.shields.io/node/v/content-type.svg -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/content-type/master.svg -[travis-url]: https://travis-ci.org/jshttp/content-type -[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-type/master.svg -[coveralls-url]: https://coveralls.io/r/jshttp/content-type -[downloads-image]: https://img.shields.io/npm/dm/content-type.svg -[downloads-url]: https://npmjs.org/package/content-type diff --git a/project starter code/node_modules/content-type/index.js b/project starter code/node_modules/content-type/index.js deleted file mode 100644 index 6ce03f20..00000000 --- a/project starter code/node_modules/content-type/index.js +++ /dev/null @@ -1,222 +0,0 @@ -/*! - * content-type - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 - * - * parameter = token "=" ( token / quoted-string ) - * token = 1*tchar - * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" - * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" - * / DIGIT / ALPHA - * ; any VCHAR, except delimiters - * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE - * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text - * obs-text = %x80-FF - * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) - */ -var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g -var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ -var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ - -/** - * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 - * - * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) - * obs-text = %x80-FF - */ -var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g - -/** - * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 - */ -var QUOTE_REGEXP = /([\\"])/g - -/** - * RegExp to match type in RFC 7231 sec 3.1.1.1 - * - * media-type = type "/" subtype - * type = token - * subtype = token - */ -var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ - -/** - * Module exports. - * @public - */ - -exports.format = format -exports.parse = parse - -/** - * Format object to media type. - * - * @param {object} obj - * @return {string} - * @public - */ - -function format (obj) { - if (!obj || typeof obj !== 'object') { - throw new TypeError('argument obj is required') - } - - var parameters = obj.parameters - var type = obj.type - - if (!type || !TYPE_REGEXP.test(type)) { - throw new TypeError('invalid type') - } - - var string = type - - // append parameters - if (parameters && typeof parameters === 'object') { - var param - var params = Object.keys(parameters).sort() - - for (var i = 0; i < params.length; i++) { - param = params[i] - - if (!TOKEN_REGEXP.test(param)) { - throw new TypeError('invalid parameter name') - } - - string += '; ' + param + '=' + qstring(parameters[param]) - } - } - - return string -} - -/** - * Parse media type to object. - * - * @param {string|object} string - * @return {Object} - * @public - */ - -function parse (string) { - if (!string) { - throw new TypeError('argument string is required') - } - - // support req/res-like objects as argument - var header = typeof string === 'object' - ? getcontenttype(string) - : string - - if (typeof header !== 'string') { - throw new TypeError('argument string is required to be a string') - } - - var index = header.indexOf(';') - var type = index !== -1 - ? header.substr(0, index).trim() - : header.trim() - - if (!TYPE_REGEXP.test(type)) { - throw new TypeError('invalid media type') - } - - var obj = new ContentType(type.toLowerCase()) - - // parse parameters - if (index !== -1) { - var key - var match - var value - - PARAM_REGEXP.lastIndex = index - - while ((match = PARAM_REGEXP.exec(header))) { - if (match.index !== index) { - throw new TypeError('invalid parameter format') - } - - index += match[0].length - key = match[1].toLowerCase() - value = match[2] - - if (value[0] === '"') { - // remove quotes and escapes - value = value - .substr(1, value.length - 2) - .replace(QESC_REGEXP, '$1') - } - - obj.parameters[key] = value - } - - if (index !== header.length) { - throw new TypeError('invalid parameter format') - } - } - - return obj -} - -/** - * Get content-type from req/res objects. - * - * @param {object} - * @return {Object} - * @private - */ - -function getcontenttype (obj) { - var header - - if (typeof obj.getHeader === 'function') { - // res-like - header = obj.getHeader('content-type') - } else if (typeof obj.headers === 'object') { - // req-like - header = obj.headers && obj.headers['content-type'] - } - - if (typeof header !== 'string') { - throw new TypeError('content-type header is missing from object') - } - - return header -} - -/** - * Quote a string if necessary. - * - * @param {string} val - * @return {string} - * @private - */ - -function qstring (val) { - var str = String(val) - - // no need to quote tokens - if (TOKEN_REGEXP.test(str)) { - return str - } - - if (str.length > 0 && !TEXT_REGEXP.test(str)) { - throw new TypeError('invalid parameter value') - } - - return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' -} - -/** - * Class to represent a content type. - * @private - */ -function ContentType (type) { - this.parameters = Object.create(null) - this.type = type -} diff --git a/project starter code/node_modules/content-type/package.json b/project starter code/node_modules/content-type/package.json deleted file mode 100644 index f2d31d41..00000000 --- a/project starter code/node_modules/content-type/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "content-type", - "description": "Create and parse HTTP Content-Type header", - "version": "1.0.4", - "author": "Douglas Christopher Wilson ", - "license": "MIT", - "keywords": [ - "content-type", - "http", - "req", - "res", - "rfc7231" - ], - "repository": "jshttp/content-type", - "devDependencies": { - "eslint": "3.19.0", - "eslint-config-standard": "10.2.1", - "eslint-plugin-import": "2.7.0", - "eslint-plugin-node": "5.1.1", - "eslint-plugin-promise": "3.5.0", - "eslint-plugin-standard": "3.0.1", - "istanbul": "0.4.5", - "mocha": "~1.21.5" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "README.md", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "lint": "eslint .", - "test": "mocha --reporter spec --check-leaks --bail test/", - "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" - } -} diff --git a/project starter code/node_modules/cookie/HISTORY.md b/project starter code/node_modules/cookie/HISTORY.md deleted file mode 100644 index ae9b995b..00000000 --- a/project starter code/node_modules/cookie/HISTORY.md +++ /dev/null @@ -1,142 +0,0 @@ -0.5.0 / 2022-04-11 -================== - - * Add `priority` option - * Fix `expires` option to reject invalid dates - * pref: improve default decode speed - * pref: remove slow string split in parse - -0.4.2 / 2022-02-02 -================== - - * pref: read value only when assigning in parse - * pref: remove unnecessary regexp in parse - -0.4.1 / 2020-04-21 -================== - - * Fix `maxAge` option to reject invalid values - -0.4.0 / 2019-05-15 -================== - - * Add `SameSite=None` support - -0.3.1 / 2016-05-26 -================== - - * Fix `sameSite: true` to work with draft-7 clients - - `true` now sends `SameSite=Strict` instead of `SameSite` - -0.3.0 / 2016-05-26 -================== - - * Add `sameSite` option - - Replaces `firstPartyOnly` option, never implemented by browsers - * Improve error message when `encode` is not a function - * Improve error message when `expires` is not a `Date` - -0.2.4 / 2016-05-20 -================== - - * perf: enable strict mode - * perf: use for loop in parse - * perf: use string concatination for serialization - -0.2.3 / 2015-10-25 -================== - - * Fix cookie `Max-Age` to never be a floating point number - -0.2.2 / 2015-09-17 -================== - - * Fix regression when setting empty cookie value - - Ease the new restriction, which is just basic header-level validation - * Fix typo in invalid value errors - -0.2.1 / 2015-09-17 -================== - - * Throw on invalid values provided to `serialize` - - Ensures the resulting string is a valid HTTP header value - -0.2.0 / 2015-08-13 -================== - - * Add `firstPartyOnly` option - * Throw better error for invalid argument to parse - * perf: hoist regular expression - -0.1.5 / 2015-09-17 -================== - - * Fix regression when setting empty cookie value - - Ease the new restriction, which is just basic header-level validation - * Fix typo in invalid value errors - -0.1.4 / 2015-09-17 -================== - - * Throw better error for invalid argument to parse - * Throw on invalid values provided to `serialize` - - Ensures the resulting string is a valid HTTP header value - -0.1.3 / 2015-05-19 -================== - - * Reduce the scope of try-catch deopt - * Remove argument reassignments - -0.1.2 / 2014-04-16 -================== - - * Remove unnecessary files from npm package - -0.1.1 / 2014-02-23 -================== - - * Fix bad parse when cookie value contained a comma - * Fix support for `maxAge` of `0` - -0.1.0 / 2013-05-01 -================== - - * Add `decode` option - * Add `encode` option - -0.0.6 / 2013-04-08 -================== - - * Ignore cookie parts missing `=` - -0.0.5 / 2012-10-29 -================== - - * Return raw cookie value if value unescape errors - -0.0.4 / 2012-06-21 -================== - - * Use encode/decodeURIComponent for cookie encoding/decoding - - Improve server/client interoperability - -0.0.3 / 2012-06-06 -================== - - * Only escape special characters per the cookie RFC - -0.0.2 / 2012-06-01 -================== - - * Fix `maxAge` option to not throw error - -0.0.1 / 2012-05-28 -================== - - * Add more tests - -0.0.0 / 2012-05-28 -================== - - * Initial release diff --git a/project starter code/node_modules/cookie/README.md b/project starter code/node_modules/cookie/README.md deleted file mode 100644 index 5449c3a2..00000000 --- a/project starter code/node_modules/cookie/README.md +++ /dev/null @@ -1,302 +0,0 @@ -# cookie - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][github-actions-ci-image]][github-actions-ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Basic HTTP cookie parser and serializer for HTTP servers. - -## Installation - -This is a [Node.js](https://nodejs.org/en/) module available through the -[npm registry](https://www.npmjs.com/). Installation is done using the -[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): - -```sh -$ npm install cookie -``` - -## API - -```js -var cookie = require('cookie'); -``` - -### cookie.parse(str, options) - -Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. -The `str` argument is the string representing a `Cookie` header value and `options` is an -optional object containing additional parsing options. - -```js -var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); -// { foo: 'bar', equation: 'E=mc^2' } -``` - -#### Options - -`cookie.parse` accepts these properties in the options object. - -##### decode - -Specifies a function that will be used to decode a cookie's value. Since the value of a cookie -has a limited character set (and must be a simple string), this function can be used to decode -a previously-encoded cookie value into a JavaScript string or other object. - -The default function is the global `decodeURIComponent`, which will decode any URL-encoded -sequences into their byte representations. - -**note** if an error is thrown from this function, the original, non-decoded cookie value will -be returned as the cookie's value. - -### cookie.serialize(name, value, options) - -Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the -name for the cookie, the `value` argument is the value to set the cookie to, and the `options` -argument is an optional object containing additional serialization options. - -```js -var setCookie = cookie.serialize('foo', 'bar'); -// foo=bar -``` - -#### Options - -`cookie.serialize` accepts these properties in the options object. - -##### domain - -Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no -domain is set, and most clients will consider the cookie to apply to only the current domain. - -##### encode - -Specifies a function that will be used to encode a cookie's value. Since value of a cookie -has a limited character set (and must be a simple string), this function can be used to encode -a value into a string suited for a cookie's value. - -The default function is the global `encodeURIComponent`, which will encode a JavaScript string -into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. - -##### expires - -Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1]. -By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and -will delete it on a condition like exiting a web browser application. - -**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and -`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### httpOnly - -Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy, -the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not allow client-side -JavaScript to see the cookie in `document.cookie`. - -##### maxAge - -Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2]. -The given number will be converted to an integer by rounding down. By default, no maximum age is set. - -**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and -`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### path - -Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path -is considered the ["default path"][rfc-6265-5.1.4]. - -##### priority - -Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. - - - `'low'` will set the `Priority` attribute to `Low`. - - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. - - `'high'` will set the `Priority` attribute to `High`. - -More information about the different priority levels can be found in -[the specification][rfc-west-cookie-priority-00-4.1]. - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -##### sameSite - -Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7]. - - - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - - `false` will not set the `SameSite` attribute. - - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. - - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. - - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - -More information about the different enforcement levels can be found in -[the specification][rfc-6265bis-09-5.4.7]. - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -##### secure - -Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy, -the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to -the server in the future if the browser does not have an HTTPS connection. - -## Example - -The following example uses this module in conjunction with the Node.js core HTTP server -to prompt a user for their name and display it back on future visits. - -```js -var cookie = require('cookie'); -var escapeHtml = require('escape-html'); -var http = require('http'); -var url = require('url'); - -function onRequest(req, res) { - // Parse the query string - var query = url.parse(req.url, true, true).query; - - if (query && query.name) { - // Set a new cookie with the name - res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { - httpOnly: true, - maxAge: 60 * 60 * 24 * 7 // 1 week - })); - - // Redirect back after setting cookie - res.statusCode = 302; - res.setHeader('Location', req.headers.referer || '/'); - res.end(); - return; - } - - // Parse the cookies on the request - var cookies = cookie.parse(req.headers.cookie || ''); - - // Get the visitor name set in the cookie - var name = cookies.name; - - res.setHeader('Content-Type', 'text/html; charset=UTF-8'); - - if (name) { - res.write('

Welcome back, ' + escapeHtml(name) + '!

'); - } else { - res.write('

Hello, new visitor!

'); - } - - res.write('
'); - res.write(' '); - res.end('
'); -} - -http.createServer(onRequest).listen(3000); -``` - -## Testing - -```sh -$ npm test -``` - -## Benchmark - -``` -$ npm run bench - -> cookie@0.4.2 bench -> node benchmark/index.js - - node@16.14.0 - v8@9.4.146.24-node.20 - uv@1.43.0 - zlib@1.2.11 - brotli@1.0.9 - ares@1.18.1 - modules@93 - nghttp2@1.45.1 - napi@8 - llhttp@6.0.4 - openssl@1.1.1m+quic - cldr@40.0 - icu@70.1 - tz@2021a3 - unicode@14.0 - ngtcp2@0.1.0-DEV - nghttp3@0.1.0-DEV - -> node benchmark/parse-top.js - - cookie.parse - top sites - - 15 tests completed. - - parse accounts.google.com x 2,421,245 ops/sec ±0.80% (188 runs sampled) - parse apple.com x 2,684,710 ops/sec ±0.59% (189 runs sampled) - parse cloudflare.com x 2,231,418 ops/sec ±0.76% (186 runs sampled) - parse docs.google.com x 2,316,357 ops/sec ±1.28% (187 runs sampled) - parse drive.google.com x 2,363,543 ops/sec ±0.49% (189 runs sampled) - parse en.wikipedia.org x 839,414 ops/sec ±0.53% (189 runs sampled) - parse linkedin.com x 553,797 ops/sec ±0.63% (190 runs sampled) - parse maps.google.com x 1,314,779 ops/sec ±0.72% (189 runs sampled) - parse microsoft.com x 153,783 ops/sec ±0.53% (190 runs sampled) - parse play.google.com x 2,249,574 ops/sec ±0.59% (187 runs sampled) - parse plus.google.com x 2,258,682 ops/sec ±0.60% (188 runs sampled) - parse sites.google.com x 2,247,069 ops/sec ±0.68% (189 runs sampled) - parse support.google.com x 1,456,840 ops/sec ±0.70% (187 runs sampled) - parse www.google.com x 1,046,028 ops/sec ±0.58% (188 runs sampled) - parse youtu.be x 937,428 ops/sec ±1.47% (190 runs sampled) - parse youtube.com x 963,878 ops/sec ±0.59% (190 runs sampled) - -> node benchmark/parse.js - - cookie.parse - generic - - 6 tests completed. - - simple x 2,745,604 ops/sec ±0.77% (185 runs sampled) - decode x 557,287 ops/sec ±0.60% (188 runs sampled) - unquote x 2,498,475 ops/sec ±0.55% (189 runs sampled) - duplicates x 868,591 ops/sec ±0.89% (187 runs sampled) - 10 cookies x 306,745 ops/sec ±0.49% (190 runs sampled) - 100 cookies x 22,414 ops/sec ±2.38% (182 runs sampled) -``` - -## References - -- [RFC 6265: HTTP State Management Mechanism][rfc-6265] -- [Same-site Cookies][rfc-6265bis-09-5.4.7] - -[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 -[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 -[rfc-6265]: https://tools.ietf.org/html/rfc6265 -[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4 -[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1 -[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2 -[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3 -[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4 -[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5 -[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6 -[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3 - -## License - -[MIT](LICENSE) - -[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master -[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/cookie/ci/master?label=ci -[github-actions-ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml -[node-version-image]: https://badgen.net/npm/node/cookie -[node-version-url]: https://nodejs.org/en/download -[npm-downloads-image]: https://badgen.net/npm/dm/cookie -[npm-url]: https://npmjs.org/package/cookie -[npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/project starter code/node_modules/cookie/index.js b/project starter code/node_modules/cookie/index.js deleted file mode 100644 index 9c3d07d8..00000000 --- a/project starter code/node_modules/cookie/index.js +++ /dev/null @@ -1,270 +0,0 @@ -/*! - * cookie - * Copyright(c) 2012-2014 Roman Shtylman - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict'; - -/** - * Module exports. - * @public - */ - -exports.parse = parse; -exports.serialize = serialize; - -/** - * Module variables. - * @private - */ - -var __toString = Object.prototype.toString - -/** - * RegExp to match field-content in RFC 7230 sec 3.2 - * - * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] - * field-vchar = VCHAR / obs-text - * obs-text = %x80-FF - */ - -var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; - -/** - * Parse a cookie header. - * - * Parse the given cookie header string into an object - * The object has the various cookies as keys(names) => values - * - * @param {string} str - * @param {object} [options] - * @return {object} - * @public - */ - -function parse(str, options) { - if (typeof str !== 'string') { - throw new TypeError('argument str must be a string'); - } - - var obj = {} - var opt = options || {}; - var dec = opt.decode || decode; - - var index = 0 - while (index < str.length) { - var eqIdx = str.indexOf('=', index) - - // no more cookie pairs - if (eqIdx === -1) { - break - } - - var endIdx = str.indexOf(';', index) - - if (endIdx === -1) { - endIdx = str.length - } else if (endIdx < eqIdx) { - // backtrack on prior semicolon - index = str.lastIndexOf(';', eqIdx - 1) + 1 - continue - } - - var key = str.slice(index, eqIdx).trim() - - // only assign once - if (undefined === obj[key]) { - var val = str.slice(eqIdx + 1, endIdx).trim() - - // quoted values - if (val.charCodeAt(0) === 0x22) { - val = val.slice(1, -1) - } - - obj[key] = tryDecode(val, dec); - } - - index = endIdx + 1 - } - - return obj; -} - -/** - * Serialize data into a cookie header. - * - * Serialize the a name value pair into a cookie string suitable for - * http headers. An optional options object specified cookie parameters. - * - * serialize('foo', 'bar', { httpOnly: true }) - * => "foo=bar; httpOnly" - * - * @param {string} name - * @param {string} val - * @param {object} [options] - * @return {string} - * @public - */ - -function serialize(name, val, options) { - var opt = options || {}; - var enc = opt.encode || encode; - - if (typeof enc !== 'function') { - throw new TypeError('option encode is invalid'); - } - - if (!fieldContentRegExp.test(name)) { - throw new TypeError('argument name is invalid'); - } - - var value = enc(val); - - if (value && !fieldContentRegExp.test(value)) { - throw new TypeError('argument val is invalid'); - } - - var str = name + '=' + value; - - if (null != opt.maxAge) { - var maxAge = opt.maxAge - 0; - - if (isNaN(maxAge) || !isFinite(maxAge)) { - throw new TypeError('option maxAge is invalid') - } - - str += '; Max-Age=' + Math.floor(maxAge); - } - - if (opt.domain) { - if (!fieldContentRegExp.test(opt.domain)) { - throw new TypeError('option domain is invalid'); - } - - str += '; Domain=' + opt.domain; - } - - if (opt.path) { - if (!fieldContentRegExp.test(opt.path)) { - throw new TypeError('option path is invalid'); - } - - str += '; Path=' + opt.path; - } - - if (opt.expires) { - var expires = opt.expires - - if (!isDate(expires) || isNaN(expires.valueOf())) { - throw new TypeError('option expires is invalid'); - } - - str += '; Expires=' + expires.toUTCString() - } - - if (opt.httpOnly) { - str += '; HttpOnly'; - } - - if (opt.secure) { - str += '; Secure'; - } - - if (opt.priority) { - var priority = typeof opt.priority === 'string' - ? opt.priority.toLowerCase() - : opt.priority - - switch (priority) { - case 'low': - str += '; Priority=Low' - break - case 'medium': - str += '; Priority=Medium' - break - case 'high': - str += '; Priority=High' - break - default: - throw new TypeError('option priority is invalid') - } - } - - if (opt.sameSite) { - var sameSite = typeof opt.sameSite === 'string' - ? opt.sameSite.toLowerCase() : opt.sameSite; - - switch (sameSite) { - case true: - str += '; SameSite=Strict'; - break; - case 'lax': - str += '; SameSite=Lax'; - break; - case 'strict': - str += '; SameSite=Strict'; - break; - case 'none': - str += '; SameSite=None'; - break; - default: - throw new TypeError('option sameSite is invalid'); - } - } - - return str; -} - -/** - * URL-decode string value. Optimized to skip native call when no %. - * - * @param {string} str - * @returns {string} - */ - -function decode (str) { - return str.indexOf('%') !== -1 - ? decodeURIComponent(str) - : str -} - -/** - * URL-encode value. - * - * @param {string} str - * @returns {string} - */ - -function encode (val) { - return encodeURIComponent(val) -} - -/** - * Determine if value is a Date. - * - * @param {*} val - * @private - */ - -function isDate (val) { - return __toString.call(val) === '[object Date]' || - val instanceof Date -} - -/** - * Try decoding a string using a decoding function. - * - * @param {string} str - * @param {function} decode - * @private - */ - -function tryDecode(str, decode) { - try { - return decode(str); - } catch (e) { - return str; - } -} diff --git a/project starter code/node_modules/cookie/package.json b/project starter code/node_modules/cookie/package.json deleted file mode 100644 index ed5606a9..00000000 --- a/project starter code/node_modules/cookie/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "cookie", - "description": "HTTP server cookie parsing and serialization", - "version": "0.5.0", - "author": "Roman Shtylman ", - "contributors": [ - "Douglas Christopher Wilson " - ], - "license": "MIT", - "keywords": [ - "cookie", - "cookies" - ], - "repository": "jshttp/cookie", - "devDependencies": { - "beautify-benchmark": "0.2.4", - "benchmark": "2.1.4", - "eslint": "7.32.0", - "eslint-plugin-markdown": "2.2.1", - "mocha": "9.2.2", - "nyc": "15.1.0", - "safe-buffer": "5.2.1", - "top-sites": "1.1.97" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "README.md", - "SECURITY.md", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "bench": "node benchmark/index.js", - "lint": "eslint .", - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-ci": "nyc --reporter=lcov --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test", - "update-bench": "node scripts/update-benchmark.js", - "version": "node scripts/version-history.js && git add HISTORY.md" - } -} diff --git a/project starter code/node_modules/express/History.md b/project starter code/node_modules/express/History.md deleted file mode 100644 index e49870fe..00000000 --- a/project starter code/node_modules/express/History.md +++ /dev/null @@ -1,3588 +0,0 @@ -4.18.2 / 2022-10-08 -=================== - - * Fix regression routing a large stack in a single route - * deps: body-parser@1.20.1 - - deps: qs@6.11.0 - - perf: remove unnecessary object clone - * deps: qs@6.11.0 - -4.18.1 / 2022-04-29 -=================== - - * Fix hanging on large stack of sync routes - -4.18.0 / 2022-04-25 -=================== - - * Add "root" option to `res.download` - * Allow `options` without `filename` in `res.download` - * Deprecate string and non-integer arguments to `res.status` - * Fix behavior of `null`/`undefined` as `maxAge` in `res.cookie` - * Fix handling very large stacks of sync middleware - * Ignore `Object.prototype` values in settings through `app.set`/`app.get` - * Invoke `default` with same arguments as types in `res.format` - * Support proper 205 responses using `res.send` - * Use `http-errors` for `res.format` error - * deps: body-parser@1.20.0 - - Fix error message for json parse whitespace in `strict` - - Fix internal error when inflated body exceeds limit - - Prevent loss of async hooks context - - Prevent hanging when request already read - - deps: depd@2.0.0 - - deps: http-errors@2.0.0 - - deps: on-finished@2.4.1 - - deps: qs@6.10.3 - - deps: raw-body@2.5.1 - * deps: cookie@0.5.0 - - Add `priority` option - - Fix `expires` option to reject invalid dates - * deps: depd@2.0.0 - - Replace internal `eval` usage with `Function` constructor - - Use instance methods on `process` to check for listeners - * deps: finalhandler@1.2.0 - - Remove set content headers that break response - - deps: on-finished@2.4.1 - - deps: statuses@2.0.1 - * deps: on-finished@2.4.1 - - Prevent loss of async hooks context - * deps: qs@6.10.3 - * deps: send@0.18.0 - - Fix emitted 416 error missing headers property - - Limit the headers removed for 304 response - - deps: depd@2.0.0 - - deps: destroy@1.2.0 - - deps: http-errors@2.0.0 - - deps: on-finished@2.4.1 - - deps: statuses@2.0.1 - * deps: serve-static@1.15.0 - - deps: send@0.18.0 - * deps: statuses@2.0.1 - - Remove code 306 - - Rename `425 Unordered Collection` to standard `425 Too Early` - -4.17.3 / 2022-02-16 -=================== - - * deps: accepts@~1.3.8 - - deps: mime-types@~2.1.34 - - deps: negotiator@0.6.3 - * deps: body-parser@1.19.2 - - deps: bytes@3.1.2 - - deps: qs@6.9.7 - - deps: raw-body@2.4.3 - * deps: cookie@0.4.2 - * deps: qs@6.9.7 - * Fix handling of `__proto__` keys - * pref: remove unnecessary regexp for trust proxy - -4.17.2 / 2021-12-16 -=================== - - * Fix handling of `undefined` in `res.jsonp` - * Fix handling of `undefined` when `"json escape"` is enabled - * Fix incorrect middleware execution with unanchored `RegExp`s - * Fix `res.jsonp(obj, status)` deprecation message - * Fix typo in `res.is` JSDoc - * deps: body-parser@1.19.1 - - deps: bytes@3.1.1 - - deps: http-errors@1.8.1 - - deps: qs@6.9.6 - - deps: raw-body@2.4.2 - - deps: safe-buffer@5.2.1 - - deps: type-is@~1.6.18 - * deps: content-disposition@0.5.4 - - deps: safe-buffer@5.2.1 - * deps: cookie@0.4.1 - - Fix `maxAge` option to reject invalid values - * deps: proxy-addr@~2.0.7 - - Use `req.socket` over deprecated `req.connection` - - deps: forwarded@0.2.0 - - deps: ipaddr.js@1.9.1 - * deps: qs@6.9.6 - * deps: safe-buffer@5.2.1 - * deps: send@0.17.2 - - deps: http-errors@1.8.1 - - deps: ms@2.1.3 - - pref: ignore empty http tokens - * deps: serve-static@1.14.2 - - deps: send@0.17.2 - * deps: setprototypeof@1.2.0 - -4.17.1 / 2019-05-25 -=================== - - * Revert "Improve error message for `null`/`undefined` to `res.status`" - -4.17.0 / 2019-05-16 -=================== - - * Add `express.raw` to parse bodies into `Buffer` - * Add `express.text` to parse bodies into string - * Improve error message for non-strings to `res.sendFile` - * Improve error message for `null`/`undefined` to `res.status` - * Support multiple hosts in `X-Forwarded-Host` - * deps: accepts@~1.3.7 - * deps: body-parser@1.19.0 - - Add encoding MIK - - Add petabyte (`pb`) support - - Fix parsing array brackets after index - - deps: bytes@3.1.0 - - deps: http-errors@1.7.2 - - deps: iconv-lite@0.4.24 - - deps: qs@6.7.0 - - deps: raw-body@2.4.0 - - deps: type-is@~1.6.17 - * deps: content-disposition@0.5.3 - * deps: cookie@0.4.0 - - Add `SameSite=None` support - * deps: finalhandler@~1.1.2 - - Set stricter `Content-Security-Policy` header - - deps: parseurl@~1.3.3 - - deps: statuses@~1.5.0 - * deps: parseurl@~1.3.3 - * deps: proxy-addr@~2.0.5 - - deps: ipaddr.js@1.9.0 - * deps: qs@6.7.0 - - Fix parsing array brackets after index - * deps: range-parser@~1.2.1 - * deps: send@0.17.1 - - Set stricter CSP header in redirect & error responses - - deps: http-errors@~1.7.2 - - deps: mime@1.6.0 - - deps: ms@2.1.1 - - deps: range-parser@~1.2.1 - - deps: statuses@~1.5.0 - - perf: remove redundant `path.normalize` call - * deps: serve-static@1.14.1 - - Set stricter CSP header in redirect response - - deps: parseurl@~1.3.3 - - deps: send@0.17.1 - * deps: setprototypeof@1.1.1 - * deps: statuses@~1.5.0 - - Add `103 Early Hints` - * deps: type-is@~1.6.18 - - deps: mime-types@~2.1.24 - - perf: prevent internal `throw` on invalid type - -4.16.4 / 2018-10-10 -=================== - - * Fix issue where `"Request aborted"` may be logged in `res.sendfile` - * Fix JSDoc for `Router` constructor - * deps: body-parser@1.18.3 - - Fix deprecation warnings on Node.js 10+ - - Fix stack trace for strict json parse error - - deps: depd@~1.1.2 - - deps: http-errors@~1.6.3 - - deps: iconv-lite@0.4.23 - - deps: qs@6.5.2 - - deps: raw-body@2.3.3 - - deps: type-is@~1.6.16 - * deps: proxy-addr@~2.0.4 - - deps: ipaddr.js@1.8.0 - * deps: qs@6.5.2 - * deps: safe-buffer@5.1.2 - -4.16.3 / 2018-03-12 -=================== - - * deps: accepts@~1.3.5 - - deps: mime-types@~2.1.18 - * deps: depd@~1.1.2 - - perf: remove argument reassignment - * deps: encodeurl@~1.0.2 - - Fix encoding `%` as last character - * deps: finalhandler@1.1.1 - - Fix 404 output for bad / missing pathnames - - deps: encodeurl@~1.0.2 - - deps: statuses@~1.4.0 - * deps: proxy-addr@~2.0.3 - - deps: ipaddr.js@1.6.0 - * deps: send@0.16.2 - - Fix incorrect end tag in default error & redirects - - deps: depd@~1.1.2 - - deps: encodeurl@~1.0.2 - - deps: statuses@~1.4.0 - * deps: serve-static@1.13.2 - - Fix incorrect end tag in redirects - - deps: encodeurl@~1.0.2 - - deps: send@0.16.2 - * deps: statuses@~1.4.0 - * deps: type-is@~1.6.16 - - deps: mime-types@~2.1.18 - -4.16.2 / 2017-10-09 -=================== - - * Fix `TypeError` in `res.send` when given `Buffer` and `ETag` header set - * perf: skip parsing of entire `X-Forwarded-Proto` header - -4.16.1 / 2017-09-29 -=================== - - * deps: send@0.16.1 - * deps: serve-static@1.13.1 - - Fix regression when `root` is incorrectly set to a file - - deps: send@0.16.1 - -4.16.0 / 2017-09-28 -=================== - - * Add `"json escape"` setting for `res.json` and `res.jsonp` - * Add `express.json` and `express.urlencoded` to parse bodies - * Add `options` argument to `res.download` - * Improve error message when autoloading invalid view engine - * Improve error messages when non-function provided as middleware - * Skip `Buffer` encoding when not generating ETag for small response - * Use `safe-buffer` for improved Buffer API - * deps: accepts@~1.3.4 - - deps: mime-types@~2.1.16 - * deps: content-type@~1.0.4 - - perf: remove argument reassignment - - perf: skip parameter parsing when no parameters - * deps: etag@~1.8.1 - - perf: replace regular expression with substring - * deps: finalhandler@1.1.0 - - Use `res.headersSent` when available - * deps: parseurl@~1.3.2 - - perf: reduce overhead for full URLs - - perf: unroll the "fast-path" `RegExp` - * deps: proxy-addr@~2.0.2 - - Fix trimming leading / trailing OWS in `X-Forwarded-For` - - deps: forwarded@~0.1.2 - - deps: ipaddr.js@1.5.2 - - perf: reduce overhead when no `X-Forwarded-For` header - * deps: qs@6.5.1 - - Fix parsing & compacting very deep objects - * deps: send@0.16.0 - - Add 70 new types for file extensions - - Add `immutable` option - - Fix missing `` in default error & redirects - - Set charset as "UTF-8" for .js and .json - - Use instance methods on steam to check for listeners - - deps: mime@1.4.1 - - perf: improve path validation speed - * deps: serve-static@1.13.0 - - Add 70 new types for file extensions - - Add `immutable` option - - Set charset as "UTF-8" for .js and .json - - deps: send@0.16.0 - * deps: setprototypeof@1.1.0 - * deps: utils-merge@1.0.1 - * deps: vary@~1.1.2 - - perf: improve header token parsing speed - * perf: re-use options object when generating ETags - * perf: remove dead `.charset` set in `res.jsonp` - -4.15.5 / 2017-09-24 -=================== - - * deps: debug@2.6.9 - * deps: finalhandler@~1.0.6 - - deps: debug@2.6.9 - - deps: parseurl@~1.3.2 - * deps: fresh@0.5.2 - - Fix handling of modified headers with invalid dates - - perf: improve ETag match loop - - perf: improve `If-None-Match` token parsing - * deps: send@0.15.6 - - Fix handling of modified headers with invalid dates - - deps: debug@2.6.9 - - deps: etag@~1.8.1 - - deps: fresh@0.5.2 - - perf: improve `If-Match` token parsing - * deps: serve-static@1.12.6 - - deps: parseurl@~1.3.2 - - deps: send@0.15.6 - - perf: improve slash collapsing - -4.15.4 / 2017-08-06 -=================== - - * deps: debug@2.6.8 - * deps: depd@~1.1.1 - - Remove unnecessary `Buffer` loading - * deps: finalhandler@~1.0.4 - - deps: debug@2.6.8 - * deps: proxy-addr@~1.1.5 - - Fix array argument being altered - - deps: ipaddr.js@1.4.0 - * deps: qs@6.5.0 - * deps: send@0.15.4 - - deps: debug@2.6.8 - - deps: depd@~1.1.1 - - deps: http-errors@~1.6.2 - * deps: serve-static@1.12.4 - - deps: send@0.15.4 - -4.15.3 / 2017-05-16 -=================== - - * Fix error when `res.set` cannot add charset to `Content-Type` - * deps: debug@2.6.7 - - Fix `DEBUG_MAX_ARRAY_LENGTH` - - deps: ms@2.0.0 - * deps: finalhandler@~1.0.3 - - Fix missing `` in HTML document - - deps: debug@2.6.7 - * deps: proxy-addr@~1.1.4 - - deps: ipaddr.js@1.3.0 - * deps: send@0.15.3 - - deps: debug@2.6.7 - - deps: ms@2.0.0 - * deps: serve-static@1.12.3 - - deps: send@0.15.3 - * deps: type-is@~1.6.15 - - deps: mime-types@~2.1.15 - * deps: vary@~1.1.1 - - perf: hoist regular expression - -4.15.2 / 2017-03-06 -=================== - - * deps: qs@6.4.0 - - Fix regression parsing keys starting with `[` - -4.15.1 / 2017-03-05 -=================== - - * deps: send@0.15.1 - - Fix issue when `Date.parse` does not return `NaN` on invalid date - - Fix strict violation in broken environments - * deps: serve-static@1.12.1 - - Fix issue when `Date.parse` does not return `NaN` on invalid date - - deps: send@0.15.1 - -4.15.0 / 2017-03-01 -=================== - - * Add debug message when loading view engine - * Add `next("router")` to exit from router - * Fix case where `router.use` skipped requests routes did not - * Remove usage of `res._headers` private field - - Improves compatibility with Node.js 8 nightly - * Skip routing when `req.url` is not set - * Use `%o` in path debug to tell types apart - * Use `Object.create` to setup request & response prototypes - * Use `setprototypeof` module to replace `__proto__` setting - * Use `statuses` instead of `http` module for status messages - * deps: debug@2.6.1 - - Allow colors in workers - - Deprecated `DEBUG_FD` environment variable set to `3` or higher - - Fix error when running under React Native - - Use same color for same namespace - - deps: ms@0.7.2 - * deps: etag@~1.8.0 - - Use SHA1 instead of MD5 for ETag hashing - - Works with FIPS 140-2 OpenSSL configuration - * deps: finalhandler@~1.0.0 - - Fix exception when `err` cannot be converted to a string - - Fully URL-encode the pathname in the 404 - - Only include the pathname in the 404 message - - Send complete HTML document - - Set `Content-Security-Policy: default-src 'self'` header - - deps: debug@2.6.1 - * deps: fresh@0.5.0 - - Fix false detection of `no-cache` request directive - - Fix incorrect result when `If-None-Match` has both `*` and ETags - - Fix weak `ETag` matching to match spec - - perf: delay reading header values until needed - - perf: enable strict mode - - perf: hoist regular expressions - - perf: remove duplicate conditional - - perf: remove unnecessary boolean coercions - - perf: skip checking modified time if ETag check failed - - perf: skip parsing `If-None-Match` when no `ETag` header - - perf: use `Date.parse` instead of `new Date` - * deps: qs@6.3.1 - - Fix array parsing from skipping empty values - - Fix compacting nested arrays - * deps: send@0.15.0 - - Fix false detection of `no-cache` request directive - - Fix incorrect result when `If-None-Match` has both `*` and ETags - - Fix weak `ETag` matching to match spec - - Remove usage of `res._headers` private field - - Support `If-Match` and `If-Unmodified-Since` headers - - Use `res.getHeaderNames()` when available - - Use `res.headersSent` when available - - deps: debug@2.6.1 - - deps: etag@~1.8.0 - - deps: fresh@0.5.0 - - deps: http-errors@~1.6.1 - * deps: serve-static@1.12.0 - - Fix false detection of `no-cache` request directive - - Fix incorrect result when `If-None-Match` has both `*` and ETags - - Fix weak `ETag` matching to match spec - - Remove usage of `res._headers` private field - - Send complete HTML document in redirect response - - Set default CSP header in redirect response - - Support `If-Match` and `If-Unmodified-Since` headers - - Use `res.getHeaderNames()` when available - - Use `res.headersSent` when available - - deps: send@0.15.0 - * perf: add fast match path for `*` route - * perf: improve `req.ips` performance - -4.14.1 / 2017-01-28 -=================== - - * deps: content-disposition@0.5.2 - * deps: finalhandler@0.5.1 - - Fix exception when `err.headers` is not an object - - deps: statuses@~1.3.1 - - perf: hoist regular expressions - - perf: remove duplicate validation path - * deps: proxy-addr@~1.1.3 - - deps: ipaddr.js@1.2.0 - * deps: send@0.14.2 - - deps: http-errors@~1.5.1 - - deps: ms@0.7.2 - - deps: statuses@~1.3.1 - * deps: serve-static@~1.11.2 - - deps: send@0.14.2 - * deps: type-is@~1.6.14 - - deps: mime-types@~2.1.13 - -4.14.0 / 2016-06-16 -=================== - - * Add `acceptRanges` option to `res.sendFile`/`res.sendfile` - * Add `cacheControl` option to `res.sendFile`/`res.sendfile` - * Add `options` argument to `req.range` - - Includes the `combine` option - * Encode URL in `res.location`/`res.redirect` if not already encoded - * Fix some redirect handling in `res.sendFile`/`res.sendfile` - * Fix Windows absolute path check using forward slashes - * Improve error with invalid arguments to `req.get()` - * Improve performance for `res.json`/`res.jsonp` in most cases - * Improve `Range` header handling in `res.sendFile`/`res.sendfile` - * deps: accepts@~1.3.3 - - Fix including type extensions in parameters in `Accept` parsing - - Fix parsing `Accept` parameters with quoted equals - - Fix parsing `Accept` parameters with quoted semicolons - - Many performance improvements - - deps: mime-types@~2.1.11 - - deps: negotiator@0.6.1 - * deps: content-type@~1.0.2 - - perf: enable strict mode - * deps: cookie@0.3.1 - - Add `sameSite` option - - Fix cookie `Max-Age` to never be a floating point number - - Improve error message when `encode` is not a function - - Improve error message when `expires` is not a `Date` - - Throw better error for invalid argument to parse - - Throw on invalid values provided to `serialize` - - perf: enable strict mode - - perf: hoist regular expression - - perf: use for loop in parse - - perf: use string concatenation for serialization - * deps: finalhandler@0.5.0 - - Change invalid or non-numeric status code to 500 - - Overwrite status message to match set status code - - Prefer `err.statusCode` if `err.status` is invalid - - Set response headers from `err.headers` object - - Use `statuses` instead of `http` module for status messages - * deps: proxy-addr@~1.1.2 - - Fix accepting various invalid netmasks - - Fix IPv6-mapped IPv4 validation edge cases - - IPv4 netmasks must be contiguous - - IPv6 addresses cannot be used as a netmask - - deps: ipaddr.js@1.1.1 - * deps: qs@6.2.0 - - Add `decoder` option in `parse` function - * deps: range-parser@~1.2.0 - - Add `combine` option to combine overlapping ranges - - Fix incorrectly returning -1 when there is at least one valid range - - perf: remove internal function - * deps: send@0.14.1 - - Add `acceptRanges` option - - Add `cacheControl` option - - Attempt to combine multiple ranges into single range - - Correctly inherit from `Stream` class - - Fix `Content-Range` header in 416 responses when using `start`/`end` options - - Fix `Content-Range` header missing from default 416 responses - - Fix redirect error when `path` contains raw non-URL characters - - Fix redirect when `path` starts with multiple forward slashes - - Ignore non-byte `Range` headers - - deps: http-errors@~1.5.0 - - deps: range-parser@~1.2.0 - - deps: statuses@~1.3.0 - - perf: remove argument reassignment - * deps: serve-static@~1.11.1 - - Add `acceptRanges` option - - Add `cacheControl` option - - Attempt to combine multiple ranges into single range - - Fix redirect error when `req.url` contains raw non-URL characters - - Ignore non-byte `Range` headers - - Use status code 301 for redirects - - deps: send@0.14.1 - * deps: type-is@~1.6.13 - - Fix type error when given invalid type to match against - - deps: mime-types@~2.1.11 - * deps: vary@~1.1.0 - - Only accept valid field names in the `field` argument - * perf: use strict equality when possible - -4.13.4 / 2016-01-21 -=================== - - * deps: content-disposition@0.5.1 - - perf: enable strict mode - * deps: cookie@0.1.5 - - Throw on invalid values provided to `serialize` - * deps: depd@~1.1.0 - - Support web browser loading - - perf: enable strict mode - * deps: escape-html@~1.0.3 - - perf: enable strict mode - - perf: optimize string replacement - - perf: use faster string coercion - * deps: finalhandler@0.4.1 - - deps: escape-html@~1.0.3 - * deps: merge-descriptors@1.0.1 - - perf: enable strict mode - * deps: methods@~1.1.2 - - perf: enable strict mode - * deps: parseurl@~1.3.1 - - perf: enable strict mode - * deps: proxy-addr@~1.0.10 - - deps: ipaddr.js@1.0.5 - - perf: enable strict mode - * deps: range-parser@~1.0.3 - - perf: enable strict mode - * deps: send@0.13.1 - - deps: depd@~1.1.0 - - deps: destroy@~1.0.4 - - deps: escape-html@~1.0.3 - - deps: range-parser@~1.0.3 - * deps: serve-static@~1.10.2 - - deps: escape-html@~1.0.3 - - deps: parseurl@~1.3.0 - - deps: send@0.13.1 - -4.13.3 / 2015-08-02 -=================== - - * Fix infinite loop condition using `mergeParams: true` - * Fix inner numeric indices incorrectly altering parent `req.params` - -4.13.2 / 2015-07-31 -=================== - - * deps: accepts@~1.2.12 - - deps: mime-types@~2.1.4 - * deps: array-flatten@1.1.1 - - perf: enable strict mode - * deps: path-to-regexp@0.1.7 - - Fix regression with escaped round brackets and matching groups - * deps: type-is@~1.6.6 - - deps: mime-types@~2.1.4 - -4.13.1 / 2015-07-05 -=================== - - * deps: accepts@~1.2.10 - - deps: mime-types@~2.1.2 - * deps: qs@4.0.0 - - Fix dropping parameters like `hasOwnProperty` - - Fix various parsing edge cases - * deps: type-is@~1.6.4 - - deps: mime-types@~2.1.2 - - perf: enable strict mode - - perf: remove argument reassignment - -4.13.0 / 2015-06-20 -=================== - - * Add settings to debug output - * Fix `res.format` error when only `default` provided - * Fix issue where `next('route')` in `app.param` would incorrectly skip values - * Fix hiding platform issues with `decodeURIComponent` - - Only `URIError`s are a 400 - * Fix using `*` before params in routes - * Fix using capture groups before params in routes - * Simplify `res.cookie` to call `res.append` - * Use `array-flatten` module for flattening arrays - * deps: accepts@~1.2.9 - - deps: mime-types@~2.1.1 - - perf: avoid argument reassignment & argument slice - - perf: avoid negotiator recursive construction - - perf: enable strict mode - - perf: remove unnecessary bitwise operator - * deps: cookie@0.1.3 - - perf: deduce the scope of try-catch deopt - - perf: remove argument reassignments - * deps: escape-html@1.0.2 - * deps: etag@~1.7.0 - - Always include entity length in ETags for hash length extensions - - Generate non-Stats ETags using MD5 only (no longer CRC32) - - Improve stat performance by removing hashing - - Improve support for JXcore - - Remove base64 padding in ETags to shorten - - Support "fake" stats objects in environments without fs - - Use MD5 instead of MD4 in weak ETags over 1KB - * deps: finalhandler@0.4.0 - - Fix a false-positive when unpiping in Node.js 0.8 - - Support `statusCode` property on `Error` objects - - Use `unpipe` module for unpiping requests - - deps: escape-html@1.0.2 - - deps: on-finished@~2.3.0 - - perf: enable strict mode - - perf: remove argument reassignment - * deps: fresh@0.3.0 - - Add weak `ETag` matching support - * deps: on-finished@~2.3.0 - - Add defined behavior for HTTP `CONNECT` requests - - Add defined behavior for HTTP `Upgrade` requests - - deps: ee-first@1.1.1 - * deps: path-to-regexp@0.1.6 - * deps: send@0.13.0 - - Allow Node.js HTTP server to set `Date` response header - - Fix incorrectly removing `Content-Location` on 304 response - - Improve the default redirect response headers - - Send appropriate headers on default error response - - Use `http-errors` for standard emitted errors - - Use `statuses` instead of `http` module for status messages - - deps: escape-html@1.0.2 - - deps: etag@~1.7.0 - - deps: fresh@0.3.0 - - deps: on-finished@~2.3.0 - - perf: enable strict mode - - perf: remove unnecessary array allocations - * deps: serve-static@~1.10.0 - - Add `fallthrough` option - - Fix reading options from options prototype - - Improve the default redirect response headers - - Malformed URLs now `next()` instead of 400 - - deps: escape-html@1.0.2 - - deps: send@0.13.0 - - perf: enable strict mode - - perf: remove argument reassignment - * deps: type-is@~1.6.3 - - deps: mime-types@~2.1.1 - - perf: reduce try block size - - perf: remove bitwise operations - * perf: enable strict mode - * perf: isolate `app.render` try block - * perf: remove argument reassignments in application - * perf: remove argument reassignments in request prototype - * perf: remove argument reassignments in response prototype - * perf: remove argument reassignments in routing - * perf: remove argument reassignments in `View` - * perf: skip attempting to decode zero length string - * perf: use saved reference to `http.STATUS_CODES` - -4.12.4 / 2015-05-17 -=================== - - * deps: accepts@~1.2.7 - - deps: mime-types@~2.0.11 - - deps: negotiator@0.5.3 - * deps: debug@~2.2.0 - - deps: ms@0.7.1 - * deps: depd@~1.0.1 - * deps: etag@~1.6.0 - - Improve support for JXcore - - Support "fake" stats objects in environments without `fs` - * deps: finalhandler@0.3.6 - - deps: debug@~2.2.0 - - deps: on-finished@~2.2.1 - * deps: on-finished@~2.2.1 - - Fix `isFinished(req)` when data buffered - * deps: proxy-addr@~1.0.8 - - deps: ipaddr.js@1.0.1 - * deps: qs@2.4.2 - - Fix allowing parameters like `constructor` - * deps: send@0.12.3 - - deps: debug@~2.2.0 - - deps: depd@~1.0.1 - - deps: etag@~1.6.0 - - deps: ms@0.7.1 - - deps: on-finished@~2.2.1 - * deps: serve-static@~1.9.3 - - deps: send@0.12.3 - * deps: type-is@~1.6.2 - - deps: mime-types@~2.0.11 - -4.12.3 / 2015-03-17 -=================== - - * deps: accepts@~1.2.5 - - deps: mime-types@~2.0.10 - * deps: debug@~2.1.3 - - Fix high intensity foreground color for bold - - deps: ms@0.7.0 - * deps: finalhandler@0.3.4 - - deps: debug@~2.1.3 - * deps: proxy-addr@~1.0.7 - - deps: ipaddr.js@0.1.9 - * deps: qs@2.4.1 - - Fix error when parameter `hasOwnProperty` is present - * deps: send@0.12.2 - - Throw errors early for invalid `extensions` or `index` options - - deps: debug@~2.1.3 - * deps: serve-static@~1.9.2 - - deps: send@0.12.2 - * deps: type-is@~1.6.1 - - deps: mime-types@~2.0.10 - -4.12.2 / 2015-03-02 -=================== - - * Fix regression where `"Request aborted"` is logged using `res.sendFile` - -4.12.1 / 2015-03-01 -=================== - - * Fix constructing application with non-configurable prototype properties - * Fix `ECONNRESET` errors from `res.sendFile` usage - * Fix `req.host` when using "trust proxy" hops count - * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count - * Fix wrong `code` on aborted connections from `res.sendFile` - * deps: merge-descriptors@1.0.0 - -4.12.0 / 2015-02-23 -=================== - - * Fix `"trust proxy"` setting to inherit when app is mounted - * Generate `ETag`s for all request responses - - No longer restricted to only responses for `GET` and `HEAD` requests - * Use `content-type` to parse `Content-Type` headers - * deps: accepts@~1.2.4 - - Fix preference sorting to be stable for long acceptable lists - - deps: mime-types@~2.0.9 - - deps: negotiator@0.5.1 - * deps: cookie-signature@1.0.6 - * deps: send@0.12.1 - - Always read the stat size from the file - - Fix mutating passed-in `options` - - deps: mime@1.3.4 - * deps: serve-static@~1.9.1 - - deps: send@0.12.1 - * deps: type-is@~1.6.0 - - fix argument reassignment - - fix false-positives in `hasBody` `Transfer-Encoding` check - - support wildcard for both type and subtype (`*/*`) - - deps: mime-types@~2.0.9 - -4.11.2 / 2015-02-01 -=================== - - * Fix `res.redirect` double-calling `res.end` for `HEAD` requests - * deps: accepts@~1.2.3 - - deps: mime-types@~2.0.8 - * deps: proxy-addr@~1.0.6 - - deps: ipaddr.js@0.1.8 - * deps: type-is@~1.5.6 - - deps: mime-types@~2.0.8 - -4.11.1 / 2015-01-20 -=================== - - * deps: send@0.11.1 - - Fix root path disclosure - * deps: serve-static@~1.8.1 - - Fix redirect loop in Node.js 0.11.14 - - Fix root path disclosure - - deps: send@0.11.1 - -4.11.0 / 2015-01-13 -=================== - - * Add `res.append(field, val)` to append headers - * Deprecate leading `:` in `name` for `app.param(name, fn)` - * Deprecate `req.param()` -- use `req.params`, `req.body`, or `req.query` instead - * Deprecate `app.param(fn)` - * Fix `OPTIONS` responses to include the `HEAD` method properly - * Fix `res.sendFile` not always detecting aborted connection - * Match routes iteratively to prevent stack overflows - * deps: accepts@~1.2.2 - - deps: mime-types@~2.0.7 - - deps: negotiator@0.5.0 - * deps: send@0.11.0 - - deps: debug@~2.1.1 - - deps: etag@~1.5.1 - - deps: ms@0.7.0 - - deps: on-finished@~2.2.0 - * deps: serve-static@~1.8.0 - - deps: send@0.11.0 - -4.10.8 / 2015-01-13 -=================== - - * Fix crash from error within `OPTIONS` response handler - * deps: proxy-addr@~1.0.5 - - deps: ipaddr.js@0.1.6 - -4.10.7 / 2015-01-04 -=================== - - * Fix `Allow` header for `OPTIONS` to not contain duplicate methods - * Fix incorrect "Request aborted" for `res.sendFile` when `HEAD` or 304 - * deps: debug@~2.1.1 - * deps: finalhandler@0.3.3 - - deps: debug@~2.1.1 - - deps: on-finished@~2.2.0 - * deps: methods@~1.1.1 - * deps: on-finished@~2.2.0 - * deps: serve-static@~1.7.2 - - Fix potential open redirect when mounted at root - * deps: type-is@~1.5.5 - - deps: mime-types@~2.0.7 - -4.10.6 / 2014-12-12 -=================== - - * Fix exception in `req.fresh`/`req.stale` without response headers - -4.10.5 / 2014-12-10 -=================== - - * Fix `res.send` double-calling `res.end` for `HEAD` requests - * deps: accepts@~1.1.4 - - deps: mime-types@~2.0.4 - * deps: type-is@~1.5.4 - - deps: mime-types@~2.0.4 - -4.10.4 / 2014-11-24 -=================== - - * Fix `res.sendfile` logging standard write errors - -4.10.3 / 2014-11-23 -=================== - - * Fix `res.sendFile` logging standard write errors - * deps: etag@~1.5.1 - * deps: proxy-addr@~1.0.4 - - deps: ipaddr.js@0.1.5 - * deps: qs@2.3.3 - - Fix `arrayLimit` behavior - -4.10.2 / 2014-11-09 -=================== - - * Correctly invoke async router callback asynchronously - * deps: accepts@~1.1.3 - - deps: mime-types@~2.0.3 - * deps: type-is@~1.5.3 - - deps: mime-types@~2.0.3 - -4.10.1 / 2014-10-28 -=================== - - * Fix handling of URLs containing `://` in the path - * deps: qs@2.3.2 - - Fix parsing of mixed objects and values - -4.10.0 / 2014-10-23 -=================== - - * Add support for `app.set('views', array)` - - Views are looked up in sequence in array of directories - * Fix `res.send(status)` to mention `res.sendStatus(status)` - * Fix handling of invalid empty URLs - * Use `content-disposition` module for `res.attachment`/`res.download` - - Sends standards-compliant `Content-Disposition` header - - Full Unicode support - * Use `path.resolve` in view lookup - * deps: debug@~2.1.0 - - Implement `DEBUG_FD` env variable support - * deps: depd@~1.0.0 - * deps: etag@~1.5.0 - - Improve string performance - - Slightly improve speed for weak ETags over 1KB - * deps: finalhandler@0.3.2 - - Terminate in progress response only on error - - Use `on-finished` to determine request status - - deps: debug@~2.1.0 - - deps: on-finished@~2.1.1 - * deps: on-finished@~2.1.1 - - Fix handling of pipelined requests - * deps: qs@2.3.0 - - Fix parsing of mixed implicit and explicit arrays - * deps: send@0.10.1 - - deps: debug@~2.1.0 - - deps: depd@~1.0.0 - - deps: etag@~1.5.0 - - deps: on-finished@~2.1.1 - * deps: serve-static@~1.7.1 - - deps: send@0.10.1 - -4.9.8 / 2014-10-17 -================== - - * Fix `res.redirect` body when redirect status specified - * deps: accepts@~1.1.2 - - Fix error when media type has invalid parameter - - deps: negotiator@0.4.9 - -4.9.7 / 2014-10-10 -================== - - * Fix using same param name in array of paths - -4.9.6 / 2014-10-08 -================== - - * deps: accepts@~1.1.1 - - deps: mime-types@~2.0.2 - - deps: negotiator@0.4.8 - * deps: serve-static@~1.6.4 - - Fix redirect loop when index file serving disabled - * deps: type-is@~1.5.2 - - deps: mime-types@~2.0.2 - -4.9.5 / 2014-09-24 -================== - - * deps: etag@~1.4.0 - * deps: proxy-addr@~1.0.3 - - Use `forwarded` npm module - * deps: send@0.9.3 - - deps: etag@~1.4.0 - * deps: serve-static@~1.6.3 - - deps: send@0.9.3 - -4.9.4 / 2014-09-19 -================== - - * deps: qs@2.2.4 - - Fix issue with object keys starting with numbers truncated - -4.9.3 / 2014-09-18 -================== - - * deps: proxy-addr@~1.0.2 - - Fix a global leak when multiple subnets are trusted - - deps: ipaddr.js@0.1.3 - -4.9.2 / 2014-09-17 -================== - - * Fix regression for empty string `path` in `app.use` - * Fix `router.use` to accept array of middleware without path - * Improve error message for bad `app.use` arguments - -4.9.1 / 2014-09-16 -================== - - * Fix `app.use` to accept array of middleware without path - * deps: depd@0.4.5 - * deps: etag@~1.3.1 - * deps: send@0.9.2 - - deps: depd@0.4.5 - - deps: etag@~1.3.1 - - deps: range-parser@~1.0.2 - * deps: serve-static@~1.6.2 - - deps: send@0.9.2 - -4.9.0 / 2014-09-08 -================== - - * Add `res.sendStatus` - * Invoke callback for sendfile when client aborts - - Applies to `res.sendFile`, `res.sendfile`, and `res.download` - - `err` will be populated with request aborted error - * Support IP address host in `req.subdomains` - * Use `etag` to generate `ETag` headers - * deps: accepts@~1.1.0 - - update `mime-types` - * deps: cookie-signature@1.0.5 - * deps: debug@~2.0.0 - * deps: finalhandler@0.2.0 - - Set `X-Content-Type-Options: nosniff` header - - deps: debug@~2.0.0 - * deps: fresh@0.2.4 - * deps: media-typer@0.3.0 - - Throw error when parameter format invalid on parse - * deps: qs@2.2.3 - - Fix issue where first empty value in array is discarded - * deps: range-parser@~1.0.2 - * deps: send@0.9.1 - - Add `lastModified` option - - Use `etag` to generate `ETag` header - - deps: debug@~2.0.0 - - deps: fresh@0.2.4 - * deps: serve-static@~1.6.1 - - Add `lastModified` option - - deps: send@0.9.1 - * deps: type-is@~1.5.1 - - fix `hasbody` to be true for `content-length: 0` - - deps: media-typer@0.3.0 - - deps: mime-types@~2.0.1 - * deps: vary@~1.0.0 - - Accept valid `Vary` header string as `field` - -4.8.8 / 2014-09-04 -================== - - * deps: send@0.8.5 - - Fix a path traversal issue when using `root` - - Fix malicious path detection for empty string path - * deps: serve-static@~1.5.4 - - deps: send@0.8.5 - -4.8.7 / 2014-08-29 -================== - - * deps: qs@2.2.2 - - Remove unnecessary cloning - -4.8.6 / 2014-08-27 -================== - - * deps: qs@2.2.0 - - Array parsing fix - - Performance improvements - -4.8.5 / 2014-08-18 -================== - - * deps: send@0.8.3 - - deps: destroy@1.0.3 - - deps: on-finished@2.1.0 - * deps: serve-static@~1.5.3 - - deps: send@0.8.3 - -4.8.4 / 2014-08-14 -================== - - * deps: qs@1.2.2 - * deps: send@0.8.2 - - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` - * deps: serve-static@~1.5.2 - - deps: send@0.8.2 - -4.8.3 / 2014-08-10 -================== - - * deps: parseurl@~1.3.0 - * deps: qs@1.2.1 - * deps: serve-static@~1.5.1 - - Fix parsing of weird `req.originalUrl` values - - deps: parseurl@~1.3.0 - - deps: utils-merge@1.0.0 - -4.8.2 / 2014-08-07 -================== - - * deps: qs@1.2.0 - - Fix parsing array of objects - -4.8.1 / 2014-08-06 -================== - - * fix incorrect deprecation warnings on `res.download` - * deps: qs@1.1.0 - - Accept urlencoded square brackets - - Accept empty values in implicit array notation - -4.8.0 / 2014-08-05 -================== - - * add `res.sendFile` - - accepts a file system path instead of a URL - - requires an absolute path or `root` option specified - * deprecate `res.sendfile` -- use `res.sendFile` instead - * support mounted app as any argument to `app.use()` - * deps: qs@1.0.2 - - Complete rewrite - - Limits array length to 20 - - Limits object depth to 5 - - Limits parameters to 1,000 - * deps: send@0.8.1 - - Add `extensions` option - * deps: serve-static@~1.5.0 - - Add `extensions` option - - deps: send@0.8.1 - -4.7.4 / 2014-08-04 -================== - - * fix `res.sendfile` regression for serving directory index files - * deps: send@0.7.4 - - Fix incorrect 403 on Windows and Node.js 0.11 - - Fix serving index files without root dir - * deps: serve-static@~1.4.4 - - deps: send@0.7.4 - -4.7.3 / 2014-08-04 -================== - - * deps: send@0.7.3 - - Fix incorrect 403 on Windows and Node.js 0.11 - * deps: serve-static@~1.4.3 - - Fix incorrect 403 on Windows and Node.js 0.11 - - deps: send@0.7.3 - -4.7.2 / 2014-07-27 -================== - - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - * deps: send@0.7.2 - - deps: depd@0.4.4 - * deps: serve-static@~1.4.2 - -4.7.1 / 2014-07-26 -================== - - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - * deps: send@0.7.1 - - deps: depd@0.4.3 - * deps: serve-static@~1.4.1 - -4.7.0 / 2014-07-25 -================== - - * fix `req.protocol` for proxy-direct connections - * configurable query parser with `app.set('query parser', parser)` - - `app.set('query parser', 'extended')` parse with "qs" module - - `app.set('query parser', 'simple')` parse with "querystring" core module - - `app.set('query parser', false)` disable query string parsing - - `app.set('query parser', true)` enable simple parsing - * deprecate `res.json(status, obj)` -- use `res.status(status).json(obj)` instead - * deprecate `res.jsonp(status, obj)` -- use `res.status(status).jsonp(obj)` instead - * deprecate `res.send(status, body)` -- use `res.status(status).send(body)` instead - * deps: debug@1.0.4 - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - * deps: finalhandler@0.1.0 - - Respond after request fully read - - deps: debug@1.0.4 - * deps: parseurl@~1.2.0 - - Cache URLs based on original value - - Remove no-longer-needed URL mis-parse work-around - - Simplify the "fast-path" `RegExp` - * deps: send@0.7.0 - - Add `dotfiles` option - - Cap `maxAge` value to 1 year - - deps: debug@1.0.4 - - deps: depd@0.4.2 - * deps: serve-static@~1.4.0 - - deps: parseurl@~1.2.0 - - deps: send@0.7.0 - * perf: prevent multiple `Buffer` creation in `res.send` - -4.6.1 / 2014-07-12 -================== - - * fix `subapp.mountpath` regression for `app.use(subapp)` - -4.6.0 / 2014-07-11 -================== - - * accept multiple callbacks to `app.use()` - * add explicit "Rosetta Flash JSONP abuse" protection - - previous versions are not vulnerable; this is just explicit protection - * catch errors in multiple `req.param(name, fn)` handlers - * deprecate `res.redirect(url, status)` -- use `res.redirect(status, url)` instead - * fix `res.send(status, num)` to send `num` as json (not error) - * remove unnecessary escaping when `res.jsonp` returns JSON response - * support non-string `path` in `app.use(path, fn)` - - supports array of paths - - supports `RegExp` - * router: fix optimization on router exit - * router: refactor location of `try` blocks - * router: speed up standard `app.use(fn)` - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - * deps: finalhandler@0.0.3 - - deps: debug@1.0.3 - * deps: methods@1.1.0 - - add `CONNECT` - * deps: parseurl@~1.1.3 - - faster parsing of href-only URLs - * deps: path-to-regexp@0.1.3 - * deps: send@0.6.0 - - deps: debug@1.0.3 - * deps: serve-static@~1.3.2 - - deps: parseurl@~1.1.3 - - deps: send@0.6.0 - * perf: fix arguments reassign deopt in some `res` methods - -4.5.1 / 2014-07-06 -================== - - * fix routing regression when altering `req.method` - -4.5.0 / 2014-07-04 -================== - - * add deprecation message to non-plural `req.accepts*` - * add deprecation message to `res.send(body, status)` - * add deprecation message to `res.vary()` - * add `headers` option to `res.sendfile` - - use to set headers on successful file transfer - * add `mergeParams` option to `Router` - - merges `req.params` from parent routes - * add `req.hostname` -- correct name for what `req.host` returns - * deprecate things with `depd` module - * deprecate `req.host` -- use `req.hostname` instead - * fix behavior when handling request without routes - * fix handling when `route.all` is only route - * invoke `router.param()` only when route matches - * restore `req.params` after invoking router - * use `finalhandler` for final response handling - * use `media-typer` to alter content-type charset - * deps: accepts@~1.0.7 - * deps: send@0.5.0 - - Accept string for `maxage` (converted by `ms`) - - Include link in default redirect response - * deps: serve-static@~1.3.0 - - Accept string for `maxAge` (converted by `ms`) - - Add `setHeaders` option - - Include HTML link in redirect response - - deps: send@0.5.0 - * deps: type-is@~1.3.2 - -4.4.5 / 2014-06-26 -================== - - * deps: cookie-signature@1.0.4 - - fix for timing attacks - -4.4.4 / 2014-06-20 -================== - - * fix `res.attachment` Unicode filenames in Safari - * fix "trim prefix" debug message in `express:router` - * deps: accepts@~1.0.5 - * deps: buffer-crc32@0.2.3 - -4.4.3 / 2014-06-11 -================== - - * fix persistence of modified `req.params[name]` from `app.param()` - * deps: accepts@1.0.3 - - deps: negotiator@0.4.6 - * deps: debug@1.0.2 - * deps: send@0.4.3 - - Do not throw uncatchable error on file open race condition - - Use `escape-html` for HTML escaping - - deps: debug@1.0.2 - - deps: finished@1.2.2 - - deps: fresh@0.2.2 - * deps: serve-static@1.2.3 - - Do not throw uncatchable error on file open race condition - - deps: send@0.4.3 - -4.4.2 / 2014-06-09 -================== - - * fix catching errors from top-level handlers - * use `vary` module for `res.vary` - * deps: debug@1.0.1 - * deps: proxy-addr@1.0.1 - * deps: send@0.4.2 - - fix "event emitter leak" warnings - - deps: debug@1.0.1 - - deps: finished@1.2.1 - * deps: serve-static@1.2.2 - - fix "event emitter leak" warnings - - deps: send@0.4.2 - * deps: type-is@1.2.1 - -4.4.1 / 2014-06-02 -================== - - * deps: methods@1.0.1 - * deps: send@0.4.1 - - Send `max-age` in `Cache-Control` in correct format - * deps: serve-static@1.2.1 - - use `escape-html` for escaping - - deps: send@0.4.1 - -4.4.0 / 2014-05-30 -================== - - * custom etag control with `app.set('etag', val)` - - `app.set('etag', function(body, encoding){ return '"etag"' })` custom etag generation - - `app.set('etag', 'weak')` weak tag - - `app.set('etag', 'strong')` strong etag - - `app.set('etag', false)` turn off - - `app.set('etag', true)` standard etag - * mark `res.send` ETag as weak and reduce collisions - * update accepts to 1.0.2 - - Fix interpretation when header not in request - * update send to 0.4.0 - - Calculate ETag with md5 for reduced collisions - - Ignore stream errors after request ends - - deps: debug@0.8.1 - * update serve-static to 1.2.0 - - Calculate ETag with md5 for reduced collisions - - Ignore stream errors after request ends - - deps: send@0.4.0 - -4.3.2 / 2014-05-28 -================== - - * fix handling of errors from `router.param()` callbacks - -4.3.1 / 2014-05-23 -================== - - * revert "fix behavior of multiple `app.VERB` for the same path" - - this caused a regression in the order of route execution - -4.3.0 / 2014-05-21 -================== - - * add `req.baseUrl` to access the path stripped from `req.url` in routes - * fix behavior of multiple `app.VERB` for the same path - * fix issue routing requests among sub routers - * invoke `router.param()` only when necessary instead of every match - * proper proxy trust with `app.set('trust proxy', trust)` - - `app.set('trust proxy', 1)` trust first hop - - `app.set('trust proxy', 'loopback')` trust loopback addresses - - `app.set('trust proxy', '10.0.0.1')` trust single IP - - `app.set('trust proxy', '10.0.0.1/16')` trust subnet - - `app.set('trust proxy', '10.0.0.1, 10.0.0.2')` trust list - - `app.set('trust proxy', false)` turn off - - `app.set('trust proxy', true)` trust everything - * set proper `charset` in `Content-Type` for `res.send` - * update type-is to 1.2.0 - - support suffix matching - -4.2.0 / 2014-05-11 -================== - - * deprecate `app.del()` -- use `app.delete()` instead - * deprecate `res.json(obj, status)` -- use `res.json(status, obj)` instead - - the edge-case `res.json(status, num)` requires `res.status(status).json(num)` - * deprecate `res.jsonp(obj, status)` -- use `res.jsonp(status, obj)` instead - - the edge-case `res.jsonp(status, num)` requires `res.status(status).jsonp(num)` - * fix `req.next` when inside router instance - * include `ETag` header in `HEAD` requests - * keep previous `Content-Type` for `res.jsonp` - * support PURGE method - - add `app.purge` - - add `router.purge` - - include PURGE in `app.all` - * update debug to 0.8.0 - - add `enable()` method - - change from stderr to stdout - * update methods to 1.0.0 - - add PURGE - -4.1.2 / 2014-05-08 -================== - - * fix `req.host` for IPv6 literals - * fix `res.jsonp` error if callback param is object - -4.1.1 / 2014-04-27 -================== - - * fix package.json to reflect supported node version - -4.1.0 / 2014-04-24 -================== - - * pass options from `res.sendfile` to `send` - * preserve casing of headers in `res.header` and `res.set` - * support unicode file names in `res.attachment` and `res.download` - * update accepts to 1.0.1 - - deps: negotiator@0.4.0 - * update cookie to 0.1.2 - - Fix for maxAge == 0 - - made compat with expires field - * update send to 0.3.0 - - Accept API options in options object - - Coerce option types - - Control whether to generate etags - - Default directory access to 403 when index disabled - - Fix sending files with dots without root set - - Include file path in etag - - Make "Can't set headers after they are sent." catchable - - Send full entity-body for multi range requests - - Set etags to "weak" - - Support "If-Range" header - - Support multiple index paths - - deps: mime@1.2.11 - * update serve-static to 1.1.0 - - Accept options directly to `send` module - - Resolve relative paths at middleware setup - - Use parseurl to parse the URL from request - - deps: send@0.3.0 - * update type-is to 1.1.0 - - add non-array values support - - add `multipart` as a shorthand - -4.0.0 / 2014-04-09 -================== - - * remove: - - node 0.8 support - - connect and connect's patches except for charset handling - - express(1) - moved to [express-generator](https://github.com/expressjs/generator) - - `express.createServer()` - it has been deprecated for a long time. Use `express()` - - `app.configure` - use logic in your own app code - - `app.router` - is removed - - `req.auth` - use `basic-auth` instead - - `req.accepted*` - use `req.accepts*()` instead - - `res.location` - relative URL resolution is removed - - `res.charset` - include the charset in the content type when using `res.set()` - - all bundled middleware except `static` - * change: - - `app.route` -> `app.mountpath` when mounting an express app in another express app - - `json spaces` no longer enabled by default in development - - `req.accepts*` -> `req.accepts*s` - i.e. `req.acceptsEncoding` -> `req.acceptsEncodings` - - `req.params` is now an object instead of an array - - `res.locals` is no longer a function. It is a plain js object. Treat it as such. - - `res.headerSent` -> `res.headersSent` to match node.js ServerResponse object - * refactor: - - `req.accepts*` with [accepts](https://github.com/expressjs/accepts) - - `req.is` with [type-is](https://github.com/expressjs/type-is) - - [path-to-regexp](https://github.com/component/path-to-regexp) - * add: - - `app.router()` - returns the app Router instance - - `app.route()` - Proxy to the app's `Router#route()` method to create a new route - - Router & Route - public API - -3.21.2 / 2015-07-31 -=================== - - * deps: connect@2.30.2 - - deps: body-parser@~1.13.3 - - deps: compression@~1.5.2 - - deps: errorhandler@~1.4.2 - - deps: method-override@~2.3.5 - - deps: serve-index@~1.7.2 - - deps: type-is@~1.6.6 - - deps: vhost@~3.0.1 - * deps: vary@~1.0.1 - - Fix setting empty header from empty `field` - - perf: enable strict mode - - perf: remove argument reassignments - -3.21.1 / 2015-07-05 -=================== - - * deps: basic-auth@~1.0.3 - * deps: connect@2.30.1 - - deps: body-parser@~1.13.2 - - deps: compression@~1.5.1 - - deps: errorhandler@~1.4.1 - - deps: morgan@~1.6.1 - - deps: pause@0.1.0 - - deps: qs@4.0.0 - - deps: serve-index@~1.7.1 - - deps: type-is@~1.6.4 - -3.21.0 / 2015-06-18 -=================== - - * deps: basic-auth@1.0.2 - - perf: enable strict mode - - perf: hoist regular expression - - perf: parse with regular expressions - - perf: remove argument reassignment - * deps: connect@2.30.0 - - deps: body-parser@~1.13.1 - - deps: bytes@2.1.0 - - deps: compression@~1.5.0 - - deps: cookie@0.1.3 - - deps: cookie-parser@~1.3.5 - - deps: csurf@~1.8.3 - - deps: errorhandler@~1.4.0 - - deps: express-session@~1.11.3 - - deps: finalhandler@0.4.0 - - deps: fresh@0.3.0 - - deps: morgan@~1.6.0 - - deps: serve-favicon@~2.3.0 - - deps: serve-index@~1.7.0 - - deps: serve-static@~1.10.0 - - deps: type-is@~1.6.3 - * deps: cookie@0.1.3 - - perf: deduce the scope of try-catch deopt - - perf: remove argument reassignments - * deps: escape-html@1.0.2 - * deps: etag@~1.7.0 - - Always include entity length in ETags for hash length extensions - - Generate non-Stats ETags using MD5 only (no longer CRC32) - - Improve stat performance by removing hashing - - Improve support for JXcore - - Remove base64 padding in ETags to shorten - - Support "fake" stats objects in environments without fs - - Use MD5 instead of MD4 in weak ETags over 1KB - * deps: fresh@0.3.0 - - Add weak `ETag` matching support - * deps: mkdirp@0.5.1 - - Work in global strict mode - * deps: send@0.13.0 - - Allow Node.js HTTP server to set `Date` response header - - Fix incorrectly removing `Content-Location` on 304 response - - Improve the default redirect response headers - - Send appropriate headers on default error response - - Use `http-errors` for standard emitted errors - - Use `statuses` instead of `http` module for status messages - - deps: escape-html@1.0.2 - - deps: etag@~1.7.0 - - deps: fresh@0.3.0 - - deps: on-finished@~2.3.0 - - perf: enable strict mode - - perf: remove unnecessary array allocations - -3.20.3 / 2015-05-17 -=================== - - * deps: connect@2.29.2 - - deps: body-parser@~1.12.4 - - deps: compression@~1.4.4 - - deps: connect-timeout@~1.6.2 - - deps: debug@~2.2.0 - - deps: depd@~1.0.1 - - deps: errorhandler@~1.3.6 - - deps: finalhandler@0.3.6 - - deps: method-override@~2.3.3 - - deps: morgan@~1.5.3 - - deps: qs@2.4.2 - - deps: response-time@~2.3.1 - - deps: serve-favicon@~2.2.1 - - deps: serve-index@~1.6.4 - - deps: serve-static@~1.9.3 - - deps: type-is@~1.6.2 - * deps: debug@~2.2.0 - - deps: ms@0.7.1 - * deps: depd@~1.0.1 - * deps: proxy-addr@~1.0.8 - - deps: ipaddr.js@1.0.1 - * deps: send@0.12.3 - - deps: debug@~2.2.0 - - deps: depd@~1.0.1 - - deps: etag@~1.6.0 - - deps: ms@0.7.1 - - deps: on-finished@~2.2.1 - -3.20.2 / 2015-03-16 -=================== - - * deps: connect@2.29.1 - - deps: body-parser@~1.12.2 - - deps: compression@~1.4.3 - - deps: connect-timeout@~1.6.1 - - deps: debug@~2.1.3 - - deps: errorhandler@~1.3.5 - - deps: express-session@~1.10.4 - - deps: finalhandler@0.3.4 - - deps: method-override@~2.3.2 - - deps: morgan@~1.5.2 - - deps: qs@2.4.1 - - deps: serve-index@~1.6.3 - - deps: serve-static@~1.9.2 - - deps: type-is@~1.6.1 - * deps: debug@~2.1.3 - - Fix high intensity foreground color for bold - - deps: ms@0.7.0 - * deps: merge-descriptors@1.0.0 - * deps: proxy-addr@~1.0.7 - - deps: ipaddr.js@0.1.9 - * deps: send@0.12.2 - - Throw errors early for invalid `extensions` or `index` options - - deps: debug@~2.1.3 - -3.20.1 / 2015-02-28 -=================== - - * Fix `req.host` when using "trust proxy" hops count - * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count - -3.20.0 / 2015-02-18 -=================== - - * Fix `"trust proxy"` setting to inherit when app is mounted - * Generate `ETag`s for all request responses - - No longer restricted to only responses for `GET` and `HEAD` requests - * Use `content-type` to parse `Content-Type` headers - * deps: connect@2.29.0 - - Use `content-type` to parse `Content-Type` headers - - deps: body-parser@~1.12.0 - - deps: compression@~1.4.1 - - deps: connect-timeout@~1.6.0 - - deps: cookie-parser@~1.3.4 - - deps: cookie-signature@1.0.6 - - deps: csurf@~1.7.0 - - deps: errorhandler@~1.3.4 - - deps: express-session@~1.10.3 - - deps: http-errors@~1.3.1 - - deps: response-time@~2.3.0 - - deps: serve-index@~1.6.2 - - deps: serve-static@~1.9.1 - - deps: type-is@~1.6.0 - * deps: cookie-signature@1.0.6 - * deps: send@0.12.1 - - Always read the stat size from the file - - Fix mutating passed-in `options` - - deps: mime@1.3.4 - -3.19.2 / 2015-02-01 -=================== - - * deps: connect@2.28.3 - - deps: compression@~1.3.1 - - deps: csurf@~1.6.6 - - deps: errorhandler@~1.3.3 - - deps: express-session@~1.10.2 - - deps: serve-index@~1.6.1 - - deps: type-is@~1.5.6 - * deps: proxy-addr@~1.0.6 - - deps: ipaddr.js@0.1.8 - -3.19.1 / 2015-01-20 -=================== - - * deps: connect@2.28.2 - - deps: body-parser@~1.10.2 - - deps: serve-static@~1.8.1 - * deps: send@0.11.1 - - Fix root path disclosure - -3.19.0 / 2015-01-09 -=================== - - * Fix `OPTIONS` responses to include the `HEAD` method property - * Use `readline` for prompt in `express(1)` - * deps: commander@2.6.0 - * deps: connect@2.28.1 - - deps: body-parser@~1.10.1 - - deps: compression@~1.3.0 - - deps: connect-timeout@~1.5.0 - - deps: csurf@~1.6.4 - - deps: debug@~2.1.1 - - deps: errorhandler@~1.3.2 - - deps: express-session@~1.10.1 - - deps: finalhandler@0.3.3 - - deps: method-override@~2.3.1 - - deps: morgan@~1.5.1 - - deps: serve-favicon@~2.2.0 - - deps: serve-index@~1.6.0 - - deps: serve-static@~1.8.0 - - deps: type-is@~1.5.5 - * deps: debug@~2.1.1 - * deps: methods@~1.1.1 - * deps: proxy-addr@~1.0.5 - - deps: ipaddr.js@0.1.6 - * deps: send@0.11.0 - - deps: debug@~2.1.1 - - deps: etag@~1.5.1 - - deps: ms@0.7.0 - - deps: on-finished@~2.2.0 - -3.18.6 / 2014-12-12 -=================== - - * Fix exception in `req.fresh`/`req.stale` without response headers - -3.18.5 / 2014-12-11 -=================== - - * deps: connect@2.27.6 - - deps: compression@~1.2.2 - - deps: express-session@~1.9.3 - - deps: http-errors@~1.2.8 - - deps: serve-index@~1.5.3 - - deps: type-is@~1.5.4 - -3.18.4 / 2014-11-23 -=================== - - * deps: connect@2.27.4 - - deps: body-parser@~1.9.3 - - deps: compression@~1.2.1 - - deps: errorhandler@~1.2.3 - - deps: express-session@~1.9.2 - - deps: qs@2.3.3 - - deps: serve-favicon@~2.1.7 - - deps: serve-static@~1.5.1 - - deps: type-is@~1.5.3 - * deps: etag@~1.5.1 - * deps: proxy-addr@~1.0.4 - - deps: ipaddr.js@0.1.5 - -3.18.3 / 2014-11-09 -=================== - - * deps: connect@2.27.3 - - Correctly invoke async callback asynchronously - - deps: csurf@~1.6.3 - -3.18.2 / 2014-10-28 -=================== - - * deps: connect@2.27.2 - - Fix handling of URLs containing `://` in the path - - deps: body-parser@~1.9.2 - - deps: qs@2.3.2 - -3.18.1 / 2014-10-22 -=================== - - * Fix internal `utils.merge` deprecation warnings - * deps: connect@2.27.1 - - deps: body-parser@~1.9.1 - - deps: express-session@~1.9.1 - - deps: finalhandler@0.3.2 - - deps: morgan@~1.4.1 - - deps: qs@2.3.0 - - deps: serve-static@~1.7.1 - * deps: send@0.10.1 - - deps: on-finished@~2.1.1 - -3.18.0 / 2014-10-17 -=================== - - * Use `content-disposition` module for `res.attachment`/`res.download` - - Sends standards-compliant `Content-Disposition` header - - Full Unicode support - * Use `etag` module to generate `ETag` headers - * deps: connect@2.27.0 - - Use `http-errors` module for creating errors - - Use `utils-merge` module for merging objects - - deps: body-parser@~1.9.0 - - deps: compression@~1.2.0 - - deps: connect-timeout@~1.4.0 - - deps: debug@~2.1.0 - - deps: depd@~1.0.0 - - deps: express-session@~1.9.0 - - deps: finalhandler@0.3.1 - - deps: method-override@~2.3.0 - - deps: morgan@~1.4.0 - - deps: response-time@~2.2.0 - - deps: serve-favicon@~2.1.6 - - deps: serve-index@~1.5.0 - - deps: serve-static@~1.7.0 - * deps: debug@~2.1.0 - - Implement `DEBUG_FD` env variable support - * deps: depd@~1.0.0 - * deps: send@0.10.0 - - deps: debug@~2.1.0 - - deps: depd@~1.0.0 - - deps: etag@~1.5.0 - -3.17.8 / 2014-10-15 -=================== - - * deps: connect@2.26.6 - - deps: compression@~1.1.2 - - deps: csurf@~1.6.2 - - deps: errorhandler@~1.2.2 - -3.17.7 / 2014-10-08 -=================== - - * deps: connect@2.26.5 - - Fix accepting non-object arguments to `logger` - - deps: serve-static@~1.6.4 - -3.17.6 / 2014-10-02 -=================== - - * deps: connect@2.26.4 - - deps: morgan@~1.3.2 - - deps: type-is@~1.5.2 - -3.17.5 / 2014-09-24 -=================== - - * deps: connect@2.26.3 - - deps: body-parser@~1.8.4 - - deps: serve-favicon@~2.1.5 - - deps: serve-static@~1.6.3 - * deps: proxy-addr@~1.0.3 - - Use `forwarded` npm module - * deps: send@0.9.3 - - deps: etag@~1.4.0 - -3.17.4 / 2014-09-19 -=================== - - * deps: connect@2.26.2 - - deps: body-parser@~1.8.3 - - deps: qs@2.2.4 - -3.17.3 / 2014-09-18 -=================== - - * deps: proxy-addr@~1.0.2 - - Fix a global leak when multiple subnets are trusted - - deps: ipaddr.js@0.1.3 - -3.17.2 / 2014-09-15 -=================== - - * Use `crc` instead of `buffer-crc32` for speed - * deps: connect@2.26.1 - - deps: body-parser@~1.8.2 - - deps: depd@0.4.5 - - deps: express-session@~1.8.2 - - deps: morgan@~1.3.1 - - deps: serve-favicon@~2.1.3 - - deps: serve-static@~1.6.2 - * deps: depd@0.4.5 - * deps: send@0.9.2 - - deps: depd@0.4.5 - - deps: etag@~1.3.1 - - deps: range-parser@~1.0.2 - -3.17.1 / 2014-09-08 -=================== - - * Fix error in `req.subdomains` on empty host - -3.17.0 / 2014-09-08 -=================== - - * Support `X-Forwarded-Host` in `req.subdomains` - * Support IP address host in `req.subdomains` - * deps: connect@2.26.0 - - deps: body-parser@~1.8.1 - - deps: compression@~1.1.0 - - deps: connect-timeout@~1.3.0 - - deps: cookie-parser@~1.3.3 - - deps: cookie-signature@1.0.5 - - deps: csurf@~1.6.1 - - deps: debug@~2.0.0 - - deps: errorhandler@~1.2.0 - - deps: express-session@~1.8.1 - - deps: finalhandler@0.2.0 - - deps: fresh@0.2.4 - - deps: media-typer@0.3.0 - - deps: method-override@~2.2.0 - - deps: morgan@~1.3.0 - - deps: qs@2.2.3 - - deps: serve-favicon@~2.1.3 - - deps: serve-index@~1.2.1 - - deps: serve-static@~1.6.1 - - deps: type-is@~1.5.1 - - deps: vhost@~3.0.0 - * deps: cookie-signature@1.0.5 - * deps: debug@~2.0.0 - * deps: fresh@0.2.4 - * deps: media-typer@0.3.0 - - Throw error when parameter format invalid on parse - * deps: range-parser@~1.0.2 - * deps: send@0.9.1 - - Add `lastModified` option - - Use `etag` to generate `ETag` header - - deps: debug@~2.0.0 - - deps: fresh@0.2.4 - * deps: vary@~1.0.0 - - Accept valid `Vary` header string as `field` - -3.16.10 / 2014-09-04 -==================== - - * deps: connect@2.25.10 - - deps: serve-static@~1.5.4 - * deps: send@0.8.5 - - Fix a path traversal issue when using `root` - - Fix malicious path detection for empty string path - -3.16.9 / 2014-08-29 -=================== - - * deps: connect@2.25.9 - - deps: body-parser@~1.6.7 - - deps: qs@2.2.2 - -3.16.8 / 2014-08-27 -=================== - - * deps: connect@2.25.8 - - deps: body-parser@~1.6.6 - - deps: csurf@~1.4.1 - - deps: qs@2.2.0 - -3.16.7 / 2014-08-18 -=================== - - * deps: connect@2.25.7 - - deps: body-parser@~1.6.5 - - deps: express-session@~1.7.6 - - deps: morgan@~1.2.3 - - deps: serve-static@~1.5.3 - * deps: send@0.8.3 - - deps: destroy@1.0.3 - - deps: on-finished@2.1.0 - -3.16.6 / 2014-08-14 -=================== - - * deps: connect@2.25.6 - - deps: body-parser@~1.6.4 - - deps: qs@1.2.2 - - deps: serve-static@~1.5.2 - * deps: send@0.8.2 - - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` - -3.16.5 / 2014-08-11 -=================== - - * deps: connect@2.25.5 - - Fix backwards compatibility in `logger` - -3.16.4 / 2014-08-10 -=================== - - * Fix original URL parsing in `res.location` - * deps: connect@2.25.4 - - Fix `query` middleware breaking with argument - - deps: body-parser@~1.6.3 - - deps: compression@~1.0.11 - - deps: connect-timeout@~1.2.2 - - deps: express-session@~1.7.5 - - deps: method-override@~2.1.3 - - deps: on-headers@~1.0.0 - - deps: parseurl@~1.3.0 - - deps: qs@1.2.1 - - deps: response-time@~2.0.1 - - deps: serve-index@~1.1.6 - - deps: serve-static@~1.5.1 - * deps: parseurl@~1.3.0 - -3.16.3 / 2014-08-07 -=================== - - * deps: connect@2.25.3 - - deps: multiparty@3.3.2 - -3.16.2 / 2014-08-07 -=================== - - * deps: connect@2.25.2 - - deps: body-parser@~1.6.2 - - deps: qs@1.2.0 - -3.16.1 / 2014-08-06 -=================== - - * deps: connect@2.25.1 - - deps: body-parser@~1.6.1 - - deps: qs@1.1.0 - -3.16.0 / 2014-08-05 -=================== - - * deps: connect@2.25.0 - - deps: body-parser@~1.6.0 - - deps: compression@~1.0.10 - - deps: csurf@~1.4.0 - - deps: express-session@~1.7.4 - - deps: qs@1.0.2 - - deps: serve-static@~1.5.0 - * deps: send@0.8.1 - - Add `extensions` option - -3.15.3 / 2014-08-04 -=================== - - * fix `res.sendfile` regression for serving directory index files - * deps: connect@2.24.3 - - deps: serve-index@~1.1.5 - - deps: serve-static@~1.4.4 - * deps: send@0.7.4 - - Fix incorrect 403 on Windows and Node.js 0.11 - - Fix serving index files without root dir - -3.15.2 / 2014-07-27 -=================== - - * deps: connect@2.24.2 - - deps: body-parser@~1.5.2 - - deps: depd@0.4.4 - - deps: express-session@~1.7.2 - - deps: morgan@~1.2.2 - - deps: serve-static@~1.4.2 - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - * deps: send@0.7.2 - - deps: depd@0.4.4 - -3.15.1 / 2014-07-26 -=================== - - * deps: connect@2.24.1 - - deps: body-parser@~1.5.1 - - deps: depd@0.4.3 - - deps: express-session@~1.7.1 - - deps: morgan@~1.2.1 - - deps: serve-index@~1.1.4 - - deps: serve-static@~1.4.1 - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - * deps: send@0.7.1 - - deps: depd@0.4.3 - -3.15.0 / 2014-07-22 -=================== - - * Fix `req.protocol` for proxy-direct connections - * Pass options from `res.sendfile` to `send` - * deps: connect@2.24.0 - - deps: body-parser@~1.5.0 - - deps: compression@~1.0.9 - - deps: connect-timeout@~1.2.1 - - deps: debug@1.0.4 - - deps: depd@0.4.2 - - deps: express-session@~1.7.0 - - deps: finalhandler@0.1.0 - - deps: method-override@~2.1.2 - - deps: morgan@~1.2.0 - - deps: multiparty@3.3.1 - - deps: parseurl@~1.2.0 - - deps: serve-static@~1.4.0 - * deps: debug@1.0.4 - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - * deps: parseurl@~1.2.0 - - Cache URLs based on original value - - Remove no-longer-needed URL mis-parse work-around - - Simplify the "fast-path" `RegExp` - * deps: send@0.7.0 - - Add `dotfiles` option - - Cap `maxAge` value to 1 year - - deps: debug@1.0.4 - - deps: depd@0.4.2 - -3.14.0 / 2014-07-11 -=================== - - * add explicit "Rosetta Flash JSONP abuse" protection - - previous versions are not vulnerable; this is just explicit protection - * deprecate `res.redirect(url, status)` -- use `res.redirect(status, url)` instead - * fix `res.send(status, num)` to send `num` as json (not error) - * remove unnecessary escaping when `res.jsonp` returns JSON response - * deps: basic-auth@1.0.0 - - support empty password - - support empty username - * deps: connect@2.23.0 - - deps: debug@1.0.3 - - deps: express-session@~1.6.4 - - deps: method-override@~2.1.0 - - deps: parseurl@~1.1.3 - - deps: serve-static@~1.3.1 - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - * deps: methods@1.1.0 - - add `CONNECT` - * deps: parseurl@~1.1.3 - - faster parsing of href-only URLs - -3.13.0 / 2014-07-03 -=================== - - * add deprecation message to `app.configure` - * add deprecation message to `req.auth` - * use `basic-auth` to parse `Authorization` header - * deps: connect@2.22.0 - - deps: csurf@~1.3.0 - - deps: express-session@~1.6.1 - - deps: multiparty@3.3.0 - - deps: serve-static@~1.3.0 - * deps: send@0.5.0 - - Accept string for `maxage` (converted by `ms`) - - Include link in default redirect response - -3.12.1 / 2014-06-26 -=================== - - * deps: connect@2.21.1 - - deps: cookie-parser@1.3.2 - - deps: cookie-signature@1.0.4 - - deps: express-session@~1.5.2 - - deps: type-is@~1.3.2 - * deps: cookie-signature@1.0.4 - - fix for timing attacks - -3.12.0 / 2014-06-21 -=================== - - * use `media-typer` to alter content-type charset - * deps: connect@2.21.0 - - deprecate `connect(middleware)` -- use `app.use(middleware)` instead - - deprecate `connect.createServer()` -- use `connect()` instead - - fix `res.setHeader()` patch to work with with get -> append -> set pattern - - deps: compression@~1.0.8 - - deps: errorhandler@~1.1.1 - - deps: express-session@~1.5.0 - - deps: serve-index@~1.1.3 - -3.11.0 / 2014-06-19 -=================== - - * deprecate things with `depd` module - * deps: buffer-crc32@0.2.3 - * deps: connect@2.20.2 - - deprecate `verify` option to `json` -- use `body-parser` npm module instead - - deprecate `verify` option to `urlencoded` -- use `body-parser` npm module instead - - deprecate things with `depd` module - - use `finalhandler` for final response handling - - use `media-typer` to parse `content-type` for charset - - deps: body-parser@1.4.3 - - deps: connect-timeout@1.1.1 - - deps: cookie-parser@1.3.1 - - deps: csurf@1.2.2 - - deps: errorhandler@1.1.0 - - deps: express-session@1.4.0 - - deps: multiparty@3.2.9 - - deps: serve-index@1.1.2 - - deps: type-is@1.3.1 - - deps: vhost@2.0.0 - -3.10.5 / 2014-06-11 -=================== - - * deps: connect@2.19.6 - - deps: body-parser@1.3.1 - - deps: compression@1.0.7 - - deps: debug@1.0.2 - - deps: serve-index@1.1.1 - - deps: serve-static@1.2.3 - * deps: debug@1.0.2 - * deps: send@0.4.3 - - Do not throw uncatchable error on file open race condition - - Use `escape-html` for HTML escaping - - deps: debug@1.0.2 - - deps: finished@1.2.2 - - deps: fresh@0.2.2 - -3.10.4 / 2014-06-09 -=================== - - * deps: connect@2.19.5 - - fix "event emitter leak" warnings - - deps: csurf@1.2.1 - - deps: debug@1.0.1 - - deps: serve-static@1.2.2 - - deps: type-is@1.2.1 - * deps: debug@1.0.1 - * deps: send@0.4.2 - - fix "event emitter leak" warnings - - deps: finished@1.2.1 - - deps: debug@1.0.1 - -3.10.3 / 2014-06-05 -=================== - - * use `vary` module for `res.vary` - * deps: connect@2.19.4 - - deps: errorhandler@1.0.2 - - deps: method-override@2.0.2 - - deps: serve-favicon@2.0.1 - * deps: debug@1.0.0 - -3.10.2 / 2014-06-03 -=================== - - * deps: connect@2.19.3 - - deps: compression@1.0.6 - -3.10.1 / 2014-06-03 -=================== - - * deps: connect@2.19.2 - - deps: compression@1.0.4 - * deps: proxy-addr@1.0.1 - -3.10.0 / 2014-06-02 -=================== - - * deps: connect@2.19.1 - - deprecate `methodOverride()` -- use `method-override` npm module instead - - deps: body-parser@1.3.0 - - deps: method-override@2.0.1 - - deps: multiparty@3.2.8 - - deps: response-time@2.0.0 - - deps: serve-static@1.2.1 - * deps: methods@1.0.1 - * deps: send@0.4.1 - - Send `max-age` in `Cache-Control` in correct format - -3.9.0 / 2014-05-30 -================== - - * custom etag control with `app.set('etag', val)` - - `app.set('etag', function(body, encoding){ return '"etag"' })` custom etag generation - - `app.set('etag', 'weak')` weak tag - - `app.set('etag', 'strong')` strong etag - - `app.set('etag', false)` turn off - - `app.set('etag', true)` standard etag - * Include ETag in HEAD requests - * mark `res.send` ETag as weak and reduce collisions - * update connect to 2.18.0 - - deps: compression@1.0.3 - - deps: serve-index@1.1.0 - - deps: serve-static@1.2.0 - * update send to 0.4.0 - - Calculate ETag with md5 for reduced collisions - - Ignore stream errors after request ends - - deps: debug@0.8.1 - -3.8.1 / 2014-05-27 -================== - - * update connect to 2.17.3 - - deps: body-parser@1.2.2 - - deps: express-session@1.2.1 - - deps: method-override@1.0.2 - -3.8.0 / 2014-05-21 -================== - - * keep previous `Content-Type` for `res.jsonp` - * set proper `charset` in `Content-Type` for `res.send` - * update connect to 2.17.1 - - fix `res.charset` appending charset when `content-type` has one - - deps: express-session@1.2.0 - - deps: morgan@1.1.1 - - deps: serve-index@1.0.3 - -3.7.0 / 2014-05-18 -================== - - * proper proxy trust with `app.set('trust proxy', trust)` - - `app.set('trust proxy', 1)` trust first hop - - `app.set('trust proxy', 'loopback')` trust loopback addresses - - `app.set('trust proxy', '10.0.0.1')` trust single IP - - `app.set('trust proxy', '10.0.0.1/16')` trust subnet - - `app.set('trust proxy', '10.0.0.1, 10.0.0.2')` trust list - - `app.set('trust proxy', false)` turn off - - `app.set('trust proxy', true)` trust everything - * update connect to 2.16.2 - - deprecate `res.headerSent` -- use `res.headersSent` - - deprecate `res.on("header")` -- use on-headers module instead - - fix edge-case in `res.appendHeader` that would append in wrong order - - json: use body-parser - - urlencoded: use body-parser - - dep: bytes@1.0.0 - - dep: cookie-parser@1.1.0 - - dep: csurf@1.2.0 - - dep: express-session@1.1.0 - - dep: method-override@1.0.1 - -3.6.0 / 2014-05-09 -================== - - * deprecate `app.del()` -- use `app.delete()` instead - * deprecate `res.json(obj, status)` -- use `res.json(status, obj)` instead - - the edge-case `res.json(status, num)` requires `res.status(status).json(num)` - * deprecate `res.jsonp(obj, status)` -- use `res.jsonp(status, obj)` instead - - the edge-case `res.jsonp(status, num)` requires `res.status(status).jsonp(num)` - * support PURGE method - - add `app.purge` - - add `router.purge` - - include PURGE in `app.all` - * update connect to 2.15.0 - * Add `res.appendHeader` - * Call error stack even when response has been sent - * Patch `res.headerSent` to return Boolean - * Patch `res.headersSent` for node.js 0.8 - * Prevent default 404 handler after response sent - * dep: compression@1.0.2 - * dep: connect-timeout@1.1.0 - * dep: debug@^0.8.0 - * dep: errorhandler@1.0.1 - * dep: express-session@1.0.4 - * dep: morgan@1.0.1 - * dep: serve-favicon@2.0.0 - * dep: serve-index@1.0.2 - * update debug to 0.8.0 - * add `enable()` method - * change from stderr to stdout - * update methods to 1.0.0 - - add PURGE - * update mkdirp to 0.5.0 - -3.5.3 / 2014-05-08 -================== - - * fix `req.host` for IPv6 literals - * fix `res.jsonp` error if callback param is object - -3.5.2 / 2014-04-24 -================== - - * update connect to 2.14.5 - * update cookie to 0.1.2 - * update mkdirp to 0.4.0 - * update send to 0.3.0 - -3.5.1 / 2014-03-25 -================== - - * pin less-middleware in generated app - -3.5.0 / 2014-03-06 -================== - - * bump deps - -3.4.8 / 2014-01-13 -================== - - * prevent incorrect automatic OPTIONS responses #1868 @dpatti - * update binary and examples for jade 1.0 #1876 @yossi, #1877 @reqshark, #1892 @matheusazzi - * throw 400 in case of malformed paths @rlidwka - -3.4.7 / 2013-12-10 -================== - - * update connect - -3.4.6 / 2013-12-01 -================== - - * update connect (raw-body) - -3.4.5 / 2013-11-27 -================== - - * update connect - * res.location: remove leading ./ #1802 @kapouer - * res.redirect: fix `res.redirect('toString') #1829 @michaelficarra - * res.send: always send ETag when content-length > 0 - * router: add Router.all() method - -3.4.4 / 2013-10-29 -================== - - * update connect - * update supertest - * update methods - * express(1): replace bodyParser() with urlencoded() and json() #1795 @chirag04 - -3.4.3 / 2013-10-23 -================== - - * update connect - -3.4.2 / 2013-10-18 -================== - - * update connect - * downgrade commander - -3.4.1 / 2013-10-15 -================== - - * update connect - * update commander - * jsonp: check if callback is a function - * router: wrap encodeURIComponent in a try/catch #1735 (@lxe) - * res.format: now includes charset @1747 (@sorribas) - * res.links: allow multiple calls @1746 (@sorribas) - -3.4.0 / 2013-09-07 -================== - - * add res.vary(). Closes #1682 - * update connect - -3.3.8 / 2013-09-02 -================== - - * update connect - -3.3.7 / 2013-08-28 -================== - - * update connect - -3.3.6 / 2013-08-27 -================== - - * Revert "remove charset from json responses. Closes #1631" (causes issues in some clients) - * add: req.accepts take an argument list - -3.3.4 / 2013-07-08 -================== - - * update send and connect - -3.3.3 / 2013-07-04 -================== - - * update connect - -3.3.2 / 2013-07-03 -================== - - * update connect - * update send - * remove .version export - -3.3.1 / 2013-06-27 -================== - - * update connect - -3.3.0 / 2013-06-26 -================== - - * update connect - * add support for multiple X-Forwarded-Proto values. Closes #1646 - * change: remove charset from json responses. Closes #1631 - * change: return actual booleans from req.accept* functions - * fix jsonp callback array throw - -3.2.6 / 2013-06-02 -================== - - * update connect - -3.2.5 / 2013-05-21 -================== - - * update connect - * update node-cookie - * add: throw a meaningful error when there is no default engine - * change generation of ETags with res.send() to GET requests only. Closes #1619 - -3.2.4 / 2013-05-09 -================== - - * fix `req.subdomains` when no Host is present - * fix `req.host` when no Host is present, return undefined - -3.2.3 / 2013-05-07 -================== - - * update connect / qs - -3.2.2 / 2013-05-03 -================== - - * update qs - -3.2.1 / 2013-04-29 -================== - - * add app.VERB() paths array deprecation warning - * update connect - * update qs and remove all ~ semver crap - * fix: accept number as value of Signed Cookie - -3.2.0 / 2013-04-15 -================== - - * add "view" constructor setting to override view behaviour - * add req.acceptsEncoding(name) - * add req.acceptedEncodings - * revert cookie signature change causing session race conditions - * fix sorting of Accept values of the same quality - -3.1.2 / 2013-04-12 -================== - - * add support for custom Accept parameters - * update cookie-signature - -3.1.1 / 2013-04-01 -================== - - * add X-Forwarded-Host support to `req.host` - * fix relative redirects - * update mkdirp - * update buffer-crc32 - * remove legacy app.configure() method from app template. - -3.1.0 / 2013-01-25 -================== - - * add support for leading "." in "view engine" setting - * add array support to `res.set()` - * add node 0.8.x to travis.yml - * add "subdomain offset" setting for tweaking `req.subdomains` - * add `res.location(url)` implementing `res.redirect()`-like setting of Location - * use app.get() for x-powered-by setting for inheritance - * fix colons in passwords for `req.auth` - -3.0.6 / 2013-01-04 -================== - - * add http verb methods to Router - * update connect - * fix mangling of the `res.cookie()` options object - * fix jsonp whitespace escape. Closes #1132 - -3.0.5 / 2012-12-19 -================== - - * add throwing when a non-function is passed to a route - * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses - * revert "add 'etag' option" - -3.0.4 / 2012-12-05 -================== - - * add 'etag' option to disable `res.send()` Etags - * add escaping of urls in text/plain in `res.redirect()` - for old browsers interpreting as html - * change crc32 module for a more liberal license - * update connect - -3.0.3 / 2012-11-13 -================== - - * update connect - * update cookie module - * fix cookie max-age - -3.0.2 / 2012-11-08 -================== - - * add OPTIONS to cors example. Closes #1398 - * fix route chaining regression. Closes #1397 - -3.0.1 / 2012-11-01 -================== - - * update connect - -3.0.0 / 2012-10-23 -================== - - * add `make clean` - * add "Basic" check to req.auth - * add `req.auth` test coverage - * add cb && cb(payload) to `res.jsonp()`. Closes #1374 - * add backwards compat for `res.redirect()` status. Closes #1336 - * add support for `res.json()` to retain previously defined Content-Types. Closes #1349 - * update connect - * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382 - * remove non-primitive string support for `res.send()` - * fix view-locals example. Closes #1370 - * fix route-separation example - -3.0.0rc5 / 2012-09-18 -================== - - * update connect - * add redis search example - * add static-files example - * add "x-powered-by" setting (`app.disable('x-powered-by')`) - * add "application/octet-stream" redirect Accept test case. Closes #1317 - -3.0.0rc4 / 2012-08-30 -================== - - * add `res.jsonp()`. Closes #1307 - * add "verbose errors" option to error-pages example - * add another route example to express(1) so people are not so confused - * add redis online user activity tracking example - * update connect dep - * fix etag quoting. Closes #1310 - * fix error-pages 404 status - * fix jsonp callback char restrictions - * remove old OPTIONS default response - -3.0.0rc3 / 2012-08-13 -================== - - * update connect dep - * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds] - * fix `res.render()` clobbering of "locals" - -3.0.0rc2 / 2012-08-03 -================== - - * add CORS example - * update connect dep - * deprecate `.createServer()` & remove old stale examples - * fix: escape `res.redirect()` link - * fix vhost example - -3.0.0rc1 / 2012-07-24 -================== - - * add more examples to view-locals - * add scheme-relative redirects (`res.redirect("//foo.com")`) support - * update cookie dep - * update connect dep - * update send dep - * fix `express(1)` -h flag, use -H for hogan. Closes #1245 - * fix `res.sendfile()` socket error handling regression - -3.0.0beta7 / 2012-07-16 -================== - - * update connect dep for `send()` root normalization regression - -3.0.0beta6 / 2012-07-13 -================== - - * add `err.view` property for view errors. Closes #1226 - * add "jsonp callback name" setting - * add support for "/foo/:bar*" non-greedy matches - * change `res.sendfile()` to use `send()` module - * change `res.send` to use "response-send" module - * remove `app.locals.use` and `res.locals.use`, use regular middleware - -3.0.0beta5 / 2012-07-03 -================== - - * add "make check" support - * add route-map example - * add `res.json(obj, status)` support back for BC - * add "methods" dep, remove internal methods module - * update connect dep - * update auth example to utilize cores pbkdf2 - * updated tests to use "supertest" - -3.0.0beta4 / 2012-06-25 -================== - - * Added `req.auth` - * Added `req.range(size)` - * Added `res.links(obj)` - * Added `res.send(body, status)` support back for backwards compat - * Added `.default()` support to `res.format()` - * Added 2xx / 304 check to `req.fresh` - * Revert "Added + support to the router" - * Fixed `res.send()` freshness check, respect res.statusCode - -3.0.0beta3 / 2012-06-15 -================== - - * Added hogan `--hjs` to express(1) [nullfirm] - * Added another example to content-negotiation - * Added `fresh` dep - * Changed: `res.send()` always checks freshness - * Fixed: expose connects mime module. Closes #1165 - -3.0.0beta2 / 2012-06-06 -================== - - * Added `+` support to the router - * Added `req.host` - * Changed `req.param()` to check route first - * Update connect dep - -3.0.0beta1 / 2012-06-01 -================== - - * Added `res.format()` callback to override default 406 behaviour - * Fixed `res.redirect()` 406. Closes #1154 - -3.0.0alpha5 / 2012-05-30 -================== - - * Added `req.ip` - * Added `{ signed: true }` option to `res.cookie()` - * Removed `res.signedCookie()` - * Changed: dont reverse `req.ips` - * Fixed "trust proxy" setting check for `req.ips` - -3.0.0alpha4 / 2012-05-09 -================== - - * Added: allow `[]` in jsonp callback. Closes #1128 - * Added `PORT` env var support in generated template. Closes #1118 [benatkin] - * Updated: connect 2.2.2 - -3.0.0alpha3 / 2012-05-04 -================== - - * Added public `app.routes`. Closes #887 - * Added _view-locals_ example - * Added _mvc_ example - * Added `res.locals.use()`. Closes #1120 - * Added conditional-GET support to `res.send()` - * Added: coerce `res.set()` values to strings - * Changed: moved `static()` in generated apps below router - * Changed: `res.send()` only set ETag when not previously set - * Changed connect 2.2.1 dep - * Changed: `make test` now runs unit / acceptance tests - * Fixed req/res proto inheritance - -3.0.0alpha2 / 2012-04-26 -================== - - * Added `make benchmark` back - * Added `res.send()` support for `String` objects - * Added client-side data exposing example - * Added `res.header()` and `req.header()` aliases for BC - * Added `express.createServer()` for BC - * Perf: memoize parsed urls - * Perf: connect 2.2.0 dep - * Changed: make `expressInit()` middleware self-aware - * Fixed: use app.get() for all core settings - * Fixed redis session example - * Fixed session example. Closes #1105 - * Fixed generated express dep. Closes #1078 - -3.0.0alpha1 / 2012-04-15 -================== - - * Added `app.locals.use(callback)` - * Added `app.locals` object - * Added `app.locals(obj)` - * Added `res.locals` object - * Added `res.locals(obj)` - * Added `res.format()` for content-negotiation - * Added `app.engine()` - * Added `res.cookie()` JSON cookie support - * Added "trust proxy" setting - * Added `req.subdomains` - * Added `req.protocol` - * Added `req.secure` - * Added `req.path` - * Added `req.ips` - * Added `req.fresh` - * Added `req.stale` - * Added comma-delimited / array support for `req.accepts()` - * Added debug instrumentation - * Added `res.set(obj)` - * Added `res.set(field, value)` - * Added `res.get(field)` - * Added `app.get(setting)`. Closes #842 - * Added `req.acceptsLanguage()` - * Added `req.acceptsCharset()` - * Added `req.accepted` - * Added `req.acceptedLanguages` - * Added `req.acceptedCharsets` - * Added "json replacer" setting - * Added "json spaces" setting - * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92 - * Added `--less` support to express(1) - * Added `express.response` prototype - * Added `express.request` prototype - * Added `express.application` prototype - * Added `app.path()` - * Added `app.render()` - * Added `res.type()` to replace `res.contentType()` - * Changed: `res.redirect()` to add relative support - * Changed: enable "jsonp callback" by default - * Changed: renamed "case sensitive routes" to "case sensitive routing" - * Rewrite of all tests with mocha - * Removed "root" setting - * Removed `res.redirect('home')` support - * Removed `req.notify()` - * Removed `app.register()` - * Removed `app.redirect()` - * Removed `app.is()` - * Removed `app.helpers()` - * Removed `app.dynamicHelpers()` - * Fixed `res.sendfile()` with non-GET. Closes #723 - * Fixed express(1) public dir for windows. Closes #866 - -2.5.9/ 2012-04-02 -================== - - * Added support for PURGE request method [pbuyle] - * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki] - -2.5.8 / 2012-02-08 -================== - - * Update mkdirp dep. Closes #991 - -2.5.7 / 2012-02-06 -================== - - * Fixed `app.all` duplicate DELETE requests [mscdex] - -2.5.6 / 2012-01-13 -================== - - * Updated hamljs dev dep. Closes #953 - -2.5.5 / 2012-01-08 -================== - - * Fixed: set `filename` on cached templates [matthewleon] - -2.5.4 / 2012-01-02 -================== - - * Fixed `express(1)` eol on 0.4.x. Closes #947 - -2.5.3 / 2011-12-30 -================== - - * Fixed `req.is()` when a charset is present - -2.5.2 / 2011-12-10 -================== - - * Fixed: express(1) LF -> CRLF for windows - -2.5.1 / 2011-11-17 -================== - - * Changed: updated connect to 1.8.x - * Removed sass.js support from express(1) - -2.5.0 / 2011-10-24 -================== - - * Added ./routes dir for generated app by default - * Added npm install reminder to express(1) app gen - * Added 0.5.x support - * Removed `make test-cov` since it wont work with node 0.5.x - * Fixed express(1) public dir for windows. Closes #866 - -2.4.7 / 2011-10-05 -================== - - * Added mkdirp to express(1). Closes #795 - * Added simple _json-config_ example - * Added shorthand for the parsed request's pathname via `req.path` - * Changed connect dep to 1.7.x to fix npm issue... - * Fixed `res.redirect()` __HEAD__ support. [reported by xerox] - * Fixed `req.flash()`, only escape args - * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie] - -2.4.6 / 2011-08-22 -================== - - * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode] - -2.4.5 / 2011-08-19 -================== - - * Added support for routes to handle errors. Closes #809 - * Added `app.routes.all()`. Closes #803 - * Added "basepath" setting to work in conjunction with reverse proxies etc. - * Refactored `Route` to use a single array of callbacks - * Added support for multiple callbacks for `app.param()`. Closes #801 -Closes #805 - * Changed: removed .call(self) for route callbacks - * Dependency: `qs >= 0.3.1` - * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808 - -2.4.4 / 2011-08-05 -================== - - * Fixed `res.header()` intention of a set, even when `undefined` - * Fixed `*`, value no longer required - * Fixed `res.send(204)` support. Closes #771 - -2.4.3 / 2011-07-14 -================== - - * Added docs for `status` option special-case. Closes #739 - * Fixed `options.filename`, exposing the view path to template engines - -2.4.2. / 2011-07-06 -================== - - * Revert "removed jsonp stripping" for XSS - -2.4.1 / 2011-07-06 -================== - - * Added `res.json()` JSONP support. Closes #737 - * Added _extending-templates_ example. Closes #730 - * Added "strict routing" setting for trailing slashes - * Added support for multiple envs in `app.configure()` calls. Closes #735 - * Changed: `res.send()` using `res.json()` - * Changed: when cookie `path === null` don't default it - * Changed; default cookie path to "home" setting. Closes #731 - * Removed _pids/logs_ creation from express(1) - -2.4.0 / 2011-06-28 -================== - - * Added chainable `res.status(code)` - * Added `res.json()`, an explicit version of `res.send(obj)` - * Added simple web-service example - -2.3.12 / 2011-06-22 -================== - - * \#express is now on freenode! come join! - * Added `req.get(field, param)` - * Added links to Japanese documentation, thanks @hideyukisaito! - * Added; the `express(1)` generated app outputs the env - * Added `content-negotiation` example - * Dependency: connect >= 1.5.1 < 2.0.0 - * Fixed view layout bug. Closes #720 - * Fixed; ignore body on 304. Closes #701 - -2.3.11 / 2011-06-04 -================== - - * Added `npm test` - * Removed generation of dummy test file from `express(1)` - * Fixed; `express(1)` adds express as a dep - * Fixed; prune on `prepublish` - -2.3.10 / 2011-05-27 -================== - - * Added `req.route`, exposing the current route - * Added _package.json_ generation support to `express(1)` - * Fixed call to `app.param()` function for optional params. Closes #682 - -2.3.9 / 2011-05-25 -================== - - * Fixed bug-ish with `../' in `res.partial()` calls - -2.3.8 / 2011-05-24 -================== - - * Fixed `app.options()` - -2.3.7 / 2011-05-23 -================== - - * Added route `Collection`, ex: `app.get('/user/:id').remove();` - * Added support for `app.param(fn)` to define param logic - * Removed `app.param()` support for callback with return value - * Removed module.parent check from express(1) generated app. Closes #670 - * Refactored router. Closes #639 - -2.3.6 / 2011-05-20 -================== - - * Changed; using devDependencies instead of git submodules - * Fixed redis session example - * Fixed markdown example - * Fixed view caching, should not be enabled in development - -2.3.5 / 2011-05-20 -================== - - * Added export `.view` as alias for `.View` - -2.3.4 / 2011-05-08 -================== - - * Added `./examples/say` - * Fixed `res.sendfile()` bug preventing the transfer of files with spaces - -2.3.3 / 2011-05-03 -================== - - * Added "case sensitive routes" option. - * Changed; split methods supported per rfc [slaskis] - * Fixed route-specific middleware when using the same callback function several times - -2.3.2 / 2011-04-27 -================== - - * Fixed view hints - -2.3.1 / 2011-04-26 -================== - - * Added `app.match()` as `app.match.all()` - * Added `app.lookup()` as `app.lookup.all()` - * Added `app.remove()` for `app.remove.all()` - * Added `app.remove.VERB()` - * Fixed template caching collision issue. Closes #644 - * Moved router over from connect and started refactor - -2.3.0 / 2011-04-25 -================== - - * Added options support to `res.clearCookie()` - * Added `res.helpers()` as alias of `res.locals()` - * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel * Dependency `connect >= 1.4.0` - * Changed; auto set Content-Type in res.attachement [Aaron Heckmann] - * Renamed "cache views" to "view cache". Closes #628 - * Fixed caching of views when using several apps. Closes #637 - * Fixed gotcha invoking `app.param()` callbacks once per route middleware. -Closes #638 - * Fixed partial lookup precedence. Closes #631 -Shaw] - -2.2.2 / 2011-04-12 -================== - - * Added second callback support for `res.download()` connection errors - * Fixed `filename` option passing to template engine - -2.2.1 / 2011-04-04 -================== - - * Added `layout(path)` helper to change the layout within a view. Closes #610 - * Fixed `partial()` collection object support. - Previously only anything with `.length` would work. - When `.length` is present one must still be aware of holes, - however now `{ collection: {foo: 'bar'}}` is valid, exposes - `keyInCollection` and `keysInCollection`. - - * Performance improved with better view caching - * Removed `request` and `response` locals - * Changed; errorHandler page title is now `Express` instead of `Connect` - -2.2.0 / 2011-03-30 -================== - - * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606 - * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606 - * Added `app.VERB(path)` as alias of `app.lookup.VERB()`. - * Dependency `connect >= 1.2.0` - -2.1.1 / 2011-03-29 -================== - - * Added; expose `err.view` object when failing to locate a view - * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann] - * Fixed; `res.send(undefined)` responds with 204 [aheckmann] - -2.1.0 / 2011-03-24 -================== - - * Added `/_?` partial lookup support. Closes #447 - * Added `request`, `response`, and `app` local variables - * Added `settings` local variable, containing the app's settings - * Added `req.flash()` exception if `req.session` is not available - * Added `res.send(bool)` support (json response) - * Fixed stylus example for latest version - * Fixed; wrap try/catch around `res.render()` - -2.0.0 / 2011-03-17 -================== - - * Fixed up index view path alternative. - * Changed; `res.locals()` without object returns the locals - -2.0.0rc3 / 2011-03-17 -================== - - * Added `res.locals(obj)` to compliment `res.local(key, val)` - * Added `res.partial()` callback support - * Fixed recursive error reporting issue in `res.render()` - -2.0.0rc2 / 2011-03-17 -================== - - * Changed; `partial()` "locals" are now optional - * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01] - * Fixed .filename view engine option [reported by drudge] - * Fixed blog example - * Fixed `{req,res}.app` reference when mounting [Ben Weaver] - -2.0.0rc / 2011-03-14 -================== - - * Fixed; expose `HTTPSServer` constructor - * Fixed express(1) default test charset. Closes #579 [reported by secoif] - * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP] - -2.0.0beta3 / 2011-03-09 -================== - - * Added support for `res.contentType()` literal - The original `res.contentType('.json')`, - `res.contentType('application/json')`, and `res.contentType('json')` - will work now. - * Added `res.render()` status option support back - * Added charset option for `res.render()` - * Added `.charset` support (via connect 1.0.4) - * Added view resolution hints when in development and a lookup fails - * Added layout lookup support relative to the page view. - For example while rendering `./views/user/index.jade` if you create - `./views/user/layout.jade` it will be used in favour of the root layout. - * Fixed `res.redirect()`. RFC states absolute url [reported by unlink] - * Fixed; default `res.send()` string charset to utf8 - * Removed `Partial` constructor (not currently used) - -2.0.0beta2 / 2011-03-07 -================== - - * Added res.render() `.locals` support back to aid in migration process - * Fixed flash example - -2.0.0beta / 2011-03-03 -================== - - * Added HTTPS support - * Added `res.cookie()` maxAge support - * Added `req.header()` _Referrer_ / _Referer_ special-case, either works - * Added mount support for `res.redirect()`, now respects the mount-point - * Added `union()` util, taking place of `merge(clone())` combo - * Added stylus support to express(1) generated app - * Added secret to session middleware used in examples and generated app - * Added `res.local(name, val)` for progressive view locals - * Added default param support to `req.param(name, default)` - * Added `app.disabled()` and `app.enabled()` - * Added `app.register()` support for omitting leading ".", either works - * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539 - * Added `app.param()` to map route params to async/sync logic - * Added; aliased `app.helpers()` as `app.locals()`. Closes #481 - * Added extname with no leading "." support to `res.contentType()` - * Added `cache views` setting, defaulting to enabled in "production" env - * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_. - * Added `req.accepts()` support for extensions - * Changed; `res.download()` and `res.sendfile()` now utilize Connect's - static file server `connect.static.send()`. - * Changed; replaced `connect.utils.mime()` with npm _mime_ module - * Changed; allow `req.query` to be pre-defined (via middleware or other parent - * Changed view partial resolution, now relative to parent view - * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`. - * Fixed `req.param()` bug returning Array.prototype methods. Closes #552 - * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()` - * Fixed; using _qs_ module instead of _querystring_ - * Fixed; strip unsafe chars from jsonp callbacks - * Removed "stream threshold" setting - -1.0.8 / 2011-03-01 -================== - - * Allow `req.query` to be pre-defined (via middleware or other parent app) - * "connect": ">= 0.5.0 < 1.0.0". Closes #547 - * Removed the long deprecated __EXPRESS_ENV__ support - -1.0.7 / 2011-02-07 -================== - - * Fixed `render()` setting inheritance. - Mounted apps would not inherit "view engine" - -1.0.6 / 2011-02-07 -================== - - * Fixed `view engine` setting bug when period is in dirname - -1.0.5 / 2011-02-05 -================== - - * Added secret to generated app `session()` call - -1.0.4 / 2011-02-05 -================== - - * Added `qs` dependency to _package.json_ - * Fixed namespaced `require()`s for latest connect support - -1.0.3 / 2011-01-13 -================== - - * Remove unsafe characters from JSONP callback names [Ryan Grove] - -1.0.2 / 2011-01-10 -================== - - * Removed nested require, using `connect.router` - -1.0.1 / 2010-12-29 -================== - - * Fixed for middleware stacked via `createServer()` - previously the `foo` middleware passed to `createServer(foo)` - would not have access to Express methods such as `res.send()` - or props like `req.query` etc. - -1.0.0 / 2010-11-16 -================== - - * Added; deduce partial object names from the last segment. - For example by default `partial('forum/post', postObject)` will - give you the _post_ object, providing a meaningful default. - * Added http status code string representation to `res.redirect()` body - * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__. - * Added `req.is()` to aid in content negotiation - * Added partial local inheritance [suggested by masylum]. Closes #102 - providing access to parent template locals. - * Added _-s, --session[s]_ flag to express(1) to add session related middleware - * Added _--template_ flag to express(1) to specify the - template engine to use. - * Added _--css_ flag to express(1) to specify the - stylesheet engine to use (or just plain css by default). - * Added `app.all()` support [thanks aheckmann] - * Added partial direct object support. - You may now `partial('user', user)` providing the "user" local, - vs previously `partial('user', { object: user })`. - * Added _route-separation_ example since many people question ways - to do this with CommonJS modules. Also view the _blog_ example for - an alternative. - * Performance; caching view path derived partial object names - * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454 - * Fixed jsonp support; _text/javascript_ as per mailinglist discussion - -1.0.0rc4 / 2010-10-14 -================== - - * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0 - * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware)) - * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass] - * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass] - * Added `partial()` support for array-like collections. Closes #434 - * Added support for swappable querystring parsers - * Added session usage docs. Closes #443 - * Added dynamic helper caching. Closes #439 [suggested by maritz] - * Added authentication example - * Added basic Range support to `res.sendfile()` (and `res.download()` etc) - * Changed; `express(1)` generated app using 2 spaces instead of 4 - * Default env to "development" again [aheckmann] - * Removed _context_ option is no more, use "scope" - * Fixed; exposing _./support_ libs to examples so they can run without installs - * Fixed mvc example - -1.0.0rc3 / 2010-09-20 -================== - - * Added confirmation for `express(1)` app generation. Closes #391 - * Added extending of flash formatters via `app.flashFormatters` - * Added flash formatter support. Closes #411 - * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold" - * Added _stream threshold_ setting for `res.sendfile()` - * Added `res.send()` __HEAD__ support - * Added `res.clearCookie()` - * Added `res.cookie()` - * Added `res.render()` headers option - * Added `res.redirect()` response bodies - * Added `res.render()` status option support. Closes #425 [thanks aheckmann] - * Fixed `res.sendfile()` responding with 403 on malicious path - * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_ - * Fixed; mounted apps settings now inherit from parent app [aheckmann] - * Fixed; stripping Content-Length / Content-Type when 204 - * Fixed `res.send()` 204. Closes #419 - * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402 - * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo] - - -1.0.0rc2 / 2010-08-17 -================== - - * Added `app.register()` for template engine mapping. Closes #390 - * Added `res.render()` callback support as second argument (no options) - * Added callback support to `res.download()` - * Added callback support for `res.sendfile()` - * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()` - * Added "partials" setting to docs - * Added default expresso tests to `express(1)` generated app. Closes #384 - * Fixed `res.sendfile()` error handling, defer via `next()` - * Fixed `res.render()` callback when a layout is used [thanks guillermo] - * Fixed; `make install` creating ~/.node_libraries when not present - * Fixed issue preventing error handlers from being defined anywhere. Closes #387 - -1.0.0rc / 2010-07-28 -================== - - * Added mounted hook. Closes #369 - * Added connect dependency to _package.json_ - - * Removed "reload views" setting and support code - development env never caches, production always caches. - - * Removed _param_ in route callbacks, signature is now - simply (req, res, next), previously (req, res, params, next). - Use _req.params_ for path captures, _req.query_ for GET params. - - * Fixed "home" setting - * Fixed middleware/router precedence issue. Closes #366 - * Fixed; _configure()_ callbacks called immediately. Closes #368 - -1.0.0beta2 / 2010-07-23 -================== - - * Added more examples - * Added; exporting `Server` constructor - * Added `Server#helpers()` for view locals - * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349 - * Added support for absolute view paths - * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363 - * Added Guillermo Rauch to the contributor list - * Added support for "as" for non-collection partials. Closes #341 - * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf] - * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo] - * Fixed instanceof `Array` checks, now `Array.isArray()` - * Fixed express(1) expansion of public dirs. Closes #348 - * Fixed middleware precedence. Closes #345 - * Fixed view watcher, now async [thanks aheckmann] - -1.0.0beta / 2010-07-15 -================== - - * Re-write - - much faster - - much lighter - - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs - -0.14.0 / 2010-06-15 -================== - - * Utilize relative requires - * Added Static bufferSize option [aheckmann] - * Fixed caching of view and partial subdirectories [aheckmann] - * Fixed mime.type() comments now that ".ext" is not supported - * Updated haml submodule - * Updated class submodule - * Removed bin/express - -0.13.0 / 2010-06-01 -================== - - * Added node v0.1.97 compatibility - * Added support for deleting cookies via Request#cookie('key', null) - * Updated haml submodule - * Fixed not-found page, now using using charset utf-8 - * Fixed show-exceptions page, now using using charset utf-8 - * Fixed view support due to fs.readFile Buffers - * Changed; mime.type() no longer accepts ".type" due to node extname() changes - -0.12.0 / 2010-05-22 -================== - - * Added node v0.1.96 compatibility - * Added view `helpers` export which act as additional local variables - * Updated haml submodule - * Changed ETag; removed inode, modified time only - * Fixed LF to CRLF for setting multiple cookies - * Fixed cookie compilation; values are now urlencoded - * Fixed cookies parsing; accepts quoted values and url escaped cookies - -0.11.0 / 2010-05-06 -================== - - * Added support for layouts using different engines - - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' }) - - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml' - - this.render('page.html.haml', { layout: false }) // no layout - * Updated ext submodule - * Updated haml submodule - * Fixed EJS partial support by passing along the context. Issue #307 - -0.10.1 / 2010-05-03 -================== - - * Fixed binary uploads. - -0.10.0 / 2010-04-30 -================== - - * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s - encoding is set to 'utf8' or 'utf-8'. - * Added "encoding" option to Request#render(). Closes #299 - * Added "dump exceptions" setting, which is enabled by default. - * Added simple ejs template engine support - * Added error response support for text/plain, application/json. Closes #297 - * Added callback function param to Request#error() - * Added Request#sendHead() - * Added Request#stream() - * Added support for Request#respond(304, null) for empty response bodies - * Added ETag support to Request#sendfile() - * Added options to Request#sendfile(), passed to fs.createReadStream() - * Added filename arg to Request#download() - * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request - * Performance enhanced by preventing several calls to toLowerCase() in Router#match() - * Changed; Request#sendfile() now streams - * Changed; Renamed Request#halt() to Request#respond(). Closes #289 - * Changed; Using sys.inspect() instead of JSON.encode() for error output - * Changed; run() returns the http.Server instance. Closes #298 - * Changed; Defaulting Server#host to null (INADDR_ANY) - * Changed; Logger "common" format scale of 0.4f - * Removed Logger "request" format - * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found - * Fixed several issues with http client - * Fixed Logger Content-Length output - * Fixed bug preventing Opera from retaining the generated session id. Closes #292 - -0.9.0 / 2010-04-14 -================== - - * Added DSL level error() route support - * Added DSL level notFound() route support - * Added Request#error() - * Added Request#notFound() - * Added Request#render() callback function. Closes #258 - * Added "max upload size" setting - * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254 - * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js - * Added callback function support to Request#halt() as 3rd/4th arg - * Added preprocessing of route param wildcards using param(). Closes #251 - * Added view partial support (with collections etc) - * Fixed bug preventing falsey params (such as ?page=0). Closes #286 - * Fixed setting of multiple cookies. Closes #199 - * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml) - * Changed; session cookie is now httpOnly - * Changed; Request is no longer global - * Changed; Event is no longer global - * Changed; "sys" module is no longer global - * Changed; moved Request#download to Static plugin where it belongs - * Changed; Request instance created before body parsing. Closes #262 - * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253 - * Changed; Pre-caching view partials in memory when "cache view partials" is enabled - * Updated support to node --version 0.1.90 - * Updated dependencies - * Removed set("session cookie") in favour of use(Session, { cookie: { ... }}) - * Removed utils.mixin(); use Object#mergeDeep() - -0.8.0 / 2010-03-19 -================== - - * Added coffeescript example app. Closes #242 - * Changed; cache api now async friendly. Closes #240 - * Removed deprecated 'express/static' support. Use 'express/plugins/static' - -0.7.6 / 2010-03-19 -================== - - * Added Request#isXHR. Closes #229 - * Added `make install` (for the executable) - * Added `express` executable for setting up simple app templates - * Added "GET /public/*" to Static plugin, defaulting to /public - * Added Static plugin - * Fixed; Request#render() only calls cache.get() once - * Fixed; Namespacing View caches with "view:" - * Fixed; Namespacing Static caches with "static:" - * Fixed; Both example apps now use the Static plugin - * Fixed set("views"). Closes #239 - * Fixed missing space for combined log format - * Deprecated Request#sendfile() and 'express/static' - * Removed Server#running - -0.7.5 / 2010-03-16 -================== - - * Added Request#flash() support without args, now returns all flashes - * Updated ext submodule - -0.7.4 / 2010-03-16 -================== - - * Fixed session reaper - * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft) - -0.7.3 / 2010-03-16 -================== - - * Added package.json - * Fixed requiring of haml / sass due to kiwi removal - -0.7.2 / 2010-03-16 -================== - - * Fixed GIT submodules (HAH!) - -0.7.1 / 2010-03-16 -================== - - * Changed; Express now using submodules again until a PM is adopted - * Changed; chat example using millisecond conversions from ext - -0.7.0 / 2010-03-15 -================== - - * Added Request#pass() support (finds the next matching route, or the given path) - * Added Logger plugin (default "common" format replaces CommonLogger) - * Removed Profiler plugin - * Removed CommonLogger plugin - -0.6.0 / 2010-03-11 -================== - - * Added seed.yml for kiwi package management support - * Added HTTP client query string support when method is GET. Closes #205 - - * Added support for arbitrary view engines. - For example "foo.engine.html" will now require('engine'), - the exports from this module are cached after the first require(). - - * Added async plugin support - - * Removed usage of RESTful route funcs as http client - get() etc, use http.get() and friends - - * Removed custom exceptions - -0.5.0 / 2010-03-10 -================== - - * Added ext dependency (library of js extensions) - * Removed extname() / basename() utils. Use path module - * Removed toArray() util. Use arguments.values - * Removed escapeRegexp() util. Use RegExp.escape() - * Removed process.mixin() dependency. Use utils.mixin() - * Removed Collection - * Removed ElementCollection - * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com) ;) - -0.4.0 / 2010-02-11 -================== - - * Added flash() example to sample upload app - * Added high level restful http client module (express/http) - * Changed; RESTful route functions double as HTTP clients. Closes #69 - * Changed; throwing error when routes are added at runtime - * Changed; defaulting render() context to the current Request. Closes #197 - * Updated haml submodule - -0.3.0 / 2010-02-11 -================== - - * Updated haml / sass submodules. Closes #200 - * Added flash message support. Closes #64 - * Added accepts() now allows multiple args. fixes #117 - * Added support for plugins to halt. Closes #189 - * Added alternate layout support. Closes #119 - * Removed Route#run(). Closes #188 - * Fixed broken specs due to use(Cookie) missing - -0.2.1 / 2010-02-05 -================== - - * Added "plot" format option for Profiler (for gnuplot processing) - * Added request number to Profiler plugin - * Fixed binary encoding for multipart file uploads, was previously defaulting to UTF8 - * Fixed issue with routes not firing when not files are present. Closes #184 - * Fixed process.Promise -> events.Promise - -0.2.0 / 2010-02-03 -================== - - * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180 - * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174 - * Added expiration support to cache api with reaper. Closes #133 - * Added cache Store.Memory#reap() - * Added Cache; cache api now uses first class Cache instances - * Added abstract session Store. Closes #172 - * Changed; cache Memory.Store#get() utilizing Collection - * Renamed MemoryStore -> Store.Memory - * Fixed use() of the same plugin several time will always use latest options. Closes #176 - -0.1.0 / 2010-02-03 -================== - - * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context - * Updated node support to 0.1.27 Closes #169 - * Updated dirname(__filename) -> __dirname - * Updated libxmljs support to v0.2.0 - * Added session support with memory store / reaping - * Added quick uid() helper - * Added multi-part upload support - * Added Sass.js support / submodule - * Added production env caching view contents and static files - * Added static file caching. Closes #136 - * Added cache plugin with memory stores - * Added support to StaticFile so that it works with non-textual files. - * Removed dirname() helper - * Removed several globals (now their modules must be required) - -0.0.2 / 2010-01-10 -================== - - * Added view benchmarks; currently haml vs ejs - * Added Request#attachment() specs. Closes #116 - * Added use of node's parseQuery() util. Closes #123 - * Added `make init` for submodules - * Updated Haml - * Updated sample chat app to show messages on load - * Updated libxmljs parseString -> parseHtmlString - * Fixed `make init` to work with older versions of git - * Fixed specs can now run independent specs for those who can't build deps. Closes #127 - * Fixed issues introduced by the node url module changes. Closes 126. - * Fixed two assertions failing due to Collection#keys() returning strings - * Fixed faulty Collection#toArray() spec due to keys() returning strings - * Fixed `make test` now builds libxmljs.node before testing - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/project starter code/node_modules/express/Readme.md b/project starter code/node_modules/express/Readme.md deleted file mode 100644 index 0936816b..00000000 --- a/project starter code/node_modules/express/Readme.md +++ /dev/null @@ -1,166 +0,0 @@ -[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/) - - Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org). - - [![NPM Version][npm-version-image]][npm-url] - [![NPM Install Size][npm-install-size-image]][npm-install-size-url] - [![NPM Downloads][npm-downloads-image]][npm-downloads-url] - -```js -const express = require('express') -const app = express() - -app.get('/', function (req, res) { - res.send('Hello World') -}) - -app.listen(3000) -``` - -## Installation - -This is a [Node.js](https://nodejs.org/en/) module available through the -[npm registry](https://www.npmjs.com/). - -Before installing, [download and install Node.js](https://nodejs.org/en/download/). -Node.js 0.10 or higher is required. - -If this is a brand new project, make sure to create a `package.json` first with -the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file). - -Installation is done using the -[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): - -```console -$ npm install express -``` - -Follow [our installing guide](http://expressjs.com/en/starter/installing.html) -for more information. - -## Features - - * Robust routing - * Focus on high performance - * Super-high test coverage - * HTTP helpers (redirection, caching, etc) - * View system supporting 14+ template engines - * Content negotiation - * Executable for generating applications quickly - -## Docs & Community - - * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)] - * [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC - * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules - * Visit the [Wiki](https://github.com/expressjs/express/wiki) - * [Google Group](https://groups.google.com/group/express-js) for discussion - * [Gitter](https://gitter.im/expressjs/express) for support and discussion - -**PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/expressjs/express/wiki/New-features-in-4.x). - -## Quick Start - - The quickest way to get started with express is to utilize the executable [`express(1)`](https://github.com/expressjs/generator) to generate an application as shown below: - - Install the executable. The executable's major version will match Express's: - -```console -$ npm install -g express-generator@4 -``` - - Create the app: - -```console -$ express /tmp/foo && cd /tmp/foo -``` - - Install dependencies: - -```console -$ npm install -``` - - Start the server: - -```console -$ npm start -``` - - View the website at: http://localhost:3000 - -## Philosophy - - The Express philosophy is to provide small, robust tooling for HTTP servers, making - it a great solution for single page applications, websites, hybrids, or public - HTTP APIs. - - Express does not force you to use any specific ORM or template engine. With support for over - 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js), - you can quickly craft your perfect framework. - -## Examples - - To view the examples, clone the Express repo and install the dependencies: - -```console -$ git clone git://github.com/expressjs/express.git --depth 1 -$ cd express -$ npm install -``` - - Then run whichever example you want: - -```console -$ node examples/content-negotiation -``` - -## Contributing - - [![Linux Build][github-actions-ci-image]][github-actions-ci-url] - [![Windows Build][appveyor-image]][appveyor-url] - [![Test Coverage][coveralls-image]][coveralls-url] - -The Express.js project welcomes all constructive contributions. Contributions take many forms, -from code for bug fixes and enhancements, to additions and fixes to documentation, additional -tests, triaging incoming pull requests and issues, and more! - -See the [Contributing Guide](Contributing.md) for more technical details on contributing. - -### Security Issues - -If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md). - -### Running Tests - -To run the test suite, first install the dependencies, then run `npm test`: - -```console -$ npm install -$ npm test -``` - -## People - -The original author of Express is [TJ Holowaychuk](https://github.com/tj) - -The current lead maintainer is [Douglas Christopher Wilson](https://github.com/dougwilson) - -[List of all contributors](https://github.com/expressjs/express/graphs/contributors) - -## License - - [MIT](LICENSE) - -[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/express/master?label=windows -[appveyor-url]: https://ci.appveyor.com/project/dougwilson/express -[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master -[coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master -[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=linux -[github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml -[npm-downloads-image]: https://badgen.net/npm/dm/express -[npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true -[npm-install-size-image]: https://badgen.net/packagephobia/install/express -[npm-install-size-url]: https://packagephobia.com/result?p=express -[npm-url]: https://npmjs.org/package/express -[npm-version-image]: https://badgen.net/npm/v/express diff --git a/project starter code/node_modules/express/index.js b/project starter code/node_modules/express/index.js deleted file mode 100644 index 6551c202..00000000 --- a/project starter code/node_modules/express/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * express - * Copyright(c) 2009-2013 TJ Holowaychuk - * Copyright(c) 2013 Roman Shtylman - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict'; - -module.exports = require('express/lib/express'); diff --git a/project starter code/node_modules/express/lib/router/index.js b/project starter code/node_modules/express/lib/router/index.js deleted file mode 100644 index 5174c34f..00000000 --- a/project starter code/node_modules/express/lib/router/index.js +++ /dev/null @@ -1,673 +0,0 @@ -/*! - * express - * Copyright(c) 2009-2013 TJ Holowaychuk - * Copyright(c) 2013 Roman Shtylman - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict'; - -/** - * Module dependencies. - * @private - */ - -var Route = require('./route'); -var Layer = require('./layer'); -var methods = require('methods'); -var mixin = require('utils-merge'); -var debug = require('debug')('express:router'); -var deprecate = require('depd')('express'); -var flatten = require('array-flatten'); -var parseUrl = require('parseurl'); -var setPrototypeOf = require('setprototypeof') - -/** - * Module variables. - * @private - */ - -var objectRegExp = /^\[object (\S+)\]$/; -var slice = Array.prototype.slice; -var toString = Object.prototype.toString; - -/** - * Initialize a new `Router` with the given `options`. - * - * @param {Object} [options] - * @return {Router} which is an callable function - * @public - */ - -var proto = module.exports = function(options) { - var opts = options || {}; - - function router(req, res, next) { - router.handle(req, res, next); - } - - // mixin Router class functions - setPrototypeOf(router, proto) - - router.params = {}; - router._params = []; - router.caseSensitive = opts.caseSensitive; - router.mergeParams = opts.mergeParams; - router.strict = opts.strict; - router.stack = []; - - return router; -}; - -/** - * Map the given param placeholder `name`(s) to the given callback. - * - * Parameter mapping is used to provide pre-conditions to routes - * which use normalized placeholders. For example a _:user_id_ parameter - * could automatically load a user's information from the database without - * any additional code, - * - * The callback uses the same signature as middleware, the only difference - * being that the value of the placeholder is passed, in this case the _id_ - * of the user. Once the `next()` function is invoked, just like middleware - * it will continue on to execute the route, or subsequent parameter functions. - * - * Just like in middleware, you must either respond to the request or call next - * to avoid stalling the request. - * - * app.param('user_id', function(req, res, next, id){ - * User.find(id, function(err, user){ - * if (err) { - * return next(err); - * } else if (!user) { - * return next(new Error('failed to load user')); - * } - * req.user = user; - * next(); - * }); - * }); - * - * @param {String} name - * @param {Function} fn - * @return {app} for chaining - * @public - */ - -proto.param = function param(name, fn) { - // param logic - if (typeof name === 'function') { - deprecate('router.param(fn): Refactor to use path params'); - this._params.push(name); - return; - } - - // apply param functions - var params = this._params; - var len = params.length; - var ret; - - if (name[0] === ':') { - deprecate('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.slice(1)) + ', fn) instead') - name = name.slice(1) - } - - for (var i = 0; i < len; ++i) { - if (ret = params[i](name, fn)) { - fn = ret; - } - } - - // ensure we end up with a - // middleware function - if ('function' !== typeof fn) { - throw new Error('invalid param() call for ' + name + ', got ' + fn); - } - - (this.params[name] = this.params[name] || []).push(fn); - return this; -}; - -/** - * Dispatch a req, res into the router. - * @private - */ - -proto.handle = function handle(req, res, out) { - var self = this; - - debug('dispatching %s %s', req.method, req.url); - - var idx = 0; - var protohost = getProtohost(req.url) || '' - var removed = ''; - var slashAdded = false; - var sync = 0 - var paramcalled = {}; - - // store options for OPTIONS request - // only used if OPTIONS request - var options = []; - - // middleware and routes - var stack = self.stack; - - // manage inter-router variables - var parentParams = req.params; - var parentUrl = req.baseUrl || ''; - var done = restore(out, req, 'baseUrl', 'next', 'params'); - - // setup next layer - req.next = next; - - // for options requests, respond with a default if nothing else responds - if (req.method === 'OPTIONS') { - done = wrap(done, function(old, err) { - if (err || options.length === 0) return old(err); - sendOptionsResponse(res, options, old); - }); - } - - // setup basic req values - req.baseUrl = parentUrl; - req.originalUrl = req.originalUrl || req.url; - - next(); - - function next(err) { - var layerError = err === 'route' - ? null - : err; - - // remove added slash - if (slashAdded) { - req.url = req.url.slice(1) - slashAdded = false; - } - - // restore altered req.url - if (removed.length !== 0) { - req.baseUrl = parentUrl; - req.url = protohost + removed + req.url.slice(protohost.length) - removed = ''; - } - - // signal to exit router - if (layerError === 'router') { - setImmediate(done, null) - return - } - - // no more matching layers - if (idx >= stack.length) { - setImmediate(done, layerError); - return; - } - - // max sync stack - if (++sync > 100) { - return setImmediate(next, err) - } - - // get pathname of request - var path = getPathname(req); - - if (path == null) { - return done(layerError); - } - - // find next matching layer - var layer; - var match; - var route; - - while (match !== true && idx < stack.length) { - layer = stack[idx++]; - match = matchLayer(layer, path); - route = layer.route; - - if (typeof match !== 'boolean') { - // hold on to layerError - layerError = layerError || match; - } - - if (match !== true) { - continue; - } - - if (!route) { - // process non-route handlers normally - continue; - } - - if (layerError) { - // routes do not match with a pending error - match = false; - continue; - } - - var method = req.method; - var has_method = route._handles_method(method); - - // build up automatic options response - if (!has_method && method === 'OPTIONS') { - appendMethods(options, route._options()); - } - - // don't even bother matching route - if (!has_method && method !== 'HEAD') { - match = false; - } - } - - // no match - if (match !== true) { - return done(layerError); - } - - // store route for dispatch on change - if (route) { - req.route = route; - } - - // Capture one-time layer values - req.params = self.mergeParams - ? mergeParams(layer.params, parentParams) - : layer.params; - var layerPath = layer.path; - - // this should be done for the layer - self.process_params(layer, paramcalled, req, res, function (err) { - if (err) { - next(layerError || err) - } else if (route) { - layer.handle_request(req, res, next) - } else { - trim_prefix(layer, layerError, layerPath, path) - } - - sync = 0 - }); - } - - function trim_prefix(layer, layerError, layerPath, path) { - if (layerPath.length !== 0) { - // Validate path is a prefix match - if (layerPath !== path.slice(0, layerPath.length)) { - next(layerError) - return - } - - // Validate path breaks on a path separator - var c = path[layerPath.length] - if (c && c !== '/' && c !== '.') return next(layerError) - - // Trim off the part of the url that matches the route - // middleware (.use stuff) needs to have the path stripped - debug('trim prefix (%s) from url %s', layerPath, req.url); - removed = layerPath; - req.url = protohost + req.url.slice(protohost.length + removed.length) - - // Ensure leading slash - if (!protohost && req.url[0] !== '/') { - req.url = '/' + req.url; - slashAdded = true; - } - - // Setup base URL (no trailing slash) - req.baseUrl = parentUrl + (removed[removed.length - 1] === '/' - ? removed.substring(0, removed.length - 1) - : removed); - } - - debug('%s %s : %s', layer.name, layerPath, req.originalUrl); - - if (layerError) { - layer.handle_error(layerError, req, res, next); - } else { - layer.handle_request(req, res, next); - } - } -}; - -/** - * Process any parameters for the layer. - * @private - */ - -proto.process_params = function process_params(layer, called, req, res, done) { - var params = this.params; - - // captured parameters from the layer, keys and values - var keys = layer.keys; - - // fast track - if (!keys || keys.length === 0) { - return done(); - } - - var i = 0; - var name; - var paramIndex = 0; - var key; - var paramVal; - var paramCallbacks; - var paramCalled; - - // process params in order - // param callbacks can be async - function param(err) { - if (err) { - return done(err); - } - - if (i >= keys.length ) { - return done(); - } - - paramIndex = 0; - key = keys[i++]; - name = key.name; - paramVal = req.params[name]; - paramCallbacks = params[name]; - paramCalled = called[name]; - - if (paramVal === undefined || !paramCallbacks) { - return param(); - } - - // param previously called with same value or error occurred - if (paramCalled && (paramCalled.match === paramVal - || (paramCalled.error && paramCalled.error !== 'route'))) { - // restore value - req.params[name] = paramCalled.value; - - // next param - return param(paramCalled.error); - } - - called[name] = paramCalled = { - error: null, - match: paramVal, - value: paramVal - }; - - paramCallback(); - } - - // single param callbacks - function paramCallback(err) { - var fn = paramCallbacks[paramIndex++]; - - // store updated value - paramCalled.value = req.params[key.name]; - - if (err) { - // store error - paramCalled.error = err; - param(err); - return; - } - - if (!fn) return param(); - - try { - fn(req, res, paramCallback, paramVal, key.name); - } catch (e) { - paramCallback(e); - } - } - - param(); -}; - -/** - * Use the given middleware function, with optional path, defaulting to "/". - * - * Use (like `.all`) will run for any http METHOD, but it will not add - * handlers for those methods so OPTIONS requests will not consider `.use` - * functions even if they could respond. - * - * The other difference is that _route_ path is stripped and not visible - * to the handler function. The main effect of this feature is that mounted - * handlers can operate without any code changes regardless of the "prefix" - * pathname. - * - * @public - */ - -proto.use = function use(fn) { - var offset = 0; - var path = '/'; - - // default path to '/' - // disambiguate router.use([fn]) - if (typeof fn !== 'function') { - var arg = fn; - - while (Array.isArray(arg) && arg.length !== 0) { - arg = arg[0]; - } - - // first arg is the path - if (typeof arg !== 'function') { - offset = 1; - path = fn; - } - } - - var callbacks = flatten(slice.call(arguments, offset)); - - if (callbacks.length === 0) { - throw new TypeError('Router.use() requires a middleware function') - } - - for (var i = 0; i < callbacks.length; i++) { - var fn = callbacks[i]; - - if (typeof fn !== 'function') { - throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn)) - } - - // add the middleware - debug('use %o %s', path, fn.name || '') - - var layer = new Layer(path, { - sensitive: this.caseSensitive, - strict: false, - end: false - }, fn); - - layer.route = undefined; - - this.stack.push(layer); - } - - return this; -}; - -/** - * Create a new Route for the given path. - * - * Each route contains a separate middleware stack and VERB handlers. - * - * See the Route api documentation for details on adding handlers - * and middleware to routes. - * - * @param {String} path - * @return {Route} - * @public - */ - -proto.route = function route(path) { - var route = new Route(path); - - var layer = new Layer(path, { - sensitive: this.caseSensitive, - strict: this.strict, - end: true - }, route.dispatch.bind(route)); - - layer.route = route; - - this.stack.push(layer); - return route; -}; - -// create Router#VERB functions -methods.concat('all').forEach(function(method){ - proto[method] = function(path){ - var route = this.route(path) - route[method].apply(route, slice.call(arguments, 1)); - return this; - }; -}); - -// append methods to a list of methods -function appendMethods(list, addition) { - for (var i = 0; i < addition.length; i++) { - var method = addition[i]; - if (list.indexOf(method) === -1) { - list.push(method); - } - } -} - -// get pathname of request -function getPathname(req) { - try { - return parseUrl(req).pathname; - } catch (err) { - return undefined; - } -} - -// Get get protocol + host for a URL -function getProtohost(url) { - if (typeof url !== 'string' || url.length === 0 || url[0] === '/') { - return undefined - } - - var searchIndex = url.indexOf('?') - var pathLength = searchIndex !== -1 - ? searchIndex - : url.length - var fqdnIndex = url.slice(0, pathLength).indexOf('://') - - return fqdnIndex !== -1 - ? url.substring(0, url.indexOf('/', 3 + fqdnIndex)) - : undefined -} - -// get type for error message -function gettype(obj) { - var type = typeof obj; - - if (type !== 'object') { - return type; - } - - // inspect [[Class]] for objects - return toString.call(obj) - .replace(objectRegExp, '$1'); -} - -/** - * Match path to a layer. - * - * @param {Layer} layer - * @param {string} path - * @private - */ - -function matchLayer(layer, path) { - try { - return layer.match(path); - } catch (err) { - return err; - } -} - -// merge params with parent params -function mergeParams(params, parent) { - if (typeof parent !== 'object' || !parent) { - return params; - } - - // make copy of parent for base - var obj = mixin({}, parent); - - // simple non-numeric merging - if (!(0 in params) || !(0 in parent)) { - return mixin(obj, params); - } - - var i = 0; - var o = 0; - - // determine numeric gaps - while (i in params) { - i++; - } - - while (o in parent) { - o++; - } - - // offset numeric indices in params before merge - for (i--; i >= 0; i--) { - params[i + o] = params[i]; - - // create holes for the merge when necessary - if (i < o) { - delete params[i]; - } - } - - return mixin(obj, params); -} - -// restore obj props after function -function restore(fn, obj) { - var props = new Array(arguments.length - 2); - var vals = new Array(arguments.length - 2); - - for (var i = 0; i < props.length; i++) { - props[i] = arguments[i + 2]; - vals[i] = obj[props[i]]; - } - - return function () { - // restore vals - for (var i = 0; i < props.length; i++) { - obj[props[i]] = vals[i]; - } - - return fn.apply(this, arguments); - }; -} - -// send an OPTIONS response -function sendOptionsResponse(res, options, next) { - try { - var body = options.join(','); - res.set('Allow', body); - res.send(body); - } catch (err) { - next(err); - } -} - -// wrap a function -function wrap(old, fn) { - return function proxy() { - var args = new Array(arguments.length + 1); - - args[0] = old; - for (var i = 0, len = arguments.length; i < len; i++) { - args[i + 1] = arguments[i]; - } - - fn.apply(this, args); - }; -} diff --git a/project starter code/node_modules/express/lib/utils.js b/project starter code/node_modules/express/lib/utils.js deleted file mode 100644 index 799a6a2b..00000000 --- a/project starter code/node_modules/express/lib/utils.js +++ /dev/null @@ -1,304 +0,0 @@ -/*! - * express - * Copyright(c) 2009-2013 TJ Holowaychuk - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict'; - -/** - * Module dependencies. - * @api private - */ - -var Buffer = require('safe-buffer').Buffer -var contentDisposition = require('content-disposition'); -var contentType = require('content-type'); -var deprecate = require('depd')('express'); -var flatten = require('array-flatten'); -var mime = require('send').mime; -var etag = require('etag'); -var proxyaddr = require('proxy-addr'); -var qs = require('qs'); -var querystring = require('querystring'); - -/** - * Return strong ETag for `body`. - * - * @param {String|Buffer} body - * @param {String} [encoding] - * @return {String} - * @api private - */ - -exports.etag = createETagGenerator({ weak: false }) - -/** - * Return weak ETag for `body`. - * - * @param {String|Buffer} body - * @param {String} [encoding] - * @return {String} - * @api private - */ - -exports.wetag = createETagGenerator({ weak: true }) - -/** - * Check if `path` looks absolute. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -exports.isAbsolute = function(path){ - if ('/' === path[0]) return true; - if (':' === path[1] && ('\\' === path[2] || '/' === path[2])) return true; // Windows device path - if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path -}; - -/** - * Flatten the given `arr`. - * - * @param {Array} arr - * @return {Array} - * @api private - */ - -exports.flatten = deprecate.function(flatten, - 'utils.flatten: use array-flatten npm module instead'); - -/** - * Normalize the given `type`, for example "html" becomes "text/html". - * - * @param {String} type - * @return {Object} - * @api private - */ - -exports.normalizeType = function(type){ - return ~type.indexOf('/') - ? acceptParams(type) - : { value: mime.lookup(type), params: {} }; -}; - -/** - * Normalize `types`, for example "html" becomes "text/html". - * - * @param {Array} types - * @return {Array} - * @api private - */ - -exports.normalizeTypes = function(types){ - var ret = []; - - for (var i = 0; i < types.length; ++i) { - ret.push(exports.normalizeType(types[i])); - } - - return ret; -}; - -/** - * Generate Content-Disposition header appropriate for the filename. - * non-ascii filenames are urlencoded and a filename* parameter is added - * - * @param {String} filename - * @return {String} - * @api private - */ - -exports.contentDisposition = deprecate.function(contentDisposition, - 'utils.contentDisposition: use content-disposition npm module instead'); - -/** - * Parse accept params `str` returning an - * object with `.value`, `.quality` and `.params`. - * also includes `.originalIndex` for stable sorting - * - * @param {String} str - * @param {Number} index - * @return {Object} - * @api private - */ - -function acceptParams(str, index) { - var parts = str.split(/ *; */); - var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index }; - - for (var i = 1; i < parts.length; ++i) { - var pms = parts[i].split(/ *= */); - if ('q' === pms[0]) { - ret.quality = parseFloat(pms[1]); - } else { - ret.params[pms[0]] = pms[1]; - } - } - - return ret; -} - -/** - * Compile "etag" value to function. - * - * @param {Boolean|String|Function} val - * @return {Function} - * @api private - */ - -exports.compileETag = function(val) { - var fn; - - if (typeof val === 'function') { - return val; - } - - switch (val) { - case true: - case 'weak': - fn = exports.wetag; - break; - case false: - break; - case 'strong': - fn = exports.etag; - break; - default: - throw new TypeError('unknown value for etag function: ' + val); - } - - return fn; -} - -/** - * Compile "query parser" value to function. - * - * @param {String|Function} val - * @return {Function} - * @api private - */ - -exports.compileQueryParser = function compileQueryParser(val) { - var fn; - - if (typeof val === 'function') { - return val; - } - - switch (val) { - case true: - case 'simple': - fn = querystring.parse; - break; - case false: - fn = newObject; - break; - case 'extended': - fn = parseExtendedQueryString; - break; - default: - throw new TypeError('unknown value for query parser function: ' + val); - } - - return fn; -} - -/** - * Compile "proxy trust" value to function. - * - * @param {Boolean|String|Number|Array|Function} val - * @return {Function} - * @api private - */ - -exports.compileTrust = function(val) { - if (typeof val === 'function') return val; - - if (val === true) { - // Support plain true/false - return function(){ return true }; - } - - if (typeof val === 'number') { - // Support trusting hop count - return function(a, i){ return i < val }; - } - - if (typeof val === 'string') { - // Support comma-separated values - val = val.split(',') - .map(function (v) { return v.trim() }) - } - - return proxyaddr.compile(val || []); -} - -/** - * Set the charset in a given Content-Type string. - * - * @param {String} type - * @param {String} charset - * @return {String} - * @api private - */ - -exports.setCharset = function setCharset(type, charset) { - if (!type || !charset) { - return type; - } - - // parse type - var parsed = contentType.parse(type); - - // set charset - parsed.parameters.charset = charset; - - // format type - return contentType.format(parsed); -}; - -/** - * Create an ETag generator function, generating ETags with - * the given options. - * - * @param {object} options - * @return {function} - * @private - */ - -function createETagGenerator (options) { - return function generateETag (body, encoding) { - var buf = !Buffer.isBuffer(body) - ? Buffer.from(body, encoding) - : body - - return etag(buf, options) - } -} - -/** - * Parse an extended query string with qs. - * - * @return {Object} - * @private - */ - -function parseExtendedQueryString(str) { - return qs.parse(str, { - allowPrototypes: true - }); -} - -/** - * Return new empty object. - * - * @return {Object} - * @api private - */ - -function newObject() { - return {}; -} diff --git a/project starter code/node_modules/express/package.json b/project starter code/node_modules/express/package.json deleted file mode 100644 index 0996637d..00000000 --- a/project starter code/node_modules/express/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "express", - "description": "Fast, unopinionated, minimalist web framework", - "version": "4.18.2", - "author": "TJ Holowaychuk ", - "contributors": [ - "Aaron Heckmann ", - "Ciaran Jessup ", - "Douglas Christopher Wilson ", - "Guillermo Rauch ", - "Jonathan Ong ", - "Roman Shtylman ", - "Young Jae Sim " - ], - "license": "MIT", - "repository": "expressjs/express", - "homepage": "http://expressjs.com/", - "keywords": [ - "express", - "framework", - "sinatra", - "web", - "http", - "rest", - "restful", - "router", - "app", - "api" - ], - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "devDependencies": { - "after": "0.8.2", - "connect-redis": "3.4.2", - "cookie-parser": "1.4.6", - "cookie-session": "2.0.0", - "ejs": "3.1.8", - "eslint": "8.24.0", - "express-session": "1.17.2", - "hbs": "4.2.0", - "marked": "0.7.0", - "method-override": "3.0.0", - "mocha": "10.0.0", - "morgan": "1.10.0", - "multiparty": "4.2.3", - "nyc": "15.1.0", - "pbkdf2-password": "1.2.1", - "supertest": "6.3.0", - "vhost": "~3.0.2" - }, - "engines": { - "node": ">= 0.10.0" - }, - "files": [ - "LICENSE", - "History.md", - "Readme.md", - "index.js", - "lib/" - ], - "scripts": { - "lint": "eslint .", - "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test", - "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/" - } -} diff --git a/project starter code/node_modules/file-type/index.js b/project starter code/node_modules/file-type/index.js deleted file mode 100644 index e2d39b65..00000000 --- a/project starter code/node_modules/file-type/index.js +++ /dev/null @@ -1,829 +0,0 @@ -'use strict'; -const toBytes = s => [...s].map(c => c.charCodeAt(0)); -const xpiZipFilename = toBytes('META-INF/mozilla.rsa'); -const oxmlContentTypes = toBytes('[Content_Types].xml'); -const oxmlRels = toBytes('_rels/.rels'); - -module.exports = input => { - const buf = input instanceof Uint8Array ? input : new Uint8Array(input); - - if (!(buf && buf.length > 1)) { - return null; - } - - const check = (header, options) => { - options = Object.assign({ - offset: 0 - }, options); - - for (let i = 0; i < header.length; i++) { - // If a bitmask is set - if (options.mask) { - // If header doesn't equal `buf` with bits masked off - if (header[i] !== (options.mask[i] & buf[i + options.offset])) { - return false; - } - } else if (header[i] !== buf[i + options.offset]) { - return false; - } - } - - return true; - }; - - const checkString = (header, options) => check(toBytes(header), options); - - if (check([0xFF, 0xD8, 0xFF])) { - return { - ext: 'jpg', - mime: 'image/jpeg' - }; - } - - if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { - return { - ext: 'png', - mime: 'image/png' - }; - } - - if (check([0x47, 0x49, 0x46])) { - return { - ext: 'gif', - mime: 'image/gif' - }; - } - - if (check([0x57, 0x45, 0x42, 0x50], {offset: 8})) { - return { - ext: 'webp', - mime: 'image/webp' - }; - } - - if (check([0x46, 0x4C, 0x49, 0x46])) { - return { - ext: 'flif', - mime: 'image/flif' - }; - } - - // Needs to be before `tif` check - if ( - (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && - check([0x43, 0x52], {offset: 8}) - ) { - return { - ext: 'cr2', - mime: 'image/x-canon-cr2' - }; - } - - if ( - check([0x49, 0x49, 0x2A, 0x0]) || - check([0x4D, 0x4D, 0x0, 0x2A]) - ) { - return { - ext: 'tif', - mime: 'image/tiff' - }; - } - - if (check([0x42, 0x4D])) { - return { - ext: 'bmp', - mime: 'image/bmp' - }; - } - - if (check([0x49, 0x49, 0xBC])) { - return { - ext: 'jxr', - mime: 'image/vnd.ms-photo' - }; - } - - if (check([0x38, 0x42, 0x50, 0x53])) { - return { - ext: 'psd', - mime: 'image/vnd.adobe.photoshop' - }; - } - - // Zip-based file formats - // Need to be before the `zip` check - if (check([0x50, 0x4B, 0x3, 0x4])) { - if ( - check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], {offset: 30}) - ) { - return { - ext: 'epub', - mime: 'application/epub+zip' - }; - } - - // Assumes signed `.xpi` from addons.mozilla.org - if (check(xpiZipFilename, {offset: 30})) { - return { - ext: 'xpi', - mime: 'application/x-xpinstall' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.text', {offset: 30})) { - return { - ext: 'odt', - mime: 'application/vnd.oasis.opendocument.text' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.spreadsheet', {offset: 30})) { - return { - ext: 'ods', - mime: 'application/vnd.oasis.opendocument.spreadsheet' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.presentation', {offset: 30})) { - return { - ext: 'odp', - mime: 'application/vnd.oasis.opendocument.presentation' - }; - } - - // The docx, xlsx and pptx file types extend the Office Open XML file format: - // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats - // We look for: - // - one entry named '[Content_Types].xml' or '_rels/.rels', - // - one entry indicating specific type of file. - // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. - const findNextZipHeaderIndex = (arr, startAt = 0) => arr.findIndex((el, i, arr) => i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4); - - let zipHeaderIndex = 0; // The first zip header was already found at index 0 - let oxmlFound = false; - let type = null; - - do { - const offset = zipHeaderIndex + 30; - - if (!oxmlFound) { - oxmlFound = (check(oxmlContentTypes, {offset}) || check(oxmlRels, {offset})); - } - - if (!type) { - if (checkString('word/', {offset})) { - type = { - ext: 'docx', - mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - }; - } else if (checkString('ppt/', {offset})) { - type = { - ext: 'pptx', - mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - }; - } else if (checkString('xl/', {offset})) { - type = { - ext: 'xlsx', - mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - }; - } - } - - if (oxmlFound && type) { - return type; - } - - zipHeaderIndex = findNextZipHeaderIndex(buf, offset); - } while (zipHeaderIndex >= 0); - - // No more zip parts available in the buffer, but maybe we are almost certain about the type? - if (type) { - return type; - } - } - - if ( - check([0x50, 0x4B]) && - (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && - (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8) - ) { - return { - ext: 'zip', - mime: 'application/zip' - }; - } - - if (check([0x75, 0x73, 0x74, 0x61, 0x72], {offset: 257})) { - return { - ext: 'tar', - mime: 'application/x-tar' - }; - } - - if ( - check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && - (buf[6] === 0x0 || buf[6] === 0x1) - ) { - return { - ext: 'rar', - mime: 'application/x-rar-compressed' - }; - } - - if (check([0x1F, 0x8B, 0x8])) { - return { - ext: 'gz', - mime: 'application/gzip' - }; - } - - if (check([0x42, 0x5A, 0x68])) { - return { - ext: 'bz2', - mime: 'application/x-bzip2' - }; - } - - if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) { - return { - ext: '7z', - mime: 'application/x-7z-compressed' - }; - } - - if (check([0x78, 0x01])) { - return { - ext: 'dmg', - mime: 'application/x-apple-diskimage' - }; - } - - if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5 - ( - check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], {offset: 4}) && - ( - check([0x6D, 0x70, 0x34, 0x31], {offset: 8}) || // MP41 - check([0x6D, 0x70, 0x34, 0x32], {offset: 8}) || // MP42 - check([0x69, 0x73, 0x6F, 0x6D], {offset: 8}) || // ISOM - check([0x69, 0x73, 0x6F, 0x32], {offset: 8}) || // ISO2 - check([0x6D, 0x6D, 0x70, 0x34], {offset: 8}) || // MMP4 - check([0x4D, 0x34, 0x56], {offset: 8}) || // M4V - check([0x64, 0x61, 0x73, 0x68], {offset: 8}) // DASH - ) - )) { - return { - ext: 'mp4', - mime: 'video/mp4' - }; - } - - if (check([0x4D, 0x54, 0x68, 0x64])) { - return { - ext: 'mid', - mime: 'audio/midi' - }; - } - - // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska - if (check([0x1A, 0x45, 0xDF, 0xA3])) { - const sliced = buf.subarray(4, 4 + 4096); - const idPos = sliced.findIndex((el, i, arr) => arr[i] === 0x42 && arr[i + 1] === 0x82); - - if (idPos !== -1) { - const docTypePos = idPos + 3; - const findDocType = type => [...type].every((c, i) => sliced[docTypePos + i] === c.charCodeAt(0)); - - if (findDocType('matroska')) { - return { - ext: 'mkv', - mime: 'video/x-matroska' - }; - } - - if (findDocType('webm')) { - return { - ext: 'webm', - mime: 'video/webm' - }; - } - } - } - - if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || - check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || - check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], {offset: 4}) || - check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // MJPEG - check([0x77, 0x69, 0x64, 0x65], {offset: 4})) { - return { - ext: 'mov', - mime: 'video/quicktime' - }; - } - - // RIFF file format which might be AVI, WAV, QCP, etc - if (check([0x52, 0x49, 0x46, 0x46])) { - if (check([0x41, 0x56, 0x49], {offset: 8})) { - return { - ext: 'avi', - mime: 'video/vnd.avi' - }; - } - if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) { - return { - ext: 'wav', - mime: 'audio/vnd.wave' - }; - } - // QLCM, QCP file - if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) { - return { - ext: 'qcp', - mime: 'audio/qcelp' - }; - } - } - - if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { - return { - ext: 'wmv', - mime: 'video/x-ms-wmv' - }; - } - - if ( - check([0x0, 0x0, 0x1, 0xBA]) || - check([0x0, 0x0, 0x1, 0xB3]) - ) { - return { - ext: 'mpg', - mime: 'video/mpeg' - }; - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], {offset: 4})) { - return { - ext: '3gp', - mime: 'video/3gpp' - }; - } - - // Check for MPEG header at different starting offsets - for (let start = 0; start < 2 && start < (buf.length - 16); start++) { - if ( - check([0x49, 0x44, 0x33], {offset: start}) || // ID3 header - check([0xFF, 0xE2], {offset: start, mask: [0xFF, 0xE2]}) // MPEG 1 or 2 Layer 3 header - ) { - return { - ext: 'mp3', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xE4], {offset: start, mask: [0xFF, 0xE4]}) // MPEG 1 or 2 Layer 2 header - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xF8], {offset: start, mask: [0xFF, 0xFC]}) // MPEG 2 layer 0 using ADTS - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xF0], {offset: start, mask: [0xFF, 0xFC]}) // MPEG 4 layer 0 using ADTS - ) { - return { - ext: 'mp4', - mime: 'audio/mpeg' - }; - } - } - - if ( - check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], {offset: 4}) || - check([0x4D, 0x34, 0x41, 0x20]) - ) { - return { // MPEG-4 layer 3 (audio) - ext: 'm4a', - mime: 'audio/mp4' // RFC 4337 - }; - } - - // Needs to be before `ogg` check - if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], {offset: 28})) { - return { - ext: 'opus', - mime: 'audio/opus' - }; - } - - // If 'OggS' in first bytes, then OGG container - if (check([0x4F, 0x67, 0x67, 0x53])) { - // This is a OGG container - - // If ' theora' in header. - if (check([0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], {offset: 28})) { - return { - ext: 'ogv', - mime: 'video/ogg' - }; - } - // If '\x01video' in header. - if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], {offset: 28})) { - return { - ext: 'ogm', - mime: 'video/ogg' - }; - } - // If ' FLAC' in header https://xiph.org/flac/faq.html - if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], {offset: 28})) { - return { - ext: 'oga', - mime: 'audio/ogg' - }; - } - - // 'Speex ' in header https://en.wikipedia.org/wiki/Speex - if (check([0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20], {offset: 28})) { - return { - ext: 'spx', - mime: 'audio/ogg' - }; - } - - // If '\x01vorbis' in header - if (check([0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], {offset: 28})) { - return { - ext: 'ogg', - mime: 'audio/ogg' - }; - } - - // Default OGG container https://www.iana.org/assignments/media-types/application/ogg - return { - ext: 'ogx', - mime: 'application/ogg' - }; - } - - if (check([0x66, 0x4C, 0x61, 0x43])) { - return { - ext: 'flac', - mime: 'audio/x-flac' - }; - } - - if (check([0x4D, 0x41, 0x43, 0x20])) { // 'MAC ' - return { - ext: 'ape', - mime: 'audio/ape' - }; - } - - if (check([0x77, 0x76, 0x70, 0x6B])) { // 'wvpk' - return { - ext: 'wv', - mime: 'audio/wavpack' - }; - } - - if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) { - return { - ext: 'amr', - mime: 'audio/amr' - }; - } - - if (check([0x25, 0x50, 0x44, 0x46])) { - return { - ext: 'pdf', - mime: 'application/pdf' - }; - } - - if (check([0x4D, 0x5A])) { - return { - ext: 'exe', - mime: 'application/x-msdownload' - }; - } - - if ( - (buf[0] === 0x43 || buf[0] === 0x46) && - check([0x57, 0x53], {offset: 1}) - ) { - return { - ext: 'swf', - mime: 'application/x-shockwave-flash' - }; - } - - if (check([0x7B, 0x5C, 0x72, 0x74, 0x66])) { - return { - ext: 'rtf', - mime: 'application/rtf' - }; - } - - if (check([0x00, 0x61, 0x73, 0x6D])) { - return { - ext: 'wasm', - mime: 'application/wasm' - }; - } - - if ( - check([0x77, 0x4F, 0x46, 0x46]) && - ( - check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || - check([0x4F, 0x54, 0x54, 0x4F], {offset: 4}) - ) - ) { - return { - ext: 'woff', - mime: 'font/woff' - }; - } - - if ( - check([0x77, 0x4F, 0x46, 0x32]) && - ( - check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || - check([0x4F, 0x54, 0x54, 0x4F], {offset: 4}) - ) - ) { - return { - ext: 'woff2', - mime: 'font/woff2' - }; - } - - if ( - check([0x4C, 0x50], {offset: 34}) && - ( - check([0x00, 0x00, 0x01], {offset: 8}) || - check([0x01, 0x00, 0x02], {offset: 8}) || - check([0x02, 0x00, 0x02], {offset: 8}) - ) - ) { - return { - ext: 'eot', - mime: 'application/vnd.ms-fontobject' - }; - } - - if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { - return { - ext: 'ttf', - mime: 'font/ttf' - }; - } - - if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { - return { - ext: 'otf', - mime: 'font/otf' - }; - } - - if (check([0x00, 0x00, 0x01, 0x00])) { - return { - ext: 'ico', - mime: 'image/x-icon' - }; - } - - if (check([0x00, 0x00, 0x02, 0x00])) { - return { - ext: 'cur', - mime: 'image/x-icon' - }; - } - - if (check([0x46, 0x4C, 0x56, 0x01])) { - return { - ext: 'flv', - mime: 'video/x-flv' - }; - } - - if (check([0x25, 0x21])) { - return { - ext: 'ps', - mime: 'application/postscript' - }; - } - - if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { - return { - ext: 'xz', - mime: 'application/x-xz' - }; - } - - if (check([0x53, 0x51, 0x4C, 0x69])) { - return { - ext: 'sqlite', - mime: 'application/x-sqlite3' - }; - } - - if (check([0x4E, 0x45, 0x53, 0x1A])) { - return { - ext: 'nes', - mime: 'application/x-nintendo-nes-rom' - }; - } - - if (check([0x43, 0x72, 0x32, 0x34])) { - return { - ext: 'crx', - mime: 'application/x-google-chrome-extension' - }; - } - - if ( - check([0x4D, 0x53, 0x43, 0x46]) || - check([0x49, 0x53, 0x63, 0x28]) - ) { - return { - ext: 'cab', - mime: 'application/vnd.ms-cab-compressed' - }; - } - - // Needs to be before `ar` check - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E, 0x0A, 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79])) { - return { - ext: 'deb', - mime: 'application/x-deb' - }; - } - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E])) { - return { - ext: 'ar', - mime: 'application/x-unix-archive' - }; - } - - if (check([0xED, 0xAB, 0xEE, 0xDB])) { - return { - ext: 'rpm', - mime: 'application/x-rpm' - }; - } - - if ( - check([0x1F, 0xA0]) || - check([0x1F, 0x9D]) - ) { - return { - ext: 'Z', - mime: 'application/x-compress' - }; - } - - if (check([0x4C, 0x5A, 0x49, 0x50])) { - return { - ext: 'lz', - mime: 'application/x-lzip' - }; - } - - if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { - return { - ext: 'msi', - mime: 'application/x-msi' - }; - } - - if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { - return { - ext: 'mxf', - mime: 'application/mxf' - }; - } - - if (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) { - return { - ext: 'mts', - mime: 'video/mp2t' - }; - } - - if (check([0x42, 0x4C, 0x45, 0x4E, 0x44, 0x45, 0x52])) { - return { - ext: 'blend', - mime: 'application/x-blender' - }; - } - - if (check([0x42, 0x50, 0x47, 0xFB])) { - return { - ext: 'bpg', - mime: 'image/bpg' - }; - } - - if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { - // JPEG-2000 family - - if (check([0x6A, 0x70, 0x32, 0x20], {offset: 20})) { - return { - ext: 'jp2', - mime: 'image/jp2' - }; - } - - if (check([0x6A, 0x70, 0x78, 0x20], {offset: 20})) { - return { - ext: 'jpx', - mime: 'image/jpx' - }; - } - - if (check([0x6A, 0x70, 0x6D, 0x20], {offset: 20})) { - return { - ext: 'jpm', - mime: 'image/jpm' - }; - } - - if (check([0x6D, 0x6A, 0x70, 0x32], {offset: 20})) { - return { - ext: 'mj2', - mime: 'image/mj2' - }; - } - } - - if (check([0x46, 0x4F, 0x52, 0x4D, 0x00])) { - return { - ext: 'aif', - mime: 'audio/aiff' - }; - } - - if (checkString('=6" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "mime", - "file", - "type", - "archive", - "image", - "img", - "pic", - "picture", - "flash", - "photo", - "video", - "detect", - "check", - "is", - "exif", - "exe", - "binary", - "buffer", - "uint8array", - "jpg", - "png", - "gif", - "webp", - "flif", - "cr2", - "tif", - "bmp", - "jxr", - "psd", - "zip", - "tar", - "rar", - "gz", - "bz2", - "7z", - "dmg", - "mp4", - "m4v", - "mid", - "mkv", - "webm", - "mov", - "avi", - "mpg", - "mp2", - "mp3", - "m4a", - "ogg", - "opus", - "flac", - "wav", - "amr", - "pdf", - "epub", - "mobi", - "swf", - "rtf", - "woff", - "woff2", - "eot", - "ttf", - "otf", - "ico", - "flv", - "ps", - "xz", - "sqlite", - "xpi", - "cab", - "deb", - "ar", - "rpm", - "Z", - "lz", - "msi", - "mxf", - "mts", - "wasm", - "webassembly", - "blend", - "bpg", - "docx", - "pptx", - "xlsx", - "3gp", - "jp2", - "jpm", - "jpx", - "mj2", - "aif", - "odt", - "ods", - "odp", - "xml", - "heic" - ], - "devDependencies": { - "ava": "*", - "read-chunk": "^2.0.0", - "xo": "*" - } -} diff --git a/project starter code/node_modules/file-type/readme.md b/project starter code/node_modules/file-type/readme.md deleted file mode 100644 index 187ff715..00000000 --- a/project starter code/node_modules/file-type/readme.md +++ /dev/null @@ -1,187 +0,0 @@ -# file-type [![Build Status](https://travis-ci.org/sindresorhus/file-type.svg?branch=master)](https://travis-ci.org/sindresorhus/file-type) - -> Detect the file type of a Buffer/Uint8Array - -The file type is detected by checking the [magic number](http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. - - -## Install - -``` -$ npm install file-type -``` - - - - - - -## Usage - -##### Node.js - -```js -const readChunk = require('read-chunk'); -const fileType = require('file-type'); -const buffer = readChunk.sync('unicorn.png', 0, 4100); - -fileType(buffer); -//=> {ext: 'png', mime: 'image/png'} -``` - -Or from a remote location: - -```js -const http = require('http'); -const fileType = require('file-type'); -const url = 'http://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; - -http.get(url, res => { - res.once('data', chunk => { - res.destroy(); - console.log(fileType(chunk)); - //=> {ext: 'gif', mime: 'image/gif'} - }); -}); -``` - -##### Browser - -```js -const xhr = new XMLHttpRequest(); -xhr.open('GET', 'unicorn.png'); -xhr.responseType = 'arraybuffer'; - -xhr.onload = () => { - fileType(new Uint8Array(this.response)); - //=> {ext: 'png', mime: 'image/png'} -}; - -xhr.send(); -``` - - -## API - -### fileType(input) - -Returns an `Object` with: - -- `ext` - One of the [supported file types](#supported-file-types) -- `mime` - The [MIME type](http://en.wikipedia.org/wiki/Internet_media_type) - -Or `null` when no match. - -#### input - -Type: `Buffer` `Uint8Array` - -It only needs the first 4100 bytes. The exception is detection of `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file. - - -## Supported file types - -- [`jpg`](https://en.wikipedia.org/wiki/JPEG) -- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) -- [`gif`](https://en.wikipedia.org/wiki/GIF) -- [`webp`](https://en.wikipedia.org/wiki/WebP) -- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) -- [`cr2`](http://fileinfo.com/extension/cr2) -- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) -- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) -- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) -- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) -- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) -- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) -- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) -- [`gz`](https://en.wikipedia.org/wiki/Gzip) -- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) -- [`7z`](https://en.wikipedia.org/wiki/7z) -- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) -- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) -- [`m4v`](https://en.wikipedia.org/wiki/M4V) -- [`mid`](https://en.wikipedia.org/wiki/MIDI) -- [`mkv`](https://en.wikipedia.org/wiki/Matroska) -- [`webm`](https://en.wikipedia.org/wiki/WebM) -- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) -- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) -- [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) -- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) -- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) -- [`mp3`](https://en.wikipedia.org/wiki/MP3) -- [`m4a`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#.MP4_versus_.M4A) -- [`ogg`](https://en.wikipedia.org/wiki/Ogg) -- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) -- [`flac`](https://en.wikipedia.org/wiki/FLAC) -- [`wav`](https://en.wikipedia.org/wiki/WAV) -- [`qcp`](https://en.wikipedia.org/wiki/QCP) -- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) -- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) -- [`epub`](https://en.wikipedia.org/wiki/EPUB) -- [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket -- [`exe`](https://en.wikipedia.org/wiki/.exe) -- [`swf`](https://en.wikipedia.org/wiki/SWF) -- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) -- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) -- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) -- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) -- [`ttf`](https://en.wikipedia.org/wiki/TrueType) -- [`otf`](https://en.wikipedia.org/wiki/OpenType) -- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) -- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) -- [`ps`](https://en.wikipedia.org/wiki/Postscript) -- [`xz`](https://en.wikipedia.org/wiki/Xz) -- [`sqlite`](https://www.sqlite.org/fileformat2.html) -- [`nes`](http://fileinfo.com/extension/nes) -- [`crx`](https://developer.chrome.com/extensions/crx) -- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) -- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) -- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) -- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) -- [`rpm`](http://fileinfo.com/extension/rpm) -- [`Z`](http://fileinfo.com/extension/z) -- [`lz`](https://en.wikipedia.org/wiki/Lzip) -- [`msi`](https://en.wikipedia.org/wiki/Windows_Installer) -- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) -- [`mts`](https://en.wikipedia.org/wiki/.m2ts) -- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) -- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) -- [`bpg`](https://bellard.org/bpg/) -- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2) -- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 -- [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 -- [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 -- [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000 -- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) -- [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing -- [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets -- [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations -- [`xml`](https://en.wikipedia.org/wiki/XML) -- [`heic`](http://nokiatech.github.io/heif/technical.html) -- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) -- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) -- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio -- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack - -*SVG isn't included as it requires the whole file to be read, but you can get it [here](https://github.com/sindresorhus/is-svg).* - -*Pull request welcome for additional commonly used file types.* - - -## Related - -- [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module - - -## Created by - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Mikael Finstad](https://github.com/mifi) - - -## License - -MIT diff --git a/project starter code/node_modules/jimp/CHANGELOG.md b/project starter code/node_modules/jimp/CHANGELOG.md deleted file mode 100644 index b719b4af..00000000 --- a/project starter code/node_modules/jimp/CHANGELOG.md +++ /dev/null @@ -1,113 +0,0 @@ -# v0.15.0 (Fri Aug 07 2020) - -#### 🚀 Enhancement - -- Remove 'browser' field from main jimp package's package.json. [#918](https://github.com/oliver-moran/jimp/pull/918) ([@Gustavo6046](https://github.com/Gustavo6046)) - -#### Authors: 1 - -- Gustavo Ramos Rehermann ([@Gustavo6046](https://github.com/Gustavo6046)) - ---- - -# v0.14.0 (Mon Jun 29 2020) - -#### 🚀 Enhancement - -- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - -#### Authors: 1 - -- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - ---- - -# v0.13.0 (Fri Jun 05 2020) - -#### 🚀 Enhancement - -- Add single frame encoder for type-gif [#899](https://github.com/oliver-moran/jimp/pull/899) ([@jeffbseeking](https://github.com/jeffbseeking) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Jeff Bonnes ([@jeffbseeking](https://github.com/jeffbseeking)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.2 (Tue Apr 14 2020) - -#### 🐛 Bug Fix - -- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee)) - -#### Authors: 1 - -- Sebastian Skałacki ([@skalee](https://github.com/skalee)) - ---- - -# v0.10.0 (Mon Mar 30 2020) - -#### 🚀 Enhancement - -- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) - -#### Authors: 1 - -- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) - ---- - -# v0.9.7 (Fri Mar 27 2020) - -#### 🐛 Bug Fix - -- Added missing plugins to the types [#863](https://github.com/oliver-moran/jimp/pull/863) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 1 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.6 (Wed Mar 18 2020) - -#### 🐛 Bug Fix - -- upgrade auto [#860](https://github.com/oliver-moran/jimp/pull/860) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### 🏠 Internal - -- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/jimp/README.md b/project starter code/node_modules/jimp/README.md deleted file mode 100644 index 720c7ed3..00000000 --- a/project starter code/node_modules/jimp/README.md +++ /dev/null @@ -1,789 +0,0 @@ -
- -

Jimp

-

JavaScript Image Manipulation Program

-
- -The "JavaScript Image Manipulation Program" :-) - -An image processing library for Node written entirely in JavaScript, with zero native dependencies. - -The default jimp configuration. - -Supported types: - -- `@jimp/jpeg` -- `@jimp/png` -- `@jimp/bmp` -- `@jimp/tiff` -- `@jimp/gif` - -## Installation - -`npm install --save jimp` - -Example usage (Promise will never resolve if callback is passed): - -```js -var Jimp = require('jimp'); - -// open a file called "lenna.png" -Jimp.read('lenna.png', (err, lenna) => { - if (err) throw err; - lenna - .resize(256, 256) // resize - .quality(60) // set JPEG quality - .greyscale() // set greyscale - .write('lena-small-bw.jpg'); // save -}); -``` - -Using promises: - -```js -Jimp.read('lenna.png') - .then(lenna => { - return lenna - .resize(256, 256) // resize - .quality(60) // set JPEG quality - .greyscale() // set greyscale - .write('lena-small-bw.jpg'); // save - }) - .catch(err => { - console.error(err); - }); -``` - -## TypeScript Usage - -If you're using this library with TypeScript the method of importing slightly differs from JavaScript. Instead of using require, you must import it with ES6 default import scheme - -```ts -import Jimp from 'jimp'; -``` - -This requires setting the `allowSyntheticDefaultImports` compiler option to `true` in your `tsconfig` - -**Note 1**: `esModuleInterop` implicitly sets `allowSyntheticDefaultImports` to `true` - -**Note 2**: `allowSyntheticDefaultImports` nor `esModuleInterop` change the runtime behavior of your code at all. They are just flags that tells TypeScript you need the compatibility they offer. - -## Module Build - -If you're using a web bundles (webpack, rollup, parcel) you can benefit from using the `module` build of jimp. Using the module build will allow your bundler to understand your code better and exclude things you aren't using. - -```js -import Jimp from 'jimp/es'; -``` - -### WebPack - -If you're using webpack you can set `process.browser` to true and your build of jimp will exclude certain parts, making it load faster. - -```js -{ - plugins: [ - new webpack.DefinePlugin({ - 'process.browser': 'true' - }), - ... - ], -} -``` - -## Basic usage - -The static `Jimp.read` method takes the path to a file, URL, dimensions, a Jimp instance or a buffer and returns a Promise: - -```js -Jimp.read('./path/to/image.jpg') - .then(image => { - // Do stuff with the image. - }) - .catch(err => { - // Handle an exception. - }); - -Jimp.read('http://www.example.com/path/to/lenna.jpg') - .then(image => { - // Do stuff with the image. - }) - .catch(err => { - // Handle an exception. - }); - -Jimp.read(jimpInstance) - .then(image => { - // Do stuff with the image. - }) - .catch(err => { - // Handle an exception. - }); - -Jimp.read(buffer) - .then(image => { - // Do stuff with the image. - }) - .catch(err => { - // Handle an exception. - }); -``` - -In some cases, you need to pass additional parameters with an image's URL. You can pass an object to the `Jimp.read` method: - -```js -Jimp.read({ - url: 'http://www.example.com/path/to/lenna.jpg', // Required! - headers: {}, - ... -}) - .then(image => { - // Do stuff with the image. - }) - .catch(err => { - // Handle an exception. - }); -``` - -Jimp uses [phin](https://github.com/ethanent/phin) as it's HTTP client. Phin uses [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods for making HTTP requests. Phin parses a `url` with the `url.parse(...)` method and passes it with all the other parameters as an `options` to the [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods. - -Briefly speaking, you can pass any options from [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback), [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) or even [`tls.connect(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/tls.html#tls_tls_connect_options_callback). - -Phin parses a `url` and combines it with any options you want. This behavior can be very useful when you need to pass some additional `headers`. Also, you can pass `rejectUnauthorized: false` if you don't require an SSL certificate to be valid (it helps to prevent `unable to verify the first certificate` error). - -The convenience method `Jimp.create` also exists. It is just a wrapper around `Jimp.read`. - -### Custom Constructor - -You might want to initialize jimp in so custom way. To do this Jimp exposes the static function `appendConstructorOption`. The appended constructor options run after all the defaults. - -To define a custom constructor provide a name for it, a function to call to determine if the arguments provided to jimp match your constructor, and a function called where you can construct the image however you want. - -```js -Jimp.appendConstructorOption( - 'Name of Option', - args => arg.hasSomeCustomThing, - function(resolve, reject, args) { - this.bitmap = customParser(args); - resolve(); - } -); -``` - -If you don't want to handle parsing the bitmap. For example if you want to do some sort of authentication for URL request. Jimp exposes `parseBitmap` so you can fall back to jimp to do the heavy lifting. - -Parse bitmap takes the raw image data in a Buffer, a path (optional), and a node style callback. - -```js -Jimp.appendConstructorOption('Custom Url', options => options.url, function( - resolve, - reject, - options -) { - phin(options, (err, res) => { - if (err) { - return reject(err); - } - - this.parseBitmap(res.body, options.url, err => { - if (err) { - return reject(err); - } - - resolve(); - }); - }); -}); -``` - -### Methods - -Once the promise is fulfilled, the following methods can be called on the image: - -```js -/* Resize */ -image.contain( w, h[, alignBits || mode, mode] ); // scale the image to the given width and height, some parts of the image may be letter boxed -image.cover( w, h[, alignBits || mode, mode] ); // scale the image to the given width and height, some parts of the image may be clipped -image.resize( w, h[, mode] ); // resize the image. Jimp.AUTO can be passed as one of the values. -image.scale( f[, mode] ); // scale the image by the factor f -image.scaleToFit( w, h[, mode] ); // scale the image to the largest size that fits inside the given width and height - -// An optional resize mode can be passed with all resize methods. - -/* Crop */ -image.autocrop([tolerance, frames]); // automatically crop same-color borders from image (if any), frames must be a Boolean -image.autocrop(options); // automatically crop same-color borders from image (if any), options may contain tolerance, cropOnlyFrames, cropSymmetric, leaveBorder -image.crop( x, y, w, h ); // crop to the given region - -/* Composing */ -image.blit( src, x, y, [srcx, srcy, srcw, srch] ); - // blit the image with another Jimp image at x, y, optionally cropped. -image.composite( src, x, y, [{ mode, opacitySource, opacityDest }] ); // composites another Jimp image over this image at x, y -image.mask( src, x, y ); // masks the image with another Jimp image at x, y using average pixel value -image.convolute( kernel ); // applies a convolution kernel matrix to the image or a region - -/* Flip and rotate */ -image.flip( horz, vert ); // flip the image horizontally or vertically -image.mirror( horz, vert ); // an alias for flip -image.rotate( deg[, mode] ); // rotate the image clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized. - -/* Colour */ -image.brightness( val ); // adjust the brighness by a value -1 to +1 -image.contrast( val ); // adjust the contrast by a value -1 to +1 -image.dither565(); // ordered dithering of the image and reduce color space to 16-bits (RGB565) -image.greyscale(); // remove colour from the image -image.invert(); // invert the image colours -image.normalize(); // normalize the channels in an image - -/* Alpha channel */ -image.hasAlpha(); // determines if an image contains opaque pixels -image.fade( f ); // an alternative to opacity, fades the image by a factor 0 - 1. 0 will haven no effect. 1 will turn the image -image.opacity( f ); // multiply the alpha channel by each pixel by the factor f, 0 - 1 -image.opaque(); // set the alpha channel on every pixel to fully opaque -image.background( hex ); // set the default new pixel colour (e.g. 0xFFFFFFFF or 0x00000000) for by some operations (e.g. image.contain and - -/* Blurs */ -image.gaussian( r ); // Gaussian blur the image by r pixels (VERY slow) -image.blur( r ); // fast blur the image by r pixels - -/* Effects */ -image.posterize( n ); // apply a posterization effect with n level -image.sepia(); // apply a sepia wash to the image -image.pixelate( size[, x, y, w, h ]); // apply a pixelation effect to the image or a region - -/* 3D */ -image.displace( map, offset ); // displaces the image pixels based on the provided displacement map. Useful for making stereoscopic 3D images. -``` - -Some of these methods are irreversible, so it can be useful to perform them on a clone of the original image: - -```js -image.clone(); // returns a clone of the image -``` - -(Contributions of more methods are welcome!) - -### Resize modes - -The default resizing algorithm uses a bilinear method as follows: - -```js -image.resize(250, 250); // resize the image to 250 x 250 -image.resize(Jimp.AUTO, 250); // resize the height to 250 and scale the width accordingly -image.resize(250, Jimp.AUTO); // resize the width to 250 and scale the height accordingly -``` - -Optionally, the following constants can be passed to choose a particular resizing algorithm: - -```js -Jimp.RESIZE_NEAREST_NEIGHBOR; -Jimp.RESIZE_BILINEAR; -Jimp.RESIZE_BICUBIC; -Jimp.RESIZE_HERMITE; -Jimp.RESIZE_BEZIER; -``` - -For example: - -```js -image.resize(250, 250, Jimp.RESIZE_BEZIER); -``` - -### Align modes - -The following constants can be passed to the `image.cover`, `image.contain` and `image.print` methods: - -```js -Jimp.HORIZONTAL_ALIGN_LEFT; -Jimp.HORIZONTAL_ALIGN_CENTER; -Jimp.HORIZONTAL_ALIGN_RIGHT; - -Jimp.VERTICAL_ALIGN_TOP; -Jimp.VERTICAL_ALIGN_MIDDLE; -Jimp.VERTICAL_ALIGN_BOTTOM; -``` - -Where the align mode changes the position of the associated axis as described in the table below. - -| Align Mode | Axis Point | -| ------------------------------ | ----------------------------------------------- | -| `Jimp.HORIZONTAL_ALIGN_LEFT` | Positions the x-axis at the left of the image | -| `Jimp.HORIZONTAL_ALIGN_CENTER` | Positions the x-axis at the center of the image | -| `Jimp.HORIZONTAL_ALIGN_RIGHT` | Positions the x-axis at the right of the image | -| `Jimp.VERTICAL_ALIGN_TOP` | Positions the y-axis at the top of the image | -| `Jimp.VERTICAL_ALIGN_MIDDLE` | Positions the y-axis at the center of the image | -| `Jimp.VERTICAL_ALIGN_BOTTOM` | Positions the y-axis at the bottom of the image | - -For example: - -```js -image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); -``` - -Default align modes for `image.cover` and `image.contain` are: - -```js -Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; -``` - -Default align modes for `image.print` are: - -```js -{ - alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT, - alignmentY: Jimp.VERTICAL_ALIGN_TOP -} -``` - -### Compositing and blend modes - -The following modes can be used for compositing two images together. mode defaults to Jimp.BLEND_SOURCE_OVER. - -```js -Jimp.BLEND_SOURCE_OVER; -Jimp.BLEND_DESTINATION_OVER; -Jimp.BLEND_MULTIPLY; -Jimp.BLEND_ADD; -Jimp.BLEND_SCREEN; -Jimp.BLEND_OVERLAY; -Jimp.BLEND_DARKEN; -Jimp.BLEND_LIGHTEN; -Jimp.BLEND_HARDLIGHT; -Jimp.BLEND_DIFFERENCE; -Jimp.BLEND_EXCLUSION; -``` - -```js -image.composite(srcImage, 100, 0, { - mode: Jimp.BLEND_MULTIPLY, - opacitySource: 0.5, - opacityDest: 0.9 -}); -``` - -### Writing text - -Jimp supports basic typography using BMFont format (.fnt) even ones in different languages! Just find a bitmap font that is suitable [bitmap fonts](https://en.wikipedia.org/wiki/Bitmap_fonts): - -```js -Jimp.loadFont(pathOrURL).then(font => { - // load font from .fnt file - image.print(font, x, y, message); // print a message on an image. message can be a any type - image.print(font, x, y, message, maxWidth); // print a message on an image with text wrapped at maxWidth -}); -``` - -Alignment modes are supported by replacing the `str` argument with an object containing `text`, `alignmentX` and `alignmentY`. `alignmentX` defaults to `Jimp.HORIZONTAL_ALIGN_LEFT` and `alignmentY` defaults to `Jimp.VERTICAL_ALIGN_TOP`. - -```js -Jimp.loadFont(pathOrURL).then(font => { - image.print( - font, - x, - y, - { - text: 'Hello world!', - alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE - }, - maxWidth, - maxHeight - ); // prints 'Hello world!' on an image, middle and center-aligned, when x = 0 and y = 0 -}); -``` - -```js -Jimp.loadFont(path, cb); // using a callback pattern -``` - -BMFont fonts are raster based and fixed in size and colour. Jimp comes with a set of fonts that can be used on images: - -```js -Jimp.FONT_SANS_8_BLACK; // Open Sans, 8px, black -Jimp.FONT_SANS_10_BLACK; // Open Sans, 10px, black -Jimp.FONT_SANS_12_BLACK; // Open Sans, 12px, black -Jimp.FONT_SANS_14_BLACK; // Open Sans, 14px, black -Jimp.FONT_SANS_16_BLACK; // Open Sans, 16px, black -Jimp.FONT_SANS_32_BLACK; // Open Sans, 32px, black -Jimp.FONT_SANS_64_BLACK; // Open Sans, 64px, black -Jimp.FONT_SANS_128_BLACK; // Open Sans, 128px, black - -Jimp.FONT_SANS_8_WHITE; // Open Sans, 8px, white -Jimp.FONT_SANS_16_WHITE; // Open Sans, 16px, white -Jimp.FONT_SANS_32_WHITE; // Open Sans, 32px, white -Jimp.FONT_SANS_64_WHITE; // Open Sans, 64px, white -Jimp.FONT_SANS_128_WHITE; // Open Sans, 128px, white -``` - -These can be used as follows: - -```js -Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => { - image.print(font, 10, 10, 'Hello world!'); -}); -``` - -#### Measuring text - -If you need to do calculations on where to place your text jimp provides two methods that measure how wide and how tall a piece of text will be. You can use these methods to lay out multiple pieces of text in relation to each other - -```js -Jimp.measureText(Jimp.FONT_SANS_32_BLACK, 'Some string'); // width of text -Jimp.measureTextHeight(Jimp.FONT_SANS_32_BLACK, 'Some string', 100); // height of text -``` - -#### Staggering Text - -If you need to stagger text position along the x or y-axis the print method also returns the final coordinates as an argument to the callback. - -```js -Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => { - image.print( - font, - 10, - 10, - 'Hello world that wraps!', - 50, - (err, image, { x, y }) => { - image.print(font, x, y + 20, 'More text on another line', 50); - } - ); -}); -``` - -Online tools are also available to convert TTF fonts to BMFont format. They can be used to create color font or sprite packs. - -:star: [Littera](http://kvazars.com/littera/) - -:star: [Hiero](https://github.com/libgdx/libgdx/wiki/Hiero) - -## Writing to files and buffers - -### Writing to files - -The image can be written to disk in PNG, JPEG or BMP format (based on the save path extension or if no extension is provided the original image's MIME type which, if not available, defaults to PNG) using: - -```js -image.write(path, cb); // Node-style callback will be fired when write is successful -image.writeAsync(path); // Returns Promise -``` - -The original extension for an image (or "png") can accessed as using `image.getExtension()`. The following will save an image using its original format: - -```js -var file = 'new_name.' + image.getExtension(); -//or -var file = 'new_name'; // with no extension -image.write(file); -``` - -### Writing to Buffers - -A PNG, JPEG or BMP binary Buffer of an image (e.g. for storage in a database) can be generated using: - -```js -image.getBuffer(mime, cb); // Node-style callback will be fired with result -image.getBufferAsync(mime); // Returns Promise -``` - -For convenience, supported MIME types are available as static properties: - -```js -Jimp.MIME_PNG; // "image/png" -Jimp.MIME_JPEG; // "image/jpeg" -Jimp.MIME_BMP; // "image/bmp" -``` - -If `Jimp.AUTO` is passed as the MIME type then the original MIME type for the image (or "image/png") will be used. Alternatively, `image.getMIME()` will return the original MIME type of the image (or "image/png"). - -### Data URI - -A Base64 data URI can be generated in the same way as a Buffer, using: - -```js -image.getBase64(mime, cb); // Node-style callback will be fired with result -image.getBase64Async(mime); // Returns Promise -``` - -### PNG and JPEG quality - -The quality of JPEGs can be set with: - -```js -image.quality(n); // set the quality of saved JPEG, 0 - 100 -``` - -The format of PNGs can be set with: - -```js -image.rgba(bool); // set whether PNGs are saved as RGBA (true, default) or RGB (false) -image.filterType(number); // set the filter type for the saved PNG -image.deflateLevel(number); // set the deflate level for the saved PNG -Jimp.deflateStrategy(number); // set the deflate for the saved PNG (0-3) -``` - -For convenience, supported filter types are available as static properties: - -```js -Jimp.PNG_FILTER_AUTO; // -1 -Jimp.PNG_FILTER_NONE; // 0 -Jimp.PNG_FILTER_SUB; // 1 -Jimp.PNG_FILTER_UP; // 2 -Jimp.PNG_FILTER_AVERAGE; // 3 -Jimp.PNG_FILTER_PATH; // 4 -``` - -## Advanced usage - -### Colour manipulation - -Jimp supports advanced colour manipulation using a single method as follows: - -```js -image.color([ - { apply: 'hue', params: [-90] }, - { apply: 'lighten', params: [50] }, - { apply: 'xor', params: ['#06D'] } -]); -``` - -The method supports the following modifiers: - -| Modifier | Description | -| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **lighten** {amount} | Lighten the color a given amount, from 0 to 100. Providing 100 will always return white (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **brighten** {amount} | Brighten the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **darken** {amount} | Darken the color a given amount, from 0 to 100. Providing 100 will always return black (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **desaturate** {amount} | Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **saturate** {amount} | Saturate the color a given amount, from 0 to 100 (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **greyscale** {amount} | Completely desaturates a color into greyscale (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **spin** {degree} | Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing - since it sets the hue back to what it was before. (works through [TinyColor](https://github.com/bgrins/TinyColor)) | -| **hue** {degree} | Alias for **spin** | -| **mix** {color, amount} | Mixes colors by their RGB component values. Amount is opacity of overlaying color | -| **tint** {amount} | Same as applying **mix** with white color | -| **shade** {amount} | Same as applying **mix** with black color | -| **xor** {color} | Treats the two colors as bitfields and applies an XOR operation to the red, green, and blue components | -| **red** {amount} | Modify Red component by a given amount | -| **green** {amount} | Modify Green component by a given amount | -| **blue** {amount} | Modify Blue component by a given amount | - -### Convolution matrix - -Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanation with examples at [GIMP's Convolution Matrix plugin](https://docs.gimp.org/2.6/en/plug-in-convmatrix.html) - -Implement emboss effect: - -```js -image.convolute([[-2, -1, 0], [-1, 1, 1], [0, 1, 2]]); -``` - -### Low-level manipulation - -Jimp enables low-level manipulation of images in memory through the bitmap property of each Jimp object: - -```js -image.bitmap.data; // a Buffer of the raw bitmap data -image.bitmap.width; // the width of the image -image.bitmap.height; // the height of the image -``` - -This data can be manipulated directly, but remember: garbage in, garbage out. - -A helper method is available to scan a region of the bitmap: - -```js -image.scan(x, y, w, h, f); // scan a given region of the bitmap and call the function f on every pixel -``` - -Example usage: - -```js -image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) { - // x, y is the position of this pixel on the image - // idx is the position start position of this rgba tuple in the bitmap Buffer - // this is the image - - var red = this.bitmap.data[idx + 0]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - var alpha = this.bitmap.data[idx + 3]; - - // rgba values run from 0 - 255 - // e.g. this.bitmap.data[idx] = 0; // removes red from this pixel -}); -``` - -If you need to do something with the image at the end of the scan: - -```js -image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) { - // do your stuff.. - - if (x == image.bitmap.width - 1 && y == image.bitmap.height - 1) { - // image scan finished, do your stuff - } -}); -``` - -It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication: - -```js -for (const { x, y, idx, image } of image.scanIterator( - 0, - 0, - image.bitmap.width, - image.bitmap.height -)) { -} -``` - -A helper to locate a particular pixel within the raw bitmap buffer: - -```js -image.getPixelIndex(x, y); // returns the index within image.bitmap.data -``` - -One of the following may be optionally passed as a third parameter to indicate a strategy for x, y positions that are outside of boundaries of the image: - -```js -Jimp.EDGE_EXTEND = 1; -Jimp.EDGE_WRAP = 2; -Jimp.EDGE_CROP = 3; -``` - -Alternatively, you can manipulate individual pixels using the following these functions: - -```js -image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF -image.setPixelColor(hex, x, y); // sets the colour of that pixel -``` - -Two static helper functions exist to convert RGBA values into single integer (hex) values: - -```js -Jimp.rgbaToInt(r, g, b, a); // e.g. converts 255, 255, 255, 255 to 0xFFFFFFFF -Jimp.intToRGBA(hex); // e.g. converts 0xFFFFFFFF to {r: 255, g: 255, b: 255, a:255} -``` - -You can convert a css color (Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to its hexadecimal equivalent: - -```js -Jimp.cssColorToHex(cssColor); // e.g. converts #FF00FF to 0xFF00FFFF -``` - -### Creating new images - -If you want to begin with an empty Jimp image, you can call the Jimp constructor passing the width and height of the image to create and a Node-style callback: - -```js -new Jimp(256, 256, (err, image) => { - // this image is 256 x 256, every pixel is set to 0x00000000 -}); -``` - -You can optionally set the pixel colour as follows: - -```js -new Jimp(256, 256, 0xff0000ff, (err, image) => { - // this image is 256 x 256, every pixel is set to 0xFF0000FF -}); -``` - -Or you can use a css color format: - -```js -new Jimp(256, 256, '#FF00FF', (err, image) => { - // this image is 256 x 256, every pixel is set to #FF00FF -}); -``` - -You can also initialize a new Jimp image with a raw image buffer: - -```js -new Jimp({ data: buffer, width: 1280, height: 768 }, (err, image) => { - // this image is 1280 x 768, pixels are loaded from the given buffer. -}); -``` - -This can be useful for interoperating with other image processing libraries. `buffer` is expected to be four-channel (rgba) image data. - -## Comparing images - -To generate a [perceptual hash](https://en.wikipedia.org/wiki/Perceptual_hashing) of a Jimp image, based on the [pHash](http://phash.org/) algorithm, use: - -```js -image.hash(); // aHgG4GgoFjA -``` - -By default the hash is returned as base 64. The hash can be returned at another base by passing a number from 2 to 64 to the method: - -```js -image.hash(2); // 1010101011010000101010000100101010010000011001001001010011100100 -``` - -There are 18,446,744,073,709,551,615 unique hashes. The hamming distance between the binary representation of these hashes can be used to find similar-looking images. - -To calculate the hamming distance between two Jimp images based on their perceptual hash use: - -```js -Jimp.distance(image1, image2); // returns a number 0-1, where 0 means the two images are perceived to be identical -``` - -Jimp also allows the diffing of two Jimp images using [PixelMatch](https://github.com/mapbox/pixelmatch) as follows: - -```js -var diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1) -diff.image; // a Jimp image showing differences -diff.percent; // the proportion of different pixels (0-1), where 0 means the images are pixel identical -``` - -Using a mix of hamming distance and pixel diffing to compare images, the following code has a 99% success rate of detecting the same image from a random sample (with 1% false positives). The test this figure is drawn from attempts to match each image from a sample of 120 PNGs against 120 corresponding JPEGs saved at a quality setting of 60. - -```js -var distance = Jimp.distance(png, jpeg); // perceived distance -var diff = Jimp.diff(png, jpeg); // pixel difference - -if (distance < 0.15 || diff.percent < 0.15) { - // images match -} else { - // not a match -} -``` - -You can also calculate the raw pHash (no padding or custom base). You can then use this in `distanceFromHash` to calculate the hash distance from a loaded image. - -```js -const hash1 = image1.pHash(); -const hash2 = image2.pHash(); - -image2.distanceFromHash(hash1); -Jimp.compareHashes(hash1, hash2); // same result as above -``` - -## Chaining or callbacks - -Most instance methods can be chained together, for example as follows: - -```js -Jimp.read('lenna.png').then(image => { - image - .greyscale() - .scale(0.5) - .write('lena-half-bw.png'); -}); -``` - -Alternatively, methods can be passed Node-style callbacks: - -```js -Jimp.read('lenna.png').then(image => { - image.greyscale((err, image) => { - image.scale(0.5, (err, image) => { - image.write('lena-half-bw.png'); - }); - }); -}); -``` - -The Node-style callback pattern allows Jimp to be used with frameworks that expect or build on the Node-style callback pattern. diff --git a/project starter code/node_modules/jimp/browser/.editorconfig b/project starter code/node_modules/jimp/browser/.editorconfig deleted file mode 100644 index f394cdbf..00000000 --- a/project starter code/node_modules/jimp/browser/.editorconfig +++ /dev/null @@ -1,2 +0,0 @@ -# Exclude this directory -root = true \ No newline at end of file diff --git a/project starter code/node_modules/jimp/browser/README.md b/project starter code/node_modules/jimp/browser/README.md deleted file mode 100644 index c2537ea4..00000000 --- a/project starter code/node_modules/jimp/browser/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# Jimp ... in a browser - -Browser support for Jimp was added by Phil Seaton. This enabled Jimp to be used in [Electron](http://electron.atom.io/) applications as well as web browsers. - -Example usage: - -```html - - -``` - -See the [main documentation](https://github.com/oliver-moran/jimp) for the full API documenatinon. - -## WebWorkers - -For better performance, it recommended that Jimp methods are run on a separate thread using [`WebWorkers`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers). The following shows how using two files (`index.html` and `jimp-worker.js`): - -```js -// index.html - -var worker = new Worker('jimp-worker.js'); -worker.onmessage = function(e) { - // append a new img element using the base 64 image - var img = document.createElement('img'); - img.setAttribute('src', e.data); - document.body.appendChild(img); -}; -worker.postMessage('lenna.png'); // message the worker thread -``` - -```js -// jimp-worker.js - -importScripts('jimp.min.js'); - -self.addEventListener('message', function(e) { - Jimp.read(e.data).then(function(lenna) { - lenna - .resize(256, 256) // resize - .quality(60) // set JPEG quality - .greyscale() // set greyscale - .getBase64(Jimp.MIME_JPEG, function(err, src) { - self.postMessage(src); // message the main thread - }); - }); -}); -``` - -## License - -Jimp is licensed under the MIT license. diff --git a/project starter code/node_modules/jimp/browser/examples/example1.html b/project starter code/node_modules/jimp/browser/examples/example1.html deleted file mode 100644 index e454f454..00000000 --- a/project starter code/node_modules/jimp/browser/examples/example1.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - Jimp browser example 1 - - - -

Demonstrates loading a local file using Jimp on the main thread

- - - - - diff --git a/project starter code/node_modules/jimp/browser/examples/example2.html b/project starter code/node_modules/jimp/browser/examples/example2.html deleted file mode 100644 index 53f7ae30..00000000 --- a/project starter code/node_modules/jimp/browser/examples/example2.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - Jimp browser example 2 - - - -

Demonstrates loading a relative file using Jimp on a WebWorker thread

- - - - diff --git a/project starter code/node_modules/jimp/browser/examples/example3.html b/project starter code/node_modules/jimp/browser/examples/example3.html deleted file mode 100644 index 0018e1e1..00000000 --- a/project starter code/node_modules/jimp/browser/examples/example3.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - Jimp browser example 3 - - - -

Demonstrates loading a local file using Jimp on a WebWorker thread

-

- - - - diff --git a/project starter code/node_modules/jimp/browser/examples/example4.html b/project starter code/node_modules/jimp/browser/examples/example4.html deleted file mode 100644 index c3967d4a..00000000 --- a/project starter code/node_modules/jimp/browser/examples/example4.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - Jimp browser example 4 - - - -

Demonstrates how to write a text over an image

- - - - -
-
-
-
-
-
- - - diff --git a/project starter code/node_modules/jimp/browser/examples/jimp-worker.js b/project starter code/node_modules/jimp/browser/examples/jimp-worker.js deleted file mode 100644 index 90ccfe09..00000000 --- a/project starter code/node_modules/jimp/browser/examples/jimp-worker.js +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-env worker */ -/* global Jimp */ - -importScripts('../lib/jimp.min.js'); - -self.addEventListener('message', e => { - Jimp.read(e.data).then(lenna => { - lenna - .resize(256, Jimp.AUTO) // resize - .quality(60) // set JPEG quality - .greyscale() // set greyscale - .getBase64(Jimp.AUTO, (err, src) => { - if (err) throw err; - self.postMessage(src); - self.close(); - }); - }); -}); diff --git a/project starter code/node_modules/jimp/browser/examples/test.html b/project starter code/node_modules/jimp/browser/examples/test.html deleted file mode 100644 index f65a8ab4..00000000 --- a/project starter code/node_modules/jimp/browser/examples/test.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - Jimp browser example 1 - - - - - - - - - \ No newline at end of file diff --git a/project starter code/node_modules/jimp/browser/lib/jimp.js b/project starter code/node_modules/jimp/browser/lib/jimp.js deleted file mode 100644 index 0c714a3f..00000000 --- a/project starter code/node_modules/jimp/browser/lib/jimp.js +++ /dev/null @@ -1,47974 +0,0 @@ -/* -Jimp v0.16.1 -https://github.com/oliver-moran/jimp -Ported for the Web by Phil Seaton -MIT License - -Copyright (c) 2018 Oliver Moran - -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. -*/ -if ((typeof(window)=='undefined' || !window) && (typeof(self)!='undefined')) var window = self; -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jimp = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= toBase) { - numberMap[newlen++] = parseInt(divide / toBase, 10); - divide = divide % toBase; - } else if (newlen > 0) { - numberMap[newlen++] = 0; - } - } - length = newlen; - result = this.dstAlphabet.slice(divide, divide + 1).concat(result); - } while (newlen !== 0); - - return result; -}; - -/** - * Valid number with source alphabet - * - * @param {number} number - * - * @returns {boolean} - */ -Converter.prototype.isValid = function(number) { - var i = 0; - for (; i < number.length; ++i) { - if (this.srcAlphabet.indexOf(number[i]) === -1) { - return false; - } - } - return true; -}; - -module.exports = Converter; -},{}],25:[function(require,module,exports){ -(function (global){ -'use strict'; - -var objectAssign = require('object-assign'); - -// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js -// original notice: - -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function compare(a, b) { - if (a === b) { - return 0; - } - - var x = a.length; - var y = b.length; - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; -} -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); -} - -// based on node assert, original notice: -// NB: The URL to the CommonJS spec is kept just for tradition. -// node-assert has evolved a lot since then, both in API and behavior. - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.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 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 util = require('util/'); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } -}; - -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } -} - - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; -} - -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -// Expose a strict only variant of assert -function strict(value, message) { - if (!value) fail(value, true, message, '==', strict); -} -assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual -}); -assert.strict.strict = assert.strict; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":84,"util/":28}],26:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],27:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],28:[function(require,module,exports){ -(function (process,global){ -// 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. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -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 isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (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 = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":27,"_process":133,"inherits":26}],29:[function(require,module,exports){ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - -},{}],30:[function(require,module,exports){ -/** - * @author shaozilee - * - * support 1bit 4bit 8bit 24bit decode - * encode with 24bit - * - */ - -var encode = require('./lib/encoder'), - decode = require('./lib/decoder'); - -module.exports = { - encode: encode, - decode: decode -}; - -},{"./lib/decoder":31,"./lib/encoder":32}],31:[function(require,module,exports){ -(function (Buffer){ -/** - * @author shaozilee - * - * Bmp format decoder,support 1bit 4bit 8bit 24bit bmp - * - */ - -function BmpDecoder(buffer,is_with_alpha) { - this.pos = 0; - this.buffer = buffer; - this.is_with_alpha = !!is_with_alpha; - this.bottom_up = true; - this.flag = this.buffer.toString("utf-8", 0, this.pos += 2); - if (this.flag != "BM") throw new Error("Invalid BMP File"); - this.parseHeader(); - this.parseRGBA(); -} - -BmpDecoder.prototype.parseHeader = function() { - this.fileSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.reserved = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.offset = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.headerSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.width = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.height = this.buffer.readInt32LE(this.pos); - this.pos += 4; - this.planes = this.buffer.readUInt16LE(this.pos); - this.pos += 2; - this.bitPP = this.buffer.readUInt16LE(this.pos); - this.pos += 2; - this.compress = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.rawSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.hr = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.vr = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.colors = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.importantColors = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - - if(this.bitPP === 16 && this.is_with_alpha){ - this.bitPP = 15 - } - if (this.bitPP < 15) { - var len = this.colors === 0 ? 1 << this.bitPP : this.colors; - this.palette = new Array(len); - for (var i = 0; i < len; i++) { - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var quad = this.buffer.readUInt8(this.pos++); - this.palette[i] = { - red: red, - green: green, - blue: blue, - quad: quad - }; - } - } - if(this.height < 0) { - this.height *= -1; - this.bottom_up = false; - } - -} - -BmpDecoder.prototype.parseRGBA = function() { - var bitn = "bit" + this.bitPP; - var len = this.width * this.height * 4; - this.data = new Buffer(len); - this[bitn](); -}; - -BmpDecoder.prototype.bit1 = function() { - var xlen = Math.ceil(this.width / 8); - var mode = xlen%4; - var y = this.height >= 0 ? this.height - 1 : -this.height - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < xlen; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x*8*4; - for (var i = 0; i < 8; i++) { - if(x*8+i>(7-i))&0x1)]; - - this.data[location+i*4] = 0; - this.data[location+i*4 + 1] = rgb.blue; - this.data[location+i*4 + 2] = rgb.green; - this.data[location+i*4 + 3] = rgb.red; - - }else{ - break; - } - } - } - - if (mode != 0){ - this.pos+=(4 - mode); - } - } -}; - -BmpDecoder.prototype.bit4 = function() { - //RLE-4 - if(this.compress == 2){ - this.data.fill(0xff); - - var location = 0; - var lines = this.bottom_up?this.height-1:0; - var low_nibble = false;//for all count of pixel - - while(location>4); - } - - if ((i & 1) && (i+1 < b)){ - c = this.buffer.readUInt8(this.pos++); - } - - low_nibble = !low_nibble; - } - - if ((((b+1) >> 1) & 1 ) == 1){ - this.pos++ - } - } - - }else{//encoded mode - for (var i = 0; i < a; i++) { - if (low_nibble) { - setPixelData.call(this, (b & 0x0f)); - } else { - setPixelData.call(this, (b & 0xf0)>>4); - } - low_nibble = !low_nibble; - } - } - - } - - - - - function setPixelData(rgbIndex){ - var rgb = this.palette[rgbIndex]; - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - location+=4; - } - }else{ - - var xlen = Math.ceil(this.width/2); - var mode = xlen%4; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < xlen; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x*2*4; - - var before = b>>4; - var after = b&0x0F; - - var rgb = this.palette[before]; - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - - - if(x*2+1>=this.width)break; - - rgb = this.palette[after]; - - this.data[location+4] = 0; - this.data[location+4 + 1] = rgb.blue; - this.data[location+4 + 2] = rgb.green; - this.data[location+4 + 3] = rgb.red; - - } - - if (mode != 0){ - this.pos+=(4 - mode); - } - } - - } - -}; - -BmpDecoder.prototype.bit8 = function() { - //RLE-8 - if(this.compress == 1){ - this.data.fill(0xff); - - var location = 0; - var lines = this.bottom_up?this.height-1:0; - - while(location= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - if (b < this.palette.length) { - var rgb = this.palette[b]; - - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - - } else { - this.data[location] = 0; - this.data[location + 1] = 0xFF; - this.data[location + 2] = 0xFF; - this.data[location + 3] = 0xFF; - } - } - if (mode != 0) { - this.pos += (4 - mode); - } - } - } -}; - -BmpDecoder.prototype.bit15 = function() { - var dif_w =this.width % 3; - var _11111 = parseInt("11111", 2),_1_5 = _11111; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - - var B = this.buffer.readUInt16LE(this.pos); - this.pos+=2; - var blue = (B & _1_5) / _1_5 * 255 | 0; - var green = (B >> 5 & _1_5 ) / _1_5 * 255 | 0; - var red = (B >> 10 & _1_5) / _1_5 * 255 | 0; - var alpha = (B>>15)?0xFF:0x00; - - var location = line * this.width * 4 + x * 4; - - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += dif_w; - } -}; - -BmpDecoder.prototype.bit16 = function() { - var dif_w =(this.width % 2)*2; - //default xrgb555 - this.maskRed = 0x7C00; - this.maskGreen = 0x3E0; - this.maskBlue =0x1F; - this.mask0 = 0; - - if(this.compress == 3){ - this.maskRed = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskGreen = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskBlue = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.mask0 = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - } - - - var ns=[0,0,0]; - for (var i=0;i<16;i++){ - if ((this.maskRed>>i)&0x01) ns[0]++; - if ((this.maskGreen>>i)&0x01) ns[1]++; - if ((this.maskBlue>>i)&0x01) ns[2]++; - } - ns[1]+=ns[0]; ns[2]+=ns[1]; ns[0]=8-ns[0]; ns[1]-=8; ns[2]-=8; - - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - - var B = this.buffer.readUInt16LE(this.pos); - this.pos+=2; - - var blue = (B&this.maskBlue)<>ns[1]; - var red = (B&this.maskRed)>>ns[2]; - - var location = line * this.width * 4 + x * 4; - - this.data[location] = 0; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += dif_w; - } -}; - -BmpDecoder.prototype.bit24 = function() { - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - //Little Endian rgb - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = 0; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += (this.width % 4); - } - -}; - -/** - * add 32bit decode func - * @author soubok - */ -BmpDecoder.prototype.bit32 = function() { - //BI_BITFIELDS - if(this.compress == 3){ - this.maskRed = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskGreen = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskBlue = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.mask0 = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - //Little Endian rgba - var alpha = this.buffer.readUInt8(this.pos++); - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - } - - }else{ - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - //Little Endian argb - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var alpha = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - } - - } - - - - -}; - -BmpDecoder.prototype.getData = function() { - return this.data; -}; - -module.exports = function(bmpData) { - var decoder = new BmpDecoder(bmpData); - return decoder; -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],32:[function(require,module,exports){ -(function (Buffer){ -/** - * @author shaozilee - * - * BMP format encoder,encode 24bit BMP - * Not support quality compression - * - */ - -function BmpEncoder(imgData){ - this.buffer = imgData.data; - this.width = imgData.width; - this.height = imgData.height; - this.extraBytes = this.width%4; - this.rgbSize = this.height*(3*this.width+this.extraBytes); - this.headerInfoSize = 40; - - this.data = []; - /******************header***********************/ - this.flag = "BM"; - this.reserved = 0; - this.offset = 54; - this.fileSize = this.rgbSize+this.offset; - this.planes = 1; - this.bitPP = 24; - this.compress = 0; - this.hr = 0; - this.vr = 0; - this.colors = 0; - this.importantColors = 0; -} - -BmpEncoder.prototype.encode = function() { - var tempBuffer = new Buffer(this.offset+this.rgbSize); - this.pos = 0; - tempBuffer.write(this.flag,this.pos,2);this.pos+=2; - tempBuffer.writeUInt32LE(this.fileSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.reserved,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.offset,this.pos);this.pos+=4; - - tempBuffer.writeUInt32LE(this.headerInfoSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.width,this.pos);this.pos+=4; - tempBuffer.writeInt32LE(-this.height,this.pos);this.pos+=4; - tempBuffer.writeUInt16LE(this.planes,this.pos);this.pos+=2; - tempBuffer.writeUInt16LE(this.bitPP,this.pos);this.pos+=2; - tempBuffer.writeUInt32LE(this.compress,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.rgbSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.hr,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.vr,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.colors,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.importantColors,this.pos);this.pos+=4; - - var i=0; - var rowBytes = 3*this.width+this.extraBytes; - - for (var y = 0; y 0){ - var fillOffset = this.pos+y*rowBytes+this.width*3; - tempBuffer.fill(0,fillOffset,fillOffset+this.extraBytes); - } - } - - return tempBuffer; -}; - -module.exports = function(imgData, quality) { - if (typeof quality === 'undefined') quality = 100; - var encoder = new BmpEncoder(imgData); - var data = encoder.encode(); - return { - data: data, - width: imgData.width, - height: imgData.height - }; -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],33:[function(require,module,exports){ - -},{}],34:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; -/* eslint camelcase: "off" */ - -var assert = require('assert'); - -var Zstream = require('pako/lib/zlib/zstream'); -var zlib_deflate = require('pako/lib/zlib/deflate.js'); -var zlib_inflate = require('pako/lib/zlib/inflate.js'); -var constants = require('pako/lib/zlib/constants'); - -for (var key in constants) { - exports[key] = constants[key]; -} - -// zlib modes -exports.NONE = 0; -exports.DEFLATE = 1; -exports.INFLATE = 2; -exports.GZIP = 3; -exports.GUNZIP = 4; -exports.DEFLATERAW = 5; -exports.INFLATERAW = 6; -exports.UNZIP = 7; - -var GZIP_HEADER_ID1 = 0x1f; -var GZIP_HEADER_ID2 = 0x8b; - -/** - * Emulate Node's zlib C++ layer for use by the JS layer in index.js - */ -function Zlib(mode) { - if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { - throw new TypeError('Bad argument'); - } - - this.dictionary = null; - this.err = 0; - this.flush = 0; - this.init_done = false; - this.level = 0; - this.memLevel = 0; - this.mode = mode; - this.strategy = 0; - this.windowBits = 0; - this.write_in_progress = false; - this.pending_close = false; - this.gzip_id_bytes_read = 0; -} - -Zlib.prototype.close = function () { - if (this.write_in_progress) { - this.pending_close = true; - return; - } - - this.pending_close = false; - - assert(this.init_done, 'close before init'); - assert(this.mode <= exports.UNZIP); - - if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { - zlib_deflate.deflateEnd(this.strm); - } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { - zlib_inflate.inflateEnd(this.strm); - } - - this.mode = exports.NONE; - - this.dictionary = null; -}; - -Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); -}; - -Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); -}; - -Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { - assert.equal(arguments.length, 8); - - assert(this.init_done, 'write before init'); - assert(this.mode !== exports.NONE, 'already finalized'); - assert.equal(false, this.write_in_progress, 'write already in progress'); - assert.equal(false, this.pending_close, 'close is pending'); - - this.write_in_progress = true; - - assert.equal(false, flush === undefined, 'must provide flush value'); - - this.write_in_progress = true; - - if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { - throw new Error('Invalid flush value'); - } - - if (input == null) { - input = Buffer.alloc(0); - in_len = 0; - in_off = 0; - } - - this.strm.avail_in = in_len; - this.strm.input = input; - this.strm.next_in = in_off; - this.strm.avail_out = out_len; - this.strm.output = out; - this.strm.next_out = out_off; - this.flush = flush; - - if (!async) { - // sync version - this._process(); - - if (this._checkError()) { - return this._afterSync(); - } - return; - } - - // async version - var self = this; - process.nextTick(function () { - self._process(); - self._after(); - }); - - return this; -}; - -Zlib.prototype._afterSync = function () { - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; - - this.write_in_progress = false; - - return [avail_in, avail_out]; -}; - -Zlib.prototype._process = function () { - var next_expected_header_byte = null; - - // If the avail_out is left at 0, then it means that it ran out - // of room. If there was avail_out left over, then it means - // that all of the input was consumed. - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflate(this.strm, this.flush); - break; - case exports.UNZIP: - if (this.strm.avail_in > 0) { - next_expected_header_byte = this.strm.next_in; - } - - switch (this.gzip_id_bytes_read) { - case 0: - if (next_expected_header_byte === null) { - break; - } - - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { - this.gzip_id_bytes_read = 1; - next_expected_header_byte++; - - if (this.strm.avail_in === 1) { - // The only available byte was already read. - break; - } - } else { - this.mode = exports.INFLATE; - break; - } - - // fallthrough - case 1: - if (next_expected_header_byte === null) { - break; - } - - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { - this.gzip_id_bytes_read = 2; - this.mode = exports.GUNZIP; - } else { - // There is no actual difference between INFLATE and INFLATERAW - // (after initialization). - this.mode = exports.INFLATE; - } - - break; - default: - throw new Error('invalid number of gzip magic number bytes read'); - } - - // fallthrough - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - this.err = zlib_inflate.inflate(this.strm, this.flush - - // If data was encoded with dictionary - );if (this.err === exports.Z_NEED_DICT && this.dictionary) { - // Load it - this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); - if (this.err === exports.Z_OK) { - // And try to decode again - this.err = zlib_inflate.inflate(this.strm, this.flush); - } else if (this.err === exports.Z_DATA_ERROR) { - // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. - // Make it possible for After() to tell a bad dictionary from bad - // input. - this.err = exports.Z_NEED_DICT; - } - } - while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { - // Bytes remain in input buffer. Perhaps this is another compressed - // member in the same archive, or just trailing garbage. - // Trailing zero bytes are okay, though, since they are frequently - // used for padding. - - this.reset(); - this.err = zlib_inflate.inflate(this.strm, this.flush); - } - break; - default: - throw new Error('Unknown mode ' + this.mode); - } -}; - -Zlib.prototype._checkError = function () { - // Acceptable error states depend on the type of zlib stream. - switch (this.err) { - case exports.Z_OK: - case exports.Z_BUF_ERROR: - if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { - this._error('unexpected end of file'); - return false; - } - break; - case exports.Z_STREAM_END: - // normal statuses, not fatal - break; - case exports.Z_NEED_DICT: - if (this.dictionary == null) { - this._error('Missing dictionary'); - } else { - this._error('Bad dictionary'); - } - return false; - default: - // something else. - this._error('Zlib error'); - return false; - } - - return true; -}; - -Zlib.prototype._after = function () { - if (!this._checkError()) { - return; - } - - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; - - this.write_in_progress = false; - - // call the write() cb - this.callback(avail_in, avail_out); - - if (this.pending_close) { - this.close(); - } -}; - -Zlib.prototype._error = function (message) { - if (this.strm.msg) { - message = this.strm.msg; - } - this.onerror(message, this.err - - // no hope of rescue. - );this.write_in_progress = false; - if (this.pending_close) { - this.close(); - } -}; - -Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { - assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); - - assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); - assert(level >= -1 && level <= 9, 'invalid compression level'); - - assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); - - assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); - - this._init(level, windowBits, memLevel, strategy, dictionary); - this._setDictionary(); -}; - -Zlib.prototype.params = function () { - throw new Error('deflateParams Not supported'); -}; - -Zlib.prototype.reset = function () { - this._reset(); - this._setDictionary(); -}; - -Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { - this.level = level; - this.windowBits = windowBits; - this.memLevel = memLevel; - this.strategy = strategy; - - this.flush = exports.Z_NO_FLUSH; - - this.err = exports.Z_OK; - - if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { - this.windowBits += 16; - } - - if (this.mode === exports.UNZIP) { - this.windowBits += 32; - } - - if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { - this.windowBits = -1 * this.windowBits; - } - - this.strm = new Zstream(); - - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); - break; - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - case exports.UNZIP: - this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); - break; - default: - throw new Error('Unknown mode ' + this.mode); - } - - if (this.err !== exports.Z_OK) { - this._error('Init error'); - } - - this.dictionary = dictionary; - - this.write_in_progress = false; - this.init_done = true; -}; - -Zlib.prototype._setDictionary = function () { - if (this.dictionary == null) { - return; - } - - this.err = exports.Z_OK; - - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); - break; - default: - break; - } - - if (this.err !== exports.Z_OK) { - this._error('Failed to set dictionary'); - } -}; - -Zlib.prototype._reset = function () { - this.err = exports.Z_OK; - - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - case exports.GZIP: - this.err = zlib_deflate.deflateReset(this.strm); - break; - case exports.INFLATE: - case exports.INFLATERAW: - case exports.GUNZIP: - this.err = zlib_inflate.inflateReset(this.strm); - break; - default: - break; - } - - if (this.err !== exports.Z_OK) { - this._error('Failed to reset stream'); - } -}; - -exports.Zlib = Zlib; -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":133,"assert":25,"buffer":48,"pako/lib/zlib/constants":38,"pako/lib/zlib/deflate.js":40,"pako/lib/zlib/inflate.js":42,"pako/lib/zlib/zstream":46}],35:[function(require,module,exports){ -(function (process){ -'use strict'; - -var Buffer = require('buffer').Buffer; -var Transform = require('stream').Transform; -var binding = require('./binding'); -var util = require('util'); -var assert = require('assert').ok; -var kMaxLength = require('buffer').kMaxLength; -var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; - -// zlib doesn't provide these, so kludge them in following the same -// const naming scheme zlib uses. -binding.Z_MIN_WINDOWBITS = 8; -binding.Z_MAX_WINDOWBITS = 15; -binding.Z_DEFAULT_WINDOWBITS = 15; - -// fewer than 64 bytes per chunk is stupid. -// technically it could work with as few as 8, but even 64 bytes -// is absurdly low. Usually a MB or more is best. -binding.Z_MIN_CHUNK = 64; -binding.Z_MAX_CHUNK = Infinity; -binding.Z_DEFAULT_CHUNK = 16 * 1024; - -binding.Z_MIN_MEMLEVEL = 1; -binding.Z_MAX_MEMLEVEL = 9; -binding.Z_DEFAULT_MEMLEVEL = 8; - -binding.Z_MIN_LEVEL = -1; -binding.Z_MAX_LEVEL = 9; -binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; - -// expose all the zlib constants -var bkeys = Object.keys(binding); -for (var bk = 0; bk < bkeys.length; bk++) { - var bkey = bkeys[bk]; - if (bkey.match(/^Z/)) { - Object.defineProperty(exports, bkey, { - enumerable: true, value: binding[bkey], writable: false - }); - } -} - -// translation table for return codes. -var codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR -}; - -var ckeys = Object.keys(codes); -for (var ck = 0; ck < ckeys.length; ck++) { - var ckey = ckeys[ck]; - codes[codes[ckey]] = ckey; -} - -Object.defineProperty(exports, 'codes', { - enumerable: true, value: Object.freeze(codes), writable: false -}); - -exports.Deflate = Deflate; -exports.Inflate = Inflate; -exports.Gzip = Gzip; -exports.Gunzip = Gunzip; -exports.DeflateRaw = DeflateRaw; -exports.InflateRaw = InflateRaw; -exports.Unzip = Unzip; - -exports.createDeflate = function (o) { - return new Deflate(o); -}; - -exports.createInflate = function (o) { - return new Inflate(o); -}; - -exports.createDeflateRaw = function (o) { - return new DeflateRaw(o); -}; - -exports.createInflateRaw = function (o) { - return new InflateRaw(o); -}; - -exports.createGzip = function (o) { - return new Gzip(o); -}; - -exports.createGunzip = function (o) { - return new Gunzip(o); -}; - -exports.createUnzip = function (o) { - return new Unzip(o); -}; - -// Convenience methods. -// compress/decompress a string or buffer in one step. -exports.deflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Deflate(opts), buffer, callback); -}; - -exports.deflateSync = function (buffer, opts) { - return zlibBufferSync(new Deflate(opts), buffer); -}; - -exports.gzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gzip(opts), buffer, callback); -}; - -exports.gzipSync = function (buffer, opts) { - return zlibBufferSync(new Gzip(opts), buffer); -}; - -exports.deflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new DeflateRaw(opts), buffer, callback); -}; - -exports.deflateRawSync = function (buffer, opts) { - return zlibBufferSync(new DeflateRaw(opts), buffer); -}; - -exports.unzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Unzip(opts), buffer, callback); -}; - -exports.unzipSync = function (buffer, opts) { - return zlibBufferSync(new Unzip(opts), buffer); -}; - -exports.inflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Inflate(opts), buffer, callback); -}; - -exports.inflateSync = function (buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -}; - -exports.gunzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gunzip(opts), buffer, callback); -}; - -exports.gunzipSync = function (buffer, opts) { - return zlibBufferSync(new Gunzip(opts), buffer); -}; - -exports.inflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new InflateRaw(opts), buffer, callback); -}; - -exports.inflateRawSync = function (buffer, opts) { - return zlibBufferSync(new InflateRaw(opts), buffer); -}; - -function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); - - engine.end(buffer); - flow(); - - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; - } - engine.once('readable', flow); - } - - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } - - function onEnd() { - var buf; - var err = null; - - if (nread >= kMaxLength) { - err = new RangeError(kRangeErrorMessage); - } else { - buf = Buffer.concat(buffers, nread); - } - - buffers = []; - engine.close(); - callback(err, buf); - } -} - -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') buffer = Buffer.from(buffer); - - if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); - - var flushFlag = engine._finishFlushFlag; - - return engine._processChunk(buffer, flushFlag); -} - -// generic zlib -// minimal 2-byte header -function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); -} - -function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); -} - -// gzip - bigger header, same deflate compression -function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); -} - -function Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); -} - -// raw - no header -function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); -} - -function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); -} - -// auto-detect header. -function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); -} - -function isValidFlushFlag(flag) { - return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; -} - -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. - -function Zlib(opts, mode) { - var _this = this; - - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; - - Transform.call(this, opts); - - if (opts.flush && !isValidFlushFlag(opts.flush)) { - throw new Error('Invalid flush flag: ' + opts.flush); - } - if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { - throw new Error('Invalid flush flag: ' + opts.finishFlush); - } - - this._flushFlag = opts.flush || binding.Z_NO_FLUSH; - this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; - - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } - } - - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } - } - - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } - } - - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } - - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } - } - - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } - } - - this._handle = new binding.Zlib(mode); - - var self = this; - this._hadError = false; - this._handle.onerror = function (message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - _close(self); - self._hadError = true; - - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; - - var level = exports.Z_DEFAULT_COMPRESSION; - if (typeof opts.level === 'number') level = opts.level; - - var strategy = exports.Z_DEFAULT_STRATEGY; - if (typeof opts.strategy === 'number') strategy = opts.strategy; - - this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); - - this._buffer = Buffer.allocUnsafe(this._chunkSize); - this._offset = 0; - this._level = level; - this._strategy = strategy; - - this.once('end', this.close); - - Object.defineProperty(this, '_closed', { - get: function () { - return !_this._handle; - }, - configurable: true, - enumerable: true - }); -} - -util.inherits(Zlib, Transform); - -Zlib.prototype.params = function (level, strategy, callback) { - if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level); - } - if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { - throw new TypeError('Invalid strategy: ' + strategy); - } - - if (this._level !== level || this._strategy !== strategy) { - var self = this; - this.flush(binding.Z_SYNC_FLUSH, function () { - assert(self._handle, 'zlib binding closed'); - self._handle.params(level, strategy); - if (!self._hadError) { - self._level = level; - self._strategy = strategy; - if (callback) callback(); - } - }); - } else { - process.nextTick(callback); - } -}; - -Zlib.prototype.reset = function () { - assert(this._handle, 'zlib binding closed'); - return this._handle.reset(); -}; - -// This is the _flush function called by the transform class, -// internally, when the last chunk has been written. -Zlib.prototype._flush = function (callback) { - this._transform(Buffer.alloc(0), '', callback); -}; - -Zlib.prototype.flush = function (kind, callback) { - var _this2 = this; - - var ws = this._writableState; - - if (typeof kind === 'function' || kind === undefined && !callback) { - callback = kind; - kind = binding.Z_FULL_FLUSH; - } - - if (ws.ended) { - if (callback) process.nextTick(callback); - } else if (ws.ending) { - if (callback) this.once('end', callback); - } else if (ws.needDrain) { - if (callback) { - this.once('drain', function () { - return _this2.flush(kind, callback); - }); - } - } else { - this._flushFlag = kind; - this.write(Buffer.alloc(0), '', callback); - } -}; - -Zlib.prototype.close = function (callback) { - _close(this, callback); - process.nextTick(emitCloseNT, this); -}; - -function _close(engine, callback) { - if (callback) process.nextTick(callback); - - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) return; - - engine._handle.close(); - engine._handle = null; -} - -function emitCloseNT(self) { - self.emit('close'); -} - -Zlib.prototype._transform = function (chunk, encoding, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); - - if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); - - if (!this._handle) return cb(new Error('zlib binding closed')); - - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag - // (or whatever flag was provided using opts.finishFlush). - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) flushFlag = this._finishFlushFlag;else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.length >= ws.length) { - this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; - } - } - - this._processChunk(chunk, flushFlag, cb); -}; - -Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; - - var self = this; - - var async = typeof cb === 'function'; - - if (!async) { - var buffers = []; - var nread = 0; - - var error; - this.on('error', function (er) { - error = er; - }); - - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - } while (!this._hadError && callback(res[0], res[1])); - - if (this._hadError) { - throw error; - } - - if (nread >= kMaxLength) { - _close(this); - throw new RangeError(kRangeErrorMessage); - } - - var buf = Buffer.concat(buffers, nread); - _close(this); - - return buf; - } - - assert(this._handle, 'zlib binding closed'); - var req = this._handle.write(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - - req.buffer = chunk; - req.callback = callback; - - function callback(availInAfter, availOutAfter) { - // When the callback is used in an async write, the callback's - // context is the `req` object that was created. The req object - // is === this._handle, and that's why it's important to null - // out the values after they are done being used. `this._handle` - // can stay in memory longer than the callback and buffer are needed. - if (this) { - this.buffer = null; - this.callback = null; - } - - if (self._hadError) return; - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - if (async) { - self.push(out); - } else { - buffers.push(out); - nread += out.length; - } - } - - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } - - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += availInBefore - availInAfter; - availInBefore = availInAfter; - - if (!async) return true; - - var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } - - if (!async) return false; - - // finished with the chunk. - cb(); - } -}; - -util.inherits(Deflate, Zlib); -util.inherits(Inflate, Zlib); -util.inherits(Gzip, Zlib); -util.inherits(Gunzip, Zlib); -util.inherits(DeflateRaw, Zlib); -util.inherits(InflateRaw, Zlib); -util.inherits(Unzip, Zlib); -}).call(this,require('_process')) -},{"./binding":34,"_process":133,"assert":25,"buffer":48,"stream":155,"util":186}],36:[function(require,module,exports){ -'use strict'; - - -var TYPED_OK = (typeof Uint8Array !== 'undefined') && - (typeof Uint16Array !== 'undefined') && - (typeof Int32Array !== 'undefined'); - -function _has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -exports.assign = function (obj /*from1, from2, from3, ...*/) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { continue; } - - if (typeof source !== 'object') { - throw new TypeError(source + 'must be non-object'); - } - - for (var p in source) { - if (_has(source, p)) { - obj[p] = source[p]; - } - } - } - - return obj; -}; - - -// reduce buffer size, avoiding mem copy -exports.shrinkBuf = function (buf, size) { - if (buf.length === size) { return buf; } - if (buf.subarray) { return buf.subarray(0, size); } - buf.length = size; - return buf; -}; - - -var fnTyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - if (src.subarray && dest.subarray) { - dest.set(src.subarray(src_offs, src_offs + len), dest_offs); - return; - } - // Fallback to ordinary array - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - var i, l, len, pos, chunk, result; - - // calculate data length - len = 0; - for (i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - - // join chunks - result = new Uint8Array(len); - pos = 0; - for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; - } - - return result; - } -}; - -var fnUntyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - return [].concat.apply([], chunks); - } -}; - - -// Enable/Disable typed arrays use, for testing -// -exports.setTyped = function (on) { - if (on) { - exports.Buf8 = Uint8Array; - exports.Buf16 = Uint16Array; - exports.Buf32 = Int32Array; - exports.assign(exports, fnTyped); - } else { - exports.Buf8 = Array; - exports.Buf16 = Array; - exports.Buf32 = Array; - exports.assign(exports, fnUntyped); - } -}; - -exports.setTyped(TYPED_OK); - -},{}],37:[function(require,module,exports){ -'use strict'; - -// Note: adler32 takes 12% for level 0 and 2% for level 6. -// It isn't worth it to make additional optimizations as in original. -// Small size is preferable. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function adler32(adler, buf, len, pos) { - var s1 = (adler & 0xffff) |0, - s2 = ((adler >>> 16) & 0xffff) |0, - n = 0; - - while (len !== 0) { - // Set limit ~ twice less than 5552, to keep - // s2 in 31-bits, because we force signed ints. - // in other case %= will fail. - n = len > 2000 ? 2000 : len; - len -= n; - - do { - s1 = (s1 + buf[pos++]) |0; - s2 = (s2 + s1) |0; - } while (--n); - - s1 %= 65521; - s2 %= 65521; - } - - return (s1 | (s2 << 16)) |0; -} - - -module.exports = adler32; - -},{}],38:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -module.exports = { - - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - - - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type -}; - -},{}],39:[function(require,module,exports){ -'use strict'; - -// Note: we can't get significant speed boost here. -// So write code to minimize size - no pregenerated tables -// and array tools dependencies. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -// Use ordinary array, since untyped makes no boost here -function makeTable() { - var c, table = []; - - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -var crcTable = makeTable(); - - -function crc32(crc, buf, len, pos) { - var t = crcTable, - end = pos + len; - - crc ^= -1; - - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - - -module.exports = crc32; - -},{}],40:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var trees = require('./trees'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var msg = require('./messages'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -//var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -//var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -//var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - - -/* compression levels */ -//var Z_NO_COMPRESSION = 0; -//var Z_BEST_SPEED = 1; -//var Z_BEST_COMPRESSION = 9; -var Z_DEFAULT_COMPRESSION = -1; - - -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_RLE = 3; -var Z_FIXED = 4; -var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//var Z_BINARY = 0; -//var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - - -/* The deflate compression method */ -var Z_DEFLATED = 8; - -/*============================================================================*/ - - -var MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_MEM_LEVEL = 8; - - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -var LITERALS = 256; -/* number of literal bytes 0..255 */ -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -var D_CODES = 30; -/* number of distance codes */ -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var EXTRA_STATE = 69; -var NAME_STATE = 73; -var COMMENT_STATE = 91; -var HCRC_STATE = 103; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ -var BS_BLOCK_DONE = 2; /* block flush performed */ -var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ -var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - -var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - - -function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -} - - -function put_byte(s, b) { - s.pending_buf[s.pending++] = b; -} - - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s, b) { -// put_byte(s, (Byte)(b >> 8)); -// put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; -//#if MIN_MATCH != 3 -// Call update_hash() MIN_MATCH-3 more times -//#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ -// if (s.high_water < s.window_size) { -// var curr = s.strstart + s.lookahead; -// var init = 0; -// -// if (s.high_water < curr) { -// /* Previous high water mark below current data -- zero WIN_INIT -// * bytes or up to end of window, whichever is less. -// */ -// init = s.window_size - curr; -// if (init > WIN_INIT) -// init = WIN_INIT; -// zmemzero(s->window + curr, (unsigned)init); -// s->high_water = curr + init; -// } -// else if (s->high_water < (ulg)curr + WIN_INIT) { -// /* High water mark at or above current data, but below current data -// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up -// * to end of window, whichever is less. -// */ -// init = (ulg)curr + WIN_INIT - s->high_water; -// if (init > s->window_size - s->high_water) -// init = s->window_size - s->high_water; -// zmemzero(s->window + s->high_water, (unsigned)init); -// s->high_water += init; -// } -// } -// -// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, -// "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); -// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || -// s.block_start >= s.w_size)) { -// throw new Error("slide too late"); -// } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); -// if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - -//#if MIN_MATCH != 3 -// Call UPDATE_HASH() MIN_MATCH-3 more times -//#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} - -var configuration_table; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ -]; - - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - - -function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ -} - - -function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - - -function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - - -function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; -} - - -function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -} - - -function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - -//#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } -//#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; -} - - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} - - -exports.deflateInit = deflateInit; -exports.deflateInit2 = deflateInit2; -exports.deflateReset = deflateReset; -exports.deflateResetKeep = deflateResetKeep; -exports.deflateSetHeader = deflateSetHeader; -exports.deflate = deflate; -exports.deflateEnd = deflateEnd; -exports.deflateSetDictionary = deflateSetDictionary; -exports.deflateInfo = 'pako deflate (from Nodeca project)'; - -/* Not implemented -exports.deflateBound = deflateBound; -exports.deflateCopy = deflateCopy; -exports.deflateParams = deflateParams; -exports.deflatePending = deflatePending; -exports.deflatePrime = deflatePrime; -exports.deflateTune = deflateTune; -*/ - -},{"../utils/common":36,"./adler32":37,"./crc32":39,"./messages":44,"./trees":45}],41:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -// See state defs from inflate.js -var BAD = 30; /* got a data error -- remain here until reset */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state.mode === LEN - strm.avail_in >= 6 - strm.avail_out >= 258 - start >= strm.avail_out - state.bits < 8 - - On return, state.mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm.avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm.avail_out >= 258 for each loop to avoid checking for - output space. - */ -module.exports = function inflate_fast(strm, start) { - var state; - var _in; /* local strm.input */ - var last; /* have enough input while in < last */ - var _out; /* local strm.output */ - var beg; /* inflate()'s initial strm.output */ - var end; /* while out < end, enough space available */ -//#ifdef INFLATE_STRICT - var dmax; /* maximum distance from zlib header */ -//#endif - var wsize; /* window size or zero if not using window */ - var whave; /* valid bytes in the window */ - var wnext; /* window write index */ - // Use `s_window` instead `window`, avoid conflict with instrumentation tools - var s_window; /* allocated sliding window, if wsize != 0 */ - var hold; /* local strm.hold */ - var bits; /* local strm.bits */ - var lcode; /* local strm.lencode */ - var dcode; /* local strm.distcode */ - var lmask; /* mask for first level of length codes */ - var dmask; /* mask for first level of distance codes */ - var here; /* retrieved table entry */ - var op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - var len; /* match length, unused bytes */ - var dist; /* match distance */ - var from; /* where to copy match from */ - var from_source; - - - var input, output; // JS specific, because we have no pointers - - /* copy state to local variables */ - state = strm.state; - //here = state.here; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); -//#ifdef INFLATE_STRICT - dmax = state.dmax; -//#endif - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - - here = lcode[hold & lmask]; - - dolen: - for (;;) { // Goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - if (op === 0) { /* literal */ - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - output[_out++] = here & 0xffff/*here.val*/; - } - else if (op & 16) { /* length base */ - len = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & ((1 << op) - 1); - hold >>>= op; - bits -= op; - } - //Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - - dodist: - for (;;) { // goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - - if (op & 16) { /* distance base */ - dist = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & ((1 << op) - 1); -//#ifdef INFLATE_STRICT - if (dist > dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } -//#endif - hold >>>= op; - bits -= op; - //Tracevv((stderr, "inflate: distance %u\n", dist)); - op = _out - beg; /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// if (len <= op - whave) { -// do { -// output[_out++] = 0; -// } while (--len); -// continue top; -// } -// len -= op - whave; -// do { -// output[_out++] = 0; -// } while (--op > whave); -// if (op === 0) { -// from = _out - dist; -// do { -// output[_out++] = output[from++]; -// } while (--len); -// continue top; -// } -//#endif - } - from = 0; // window index - from_source = s_window; - if (wnext === 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } - else { - from = _out - dist; /* copy direct from output */ - do { /* minimum length is three */ - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } - else if ((op & 64) === 0) { /* 2nd level distance code */ - here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dodist; - } - else { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } - else if ((op & 64) === 0) { /* 2nd level length code */ - here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dolen; - } - else if (op & 32) { /* end-of-block */ - //Tracevv((stderr, "inflate: end of block\n")); - state.mode = TYPE; - break top; - } - else { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } while (_in < last && _out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - - /* update state and return */ - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); - strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); - state.hold = hold; - state.bits = bits; - return; -}; - -},{}],42:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var inflate_fast = require('./inffast'); -var inflate_table = require('./inftrees'); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -//var Z_NO_FLUSH = 0; -//var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -//var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - -/* The deflate compression method */ -var Z_DEFLATED = 8; - - -/* STATES ====================================================================*/ -/* ===========================================================================*/ - - -var HEAD = 1; /* i: waiting for magic header */ -var FLAGS = 2; /* i: waiting for method and flags (gzip) */ -var TIME = 3; /* i: waiting for modification time (gzip) */ -var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ -var EXLEN = 5; /* i: waiting for extra length (gzip) */ -var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ -var NAME = 7; /* i: waiting for end of file name (gzip) */ -var COMMENT = 8; /* i: waiting for end of comment (gzip) */ -var HCRC = 9; /* i: waiting for header crc (gzip) */ -var DICTID = 10; /* i: waiting for dictionary check value */ -var DICT = 11; /* waiting for inflateSetDictionary() call */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ -var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ -var STORED = 14; /* i: waiting for stored size (length and complement) */ -var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ -var COPY = 16; /* i/o: waiting for input or output to copy stored block */ -var TABLE = 17; /* i: waiting for dynamic block table lengths */ -var LENLENS = 18; /* i: waiting for code length code lengths */ -var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ -var LEN_ = 20; /* i: same as LEN below, but only first time in */ -var LEN = 21; /* i: waiting for length/lit/eob code */ -var LENEXT = 22; /* i: waiting for length extra bits */ -var DIST = 23; /* i: waiting for distance code */ -var DISTEXT = 24; /* i: waiting for distance extra bits */ -var MATCH = 25; /* o: waiting for output space to copy string */ -var LIT = 26; /* o: waiting for output space to write literal */ -var CHECK = 27; /* i: waiting for 32-bit check value */ -var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ -var DONE = 29; /* finished check, done -- remain here until reset */ -var BAD = 30; /* got a data error -- remain here until reset */ -var MEM = 31; /* got an inflate() memory error -- remain here until reset */ -var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - -/* ===========================================================================*/ - - - -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_WBITS = MAX_WBITS; - - -function zswap32(q) { - return (((q >>> 24) & 0xff) + - ((q >>> 8) & 0xff00) + - ((q & 0xff00) << 8) + - ((q & 0xff) << 24)); -} - - -function InflateState() { - this.mode = 0; /* current inflate mode */ - this.last = false; /* true if processing last block */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.havedict = false; /* true if dictionary provided */ - this.flags = 0; /* gzip header method and flags (0 if zlib) */ - this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ - this.check = 0; /* protected copy of check value */ - this.total = 0; /* protected copy of output count */ - // TODO: may be {} - this.head = null; /* where to save gzip header information */ - - /* sliding window */ - this.wbits = 0; /* log base 2 of requested window size */ - this.wsize = 0; /* window size or zero if not using window */ - this.whave = 0; /* valid bytes in the window */ - this.wnext = 0; /* window write index */ - this.window = null; /* allocated sliding window, if needed */ - - /* bit accumulator */ - this.hold = 0; /* input bit accumulator */ - this.bits = 0; /* number of bits in "in" */ - - /* for string and stored block copying */ - this.length = 0; /* literal or length of data to copy */ - this.offset = 0; /* distance back to copy string from */ - - /* for table and code decoding */ - this.extra = 0; /* extra bits needed */ - - /* fixed and dynamic code tables */ - this.lencode = null; /* starting table for length/literal codes */ - this.distcode = null; /* starting table for distance codes */ - this.lenbits = 0; /* index bits for lencode */ - this.distbits = 0; /* index bits for distcode */ - - /* dynamic table building */ - this.ncode = 0; /* number of code length code lengths */ - this.nlen = 0; /* number of length code lengths */ - this.ndist = 0; /* number of distance code lengths */ - this.have = 0; /* number of code lengths in lens[] */ - this.next = null; /* next available space in codes[] */ - - this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ - this.work = new utils.Buf16(288); /* work area for code table building */ - - /* - because we don't have pointers in js, we use lencode and distcode directly - as buffers so we don't need codes - */ - //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ - this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ - this.distdyn = null; /* dynamic table for distance codes (JS specific) */ - this.sane = 0; /* if false, allow invalid distance too far */ - this.back = 0; /* bits back of last unprocessed length/lit */ - this.was = 0; /* initial length of match */ -} - -function inflateResetKeep(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ''; /*Z_NULL*/ - if (state.wrap) { /* to support ill-conceived Java test suite */ - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null/*Z_NULL*/; - state.hold = 0; - state.bits = 0; - //state.lencode = state.distcode = state.next = state.codes; - state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); - state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); - - state.sane = 1; - state.back = -1; - //Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -function inflateReset(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - -} - -function inflateReset2(strm, windowBits) { - var wrap; - var state; - - /* get the state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - - /* update state and reset the rest of it */ - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); -} - -function inflateInit2(strm, windowBits) { - var ret; - var state; - - if (!strm) { return Z_STREAM_ERROR; } - //strm.msg = Z_NULL; /* in case we return an error */ - - state = new InflateState(); - - //if (state === Z_NULL) return Z_MEM_ERROR; - //Tracev((stderr, "inflate: allocated\n")); - strm.state = state; - state.window = null/*Z_NULL*/; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null/*Z_NULL*/; - } - return ret; -} - -function inflateInit(strm) { - return inflateInit2(strm, DEF_WBITS); -} - - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -var virgin = true; - -var lenfix, distfix; // We have no pointers in JS, so keep tables separate - -function fixedtables(state) { - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - var sym; - - lenfix = new utils.Buf32(512); - distfix = new utils.Buf32(32); - - /* literal/length table */ - sym = 0; - while (sym < 144) { state.lens[sym++] = 8; } - while (sym < 256) { state.lens[sym++] = 9; } - while (sym < 280) { state.lens[sym++] = 7; } - while (sym < 288) { state.lens[sym++] = 8; } - - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - - /* distance table */ - sym = 0; - while (sym < 32) { state.lens[sym++] = 5; } - - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - - /* do this just once */ - virgin = false; - } - - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; -} - - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -function updatewindow(strm, src, end, copy) { - var dist; - var state = strm.state; - - /* if it hasn't been done already, allocate space for the window */ - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - - state.window = new utils.Buf8(state.wsize); - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state.wsize) { - utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); - state.wnext = 0; - state.whave = state.wsize; - } - else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - //zmemcpy(state->window + state->wnext, end - copy, dist); - utils.arraySet(state.window, src, end - copy, dist, state.wnext); - copy -= dist; - if (copy) { - //zmemcpy(state->window, end - copy, copy); - utils.arraySet(state.window, src, end - copy, copy, 0); - state.wnext = copy; - state.whave = state.wsize; - } - else { - state.wnext += dist; - if (state.wnext === state.wsize) { state.wnext = 0; } - if (state.whave < state.wsize) { state.whave += dist; } - } - } - return 0; -} - -function inflate(strm, flush) { - var state; - var input, output; // input/output buffers - var next; /* next input INDEX */ - var put; /* next output INDEX */ - var have, left; /* available input and output */ - var hold; /* bit buffer */ - var bits; /* bits in bit buffer */ - var _in, _out; /* save starting available input and output */ - var copy; /* number of stored or match bytes to copy */ - var from; /* where to copy match bytes from */ - var from_source; - var here = 0; /* current decoding table entry */ - var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) - //var last; /* parent table entry */ - var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) - var len; /* length to copy for repeats, bits to drop */ - var ret; /* return code */ - var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ - var opts; - - var n; // temporary var for NEED_BITS - - var order = /* permutation of code lengths */ - [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - - - if (!strm || !strm.state || !strm.output || - (!strm.input && strm.avail_in !== 0)) { - return Z_STREAM_ERROR; - } - - state = strm.state; - if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ - - - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - _in = have; - _out = left; - ret = Z_OK; - - inf_leave: // goto emulation - for (;;) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - //=== NEEDBITS(16); - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ - state.check = 0/*crc32(0L, Z_NULL, 0)*/; - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = FLAGS; - break; - } - state.flags = 0; /* expect zlib header */ - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { - strm.msg = 'incorrect header check'; - state.mode = BAD; - break; - } - if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - len = (hold & 0x0f)/*BITS(4)*/ + 8; - if (state.wbits === 0) { - state.wbits = len; - } - else if (len > state.wbits) { - strm.msg = 'invalid window size'; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - //Tracev((stderr, "inflate: zlib header ok\n")); - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = hold & 0x200 ? DICTID : TYPE; - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - break; - case FLAGS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.flags = hold; - if ((state.flags & 0xff) !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - if (state.flags & 0xe000) { - strm.msg = 'unknown header flags set'; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = ((hold >> 8) & 1); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = TIME; - /* falls through */ - case TIME: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.time = hold; - } - if (state.flags & 0x0200) { - //=== CRC4(state.check, hold) - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - hbuf[2] = (hold >>> 16) & 0xff; - hbuf[3] = (hold >>> 24) & 0xff; - state.check = crc32(state.check, hbuf, 4, 0); - //=== - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = OS; - /* falls through */ - case OS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.xflags = (hold & 0xff); - state.head.os = (hold >> 8); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 0x0400) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - else if (state.head) { - state.head.extra = null/*Z_NULL*/; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 0x0400) { - copy = state.length; - if (copy > have) { copy = have; } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - // Use untyped array for more convenient processing later - state.head.extra = new Array(state.head.extra_len); - } - utils.arraySet( - state.head.extra, - input, - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - copy, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - //zmemcpy(state.head.extra + len, next, - // len + copy > state.head.extra_max ? - // state.head.extra_max - len : copy); - } - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { break inf_leave; } - } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 0x0800) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - // TODO: 2 or 1 bytes? - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.name_max*/)) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 0x1000) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.comm_max*/)) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 0x0200) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.check & 0xffff)) { - strm.msg = 'header crc mismatch'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - if (state.head) { - state.head.hcrc = ((state.flags >> 9) & 1); - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - strm.adler = state.check = zswap32(hold); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - return Z_NEED_DICT; - } - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } - /* falls through */ - case TYPEDO: - if (state.last) { - //--- BYTEBITS() ---// - hold >>>= bits & 7; - bits -= bits & 7; - //---// - state.mode = CHECK; - break; - } - //=== NEEDBITS(3); */ - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.last = (hold & 0x01)/*BITS(1)*/; - //--- DROPBITS(1) ---// - hold >>>= 1; - bits -= 1; - //---// - - switch ((hold & 0x03)/*BITS(2)*/) { - case 0: /* stored block */ - //Tracev((stderr, "inflate: stored block%s\n", - // state.last ? " (last)" : "")); - state.mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - //Tracev((stderr, "inflate: fixed codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = LEN_; /* decode codes */ - if (flush === Z_TREES) { - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break inf_leave; - } - break; - case 2: /* dynamic block */ - //Tracev((stderr, "inflate: dynamic codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = TABLE; - break; - case 3: - strm.msg = 'invalid block type'; - state.mode = BAD; - } - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break; - case STORED: - //--- BYTEBITS() ---// /* go to byte boundary */ - hold >>>= bits & 7; - bits -= bits & 7; - //---// - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { - strm.msg = 'invalid stored block lengths'; - state.mode = BAD; - break; - } - state.length = hold & 0xffff; - //Tracev((stderr, "inflate: stored length %u\n", - // state.length)); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = COPY_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { copy = have; } - if (copy > left) { copy = left; } - if (copy === 0) { break inf_leave; } - //--- zmemcpy(put, next, copy); --- - utils.arraySet(output, input, next, copy, put); - //---// - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - //Tracev((stderr, "inflate: stored end\n")); - state.mode = TYPE; - break; - case TABLE: - //=== NEEDBITS(14); */ - while (bits < 14) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// -//#ifndef PKZIP_BUG_WORKAROUND - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = 'too many length or distance symbols'; - state.mode = BAD; - break; - } -//#endif - //Tracev((stderr, "inflate: table sizes ok\n")); - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - //=== NEEDBITS(3); - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - // We have separate tables & no pointers. 2 commented lines below not needed. - //state.next = state.codes; - //state.lencode = state.next; - // Switch to use dynamic table - state.lencode = state.lendyn; - state.lenbits = 7; - - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - - if (ret) { - strm.msg = 'invalid code lengths set'; - state.mode = BAD; - break; - } - //Tracev((stderr, "inflate: code lengths ok\n")); - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_val < 16) { - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.lens[state.have++] = here_val; - } - else { - if (here_val === 16) { - //=== NEEDBITS(here.bits + 2); - n = here_bits + 2; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - if (state.have === 0) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 0x03);//BITS(2); - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - } - else if (here_val === 17) { - //=== NEEDBITS(here.bits + 3); - n = here_bits + 3; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 3 + (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - else { - //=== NEEDBITS(here.bits + 7); - n = here_bits + 7; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 11 + (hold & 0x7f);//BITS(7); - //--- DROPBITS(7) ---// - hold >>>= 7; - bits -= 7; - //---// - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - - /* handle error breaks in while */ - if (state.mode === BAD) { break; } - - /* check for end-of-block code (better have one) */ - if (state.lens[256] === 0) { - strm.msg = 'invalid code -- missing end-of-block'; - state.mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state.lenbits = 9; - - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.lenbits = opts.bits; - // state.lencode = state.next; - - if (ret) { - strm.msg = 'invalid literal/lengths set'; - state.mode = BAD; - break; - } - - state.distbits = 6; - //state.distcode.copy(state.codes); - // Switch to use dynamic table - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.distbits = opts.bits; - // state.distcode = state.next; - - if (ret) { - strm.msg = 'invalid distances set'; - state.mode = BAD; - break; - } - //Tracev((stderr, 'inflate: codes ok\n')); - state.mode = LEN_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - inflate_fast(strm, _out); - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if (here_bits <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_op && (here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.lencode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - state.mode = LIT; - break; - } - if (here_op & 32) { - //Tracevv((stderr, "inflate: end of block\n")); - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //Tracevv((stderr, "inflate: length %u\n", state.length)); - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (;;) { - here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if ((here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.distcode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - if (here_op & 64) { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = (here_op) & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } -//#ifdef INFLATE_STRICT - if (state.offset > state.dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -//#endif - //Tracevv((stderr, "inflate: distance %u\n", state.offset)); - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) { break inf_leave; } - copy = _out - left; - if (state.offset > copy) { /* copy from window */ - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// Trace((stderr, "inflate.c too far\n")); -// copy -= state.whave; -// if (copy > state.length) { copy = state.length; } -// if (copy > left) { copy = left; } -// left -= copy; -// state.length -= copy; -// do { -// output[put++] = 0; -// } while (--copy); -// if (state.length === 0) { state.mode = LEN; } -// break; -//#endif - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } - else { - from = state.wnext - copy; - } - if (copy > state.length) { copy = state.length; } - from_source = state.window; - } - else { /* copy from output */ - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) { copy = left; } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { state.mode = LEN; } - break; - case LIT: - if (left === 0) { break inf_leave; } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - // Use '|' instead of '+' to make sure that result is signed - hold |= input[next++] << bits; - bits += 8; - } - //===// - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = - /*UPDATE(state.check, put - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); - - } - _out = left; - // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = 'incorrect data check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: check matches trailer\n")); - } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.total & 0xffffffff)) { - strm.msg = 'incorrect length check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: length matches trailer\n")); - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; - } - } - - // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - - if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH))) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + - (state.mode === TYPE ? 128 : 0) + - (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; -} - -function inflateEnd(strm) { - - if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { - return Z_STREAM_ERROR; - } - - var state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; -} - -function inflateGetHeader(strm, head) { - var state; - - /* check state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } - - /* save header structure */ - state.head = head; - head.done = false; - return Z_OK; -} - -function inflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var state; - var dictid; - var ret; - - /* check state */ - if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } - state = strm.state; - - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - - /* check for correct dictionary identifier */ - if (state.mode === DICT) { - dictid = 1; /* adler32(0, null, 0)*/ - /* dictid = adler32(dictid, dictionary, dictLength); */ - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - // Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -exports.inflateReset = inflateReset; -exports.inflateReset2 = inflateReset2; -exports.inflateResetKeep = inflateResetKeep; -exports.inflateInit = inflateInit; -exports.inflateInit2 = inflateInit2; -exports.inflate = inflate; -exports.inflateEnd = inflateEnd; -exports.inflateGetHeader = inflateGetHeader; -exports.inflateSetDictionary = inflateSetDictionary; -exports.inflateInfo = 'pako inflate (from Nodeca project)'; - -/* Not implemented -exports.inflateCopy = inflateCopy; -exports.inflateGetDictionary = inflateGetDictionary; -exports.inflateMark = inflateMark; -exports.inflatePrime = inflatePrime; -exports.inflateSync = inflateSync; -exports.inflateSyncPoint = inflateSyncPoint; -exports.inflateUndermine = inflateUndermine; -*/ - -},{"../utils/common":36,"./adler32":37,"./crc32":39,"./inffast":41,"./inftrees":43}],43:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); - -var MAXBITS = 15; -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -var lbase = [ /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 -]; - -var lext = [ /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 -]; - -var dbase = [ /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0 -]; - -var dext = [ /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64 -]; - -module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) -{ - var bits = opts.bits; - //here = opts.here; /* table entry for duplication */ - - var len = 0; /* a code's length in bits */ - var sym = 0; /* index of code symbols */ - var min = 0, max = 0; /* minimum and maximum code lengths */ - var root = 0; /* number of index bits for root table */ - var curr = 0; /* number of index bits for current table */ - var drop = 0; /* code bits to drop for sub-table */ - var left = 0; /* number of prefix codes available */ - var used = 0; /* code entries in table used */ - var huff = 0; /* Huffman code */ - var incr; /* for incrementing code, index */ - var fill; /* index for replicating entries */ - var low; /* low bits for current root entry */ - var mask; /* mask for low root bits */ - var next; /* next available space in table */ - var base = null; /* base value table to use */ - var base_index = 0; -// var shoextra; /* extra bits table to use */ - var end; /* use base and extra for symbol > end */ - var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ - var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ - var extra = null; - var extra_index = 0; - - var here_bits, here_op, here_val; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - - /* bound code lengths, force root to be within code lengths */ - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { break; } - } - if (root > max) { - root = max; - } - if (max === 0) { /* no symbols to code at all */ - //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ - //table.bits[opts.table_index] = 1; //here.bits = (var char)1; - //table.val[opts.table_index++] = 0; //here.val = (var short)0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - - //table.op[opts.table_index] = 64; - //table.bits[opts.table_index] = 1; - //table.val[opts.table_index++] = 0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - opts.bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { break; } - } - if (root < min) { - root = min; - } - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } /* over-subscribed */ - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; /* incomplete set */ - } - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - // poor man optimization - use if-else instead of switch, - // to avoid deopts in old v8 - if (type === CODES) { - base = extra = work; /* dummy value--not used */ - end = 19; - - } else if (type === LENS) { - base = lbase; - base_index -= 257; - extra = lext; - extra_index -= 257; - end = 256; - - } else { /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize opts for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = table_index; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = -1; /* trigger new sub-table when len > root */ - used = 1 << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here_bits = len - drop; - if (work[sym] < end) { - here_op = 0; - here_val = work[sym]; - } - else if (work[sym] > end) { - here_op = extra[extra_index + work[sym]]; - here_val = base[base_index + work[sym]]; - } - else { - here_op = 32 + 64; /* end of block */ - here_val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1 << (len - drop); - fill = 1 << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; - } while (fill !== 0); - - /* backwards increment the len-bit code huff */ - incr = 1 << (len - 1); - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - - /* go to next symbol, update count, len */ - sym++; - if (--count[len] === 0) { - if (len === max) { break; } - len = lens[lens_index + work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) !== low) { - /* if first time, transition to sub-tables */ - if (drop === 0) { - drop = root; - } - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { break; } - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1 << curr; - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* point entry in root table to sub-table */ - low = huff & mask; - /*table.op[low] = curr; - table.bits[low] = root; - table.val[low] = next - opts.table_index;*/ - table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff !== 0) { - //table.op[next + huff] = 64; /* invalid code marker */ - //table.bits[next + huff] = len - drop; - //table.val[next + huff] = 0; - table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; - } - - /* set return parameters */ - //opts.table_index += used; - opts.bits = root; - return 0; -}; - -},{"../utils/common":36}],44:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -module.exports = { - 2: 'need dictionary', /* Z_NEED_DICT 2 */ - 1: 'stream end', /* Z_STREAM_END 1 */ - 0: '', /* Z_OK 0 */ - '-1': 'file error', /* Z_ERRNO (-1) */ - '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ - '-3': 'data error', /* Z_DATA_ERROR (-3) */ - '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ - '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ - '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ -}; - -},{}],45:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -/* eslint-disable space-unary-ops */ - -var utils = require('../utils/common'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -//var Z_FILTERED = 1; -//var Z_HUFFMAN_ONLY = 2; -//var Z_RLE = 3; -var Z_FIXED = 4; -//var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -var Z_BINARY = 0; -var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - -/*============================================================================*/ - - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - -// From zutil.h - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; -/* The three kinds of block type */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -var LITERALS = 256; -/* number of literal bytes 0..255 */ - -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -var D_CODES = 30; -/* number of distance codes */ - -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var Buf_size = 16; -/* size of bit buffer in bi_buf */ - - -/* =========================================================================== - * Constants - */ - -var MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -var END_BLOCK = 256; -/* end of block literal code */ - -var REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -var REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -var REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - -var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - -var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - -var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 -var static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -var static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -var _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -var base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -var base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - - -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; -} - - -var static_l_desc; -var static_d_desc; -var static_bl_desc; - - -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ -} - - - -function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s, w) { -// put_byte(s, (uch)((w) & 0xff)); -// put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - - -function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); -} - - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } -} - - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree, max_code, bl_count) -// ct_data *tree; /* the tree to decorate */ -// int max_code; /* largest code with non zero frequency */ -// ushf *bl_count; /* number of codes at each bit length */ -{ - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; -} - - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s) -{ - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s, buf, len, header) -//DeflateState *s; -//charf *buf; /* the input data */ -//unsigned len; /* its length */ -//int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } -// while (len--) { -// put_byte(s, *buf++); -// } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s, tree, k) -// deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - - -// inlined manually -// var SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s, ltree, dtree) -// deflate_state *s; -// const ct_data *ltree; /* literal tree */ -// const ct_data *dtree; /* distance tree */ -{ - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s, lcodes, dcodes, blcodes) -// deflate_state *s; -// int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - - -var static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -function _tr_init(s) -{ - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - - -/* =========================================================================== - * Send a stored block - */ -function _tr_stored_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -function _tr_flush_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block, or NULL if too old */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -function _tr_tally(s, dist, lc) -// deflate_state *s; -// unsigned dist; /* distance of matched string */ -// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility - -//#ifdef TRUNCATE_BLOCK -// /* Try to guess if it is profitable to stop the current block here */ -// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { -// /* Compute an upper bound for the compressed length */ -// out_length = s.last_lit*8; -// in_length = s.strstart - s.block_start; -// -// for (dcode = 0; dcode < D_CODES; dcode++) { -// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); -// } -// out_length >>>= 3; -// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", -// // s->last_lit, in_length, out_length, -// // 100L - out_length*100L/in_length)); -// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { -// return true; -// } -// } -//#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -exports._tr_init = _tr_init; -exports._tr_stored_block = _tr_stored_block; -exports._tr_flush_block = _tr_flush_block; -exports._tr_tally = _tr_tally; -exports._tr_align = _tr_align; - -},{"../utils/common":36}],46:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function ZStream() { - /* next input byte */ - this.input = null; // JS specific, because we have no pointers - this.next_in = 0; - /* number of bytes available at input */ - this.avail_in = 0; - /* total number of input bytes read so far */ - this.total_in = 0; - /* next output byte should be put there */ - this.output = null; // JS specific, because we have no pointers - this.next_out = 0; - /* remaining free space at output */ - this.avail_out = 0; - /* total number of bytes output so far */ - this.total_out = 0; - /* last error message, NULL if no error */ - this.msg = ''/*Z_NULL*/; - /* not visible by applications */ - this.state = null; - /* best guess about the data type: binary or text */ - this.data_type = 2/*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - this.adler = 0; -} - -module.exports = ZStream; - -},{}],47:[function(require,module,exports){ -arguments[4][33][0].apply(exports,arguments) -},{"dup":33}],48:[function(require,module,exports){ -(function (Buffer){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') -var customInspectSymbol = - (typeof Symbol === 'function' && typeof Symbol.for === 'function') - ? Symbol.for('nodejs.util.inspect.custom') - : null - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - var proto = { foo: function () { return 42 } } - Object.setPrototypeOf(proto, Uint8Array.prototype) - Object.setPrototypeOf(arr, proto) - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - Object.setPrototypeOf(buf, Buffer.prototype) - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } - - if (value == null) { - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - var b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) -Object.setPrototypeOf(Buffer, Uint8Array) - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) - - var actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype) - - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} -if (customInspectSymbol) { - Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - var strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]] - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype) - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } else if (typeof val === 'boolean') { - val = Number(val) - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -var hexSliceLookupTable = (function () { - var alphabet = '0123456789abcdef' - var table = new Array(256) - for (var i = 0; i < 16; ++i) { - var i16 = i * 16 - for (var j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j] - } - } - return table -})() - -}).call(this,require("buffer").Buffer) -},{"base64-js":29,"buffer":48,"ieee754":73}],49:[function(require,module,exports){ -var Buffer = require('buffer').Buffer; // for use with browserify - -module.exports = function (a, b) { - if (!Buffer.isBuffer(a)) return undefined; - if (!Buffer.isBuffer(b)) return undefined; - if (typeof a.equals === 'function') return a.equals(b); - if (a.length !== b.length) return false; - - for (var i = 0; i < a.length; i++) { - if (a[i] !== b[i]) return false; - } - - return true; -}; - -},{"buffer":48}],50:[function(require,module,exports){ -module.exports = { - "100": "Continue", - "101": "Switching Protocols", - "102": "Processing", - "200": "OK", - "201": "Created", - "202": "Accepted", - "203": "Non-Authoritative Information", - "204": "No Content", - "205": "Reset Content", - "206": "Partial Content", - "207": "Multi-Status", - "208": "Already Reported", - "226": "IM Used", - "300": "Multiple Choices", - "301": "Moved Permanently", - "302": "Found", - "303": "See Other", - "304": "Not Modified", - "305": "Use Proxy", - "307": "Temporary Redirect", - "308": "Permanent Redirect", - "400": "Bad Request", - "401": "Unauthorized", - "402": "Payment Required", - "403": "Forbidden", - "404": "Not Found", - "405": "Method Not Allowed", - "406": "Not Acceptable", - "407": "Proxy Authentication Required", - "408": "Request Timeout", - "409": "Conflict", - "410": "Gone", - "411": "Length Required", - "412": "Precondition Failed", - "413": "Payload Too Large", - "414": "URI Too Long", - "415": "Unsupported Media Type", - "416": "Range Not Satisfiable", - "417": "Expectation Failed", - "418": "I'm a teapot", - "421": "Misdirected Request", - "422": "Unprocessable Entity", - "423": "Locked", - "424": "Failed Dependency", - "425": "Unordered Collection", - "426": "Upgrade Required", - "428": "Precondition Required", - "429": "Too Many Requests", - "431": "Request Header Fields Too Large", - "451": "Unavailable For Legal Reasons", - "500": "Internal Server Error", - "501": "Not Implemented", - "502": "Bad Gateway", - "503": "Service Unavailable", - "504": "Gateway Timeout", - "505": "HTTP Version Not Supported", - "506": "Variant Also Negotiates", - "507": "Insufficient Storage", - "508": "Loop Detected", - "509": "Bandwidth Limit Exceeded", - "510": "Not Extended", - "511": "Network Authentication Required" -} - -},{}],51:[function(require,module,exports){ -(function (Buffer){ -// 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 = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":76}],52:[function(require,module,exports){ -// 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. - -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill - -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; -} - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); - this._maxListeners = n; - return this; -}; - -function $getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} - -EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; - var doError = (type === 'error'); - - events = this._events; - if (events) - doError = (doError && events.error == null); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - if (arguments.length > 1) - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; - } - return false; - } - - handler = events[type]; - - if (!handler) - return false; - - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = target._events; - if (!events) { - events = target._events = objectCreate(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (!existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { - // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - } - - // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - switch (arguments.length) { - case 0: - return this.listener.call(this.target); - case 1: - return this.listener.call(this.target, arguments[0]); - case 2: - return this.listener.call(this.target, arguments[0], arguments[1]); - case 3: - return this.listener.call(this.target, arguments[0], arguments[1], - arguments[2]); - default: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = this._events; - if (!events) - return this; - - list = events[type]; - if (!list) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else - spliceOne(list, position); - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (!events) - return this; - - // not listening for removeListener, no need to emit - if (!events.removeListener) { - if (arguments.length === 0) { - this._events = objectCreate(null); - this._eventsCount = 0; - } else if (events[type]) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = objectKeys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = objectCreate(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (!events) - return []; - - var evlistener = events[type]; - if (!evlistener) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; -}; - -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; -} - -},{}],53:[function(require,module,exports){ -var Parser = require('./lib/parser'); - -function getGlobal() { - return (1,eval)('this'); -} - -module.exports = { - create: function(buffer, global) { - global = global || getGlobal(); - if(buffer instanceof global.ArrayBuffer) { - var DOMBufferStream = require('./lib/dom-bufferstream'); - return new Parser(new DOMBufferStream(buffer, 0, buffer.byteLength, true, global)); - } else { - var NodeBufferStream = require('./lib/bufferstream'); - return new Parser(new NodeBufferStream(buffer, 0, buffer.length, true)); - } - } -}; - -},{"./lib/bufferstream":54,"./lib/dom-bufferstream":56,"./lib/parser":60}],54:[function(require,module,exports){ -function BufferStream(buffer, offset, length, bigEndian) { - this.buffer = buffer; - this.offset = offset || 0; - length = typeof length === 'number' ? length : buffer.length; - this.endPosition = this.offset + length; - this.setBigEndian(bigEndian); -} - -BufferStream.prototype = { - setBigEndian: function(bigEndian) { - this.bigEndian = !!bigEndian; - }, - nextUInt8: function() { - var value = this.buffer.readUInt8(this.offset); - this.offset += 1; - return value; - }, - nextInt8: function() { - var value = this.buffer.readInt8(this.offset); - this.offset += 1; - return value; - }, - nextUInt16: function() { - var value = this.bigEndian ? this.buffer.readUInt16BE(this.offset) : this.buffer.readUInt16LE(this.offset); - this.offset += 2; - return value; - }, - nextUInt32: function() { - var value = this.bigEndian ? this.buffer.readUInt32BE(this.offset) : this.buffer.readUInt32LE(this.offset); - this.offset += 4; - return value; - }, - nextInt16: function() { - var value = this.bigEndian ? this.buffer.readInt16BE(this.offset) : this.buffer.readInt16LE(this.offset); - this.offset += 2; - return value; - }, - nextInt32: function() { - var value = this.bigEndian ? this.buffer.readInt32BE(this.offset) : this.buffer.readInt32LE(this.offset); - this.offset += 4; - return value; - }, - nextFloat: function() { - var value = this.bigEndian ? this.buffer.readFloatBE(this.offset) : this.buffer.readFloatLE(this.offset); - this.offset += 4; - return value; - }, - nextDouble: function() { - var value = this.bigEndian ? this.buffer.readDoubleBE(this.offset) : this.buffer.readDoubleLE(this.offset); - this.offset += 8; - return value; - }, - nextBuffer: function(length) { - var value = this.buffer.slice(this.offset, this.offset + length); - this.offset += length; - return value; - }, - remainingLength: function() { - return this.endPosition - this.offset; - }, - nextString: function(length) { - var value = this.buffer.toString('utf8', this.offset, this.offset + length); - this.offset += length; - return value; - }, - mark: function() { - var self = this; - return { - openWithOffset: function(offset) { - offset = (offset || 0) + this.offset; - return new BufferStream(self.buffer, offset, self.endPosition - offset, self.bigEndian); - }, - offset: this.offset - }; - }, - offsetFrom: function(marker) { - return this.offset - marker.offset; - }, - skip: function(amount) { - this.offset += amount; - }, - branch: function(offset, length) { - length = typeof length === 'number' ? length : this.endPosition - (this.offset + offset); - return new BufferStream(this.buffer, this.offset + offset, length, this.bigEndian); - } -}; - -module.exports = BufferStream; - -},{}],55:[function(require,module,exports){ -function parseNumber(s) { - return parseInt(s, 10); -} - -//in seconds -var hours = 3600; -var minutes = 60; - -//take date (year, month, day) and time (hour, minutes, seconds) digits in UTC -//and return a timestamp in seconds -function parseDateTimeParts(dateParts, timeParts) { - dateParts = dateParts.map(parseNumber); - timeParts = timeParts.map(parseNumber); - var year = dateParts[0]; - var month = dateParts[1] - 1; - var day = dateParts[2]; - var hours = timeParts[0]; - var minutes = timeParts[1]; - var seconds = timeParts[2]; - var date = Date.UTC(year, month, day, hours, minutes, seconds, 0); - var timestamp = date / 1000; - return timestamp; -} - -//parse date with "2004-09-04T23:39:06-08:00" format, -//one of the formats supported by ISO 8601, and -//convert to utc timestamp in seconds -function parseDateWithTimezoneFormat(dateTimeStr) { - - var dateParts = dateTimeStr.substr(0, 10).split('-'); - var timeParts = dateTimeStr.substr(11, 8).split(':'); - var timezoneStr = dateTimeStr.substr(19, 6); - var timezoneParts = timezoneStr.split(':').map(parseNumber); - var timezoneOffset = (timezoneParts[0] * hours) + - (timezoneParts[1] * minutes); - - var timestamp = parseDateTimeParts(dateParts, timeParts); - //minus because the timezoneOffset describes - //how much the described time is ahead of UTC - timestamp -= timezoneOffset; - - if(typeof timestamp === 'number' && !isNaN(timestamp)) { - return timestamp; - } -} - -//parse date with "YYYY:MM:DD hh:mm:ss" format, convert to utc timestamp in seconds -function parseDateWithSpecFormat(dateTimeStr) { - var parts = dateTimeStr.split(' '), - dateParts = parts[0].split(':'), - timeParts = parts[1].split(':'); - - var timestamp = parseDateTimeParts(dateParts, timeParts); - - if(typeof timestamp === 'number' && !isNaN(timestamp)) { - return timestamp; - } -} - -function parseExifDate(dateTimeStr) { - //some easy checks to determine two common date formats - - //is the date in the standard "YYYY:MM:DD hh:mm:ss" format? - var isSpecFormat = dateTimeStr.length === 19 && - dateTimeStr.charAt(4) === ':'; - //is the date in the non-standard format, - //"2004-09-04T23:39:06-08:00" to include a timezone? - var isTimezoneFormat = dateTimeStr.length === 25 && - dateTimeStr.charAt(10) === 'T'; - var timestamp; - - if(isTimezoneFormat) { - return parseDateWithTimezoneFormat(dateTimeStr); - } - else if(isSpecFormat) { - return parseDateWithSpecFormat(dateTimeStr); - } -} - -module.exports = { - parseDateWithSpecFormat: parseDateWithSpecFormat, - parseDateWithTimezoneFormat: parseDateWithTimezoneFormat, - parseExifDate: parseExifDate -}; - -},{}],56:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -function DOMBufferStream(arrayBuffer, offset, length, bigEndian, global, parentOffset) { - this.global = global; - offset = offset || 0; - length = length || (arrayBuffer.byteLength - offset); - this.arrayBuffer = arrayBuffer.slice(offset, offset + length); - this.view = new global.DataView(this.arrayBuffer, 0, this.arrayBuffer.byteLength); - this.setBigEndian(bigEndian); - this.offset = 0; - this.parentOffset = (parentOffset || 0) + offset; -} - -DOMBufferStream.prototype = { - setBigEndian: function(bigEndian) { - this.littleEndian = !bigEndian; - }, - nextUInt8: function() { - var value = this.view.getUint8(this.offset); - this.offset += 1; - return value; - }, - nextInt8: function() { - var value = this.view.getInt8(this.offset); - this.offset += 1; - return value; - }, - nextUInt16: function() { - var value = this.view.getUint16(this.offset, this.littleEndian); - this.offset += 2; - return value; - }, - nextUInt32: function() { - var value = this.view.getUint32(this.offset, this.littleEndian); - this.offset += 4; - return value; - }, - nextInt16: function() { - var value = this.view.getInt16(this.offset, this.littleEndian); - this.offset += 2; - return value; - }, - nextInt32: function() { - var value = this.view.getInt32(this.offset, this.littleEndian); - this.offset += 4; - return value; - }, - nextFloat: function() { - var value = this.view.getFloat32(this.offset, this.littleEndian); - this.offset += 4; - return value; - }, - nextDouble: function() { - var value = this.view.getFloat64(this.offset, this.littleEndian); - this.offset += 8; - return value; - }, - nextBuffer: function(length) { - //this won't work in IE10 - var value = this.arrayBuffer.slice(this.offset, this.offset + length); - this.offset += length; - return value; - }, - remainingLength: function() { - return this.arrayBuffer.byteLength - this.offset; - }, - nextString: function(length) { - var value = this.arrayBuffer.slice(this.offset, this.offset + length); - value = String.fromCharCode.apply(null, new this.global.Uint8Array(value)); - this.offset += length; - return value; - }, - mark: function() { - var self = this; - return { - openWithOffset: function(offset) { - offset = (offset || 0) + this.offset; - return new DOMBufferStream(self.arrayBuffer, offset, self.arrayBuffer.byteLength - offset, !self.littleEndian, self.global, self.parentOffset); - }, - offset: this.offset, - getParentOffset: function() { - return self.parentOffset; - } - }; - }, - offsetFrom: function(marker) { - return this.parentOffset + this.offset - (marker.offset + marker.getParentOffset()); - }, - skip: function(amount) { - this.offset += amount; - }, - branch: function(offset, length) { - length = typeof length === 'number' ? length : this.arrayBuffer.byteLength - (this.offset + offset); - return new DOMBufferStream(this.arrayBuffer, this.offset + offset, length, !this.littleEndian, this.global, this.parentOffset); - } -}; - -module.exports = DOMBufferStream; - -},{}],57:[function(require,module,exports){ -module.exports = { - exif : { - 0x0001 : "InteropIndex", - 0x0002 : "InteropVersion", - 0x000B : "ProcessingSoftware", - 0x00FE : "SubfileType", - 0x00FF : "OldSubfileType", - 0x0100 : "ImageWidth", - 0x0101 : "ImageHeight", - 0x0102 : "BitsPerSample", - 0x0103 : "Compression", - 0x0106 : "PhotometricInterpretation", - 0x0107 : "Thresholding", - 0x0108 : "CellWidth", - 0x0109 : "CellLength", - 0x010A : "FillOrder", - 0x010D : "DocumentName", - 0x010E : "ImageDescription", - 0x010F : "Make", - 0x0110 : "Model", - 0x0111 : "StripOffsets", - 0x0112 : "Orientation", - 0x0115 : "SamplesPerPixel", - 0x0116 : "RowsPerStrip", - 0x0117 : "StripByteCounts", - 0x0118 : "MinSampleValue", - 0x0119 : "MaxSampleValue", - 0x011A : "XResolution", - 0x011B : "YResolution", - 0x011C : "PlanarConfiguration", - 0x011D : "PageName", - 0x011E : "XPosition", - 0x011F : "YPosition", - 0x0120 : "FreeOffsets", - 0x0121 : "FreeByteCounts", - 0x0122 : "GrayResponseUnit", - 0x0123 : "GrayResponseCurve", - 0x0124 : "T4Options", - 0x0125 : "T6Options", - 0x0128 : "ResolutionUnit", - 0x0129 : "PageNumber", - 0x012C : "ColorResponseUnit", - 0x012D : "TransferFunction", - 0x0131 : "Software", - 0x0132 : "ModifyDate", - 0x013B : "Artist", - 0x013C : "HostComputer", - 0x013D : "Predictor", - 0x013E : "WhitePoint", - 0x013F : "PrimaryChromaticities", - 0x0140 : "ColorMap", - 0x0141 : "HalftoneHints", - 0x0142 : "TileWidth", - 0x0143 : "TileLength", - 0x0144 : "TileOffsets", - 0x0145 : "TileByteCounts", - 0x0146 : "BadFaxLines", - 0x0147 : "CleanFaxData", - 0x0148 : "ConsecutiveBadFaxLines", - 0x014A : "SubIFD", - 0x014C : "InkSet", - 0x014D : "InkNames", - 0x014E : "NumberofInks", - 0x0150 : "DotRange", - 0x0151 : "TargetPrinter", - 0x0152 : "ExtraSamples", - 0x0153 : "SampleFormat", - 0x0154 : "SMinSampleValue", - 0x0155 : "SMaxSampleValue", - 0x0156 : "TransferRange", - 0x0157 : "ClipPath", - 0x0158 : "XClipPathUnits", - 0x0159 : "YClipPathUnits", - 0x015A : "Indexed", - 0x015B : "JPEGTables", - 0x015F : "OPIProxy", - 0x0190 : "GlobalParametersIFD", - 0x0191 : "ProfileType", - 0x0192 : "FaxProfile", - 0x0193 : "CodingMethods", - 0x0194 : "VersionYear", - 0x0195 : "ModeNumber", - 0x01B1 : "Decode", - 0x01B2 : "DefaultImageColor", - 0x01B3 : "T82Options", - 0x01B5 : "JPEGTables", - 0x0200 : "JPEGProc", - 0x0201 : "ThumbnailOffset", - 0x0202 : "ThumbnailLength", - 0x0203 : "JPEGRestartInterval", - 0x0205 : "JPEGLosslessPredictors", - 0x0206 : "JPEGPointTransforms", - 0x0207 : "JPEGQTables", - 0x0208 : "JPEGDCTables", - 0x0209 : "JPEGACTables", - 0x0211 : "YCbCrCoefficients", - 0x0212 : "YCbCrSubSampling", - 0x0213 : "YCbCrPositioning", - 0x0214 : "ReferenceBlackWhite", - 0x022F : "StripRowCounts", - 0x02BC : "ApplicationNotes", - 0x03E7 : "USPTOMiscellaneous", - 0x1000 : "RelatedImageFileFormat", - 0x1001 : "RelatedImageWidth", - 0x1002 : "RelatedImageHeight", - 0x4746 : "Rating", - 0x4747 : "XP_DIP_XML", - 0x4748 : "StitchInfo", - 0x4749 : "RatingPercent", - 0x800D : "ImageID", - 0x80A3 : "WangTag1", - 0x80A4 : "WangAnnotation", - 0x80A5 : "WangTag3", - 0x80A6 : "WangTag4", - 0x80E3 : "Matteing", - 0x80E4 : "DataType", - 0x80E5 : "ImageDepth", - 0x80E6 : "TileDepth", - 0x827D : "Model2", - 0x828D : "CFARepeatPatternDim", - 0x828E : "CFAPattern2", - 0x828F : "BatteryLevel", - 0x8290 : "KodakIFD", - 0x8298 : "Copyright", - 0x829A : "ExposureTime", - 0x829D : "FNumber", - 0x82A5 : "MDFileTag", - 0x82A6 : "MDScalePixel", - 0x82A7 : "MDColorTable", - 0x82A8 : "MDLabName", - 0x82A9 : "MDSampleInfo", - 0x82AA : "MDPrepDate", - 0x82AB : "MDPrepTime", - 0x82AC : "MDFileUnits", - 0x830E : "PixelScale", - 0x8335 : "AdventScale", - 0x8336 : "AdventRevision", - 0x835C : "UIC1Tag", - 0x835D : "UIC2Tag", - 0x835E : "UIC3Tag", - 0x835F : "UIC4Tag", - 0x83BB : "IPTC-NAA", - 0x847E : "IntergraphPacketData", - 0x847F : "IntergraphFlagRegisters", - 0x8480 : "IntergraphMatrix", - 0x8481 : "INGRReserved", - 0x8482 : "ModelTiePoint", - 0x84E0 : "Site", - 0x84E1 : "ColorSequence", - 0x84E2 : "IT8Header", - 0x84E3 : "RasterPadding", - 0x84E4 : "BitsPerRunLength", - 0x84E5 : "BitsPerExtendedRunLength", - 0x84E6 : "ColorTable", - 0x84E7 : "ImageColorIndicator", - 0x84E8 : "BackgroundColorIndicator", - 0x84E9 : "ImageColorValue", - 0x84EA : "BackgroundColorValue", - 0x84EB : "PixelIntensityRange", - 0x84EC : "TransparencyIndicator", - 0x84ED : "ColorCharacterization", - 0x84EE : "HCUsage", - 0x84EF : "TrapIndicator", - 0x84F0 : "CMYKEquivalent", - 0x8546 : "SEMInfo", - 0x8568 : "AFCP_IPTC", - 0x85B8 : "PixelMagicJBIGOptions", - 0x85D8 : "ModelTransform", - 0x8602 : "WB_GRGBLevels", - 0x8606 : "LeafData", - 0x8649 : "PhotoshopSettings", - 0x8769 : "ExifOffset", - 0x8773 : "ICC_Profile", - 0x877F : "TIFF_FXExtensions", - 0x8780 : "MultiProfiles", - 0x8781 : "SharedData", - 0x8782 : "T88Options", - 0x87AC : "ImageLayer", - 0x87AF : "GeoTiffDirectory", - 0x87B0 : "GeoTiffDoubleParams", - 0x87B1 : "GeoTiffAsciiParams", - 0x8822 : "ExposureProgram", - 0x8824 : "SpectralSensitivity", - 0x8825 : "GPSInfo", - 0x8827 : "ISO", - 0x8828 : "Opto-ElectricConvFactor", - 0x8829 : "Interlace", - 0x882A : "TimeZoneOffset", - 0x882B : "SelfTimerMode", - 0x8830 : "SensitivityType", - 0x8831 : "StandardOutputSensitivity", - 0x8832 : "RecommendedExposureIndex", - 0x8833 : "ISOSpeed", - 0x8834 : "ISOSpeedLatitudeyyy", - 0x8835 : "ISOSpeedLatitudezzz", - 0x885C : "FaxRecvParams", - 0x885D : "FaxSubAddress", - 0x885E : "FaxRecvTime", - 0x888A : "LeafSubIFD", - 0x9000 : "ExifVersion", - 0x9003 : "DateTimeOriginal", - 0x9004 : "CreateDate", - 0x9101 : "ComponentsConfiguration", - 0x9102 : "CompressedBitsPerPixel", - 0x9201 : "ShutterSpeedValue", - 0x9202 : "ApertureValue", - 0x9203 : "BrightnessValue", - 0x9204 : "ExposureCompensation", - 0x9205 : "MaxApertureValue", - 0x9206 : "SubjectDistance", - 0x9207 : "MeteringMode", - 0x9208 : "LightSource", - 0x9209 : "Flash", - 0x920A : "FocalLength", - 0x920B : "FlashEnergy", - 0x920C : "SpatialFrequencyResponse", - 0x920D : "Noise", - 0x920E : "FocalPlaneXResolution", - 0x920F : "FocalPlaneYResolution", - 0x9210 : "FocalPlaneResolutionUnit", - 0x9211 : "ImageNumber", - 0x9212 : "SecurityClassification", - 0x9213 : "ImageHistory", - 0x9214 : "SubjectArea", - 0x9215 : "ExposureIndex", - 0x9216 : "TIFF-EPStandardID", - 0x9217 : "SensingMethod", - 0x923A : "CIP3DataFile", - 0x923B : "CIP3Sheet", - 0x923C : "CIP3Side", - 0x923F : "StoNits", - 0x927C : "MakerNote", - 0x9286 : "UserComment", - 0x9290 : "SubSecTime", - 0x9291 : "SubSecTimeOriginal", - 0x9292 : "SubSecTimeDigitized", - 0x932F : "MSDocumentText", - 0x9330 : "MSPropertySetStorage", - 0x9331 : "MSDocumentTextPosition", - 0x935C : "ImageSourceData", - 0x9C9B : "XPTitle", - 0x9C9C : "XPComment", - 0x9C9D : "XPAuthor", - 0x9C9E : "XPKeywords", - 0x9C9F : "XPSubject", - 0xA000 : "FlashpixVersion", - 0xA001 : "ColorSpace", - 0xA002 : "ExifImageWidth", - 0xA003 : "ExifImageHeight", - 0xA004 : "RelatedSoundFile", - 0xA005 : "InteropOffset", - 0xA20B : "FlashEnergy", - 0xA20C : "SpatialFrequencyResponse", - 0xA20D : "Noise", - 0xA20E : "FocalPlaneXResolution", - 0xA20F : "FocalPlaneYResolution", - 0xA210 : "FocalPlaneResolutionUnit", - 0xA211 : "ImageNumber", - 0xA212 : "SecurityClassification", - 0xA213 : "ImageHistory", - 0xA214 : "SubjectLocation", - 0xA215 : "ExposureIndex", - 0xA216 : "TIFF-EPStandardID", - 0xA217 : "SensingMethod", - 0xA300 : "FileSource", - 0xA301 : "SceneType", - 0xA302 : "CFAPattern", - 0xA401 : "CustomRendered", - 0xA402 : "ExposureMode", - 0xA403 : "WhiteBalance", - 0xA404 : "DigitalZoomRatio", - 0xA405 : "FocalLengthIn35mmFormat", - 0xA406 : "SceneCaptureType", - 0xA407 : "GainControl", - 0xA408 : "Contrast", - 0xA409 : "Saturation", - 0xA40A : "Sharpness", - 0xA40B : "DeviceSettingDescription", - 0xA40C : "SubjectDistanceRange", - 0xA420 : "ImageUniqueID", - 0xA430 : "OwnerName", - 0xA431 : "SerialNumber", - 0xA432 : "LensInfo", - 0xA433 : "LensMake", - 0xA434 : "LensModel", - 0xA435 : "LensSerialNumber", - 0xA480 : "GDALMetadata", - 0xA481 : "GDALNoData", - 0xA500 : "Gamma", - 0xAFC0 : "ExpandSoftware", - 0xAFC1 : "ExpandLens", - 0xAFC2 : "ExpandFilm", - 0xAFC3 : "ExpandFilterLens", - 0xAFC4 : "ExpandScanner", - 0xAFC5 : "ExpandFlashLamp", - 0xBC01 : "PixelFormat", - 0xBC02 : "Transformation", - 0xBC03 : "Uncompressed", - 0xBC04 : "ImageType", - 0xBC80 : "ImageWidth", - 0xBC81 : "ImageHeight", - 0xBC82 : "WidthResolution", - 0xBC83 : "HeightResolution", - 0xBCC0 : "ImageOffset", - 0xBCC1 : "ImageByteCount", - 0xBCC2 : "AlphaOffset", - 0xBCC3 : "AlphaByteCount", - 0xBCC4 : "ImageDataDiscard", - 0xBCC5 : "AlphaDataDiscard", - 0xC427 : "OceScanjobDesc", - 0xC428 : "OceApplicationSelector", - 0xC429 : "OceIDNumber", - 0xC42A : "OceImageLogic", - 0xC44F : "Annotations", - 0xC4A5 : "PrintIM", - 0xC580 : "USPTOOriginalContentType", - 0xC612 : "DNGVersion", - 0xC613 : "DNGBackwardVersion", - 0xC614 : "UniqueCameraModel", - 0xC615 : "LocalizedCameraModel", - 0xC616 : "CFAPlaneColor", - 0xC617 : "CFALayout", - 0xC618 : "LinearizationTable", - 0xC619 : "BlackLevelRepeatDim", - 0xC61A : "BlackLevel", - 0xC61B : "BlackLevelDeltaH", - 0xC61C : "BlackLevelDeltaV", - 0xC61D : "WhiteLevel", - 0xC61E : "DefaultScale", - 0xC61F : "DefaultCropOrigin", - 0xC620 : "DefaultCropSize", - 0xC621 : "ColorMatrix1", - 0xC622 : "ColorMatrix2", - 0xC623 : "CameraCalibration1", - 0xC624 : "CameraCalibration2", - 0xC625 : "ReductionMatrix1", - 0xC626 : "ReductionMatrix2", - 0xC627 : "AnalogBalance", - 0xC628 : "AsShotNeutral", - 0xC629 : "AsShotWhiteXY", - 0xC62A : "BaselineExposure", - 0xC62B : "BaselineNoise", - 0xC62C : "BaselineSharpness", - 0xC62D : "BayerGreenSplit", - 0xC62E : "LinearResponseLimit", - 0xC62F : "CameraSerialNumber", - 0xC630 : "DNGLensInfo", - 0xC631 : "ChromaBlurRadius", - 0xC632 : "AntiAliasStrength", - 0xC633 : "ShadowScale", - 0xC634 : "DNGPrivateData", - 0xC635 : "MakerNoteSafety", - 0xC640 : "RawImageSegmentation", - 0xC65A : "CalibrationIlluminant1", - 0xC65B : "CalibrationIlluminant2", - 0xC65C : "BestQualityScale", - 0xC65D : "RawDataUniqueID", - 0xC660 : "AliasLayerMetadata", - 0xC68B : "OriginalRawFileName", - 0xC68C : "OriginalRawFileData", - 0xC68D : "ActiveArea", - 0xC68E : "MaskedAreas", - 0xC68F : "AsShotICCProfile", - 0xC690 : "AsShotPreProfileMatrix", - 0xC691 : "CurrentICCProfile", - 0xC692 : "CurrentPreProfileMatrix", - 0xC6BF : "ColorimetricReference", - 0xC6D2 : "PanasonicTitle", - 0xC6D3 : "PanasonicTitle2", - 0xC6F3 : "CameraCalibrationSig", - 0xC6F4 : "ProfileCalibrationSig", - 0xC6F5 : "ProfileIFD", - 0xC6F6 : "AsShotProfileName", - 0xC6F7 : "NoiseReductionApplied", - 0xC6F8 : "ProfileName", - 0xC6F9 : "ProfileHueSatMapDims", - 0xC6FA : "ProfileHueSatMapData1", - 0xC6FB : "ProfileHueSatMapData2", - 0xC6FC : "ProfileToneCurve", - 0xC6FD : "ProfileEmbedPolicy", - 0xC6FE : "ProfileCopyright", - 0xC714 : "ForwardMatrix1", - 0xC715 : "ForwardMatrix2", - 0xC716 : "PreviewApplicationName", - 0xC717 : "PreviewApplicationVersion", - 0xC718 : "PreviewSettingsName", - 0xC719 : "PreviewSettingsDigest", - 0xC71A : "PreviewColorSpace", - 0xC71B : "PreviewDateTime", - 0xC71C : "RawImageDigest", - 0xC71D : "OriginalRawFileDigest", - 0xC71E : "SubTileBlockSize", - 0xC71F : "RowInterleaveFactor", - 0xC725 : "ProfileLookTableDims", - 0xC726 : "ProfileLookTableData", - 0xC740 : "OpcodeList1", - 0xC741 : "OpcodeList2", - 0xC74E : "OpcodeList3", - 0xC761 : "NoiseProfile", - 0xC763 : "TimeCodes", - 0xC764 : "FrameRate", - 0xC772 : "TStop", - 0xC789 : "ReelName", - 0xC791 : "OriginalDefaultFinalSize", - 0xC792 : "OriginalBestQualitySize", - 0xC793 : "OriginalDefaultCropSize", - 0xC7A1 : "CameraLabel", - 0xC7A3 : "ProfileHueSatMapEncoding", - 0xC7A4 : "ProfileLookTableEncoding", - 0xC7A5 : "BaselineExposureOffset", - 0xC7A6 : "DefaultBlackRender", - 0xC7A7 : "NewRawImageDigest", - 0xC7A8 : "RawToPreviewGain", - 0xC7B5 : "DefaultUserCrop", - 0xEA1C : "Padding", - 0xEA1D : "OffsetSchema", - 0xFDE8 : "OwnerName", - 0xFDE9 : "SerialNumber", - 0xFDEA : "Lens", - 0xFE00 : "KDC_IFD", - 0xFE4C : "RawFile", - 0xFE4D : "Converter", - 0xFE4E : "WhiteBalance", - 0xFE51 : "Exposure", - 0xFE52 : "Shadows", - 0xFE53 : "Brightness", - 0xFE54 : "Contrast", - 0xFE55 : "Saturation", - 0xFE56 : "Sharpness", - 0xFE57 : "Smoothness", - 0xFE58 : "MoireFilter" - - }, - gps : { - 0x0000 : 'GPSVersionID', - 0x0001 : 'GPSLatitudeRef', - 0x0002 : 'GPSLatitude', - 0x0003 : 'GPSLongitudeRef', - 0x0004 : 'GPSLongitude', - 0x0005 : 'GPSAltitudeRef', - 0x0006 : 'GPSAltitude', - 0x0007 : 'GPSTimeStamp', - 0x0008 : 'GPSSatellites', - 0x0009 : 'GPSStatus', - 0x000A : 'GPSMeasureMode', - 0x000B : 'GPSDOP', - 0x000C : 'GPSSpeedRef', - 0x000D : 'GPSSpeed', - 0x000E : 'GPSTrackRef', - 0x000F : 'GPSTrack', - 0x0010 : 'GPSImgDirectionRef', - 0x0011 : 'GPSImgDirection', - 0x0012 : 'GPSMapDatum', - 0x0013 : 'GPSDestLatitudeRef', - 0x0014 : 'GPSDestLatitude', - 0x0015 : 'GPSDestLongitudeRef', - 0x0016 : 'GPSDestLongitude', - 0x0017 : 'GPSDestBearingRef', - 0x0018 : 'GPSDestBearing', - 0x0019 : 'GPSDestDistanceRef', - 0x001A : 'GPSDestDistance', - 0x001B : 'GPSProcessingMethod', - 0x001C : 'GPSAreaInformation', - 0x001D : 'GPSDateStamp', - 0x001E : 'GPSDifferential', - 0x001F : 'GPSHPositioningError' - } -}; -},{}],58:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -function readExifValue(format, stream) { - switch(format) { - case 1: return stream.nextUInt8(); - case 3: return stream.nextUInt16(); - case 4: return stream.nextUInt32(); - case 5: return [stream.nextUInt32(), stream.nextUInt32()]; - case 6: return stream.nextInt8(); - case 8: return stream.nextUInt16(); - case 9: return stream.nextUInt32(); - case 10: return [stream.nextInt32(), stream.nextInt32()]; - case 11: return stream.nextFloat(); - case 12: return stream.nextDouble(); - default: throw new Error('Invalid format while decoding: ' + format); - } -} - -function getBytesPerComponent(format) { - switch(format) { - case 1: - case 2: - case 6: - case 7: - return 1; - case 3: - case 8: - return 2; - case 4: - case 9: - case 11: - return 4; - case 5: - case 10: - case 12: - return 8; - default: - return 0; - } -} - -function readExifTag(tiffMarker, stream) { - var tagType = stream.nextUInt16(), - format = stream.nextUInt16(), - bytesPerComponent = getBytesPerComponent(format), - components = stream.nextUInt32(), - valueBytes = bytesPerComponent * components, - values, - value, - c; - - /* if the value is bigger then 4 bytes, the value is in the data section of the IFD - and the value present in the tag is the offset starting from the tiff header. So we replace the stream - with a stream that is located at the given offset in the data section. s*/ - if(valueBytes > 4) { - stream = tiffMarker.openWithOffset(stream.nextUInt32()); - } - //we don't want to read strings as arrays - if(format === 2) { - values = stream.nextString(components); - //cut off \0 characters - var lastNull = values.indexOf('\0'); - if(lastNull !== -1) { - values = values.substr(0, lastNull); - } - } - else if(format === 7) { - values = stream.nextBuffer(components); - } - else if(format !== 0) { - values = []; - for(c = 0; c < components; ++c) { - values.push(readExifValue(format, stream)); - } - } - //since our stream is a stateful object, we need to skip remaining bytes - //so our offset stays correct - if(valueBytes < 4) { - stream.skip(4 - valueBytes); - } - - return [tagType, values, format]; -} - -function readIFDSection(tiffMarker, stream, iterator) { - var numberOfEntries = stream.nextUInt16(), tag, i; - for(i = 0; i < numberOfEntries; ++i) { - tag = readExifTag(tiffMarker, stream); - iterator(tag[0], tag[1], tag[2]); - } -} - -function readHeader(stream) { - var exifHeader = stream.nextString(6); - if(exifHeader !== 'Exif\0\0') { - throw new Error('Invalid EXIF header'); - } - - var tiffMarker = stream.mark(); - var tiffHeader = stream.nextUInt16(); - if(tiffHeader === 0x4949) { - stream.setBigEndian(false); - } else if(tiffHeader === 0x4D4D) { - stream.setBigEndian(true); - } else { - throw new Error('Invalid TIFF header'); - } - if(stream.nextUInt16() !== 0x002A) { - throw new Error('Invalid TIFF data'); - } - return tiffMarker; -} - -module.exports = { - IFD0: 1, - IFD1: 2, - GPSIFD: 3, - SubIFD: 4, - InteropIFD: 5, - parseTags: function(stream, iterator) { - var tiffMarker; - try { - tiffMarker = readHeader(stream); - } catch(e) { - return false; //ignore APP1 sections with invalid headers - } - var subIfdOffset, gpsOffset, interopOffset; - var ifd0Stream = tiffMarker.openWithOffset(stream.nextUInt32()), - IFD0 = this.IFD0; - readIFDSection(tiffMarker, ifd0Stream, function(tagType, value, format) { - switch(tagType) { - case 0x8825: gpsOffset = value[0]; break; - case 0x8769: subIfdOffset = value[0]; break; - default: iterator(IFD0, tagType, value, format); break; - } - }); - var ifd1Offset = ifd0Stream.nextUInt32(); - if(ifd1Offset !== 0) { - var ifd1Stream = tiffMarker.openWithOffset(ifd1Offset); - readIFDSection(tiffMarker, ifd1Stream, iterator.bind(null, this.IFD1)); - } - - if(gpsOffset) { - var gpsStream = tiffMarker.openWithOffset(gpsOffset); - readIFDSection(tiffMarker, gpsStream, iterator.bind(null, this.GPSIFD)); - } - - if(subIfdOffset) { - var subIfdStream = tiffMarker.openWithOffset(subIfdOffset), InteropIFD = this.InteropIFD; - readIFDSection(tiffMarker, subIfdStream, function(tagType, value, format) { - if(tagType === 0xA005) { - interopOffset = value[0]; - } else { - iterator(InteropIFD, tagType, value, format); - } - }); - } - - if(interopOffset) { - var interopStream = tiffMarker.openWithOffset(interopOffset); - readIFDSection(tiffMarker, interopStream, iterator.bind(null, this.InteropIFD)); - } - return true; - } -}; -},{}],59:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -module.exports = { - parseSections: function(stream, iterator) { - var len, markerType; - stream.setBigEndian(true); - //stop reading the stream at the SOS (Start of Stream) marker, - //because its length is not stored in the header so we can't - //know where to jump to. The only marker after that is just EOI (End Of Image) anyway - while(stream.remainingLength() > 0 && markerType !== 0xDA) { - if(stream.nextUInt8() !== 0xFF) { - throw new Error('Invalid JPEG section offset'); - } - markerType = stream.nextUInt8(); - //don't read size from markers that have no datas - if((markerType >= 0xD0 && markerType <= 0xD9) || markerType === 0xDA) { - len = 0; - } else { - len = stream.nextUInt16() - 2; - } - iterator(markerType, stream.branch(0, len)); - stream.skip(len); - } - }, - //stream should be located after SOF section size and in big endian mode, like passed to parseSections iterator - getSizeFromSOFSection: function(stream) { - stream.skip(1); - return { - height: stream.nextUInt16(), - width: stream.nextUInt16() - }; - }, - getSectionName: function(markerType) { - var name, index; - switch(markerType) { - case 0xD8: name = 'SOI'; break; - case 0xC4: name = 'DHT'; break; - case 0xDB: name = 'DQT'; break; - case 0xDD: name = 'DRI'; break; - case 0xDA: name = 'SOS'; break; - case 0xFE: name = 'COM'; break; - case 0xD9: name = 'EOI'; break; - default: - if(markerType >= 0xE0 && markerType <= 0xEF) { - name = 'APP'; - index = markerType - 0xE0; - } - else if(markerType >= 0xC0 && markerType <= 0xCF && markerType !== 0xC4 && markerType !== 0xC8 && markerType !== 0xCC) { - name = 'SOF'; - index = markerType - 0xC0; - } - else if(markerType >= 0xD0 && markerType <= 0xD7) { - name = 'RST'; - index = markerType - 0xD0; - } - break; - } - var nameStruct = { - name: name - }; - if(typeof index === 'number') { - nameStruct.index = index; - } - return nameStruct; - } -}; -},{}],60:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -var jpeg = require('./jpeg'), - exif = require('./exif'), - simplify = require('./simplify'); - -function ExifResult(startMarker, tags, imageSize, thumbnailOffset, thumbnailLength, thumbnailType, app1Offset) { - this.startMarker = startMarker; - this.tags = tags; - this.imageSize = imageSize; - this.thumbnailOffset = thumbnailOffset; - this.thumbnailLength = thumbnailLength; - this.thumbnailType = thumbnailType; - this.app1Offset = app1Offset; -} - -ExifResult.prototype = { - hasThumbnail: function(mime) { - if(!this.thumbnailOffset || !this.thumbnailLength) { - return false; - } - if(typeof mime !== 'string') { - return true; - } - if(mime.toLowerCase().trim() === 'image/jpeg') { - return this.thumbnailType === 6; - } - if(mime.toLowerCase().trim() === 'image/tiff') { - return this.thumbnailType === 1; - } - return false; - }, - getThumbnailOffset: function() { - return this.app1Offset + 6 + this.thumbnailOffset; - }, - getThumbnailLength: function() { - return this.thumbnailLength; - }, - getThumbnailBuffer: function() { - return this._getThumbnailStream().nextBuffer(this.thumbnailLength); - }, - _getThumbnailStream: function() { - return this.startMarker.openWithOffset(this.getThumbnailOffset()); - }, - getImageSize: function() { - return this.imageSize; - }, - getThumbnailSize: function() { - var stream = this._getThumbnailStream(), size; - jpeg.parseSections(stream, function(sectionType, sectionStream) { - if(jpeg.getSectionName(sectionType).name === 'SOF') { - size = jpeg.getSizeFromSOFSection(sectionStream); - } - }); - return size; - } -}; - -function Parser(stream) { - this.stream = stream; - this.flags = { - readBinaryTags: false, - resolveTagNames: true, - simplifyValues: true, - imageSize: true, - hidePointers: true, - returnTags: true - }; -} - -Parser.prototype = { - enableBinaryFields: function(enable) { - this.flags.readBinaryTags = !!enable; - return this; - }, - enablePointers: function(enable) { - this.flags.hidePointers = !enable; - return this; - }, - enableTagNames: function(enable) { - this.flags.resolveTagNames = !!enable; - return this; - }, - enableImageSize: function(enable) { - this.flags.imageSize = !!enable; - return this; - }, - enableReturnTags: function(enable) { - this.flags.returnTags = !!enable; - return this; - }, - enableSimpleValues: function(enable) { - this.flags.simplifyValues = !!enable; - return this; - }, - parse: function() { - var start = this.stream.mark(), - stream = start.openWithOffset(0), - flags = this.flags, - tags, - imageSize, - thumbnailOffset, - thumbnailLength, - thumbnailType, - app1Offset, - tagNames, - getTagValue, setTagValue; - if(flags.resolveTagNames) { - tagNames = require('./exif-tags'); - } - if(flags.resolveTagNames) { - tags = {}; - getTagValue = function(t) { - return tags[t.name]; - }; - setTagValue = function(t, value) { - tags[t.name] = value; - }; - } else { - tags = []; - getTagValue = function(t) { - var i; - for(i = 0; i < tags.length; ++i) { - if(tags[i].type === t.type && tags[i].section === t.section) { - return tags.value; - } - } - }; - setTagValue = function(t, value) { - var i; - for(i = 0; i < tags.length; ++i) { - if(tags[i].type === t.type && tags[i].section === t.section) { - tags.value = value; - return; - } - } - }; - } - - jpeg.parseSections(stream, function(sectionType, sectionStream) { - var validExifHeaders, sectionOffset = sectionStream.offsetFrom(start); - if(sectionType === 0xE1) { - validExifHeaders = exif.parseTags(sectionStream, function(ifdSection, tagType, value, format) { - //ignore binary fields if disabled - if(!flags.readBinaryTags && format === 7) { - return; - } - - if(tagType === 0x0201) { - thumbnailOffset = value[0]; - if(flags.hidePointers) {return;} - } else if(tagType === 0x0202) { - thumbnailLength = value[0]; - if(flags.hidePointers) {return;} - } else if(tagType === 0x0103) { - thumbnailType = value[0]; - if(flags.hidePointers) {return;} - } - //if flag is set to not store tags, return here after storing pointers - if(!flags.returnTags) { - return; - } - - if(flags.simplifyValues) { - value = simplify.simplifyValue(value, format); - } - if(flags.resolveTagNames) { - var sectionTagNames = ifdSection === exif.GPSIFD ? tagNames.gps : tagNames.exif; - var name = sectionTagNames[tagType]; - if(!name) { - name = tagNames.exif[tagType]; - } - if (!tags.hasOwnProperty(name)) { - tags[name] = value; - } - } else { - tags.push({ - section: ifdSection, - type: tagType, - value: value - }); - } - }); - if(validExifHeaders) { - app1Offset = sectionOffset; - } - } - else if(flags.imageSize && jpeg.getSectionName(sectionType).name === 'SOF') { - imageSize = jpeg.getSizeFromSOFSection(sectionStream); - } - }); - - if(flags.simplifyValues) { - simplify.castDegreeValues(getTagValue, setTagValue); - simplify.castDateValues(getTagValue, setTagValue); - } - - return new ExifResult(start, tags, imageSize, thumbnailOffset, thumbnailLength, thumbnailType, app1Offset); - } -}; - - - -module.exports = Parser; - -},{"./exif":58,"./exif-tags":57,"./jpeg":59,"./simplify":61}],61:[function(require,module,exports){ -var exif = require('./exif'); -var date = require('./date'); - -var degreeTags = [{ - section: exif.GPSIFD, - type: 0x0002, - name: 'GPSLatitude', - refType: 0x0001, - refName: 'GPSLatitudeRef', - posVal: 'N' -}, -{ - section: exif.GPSIFD, - type: 0x0004, - name: 'GPSLongitude', - refType: 0x0003, - refName: 'GPSLongitudeRef', - posVal: 'E' -}]; -var dateTags = [{ - section: exif.SubIFD, - type: 0x0132, - name: 'ModifyDate' -}, -{ - section: exif.SubIFD, - type: 0x9003, - name: 'DateTimeOriginal' -}, -{ - section: exif.SubIFD, - type: 0x9004, - name: 'CreateDate' -}, -{ - section: exif.SubIFD, - type: 0x0132, - name : 'ModifyDate', -}]; - -module.exports = { - castDegreeValues: function(getTagValue, setTagValue) { - degreeTags.forEach(function(t) { - var degreeVal = getTagValue(t); - if(degreeVal) { - var degreeRef = getTagValue({section: t.section, type: t.refType, name: t.refName}); - var degreeNumRef = degreeRef === t.posVal ? 1 : -1; - var degree = (degreeVal[0] + (degreeVal[1] / 60) + (degreeVal[2] / 3600)) * degreeNumRef; - setTagValue(t, degree); - } - }); - }, - castDateValues: function(getTagValue, setTagValue) { - dateTags.forEach(function(t) { - var dateStrVal = getTagValue(t); - if(dateStrVal) { - //some easy checks to determine two common date formats - var timestamp = date.parseExifDate(dateStrVal); - if(typeof timestamp !== 'undefined') { - setTagValue(t, timestamp); - } - } - }); - }, - simplifyValue: function(values, format) { - if(Array.isArray(values)) { - values = values.map(function(value) { - if(format === 10 || format === 5) { - return value[0] / value[1]; - } - return value; - }); - if(values.length === 1) { - values = values[0]; - } - } - return values; - } -}; - -},{"./date":55,"./exif":58}],62:[function(require,module,exports){ -'use strict'; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var toBytes = function toBytes(s) { - return (0, _toConsumableArray2["default"])(s).map(function (c) { - return c.charCodeAt(0); - }); -}; - -var xpiZipFilename = toBytes('META-INF/mozilla.rsa'); -var oxmlContentTypes = toBytes('[Content_Types].xml'); -var oxmlRels = toBytes('_rels/.rels'); - -module.exports = function (input) { - var buf = input instanceof Uint8Array ? input : new Uint8Array(input); - - if (!(buf && buf.length > 1)) { - return null; - } - - var check = function check(header, options) { - options = Object.assign({ - offset: 0 - }, options); - - for (var i = 0; i < header.length; i++) { - // If a bitmask is set - if (options.mask) { - // If header doesn't equal `buf` with bits masked off - if (header[i] !== (options.mask[i] & buf[i + options.offset])) { - return false; - } - } else if (header[i] !== buf[i + options.offset]) { - return false; - } - } - - return true; - }; - - var checkString = function checkString(header, options) { - return check(toBytes(header), options); - }; - - if (check([0xFF, 0xD8, 0xFF])) { - return { - ext: 'jpg', - mime: 'image/jpeg' - }; - } - - if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { - return { - ext: 'png', - mime: 'image/png' - }; - } - - if (check([0x47, 0x49, 0x46])) { - return { - ext: 'gif', - mime: 'image/gif' - }; - } - - if (check([0x57, 0x45, 0x42, 0x50], { - offset: 8 - })) { - return { - ext: 'webp', - mime: 'image/webp' - }; - } - - if (check([0x46, 0x4C, 0x49, 0x46])) { - return { - ext: 'flif', - mime: 'image/flif' - }; - } // Needs to be before `tif` check - - - if ((check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && check([0x43, 0x52], { - offset: 8 - })) { - return { - ext: 'cr2', - mime: 'image/x-canon-cr2' - }; - } - - if (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) { - return { - ext: 'tif', - mime: 'image/tiff' - }; - } - - if (check([0x42, 0x4D])) { - return { - ext: 'bmp', - mime: 'image/bmp' - }; - } - - if (check([0x49, 0x49, 0xBC])) { - return { - ext: 'jxr', - mime: 'image/vnd.ms-photo' - }; - } - - if (check([0x38, 0x42, 0x50, 0x53])) { - return { - ext: 'psd', - mime: 'image/vnd.adobe.photoshop' - }; - } // Zip-based file formats - // Need to be before the `zip` check - - - if (check([0x50, 0x4B, 0x3, 0x4])) { - if (check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], { - offset: 30 - })) { - return { - ext: 'epub', - mime: 'application/epub+zip' - }; - } // Assumes signed `.xpi` from addons.mozilla.org - - - if (check(xpiZipFilename, { - offset: 30 - })) { - return { - ext: 'xpi', - mime: 'application/x-xpinstall' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.text', { - offset: 30 - })) { - return { - ext: 'odt', - mime: 'application/vnd.oasis.opendocument.text' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.spreadsheet', { - offset: 30 - })) { - return { - ext: 'ods', - mime: 'application/vnd.oasis.opendocument.spreadsheet' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.presentation', { - offset: 30 - })) { - return { - ext: 'odp', - mime: 'application/vnd.oasis.opendocument.presentation' - }; - } // The docx, xlsx and pptx file types extend the Office Open XML file format: - // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats - // We look for: - // - one entry named '[Content_Types].xml' or '_rels/.rels', - // - one entry indicating specific type of file. - // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. - - - var findNextZipHeaderIndex = function findNextZipHeaderIndex(arr) { - var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - return arr.findIndex(function (el, i, arr) { - return i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4; - }); - }; - - var zipHeaderIndex = 0; // The first zip header was already found at index 0 - - var oxmlFound = false; - var type = null; - - do { - var offset = zipHeaderIndex + 30; - - if (!oxmlFound) { - oxmlFound = check(oxmlContentTypes, { - offset: offset - }) || check(oxmlRels, { - offset: offset - }); - } - - if (!type) { - if (checkString('word/', { - offset: offset - })) { - type = { - ext: 'docx', - mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - }; - } else if (checkString('ppt/', { - offset: offset - })) { - type = { - ext: 'pptx', - mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - }; - } else if (checkString('xl/', { - offset: offset - })) { - type = { - ext: 'xlsx', - mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - }; - } - } - - if (oxmlFound && type) { - return type; - } - - zipHeaderIndex = findNextZipHeaderIndex(buf, offset); - } while (zipHeaderIndex >= 0); // No more zip parts available in the buffer, but maybe we are almost certain about the type? - - - if (type) { - return type; - } - } - - if (check([0x50, 0x4B]) && (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8)) { - return { - ext: 'zip', - mime: 'application/zip' - }; - } - - if (check([0x75, 0x73, 0x74, 0x61, 0x72], { - offset: 257 - })) { - return { - ext: 'tar', - mime: 'application/x-tar' - }; - } - - if (check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && (buf[6] === 0x0 || buf[6] === 0x1)) { - return { - ext: 'rar', - mime: 'application/x-rar-compressed' - }; - } - - if (check([0x1F, 0x8B, 0x8])) { - return { - ext: 'gz', - mime: 'application/gzip' - }; - } - - if (check([0x42, 0x5A, 0x68])) { - return { - ext: 'bz2', - mime: 'application/x-bzip2' - }; - } - - if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) { - return { - ext: '7z', - mime: 'application/x-7z-compressed' - }; - } - - if (check([0x78, 0x01])) { - return { - ext: 'dmg', - mime: 'application/x-apple-diskimage' - }; - } - - if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5 - check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], { - offset: 4 - }) && (check([0x6D, 0x70, 0x34, 0x31], { - offset: 8 - }) || // MP41 - check([0x6D, 0x70, 0x34, 0x32], { - offset: 8 - }) || // MP42 - check([0x69, 0x73, 0x6F, 0x6D], { - offset: 8 - }) || // ISOM - check([0x69, 0x73, 0x6F, 0x32], { - offset: 8 - }) || // ISO2 - check([0x6D, 0x6D, 0x70, 0x34], { - offset: 8 - }) || // MMP4 - check([0x4D, 0x34, 0x56], { - offset: 8 - }) || // M4V - check([0x64, 0x61, 0x73, 0x68], { - offset: 8 - }) // DASH - )) { - return { - ext: 'mp4', - mime: 'video/mp4' - }; - } - - if (check([0x4D, 0x54, 0x68, 0x64])) { - return { - ext: 'mid', - mime: 'audio/midi' - }; - } // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska - - - if (check([0x1A, 0x45, 0xDF, 0xA3])) { - var sliced = buf.subarray(4, 4 + 4096); - var idPos = sliced.findIndex(function (el, i, arr) { - return arr[i] === 0x42 && arr[i + 1] === 0x82; - }); - - if (idPos !== -1) { - var docTypePos = idPos + 3; - - var findDocType = function findDocType(type) { - return (0, _toConsumableArray2["default"])(type).every(function (c, i) { - return sliced[docTypePos + i] === c.charCodeAt(0); - }); - }; - - if (findDocType('matroska')) { - return { - ext: 'mkv', - mime: 'video/x-matroska' - }; - } - - if (findDocType('webm')) { - return { - ext: 'webm', - mime: 'video/webm' - }; - } - } - } - - if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || check([0x66, 0x72, 0x65, 0x65], { - offset: 4 - }) || check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], { - offset: 4 - }) || check([0x6D, 0x64, 0x61, 0x74], { - offset: 4 - }) || // MJPEG - check([0x77, 0x69, 0x64, 0x65], { - offset: 4 - })) { - return { - ext: 'mov', - mime: 'video/quicktime' - }; - } // RIFF file format which might be AVI, WAV, QCP, etc - - - if (check([0x52, 0x49, 0x46, 0x46])) { - if (check([0x41, 0x56, 0x49], { - offset: 8 - })) { - return { - ext: 'avi', - mime: 'video/vnd.avi' - }; - } - - if (check([0x57, 0x41, 0x56, 0x45], { - offset: 8 - })) { - return { - ext: 'wav', - mime: 'audio/vnd.wave' - }; - } // QLCM, QCP file - - - if (check([0x51, 0x4C, 0x43, 0x4D], { - offset: 8 - })) { - return { - ext: 'qcp', - mime: 'audio/qcelp' - }; - } - } - - if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { - return { - ext: 'wmv', - mime: 'video/x-ms-wmv' - }; - } - - if (check([0x0, 0x0, 0x1, 0xBA]) || check([0x0, 0x0, 0x1, 0xB3])) { - return { - ext: 'mpg', - mime: 'video/mpeg' - }; - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], { - offset: 4 - })) { - return { - ext: '3gp', - mime: 'video/3gpp' - }; - } // Check for MPEG header at different starting offsets - - - for (var start = 0; start < 2 && start < buf.length - 16; start++) { - if (check([0x49, 0x44, 0x33], { - offset: start - }) || // ID3 header - check([0xFF, 0xE2], { - offset: start, - mask: [0xFF, 0xE2] - }) // MPEG 1 or 2 Layer 3 header - ) { - return { - ext: 'mp3', - mime: 'audio/mpeg' - }; - } - - if (check([0xFF, 0xE4], { - offset: start, - mask: [0xFF, 0xE4] - }) // MPEG 1 or 2 Layer 2 header - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if (check([0xFF, 0xF8], { - offset: start, - mask: [0xFF, 0xFC] - }) // MPEG 2 layer 0 using ADTS - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if (check([0xFF, 0xF0], { - offset: start, - mask: [0xFF, 0xFC] - }) // MPEG 4 layer 0 using ADTS - ) { - return { - ext: 'mp4', - mime: 'audio/mpeg' - }; - } - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], { - offset: 4 - }) || check([0x4D, 0x34, 0x41, 0x20])) { - return { - // MPEG-4 layer 3 (audio) - ext: 'm4a', - mime: 'audio/mp4' // RFC 4337 - - }; - } // Needs to be before `ogg` check - - - if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], { - offset: 28 - })) { - return { - ext: 'opus', - mime: 'audio/opus' - }; - } // If 'OggS' in first bytes, then OGG container - - - if (check([0x4F, 0x67, 0x67, 0x53])) { - // This is a OGG container - // If ' theora' in header. - if (check([0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], { - offset: 28 - })) { - return { - ext: 'ogv', - mime: 'video/ogg' - }; - } // If '\x01video' in header. - - - if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], { - offset: 28 - })) { - return { - ext: 'ogm', - mime: 'video/ogg' - }; - } // If ' FLAC' in header https://xiph.org/flac/faq.html - - - if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], { - offset: 28 - })) { - return { - ext: 'oga', - mime: 'audio/ogg' - }; - } // 'Speex ' in header https://en.wikipedia.org/wiki/Speex - - - if (check([0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20], { - offset: 28 - })) { - return { - ext: 'spx', - mime: 'audio/ogg' - }; - } // If '\x01vorbis' in header - - - if (check([0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], { - offset: 28 - })) { - return { - ext: 'ogg', - mime: 'audio/ogg' - }; - } // Default OGG container https://www.iana.org/assignments/media-types/application/ogg - - - return { - ext: 'ogx', - mime: 'application/ogg' - }; - } - - if (check([0x66, 0x4C, 0x61, 0x43])) { - return { - ext: 'flac', - mime: 'audio/x-flac' - }; - } - - if (check([0x4D, 0x41, 0x43, 0x20])) { - // 'MAC ' - return { - ext: 'ape', - mime: 'audio/ape' - }; - } - - if (check([0x77, 0x76, 0x70, 0x6B])) { - // 'wvpk' - return { - ext: 'wv', - mime: 'audio/wavpack' - }; - } - - if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) { - return { - ext: 'amr', - mime: 'audio/amr' - }; - } - - if (check([0x25, 0x50, 0x44, 0x46])) { - return { - ext: 'pdf', - mime: 'application/pdf' - }; - } - - if (check([0x4D, 0x5A])) { - return { - ext: 'exe', - mime: 'application/x-msdownload' - }; - } - - if ((buf[0] === 0x43 || buf[0] === 0x46) && check([0x57, 0x53], { - offset: 1 - })) { - return { - ext: 'swf', - mime: 'application/x-shockwave-flash' - }; - } - - if (check([0x7B, 0x5C, 0x72, 0x74, 0x66])) { - return { - ext: 'rtf', - mime: 'application/rtf' - }; - } - - if (check([0x00, 0x61, 0x73, 0x6D])) { - return { - ext: 'wasm', - mime: 'application/wasm' - }; - } - - if (check([0x77, 0x4F, 0x46, 0x46]) && (check([0x00, 0x01, 0x00, 0x00], { - offset: 4 - }) || check([0x4F, 0x54, 0x54, 0x4F], { - offset: 4 - }))) { - return { - ext: 'woff', - mime: 'font/woff' - }; - } - - if (check([0x77, 0x4F, 0x46, 0x32]) && (check([0x00, 0x01, 0x00, 0x00], { - offset: 4 - }) || check([0x4F, 0x54, 0x54, 0x4F], { - offset: 4 - }))) { - return { - ext: 'woff2', - mime: 'font/woff2' - }; - } - - if (check([0x4C, 0x50], { - offset: 34 - }) && (check([0x00, 0x00, 0x01], { - offset: 8 - }) || check([0x01, 0x00, 0x02], { - offset: 8 - }) || check([0x02, 0x00, 0x02], { - offset: 8 - }))) { - return { - ext: 'eot', - mime: 'application/vnd.ms-fontobject' - }; - } - - if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { - return { - ext: 'ttf', - mime: 'font/ttf' - }; - } - - if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { - return { - ext: 'otf', - mime: 'font/otf' - }; - } - - if (check([0x00, 0x00, 0x01, 0x00])) { - return { - ext: 'ico', - mime: 'image/x-icon' - }; - } - - if (check([0x00, 0x00, 0x02, 0x00])) { - return { - ext: 'cur', - mime: 'image/x-icon' - }; - } - - if (check([0x46, 0x4C, 0x56, 0x01])) { - return { - ext: 'flv', - mime: 'video/x-flv' - }; - } - - if (check([0x25, 0x21])) { - return { - ext: 'ps', - mime: 'application/postscript' - }; - } - - if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { - return { - ext: 'xz', - mime: 'application/x-xz' - }; - } - - if (check([0x53, 0x51, 0x4C, 0x69])) { - return { - ext: 'sqlite', - mime: 'application/x-sqlite3' - }; - } - - if (check([0x4E, 0x45, 0x53, 0x1A])) { - return { - ext: 'nes', - mime: 'application/x-nintendo-nes-rom' - }; - } - - if (check([0x43, 0x72, 0x32, 0x34])) { - return { - ext: 'crx', - mime: 'application/x-google-chrome-extension' - }; - } - - if (check([0x4D, 0x53, 0x43, 0x46]) || check([0x49, 0x53, 0x63, 0x28])) { - return { - ext: 'cab', - mime: 'application/vnd.ms-cab-compressed' - }; - } // Needs to be before `ar` check - - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E, 0x0A, 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79])) { - return { - ext: 'deb', - mime: 'application/x-deb' - }; - } - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E])) { - return { - ext: 'ar', - mime: 'application/x-unix-archive' - }; - } - - if (check([0xED, 0xAB, 0xEE, 0xDB])) { - return { - ext: 'rpm', - mime: 'application/x-rpm' - }; - } - - if (check([0x1F, 0xA0]) || check([0x1F, 0x9D])) { - return { - ext: 'Z', - mime: 'application/x-compress' - }; - } - - if (check([0x4C, 0x5A, 0x49, 0x50])) { - return { - ext: 'lz', - mime: 'application/x-lzip' - }; - } - - if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { - return { - ext: 'msi', - mime: 'application/x-msi' - }; - } - - if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { - return { - ext: 'mxf', - mime: 'application/mxf' - }; - } - - if (check([0x47], { - offset: 4 - }) && (check([0x47], { - offset: 192 - }) || check([0x47], { - offset: 196 - }))) { - return { - ext: 'mts', - mime: 'video/mp2t' - }; - } - - if (check([0x42, 0x4C, 0x45, 0x4E, 0x44, 0x45, 0x52])) { - return { - ext: 'blend', - mime: 'application/x-blender' - }; - } - - if (check([0x42, 0x50, 0x47, 0xFB])) { - return { - ext: 'bpg', - mime: 'image/bpg' - }; - } - - if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { - // JPEG-2000 family - if (check([0x6A, 0x70, 0x32, 0x20], { - offset: 20 - })) { - return { - ext: 'jp2', - mime: 'image/jp2' - }; - } - - if (check([0x6A, 0x70, 0x78, 0x20], { - offset: 20 - })) { - return { - ext: 'jpx', - mime: 'image/jpx' - }; - } - - if (check([0x6A, 0x70, 0x6D, 0x20], { - offset: 20 - })) { - return { - ext: 'jpm', - mime: 'image/jpm' - }; - } - - if (check([0x6D, 0x6A, 0x70, 0x32], { - offset: 20 - })) { - return { - ext: 'mj2', - mime: 'image/mj2' - }; - } - } - - if (check([0x46, 0x4F, 0x52, 0x4D, 0x00])) { - return { - ext: 'aif', - mime: 'audio/aiff' - }; - } - - if (checkString('= 3) { - receiver = thisArg; - } - - if (toStr.call(list) === '[object Array]') { - forEachArray(list, iterator, receiver); - } else if (typeof list === 'string') { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } -}; - -module.exports = forEach; - -},{"is-callable":77}],64:[function(require,module,exports){ -// (c) Dean McNamee , 2013. -// -// https://github.com/deanm/omggif -// -// 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. -// -// omggif is a JavaScript implementation of a GIF 89a encoder and decoder, -// including animation and compression. It does not rely on any specific -// underlying system, so should run in the browser, Node, or Plask. - -"use strict"; - -function GifWriter(buf, width, height, gopts) { - var p = 0; - - var gopts = gopts === undefined ? { } : gopts; - var loop_count = gopts.loop === undefined ? null : gopts.loop; - var global_palette = gopts.palette === undefined ? null : gopts.palette; - - if (width <= 0 || height <= 0 || width > 65535 || height > 65535) - throw new Error("Width/Height invalid."); - - function check_palette_and_num_colors(palette) { - var num_colors = palette.length; - if (num_colors < 2 || num_colors > 256 || num_colors & (num_colors-1)) { - throw new Error( - "Invalid code/color length, must be power of 2 and 2 .. 256."); - } - return num_colors; - } - - // - Header. - buf[p++] = 0x47; buf[p++] = 0x49; buf[p++] = 0x46; // GIF - buf[p++] = 0x38; buf[p++] = 0x39; buf[p++] = 0x61; // 89a - - // Handling of Global Color Table (palette) and background index. - var gp_num_colors_pow2 = 0; - var background = 0; - if (global_palette !== null) { - var gp_num_colors = check_palette_and_num_colors(global_palette); - while (gp_num_colors >>= 1) ++gp_num_colors_pow2; - gp_num_colors = 1 << gp_num_colors_pow2; - --gp_num_colors_pow2; - if (gopts.background !== undefined) { - background = gopts.background; - if (background >= gp_num_colors) - throw new Error("Background index out of range."); - // The GIF spec states that a background index of 0 should be ignored, so - // this is probably a mistake and you really want to set it to another - // slot in the palette. But actually in the end most browsers, etc end - // up ignoring this almost completely (including for dispose background). - if (background === 0) - throw new Error("Background index explicitly passed as 0."); - } - } - - // - Logical Screen Descriptor. - // NOTE(deanm): w/h apparently ignored by implementations, but set anyway. - buf[p++] = width & 0xff; buf[p++] = width >> 8 & 0xff; - buf[p++] = height & 0xff; buf[p++] = height >> 8 & 0xff; - // NOTE: Indicates 0-bpp original color resolution (unused?). - buf[p++] = (global_palette !== null ? 0x80 : 0) | // Global Color Table Flag. - gp_num_colors_pow2; // NOTE: No sort flag (unused?). - buf[p++] = background; // Background Color Index. - buf[p++] = 0; // Pixel aspect ratio (unused?). - - // - Global Color Table - if (global_palette !== null) { - for (var i = 0, il = global_palette.length; i < il; ++i) { - var rgb = global_palette[i]; - buf[p++] = rgb >> 16 & 0xff; - buf[p++] = rgb >> 8 & 0xff; - buf[p++] = rgb & 0xff; - } - } - - if (loop_count !== null) { // Netscape block for looping. - if (loop_count < 0 || loop_count > 65535) - throw new Error("Loop count invalid.") - // Extension code, label, and length. - buf[p++] = 0x21; buf[p++] = 0xff; buf[p++] = 0x0b; - // NETSCAPE2.0 - buf[p++] = 0x4e; buf[p++] = 0x45; buf[p++] = 0x54; buf[p++] = 0x53; - buf[p++] = 0x43; buf[p++] = 0x41; buf[p++] = 0x50; buf[p++] = 0x45; - buf[p++] = 0x32; buf[p++] = 0x2e; buf[p++] = 0x30; - // Sub-block - buf[p++] = 0x03; buf[p++] = 0x01; - buf[p++] = loop_count & 0xff; buf[p++] = loop_count >> 8 & 0xff; - buf[p++] = 0x00; // Terminator. - } - - - var ended = false; - - this.addFrame = function(x, y, w, h, indexed_pixels, opts) { - if (ended === true) { --p; ended = false; } // Un-end. - - opts = opts === undefined ? { } : opts; - - // TODO(deanm): Bounds check x, y. Do they need to be within the virtual - // canvas width/height, I imagine? - if (x < 0 || y < 0 || x > 65535 || y > 65535) - throw new Error("x/y invalid.") - - if (w <= 0 || h <= 0 || w > 65535 || h > 65535) - throw new Error("Width/Height invalid.") - - if (indexed_pixels.length < w * h) - throw new Error("Not enough pixels for the frame size."); - - var using_local_palette = true; - var palette = opts.palette; - if (palette === undefined || palette === null) { - using_local_palette = false; - palette = global_palette; - } - - if (palette === undefined || palette === null) - throw new Error("Must supply either a local or global palette."); - - var num_colors = check_palette_and_num_colors(palette); - - // Compute the min_code_size (power of 2), destroying num_colors. - var min_code_size = 0; - while (num_colors >>= 1) ++min_code_size; - num_colors = 1 << min_code_size; // Now we can easily get it back. - - var delay = opts.delay === undefined ? 0 : opts.delay; - - // From the spec: - // 0 - No disposal specified. The decoder is - // not required to take any action. - // 1 - Do not dispose. The graphic is to be left - // in place. - // 2 - Restore to background color. The area used by the - // graphic must be restored to the background color. - // 3 - Restore to previous. The decoder is required to - // restore the area overwritten by the graphic with - // what was there prior to rendering the graphic. - // 4-7 - To be defined. - // NOTE(deanm): Dispose background doesn't really work, apparently most - // browsers ignore the background palette index and clear to transparency. - var disposal = opts.disposal === undefined ? 0 : opts.disposal; - if (disposal < 0 || disposal > 3) // 4-7 is reserved. - throw new Error("Disposal out of range."); - - var use_transparency = false; - var transparent_index = 0; - if (opts.transparent !== undefined && opts.transparent !== null) { - use_transparency = true; - transparent_index = opts.transparent; - if (transparent_index < 0 || transparent_index >= num_colors) - throw new Error("Transparent color index."); - } - - if (disposal !== 0 || use_transparency || delay !== 0) { - // - Graphics Control Extension - buf[p++] = 0x21; buf[p++] = 0xf9; // Extension / Label. - buf[p++] = 4; // Byte size. - - buf[p++] = disposal << 2 | (use_transparency === true ? 1 : 0); - buf[p++] = delay & 0xff; buf[p++] = delay >> 8 & 0xff; - buf[p++] = transparent_index; // Transparent color index. - buf[p++] = 0; // Block Terminator. - } - - // - Image Descriptor - buf[p++] = 0x2c; // Image Seperator. - buf[p++] = x & 0xff; buf[p++] = x >> 8 & 0xff; // Left. - buf[p++] = y & 0xff; buf[p++] = y >> 8 & 0xff; // Top. - buf[p++] = w & 0xff; buf[p++] = w >> 8 & 0xff; - buf[p++] = h & 0xff; buf[p++] = h >> 8 & 0xff; - // NOTE: No sort flag (unused?). - // TODO(deanm): Support interlace. - buf[p++] = using_local_palette === true ? (0x80 | (min_code_size-1)) : 0; - - // - Local Color Table - if (using_local_palette === true) { - for (var i = 0, il = palette.length; i < il; ++i) { - var rgb = palette[i]; - buf[p++] = rgb >> 16 & 0xff; - buf[p++] = rgb >> 8 & 0xff; - buf[p++] = rgb & 0xff; - } - } - - p = GifWriterOutputLZWCodeStream( - buf, p, min_code_size < 2 ? 2 : min_code_size, indexed_pixels); - - return p; - }; - - this.end = function() { - if (ended === false) { - buf[p++] = 0x3b; // Trailer. - ended = true; - } - return p; - }; - - this.getOutputBuffer = function() { return buf; }; - this.setOutputBuffer = function(v) { buf = v; }; - this.getOutputBufferPosition = function() { return p; }; - this.setOutputBufferPosition = function(v) { p = v; }; -} - -// Main compression routine, palette indexes -> LZW code stream. -// |index_stream| must have at least one entry. -function GifWriterOutputLZWCodeStream(buf, p, min_code_size, index_stream) { - buf[p++] = min_code_size; - var cur_subblock = p++; // Pointing at the length field. - - var clear_code = 1 << min_code_size; - var code_mask = clear_code - 1; - var eoi_code = clear_code + 1; - var next_code = eoi_code + 1; - - var cur_code_size = min_code_size + 1; // Number of bits per code. - var cur_shift = 0; - // We have at most 12-bit codes, so we should have to hold a max of 19 - // bits here (and then we would write out). - var cur = 0; - - function emit_bytes_to_buffer(bit_block_size) { - while (cur_shift >= bit_block_size) { - buf[p++] = cur & 0xff; - cur >>= 8; cur_shift -= 8; - if (p === cur_subblock + 256) { // Finished a subblock. - buf[cur_subblock] = 255; - cur_subblock = p++; - } - } - } - - function emit_code(c) { - cur |= c << cur_shift; - cur_shift += cur_code_size; - emit_bytes_to_buffer(8); - } - - // I am not an expert on the topic, and I don't want to write a thesis. - // However, it is good to outline here the basic algorithm and the few data - // structures and optimizations here that make this implementation fast. - // The basic idea behind LZW is to build a table of previously seen runs - // addressed by a short id (herein called output code). All data is - // referenced by a code, which represents one or more values from the - // original input stream. All input bytes can be referenced as the same - // value as an output code. So if you didn't want any compression, you - // could more or less just output the original bytes as codes (there are - // some details to this, but it is the idea). In order to achieve - // compression, values greater then the input range (codes can be up to - // 12-bit while input only 8-bit) represent a sequence of previously seen - // inputs. The decompressor is able to build the same mapping while - // decoding, so there is always a shared common knowledge between the - // encoding and decoder, which is also important for "timing" aspects like - // how to handle variable bit width code encoding. - // - // One obvious but very important consequence of the table system is there - // is always a unique id (at most 12-bits) to map the runs. 'A' might be - // 4, then 'AA' might be 10, 'AAA' 11, 'AAAA' 12, etc. This relationship - // can be used for an effecient lookup strategy for the code mapping. We - // need to know if a run has been seen before, and be able to map that run - // to the output code. Since we start with known unique ids (input bytes), - // and then from those build more unique ids (table entries), we can - // continue this chain (almost like a linked list) to always have small - // integer values that represent the current byte chains in the encoder. - // This means instead of tracking the input bytes (AAAABCD) to know our - // current state, we can track the table entry for AAAABC (it is guaranteed - // to exist by the nature of the algorithm) and the next character D. - // Therefor the tuple of (table_entry, byte) is guaranteed to also be - // unique. This allows us to create a simple lookup key for mapping input - // sequences to codes (table indices) without having to store or search - // any of the code sequences. So if 'AAAA' has a table entry of 12, the - // tuple of ('AAAA', K) for any input byte K will be unique, and can be our - // key. This leads to a integer value at most 20-bits, which can always - // fit in an SMI value and be used as a fast sparse array / object key. - - // Output code for the current contents of the index buffer. - var ib_code = index_stream[0] & code_mask; // Load first input index. - var code_table = { }; // Key'd on our 20-bit "tuple". - - emit_code(clear_code); // Spec says first code should be a clear code. - - // First index already loaded, process the rest of the stream. - for (var i = 1, il = index_stream.length; i < il; ++i) { - var k = index_stream[i] & code_mask; - var cur_key = ib_code << 8 | k; // (prev, k) unique tuple. - var cur_code = code_table[cur_key]; // buffer + k. - - // Check if we have to create a new code table entry. - if (cur_code === undefined) { // We don't have buffer + k. - // Emit index buffer (without k). - // This is an inline version of emit_code, because this is the core - // writing routine of the compressor (and V8 cannot inline emit_code - // because it is a closure here in a different context). Additionally - // we can call emit_byte_to_buffer less often, because we can have - // 30-bits (from our 31-bit signed SMI), and we know our codes will only - // be 12-bits, so can safely have 18-bits there without overflow. - // emit_code(ib_code); - cur |= ib_code << cur_shift; - cur_shift += cur_code_size; - while (cur_shift >= 8) { - buf[p++] = cur & 0xff; - cur >>= 8; cur_shift -= 8; - if (p === cur_subblock + 256) { // Finished a subblock. - buf[cur_subblock] = 255; - cur_subblock = p++; - } - } - - if (next_code === 4096) { // Table full, need a clear. - emit_code(clear_code); - next_code = eoi_code + 1; - cur_code_size = min_code_size + 1; - code_table = { }; - } else { // Table not full, insert a new entry. - // Increase our variable bit code sizes if necessary. This is a bit - // tricky as it is based on "timing" between the encoding and - // decoder. From the encoders perspective this should happen after - // we've already emitted the index buffer and are about to create the - // first table entry that would overflow our current code bit size. - if (next_code >= (1 << cur_code_size)) ++cur_code_size; - code_table[cur_key] = next_code++; // Insert into code table. - } - - ib_code = k; // Index buffer to single input k. - } else { - ib_code = cur_code; // Index buffer to sequence in code table. - } - } - - emit_code(ib_code); // There will still be something in the index buffer. - emit_code(eoi_code); // End Of Information. - - // Flush / finalize the sub-blocks stream to the buffer. - emit_bytes_to_buffer(1); - - // Finish the sub-blocks, writing out any unfinished lengths and - // terminating with a sub-block of length 0. If we have already started - // but not yet used a sub-block it can just become the terminator. - if (cur_subblock + 1 === p) { // Started but unused. - buf[cur_subblock] = 0; - } else { // Started and used, write length and additional terminator block. - buf[cur_subblock] = p - cur_subblock - 1; - buf[p++] = 0; - } - return p; -} - -function GifReader(buf) { - var p = 0; - - // - Header (GIF87a or GIF89a). - if (buf[p++] !== 0x47 || buf[p++] !== 0x49 || buf[p++] !== 0x46 || - buf[p++] !== 0x38 || (buf[p++]+1 & 0xfd) !== 0x38 || buf[p++] !== 0x61) { - throw new Error("Invalid GIF 87a/89a header."); - } - - // - Logical Screen Descriptor. - var width = buf[p++] | buf[p++] << 8; - var height = buf[p++] | buf[p++] << 8; - var pf0 = buf[p++]; // . - var global_palette_flag = pf0 >> 7; - var num_global_colors_pow2 = pf0 & 0x7; - var num_global_colors = 1 << (num_global_colors_pow2 + 1); - var background = buf[p++]; - buf[p++]; // Pixel aspect ratio (unused?). - - var global_palette_offset = null; - var global_palette_size = null; - - if (global_palette_flag) { - global_palette_offset = p; - global_palette_size = num_global_colors; - p += num_global_colors * 3; // Seek past palette. - } - - var no_eof = true; - - var frames = [ ]; - - var delay = 0; - var transparent_index = null; - var disposal = 0; // 0 - No disposal specified. - var loop_count = null; - - this.width = width; - this.height = height; - - while (no_eof && p < buf.length) { - switch (buf[p++]) { - case 0x21: // Graphics Control Extension Block - switch (buf[p++]) { - case 0xff: // Application specific block - // Try if it's a Netscape block (with animation loop counter). - if (buf[p ] !== 0x0b || // 21 FF already read, check block size. - // NETSCAPE2.0 - buf[p+1 ] == 0x4e && buf[p+2 ] == 0x45 && buf[p+3 ] == 0x54 && - buf[p+4 ] == 0x53 && buf[p+5 ] == 0x43 && buf[p+6 ] == 0x41 && - buf[p+7 ] == 0x50 && buf[p+8 ] == 0x45 && buf[p+9 ] == 0x32 && - buf[p+10] == 0x2e && buf[p+11] == 0x30 && - // Sub-block - buf[p+12] == 0x03 && buf[p+13] == 0x01 && buf[p+16] == 0) { - p += 14; - loop_count = buf[p++] | buf[p++] << 8; - p++; // Skip terminator. - } else { // We don't know what it is, just try to get past it. - p += 12; - while (true) { // Seek through subblocks. - var block_size = buf[p++]; - // Bad block size (ex: undefined from an out of bounds read). - if (!(block_size >= 0)) throw Error("Invalid block size"); - if (block_size === 0) break; // 0 size is terminator - p += block_size; - } - } - break; - - case 0xf9: // Graphics Control Extension - if (buf[p++] !== 0x4 || buf[p+4] !== 0) - throw new Error("Invalid graphics extension block."); - var pf1 = buf[p++]; - delay = buf[p++] | buf[p++] << 8; - transparent_index = buf[p++]; - if ((pf1 & 1) === 0) transparent_index = null; - disposal = pf1 >> 2 & 0x7; - p++; // Skip terminator. - break; - - case 0xfe: // Comment Extension. - while (true) { // Seek through subblocks. - var block_size = buf[p++]; - // Bad block size (ex: undefined from an out of bounds read). - if (!(block_size >= 0)) throw Error("Invalid block size"); - if (block_size === 0) break; // 0 size is terminator - // console.log(buf.slice(p, p+block_size).toString('ascii')); - p += block_size; - } - break; - - default: - throw new Error( - "Unknown graphic control label: 0x" + buf[p-1].toString(16)); - } - break; - - case 0x2c: // Image Descriptor. - var x = buf[p++] | buf[p++] << 8; - var y = buf[p++] | buf[p++] << 8; - var w = buf[p++] | buf[p++] << 8; - var h = buf[p++] | buf[p++] << 8; - var pf2 = buf[p++]; - var local_palette_flag = pf2 >> 7; - var interlace_flag = pf2 >> 6 & 1; - var num_local_colors_pow2 = pf2 & 0x7; - var num_local_colors = 1 << (num_local_colors_pow2 + 1); - var palette_offset = global_palette_offset; - var palette_size = global_palette_size; - var has_local_palette = false; - if (local_palette_flag) { - var has_local_palette = true; - palette_offset = p; // Override with local palette. - palette_size = num_local_colors; - p += num_local_colors * 3; // Seek past palette. - } - - var data_offset = p; - - p++; // codesize - while (true) { - var block_size = buf[p++]; - // Bad block size (ex: undefined from an out of bounds read). - if (!(block_size >= 0)) throw Error("Invalid block size"); - if (block_size === 0) break; // 0 size is terminator - p += block_size; - } - - frames.push({x: x, y: y, width: w, height: h, - has_local_palette: has_local_palette, - palette_offset: palette_offset, - palette_size: palette_size, - data_offset: data_offset, - data_length: p - data_offset, - transparent_index: transparent_index, - interlaced: !!interlace_flag, - delay: delay, - disposal: disposal}); - break; - - case 0x3b: // Trailer Marker (end of file). - no_eof = false; - break; - - default: - throw new Error("Unknown gif block: 0x" + buf[p-1].toString(16)); - break; - } - } - - this.numFrames = function() { - return frames.length; - }; - - this.loopCount = function() { - return loop_count; - }; - - this.frameInfo = function(frame_num) { - if (frame_num < 0 || frame_num >= frames.length) - throw new Error("Frame index out of range."); - return frames[frame_num]; - } - - this.decodeAndBlitFrameBGRA = function(frame_num, pixels) { - var frame = this.frameInfo(frame_num); - var num_pixels = frame.width * frame.height; - var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices. - GifReaderLZWOutputIndexStream( - buf, frame.data_offset, index_stream, num_pixels); - var palette_offset = frame.palette_offset; - - // NOTE(deanm): It seems to be much faster to compare index to 256 than - // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in - // the profile, not sure if it's related to using a Uint8Array. - var trans = frame.transparent_index; - if (trans === null) trans = 256; - - // We are possibly just blitting to a portion of the entire frame. - // That is a subrect within the framerect, so the additional pixels - // must be skipped over after we finished a scanline. - var framewidth = frame.width; - var framestride = width - framewidth; - var xleft = framewidth; // Number of subrect pixels left in scanline. - - // Output indicies of the top left and bottom right corners of the subrect. - var opbeg = ((frame.y * width) + frame.x) * 4; - var opend = ((frame.y + frame.height) * width + frame.x) * 4; - var op = opbeg; - - var scanstride = framestride * 4; - - // Use scanstride to skip past the rows when interlacing. This is skipping - // 7 rows for the first two passes, then 3 then 1. - if (frame.interlaced === true) { - scanstride += width * 4 * 7; // Pass 1. - } - - var interlaceskip = 8; // Tracking the row interval in the current pass. - - for (var i = 0, il = index_stream.length; i < il; ++i) { - var index = index_stream[i]; - - if (xleft === 0) { // Beginning of new scan line - op += scanstride; - xleft = framewidth; - if (op >= opend) { // Catch the wrap to switch passes when interlacing. - scanstride = framestride * 4 + width * 4 * (interlaceskip-1); - // interlaceskip / 2 * 4 is interlaceskip << 1. - op = opbeg + (framewidth + framestride) * (interlaceskip << 1); - interlaceskip >>= 1; - } - } - - if (index === trans) { - op += 4; - } else { - var r = buf[palette_offset + index * 3]; - var g = buf[palette_offset + index * 3 + 1]; - var b = buf[palette_offset + index * 3 + 2]; - pixels[op++] = b; - pixels[op++] = g; - pixels[op++] = r; - pixels[op++] = 255; - } - --xleft; - } - }; - - // I will go to copy and paste hell one day... - this.decodeAndBlitFrameRGBA = function(frame_num, pixels) { - var frame = this.frameInfo(frame_num); - var num_pixels = frame.width * frame.height; - var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices. - GifReaderLZWOutputIndexStream( - buf, frame.data_offset, index_stream, num_pixels); - var palette_offset = frame.palette_offset; - - // NOTE(deanm): It seems to be much faster to compare index to 256 than - // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in - // the profile, not sure if it's related to using a Uint8Array. - var trans = frame.transparent_index; - if (trans === null) trans = 256; - - // We are possibly just blitting to a portion of the entire frame. - // That is a subrect within the framerect, so the additional pixels - // must be skipped over after we finished a scanline. - var framewidth = frame.width; - var framestride = width - framewidth; - var xleft = framewidth; // Number of subrect pixels left in scanline. - - // Output indicies of the top left and bottom right corners of the subrect. - var opbeg = ((frame.y * width) + frame.x) * 4; - var opend = ((frame.y + frame.height) * width + frame.x) * 4; - var op = opbeg; - - var scanstride = framestride * 4; - - // Use scanstride to skip past the rows when interlacing. This is skipping - // 7 rows for the first two passes, then 3 then 1. - if (frame.interlaced === true) { - scanstride += width * 4 * 7; // Pass 1. - } - - var interlaceskip = 8; // Tracking the row interval in the current pass. - - for (var i = 0, il = index_stream.length; i < il; ++i) { - var index = index_stream[i]; - - if (xleft === 0) { // Beginning of new scan line - op += scanstride; - xleft = framewidth; - if (op >= opend) { // Catch the wrap to switch passes when interlacing. - scanstride = framestride * 4 + width * 4 * (interlaceskip-1); - // interlaceskip / 2 * 4 is interlaceskip << 1. - op = opbeg + (framewidth + framestride) * (interlaceskip << 1); - interlaceskip >>= 1; - } - } - - if (index === trans) { - op += 4; - } else { - var r = buf[palette_offset + index * 3]; - var g = buf[palette_offset + index * 3 + 1]; - var b = buf[palette_offset + index * 3 + 2]; - pixels[op++] = r; - pixels[op++] = g; - pixels[op++] = b; - pixels[op++] = 255; - } - --xleft; - } - }; -} - -function GifReaderLZWOutputIndexStream(code_stream, p, output, output_length) { - var min_code_size = code_stream[p++]; - - var clear_code = 1 << min_code_size; - var eoi_code = clear_code + 1; - var next_code = eoi_code + 1; - - var cur_code_size = min_code_size + 1; // Number of bits per code. - // NOTE: This shares the same name as the encoder, but has a different - // meaning here. Here this masks each code coming from the code stream. - var code_mask = (1 << cur_code_size) - 1; - var cur_shift = 0; - var cur = 0; - - var op = 0; // Output pointer. - - var subblock_size = code_stream[p++]; - - // TODO(deanm): Would using a TypedArray be any faster? At least it would - // solve the fast mode / backing store uncertainty. - // var code_table = Array(4096); - var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits. - - var prev_code = null; // Track code-1. - - while (true) { - // Read up to two bytes, making sure we always 12-bits for max sized code. - while (cur_shift < 16) { - if (subblock_size === 0) break; // No more data to be read. - - cur |= code_stream[p++] << cur_shift; - cur_shift += 8; - - if (subblock_size === 1) { // Never let it get to 0 to hold logic above. - subblock_size = code_stream[p++]; // Next subblock. - } else { - --subblock_size; - } - } - - // TODO(deanm): We should never really get here, we should have received - // and EOI. - if (cur_shift < cur_code_size) - break; - - var code = cur & code_mask; - cur >>= cur_code_size; - cur_shift -= cur_code_size; - - // TODO(deanm): Maybe should check that the first code was a clear code, - // at least this is what you're supposed to do. But actually our encoder - // now doesn't emit a clear code first anyway. - if (code === clear_code) { - // We don't actually have to clear the table. This could be a good idea - // for greater error checking, but we don't really do any anyway. We - // will just track it with next_code and overwrite old entries. - - next_code = eoi_code + 1; - cur_code_size = min_code_size + 1; - code_mask = (1 << cur_code_size) - 1; - - // Don't update prev_code ? - prev_code = null; - continue; - } else if (code === eoi_code) { - break; - } - - // We have a similar situation as the decoder, where we want to store - // variable length entries (code table entries), but we want to do in a - // faster manner than an array of arrays. The code below stores sort of a - // linked list within the code table, and then "chases" through it to - // construct the dictionary entries. When a new entry is created, just the - // last byte is stored, and the rest (prefix) of the entry is only - // referenced by its table entry. Then the code chases through the - // prefixes until it reaches a single byte code. We have to chase twice, - // first to compute the length, and then to actually copy the data to the - // output (backwards, since we know the length). The alternative would be - // storing something in an intermediate stack, but that doesn't make any - // more sense. I implemented an approach where it also stored the length - // in the code table, although it's a bit tricky because you run out of - // bits (12 + 12 + 8), but I didn't measure much improvements (the table - // entries are generally not the long). Even when I created benchmarks for - // very long table entries the complexity did not seem worth it. - // The code table stores the prefix entry in 12 bits and then the suffix - // byte in 8 bits, so each entry is 20 bits. - - var chase_code = code < next_code ? code : prev_code; - - // Chase what we will output, either {CODE} or {CODE-1}. - var chase_length = 0; - var chase = chase_code; - while (chase > clear_code) { - chase = code_table[chase] >> 8; - ++chase_length; - } - - var k = chase; - - var op_end = op + chase_length + (chase_code !== code ? 1 : 0); - if (op_end > output_length) { - console.log("Warning, gif stream longer than expected."); - return; - } - - // Already have the first byte from the chase, might as well write it fast. - output[op++] = k; - - op += chase_length; - var b = op; // Track pointer, writing backwards. - - if (chase_code !== code) // The case of emitting {CODE-1} + k. - output[op++] = k; - - chase = chase_code; - while (chase_length--) { - chase = code_table[chase]; - output[--b] = chase & 0xff; // Write backwards. - chase >>= 8; // Pull down to the prefix code. - } - - if (prev_code !== null && next_code < 4096) { - code_table[next_code++] = prev_code << 8 | k; - // TODO(deanm): Figure out this clearing vs code growth logic better. I - // have an feeling that it should just happen somewhere else, for now it - // is awkward between when we grow past the max and then hit a clear code. - // For now just check if we hit the max 12-bits (then a clear code should - // follow, also of course encoded in 12-bits). - if (next_code >= code_mask+1 && cur_code_size < 12) { - ++cur_code_size; - code_mask = code_mask << 1 | 1; - } - } - - prev_code = code; - } - - if (op !== output_length) { - console.log("Warning, gif stream shorter than expected."); - } - - return output; -} - -// CommonJS. -try { exports.GifWriter = GifWriter; exports.GifReader = GifReader } catch(e) {} - -},{}],65:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -/** @class BitmapImage */ - -class BitmapImage { - - /** - * BitmapImage is a class that hold an RGBA (red, green, blue, alpha) representation of an image. It's shape is borrowed from the Jimp package to make it easy to transfer GIF image frames into Jimp and Jimp images into GIF image frames. Each instance has a `bitmap` property having the following properties: - * - * Property | Description - * --- | --- - * bitmap.width | width of image in pixels - * bitmap.height | height of image in pixels - * bitmap.data | a Buffer whose every four bytes represents a pixel, each sequential byte of a pixel corresponding to the red, green, blue, and alpha values of the pixel - * - * Its constructor supports the following signatures: - * - * * new BitmapImage(bitmap: { width: number, height: number, data: Buffer }) - * * new BitmapImage(bitmapImage: BitmapImage) - * * new BitmapImage(width: number, height: number, buffer: Buffer) - * * new BitmapImage(width: number, height: number, backgroundRGBA?: number) - * - * When a `BitmapImage` is provided, the constructed `BitmapImage` is a deep clone of the provided one, so that each image's pixel data can subsequently be modified without affecting each other. - * - * `backgroundRGBA` is an optional parameter representing a pixel as a single number. In hex, the number is as follows: 0xRRGGBBAA, where RR is the red byte, GG the green byte, BB, the blue byte, and AA the alpha value. An AA of 0x00 is considered transparent, and all non-zero AA values are treated as opaque. - */ - - constructor(...args) { - // don't confirm the number of args, because a subclass may have - // additional args and pass them all to the superclass - if (args.length === 0) { - throw new Error("constructor requires parameters"); - } - const firstArg = args[0]; - if (firstArg !== null && typeof firstArg === 'object') { - if (firstArg instanceof BitmapImage) { - // copy a provided BitmapImage - const sourceBitmap = firstArg.bitmap; - this.bitmap = { - width: sourceBitmap.width, - height: sourceBitmap.height, - data: new Buffer(sourceBitmap.width * sourceBitmap.height * 4) - }; - sourceBitmap.data.copy(this.bitmap.data); - } - else if (firstArg.width && firstArg.height && firstArg.data) { - // share a provided bitmap - this.bitmap = firstArg; - } - else { - throw new Error("unrecognized constructor parameters"); - } - } - else if (typeof firstArg === 'number' && typeof args[1] === 'number') - { - const width = firstArg; - const height = args[1]; - const thirdArg = args[2]; - this.bitmap = { width, height }; - - if (Buffer.isBuffer(thirdArg)) { - this.bitmap.data = thirdArg; - } - else { - this.bitmap.data = new Buffer(width * height * 4); - if (typeof thirdArg === 'number') { - this.fillRGBA(thirdArg); - } - } - } - else { - throw new Error("unrecognized constructor parameters"); - } - } - - /** - * Copy a square portion of this image into another image. - * - * @param {BitmapImage} toImage Image into which to copy the square - * @param {number} toX x-coord in toImage of upper-left corner of receiving square - * @param {number} toY y-coord in toImage of upper-left corner of receiving square - * @param {number} fromX x-coord in this image of upper-left corner of source square - * @param {number} fromY y-coord in this image of upper-left corner of source square - * @return {BitmapImage} The present image to allow for chaining. - */ - - blit(toImage, toX, toY, fromX, fromY, fromWidth, fromHeight) { - if (fromX + fromWidth > this.bitmap.width) { - throw new Error("copy exceeds width of source bitmap"); - } - if (toX + fromWidth > toImage.bitmap.width) { - throw new Error("copy exceeds width of target bitmap"); - } - if (fromY + fromHeight > this.bitmap.height) { - throw new Error("copy exceeds height of source bitmap"); - } - if (toY + fromHeight > toImage.bitmap.height) { - throw new Erro("copy exceeds height of target bitmap"); - } - - const sourceBuf = this.bitmap.data; - const targetBuf = toImage.bitmap.data; - const sourceByteWidth = this.bitmap.width * 4; - const targetByteWidth = toImage.bitmap.width * 4; - const copyByteWidth = fromWidth * 4; - let si = fromY * sourceByteWidth + fromX * 4; - let ti = toY * targetByteWidth + toX * 4; - - while (--fromHeight >= 0) { - sourceBuf.copy(targetBuf, ti, si, si + copyByteWidth); - si += sourceByteWidth; - ti += targetByteWidth; - } - return this; - } - - /** - * Fills the image with a single color. - * - * @param {number} rgba Color with which to fill image, expressed as a singlenumber in the form 0xRRGGBBAA, where AA is 0x00 for transparent and any other value for opaque. - * @return {BitmapImage} The present image to allow for chaining. - */ - - fillRGBA(rgba) { - const buf = this.bitmap.data; - const bufByteWidth = this.bitmap.height * 4; - - let bi = 0; - while (bi < bufByteWidth) { - buf.writeUInt32BE(rgba, bi); - bi += 4; - } - while (bi < buf.length) { - buf.copy(buf, bi, 0, bufByteWidth); - bi += bufByteWidth; - } - return this; - } - - /** - * Gets the RGBA number of the pixel at the given coordinate in the form 0xRRGGBBAA, where AA is the alpha value, with alpha 0x00 encoding to transparency in GIFs. - * - * @param {number} x x-coord of pixel - * @param {number} y y-coord of pixel - * @return {number} RGBA of pixel in 0xRRGGBBAA form - */ - - getRGBA(x, y) { - const bi = (y * this.bitmap.width + x) * 4; - return this.bitmap.data.readUInt32BE(bi); - } - - /** - * Gets a set of all RGBA colors found within the image. - * - * @return {Set} Set of all RGBA colors that the image contains. - */ - - getRGBASet() { - const rgbaSet = new Set(); - const buf = this.bitmap.data; - for (let bi = 0; bi < buf.length; bi += 4) { - rgbaSet.add(buf.readUInt32BE(bi, true)); - } - return rgbaSet; - } - - /** - * Converts the image to greyscale using inferred Adobe metrics. - * - * @return {BitmapImage} The present image to allow for chaining. - */ - - greyscale() { - const buf = this.bitmap.data; - this.scan(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { - const grey = Math.round( - 0.299 * buf[idx] + - 0.587 * buf[idx + 1] + - 0.114 * buf[idx + 2] - ); - buf[idx] = grey; - buf[idx + 1] = grey; - buf[idx + 2] = grey; - }); - return this; - } - - /** - * Reframes the image as if placing a frame around the original image and replacing the original image with the newly framed image. When the new frame is strictly within the boundaries of the original image, this method crops the image. When any of the new boundaries exceed those of the original image, the `fillRGBA` must be provided to indicate the color with which to fill the extra space added to the image. - * - * @param {number} xOffset The x-coord offset of the upper-left pixel of the desired image relative to the present image. - * @param {number} yOffset The y-coord offset of the upper-left pixel of the desired image relative to the present image. - * @param {number} width The width of the new image after reframing - * @param {number} height The height of the new image after reframing - * @param {number} fillRGBA The color with which to fill space added to the image as a result of the reframing, in 0xRRGGBBAA format, where AA is 0x00 to indicate transparent and a non-zero value to indicate opaque. This parameter is only required when the reframing exceeds the original boundaries (i.e. does not simply perform a crop). - * @return {BitmapImage} The present image to allow for chaining. - */ - - reframe(xOffset, yOffset, width, height, fillRGBA) { - const cropX = (xOffset < 0 ? 0 : xOffset); - const cropY = (yOffset < 0 ? 0 : yOffset); - const cropWidth = (width + cropX > this.bitmap.width ? - this.bitmap.width - cropX : width); - const cropHeight = (height + cropY > this.bitmap.height ? - this.bitmap.height - cropY : height); - const newX = (xOffset < 0 ? -xOffset : 0); - const newY = (yOffset < 0 ? -yOffset : 0); - - let image; - if (fillRGBA === undefined) { - if (cropX !== xOffset || cropY != yOffset || - cropWidth !== width || cropHeight !== height) - { - throw new GifError(`fillRGBA required for this reframing`); - } - image = new BitmapImage(width, height); - } - else { - image = new BitmapImage(width, height, fillRGBA); - } - this.blit(image, newX, newY, cropX, cropY, cropWidth, cropHeight); - this.bitmap = image.bitmap; - return this; - } - - /** - * Scales the image size up by an integer factor. Each pixel of the original image becomes a square of the same color in the new image having a size of `factor` x `factor` pixels. - * - * @param {number} factor The factor by which to scale up the image. Must be an integer >= 1. - * @return {BitmapImage} The present image to allow for chaining. - */ - - scale(factor) { - if (factor === 1) { - return; - } - if (!Number.isInteger(factor) || factor < 1) { - throw new Error("the scale must be an integer >= 1"); - } - const sourceWidth = this.bitmap.width; - const sourceHeight = this.bitmap.height; - const destByteWidth = sourceWidth * factor * 4; - const sourceBuf = this.bitmap.data; - const destBuf = new Buffer(sourceHeight * destByteWidth * factor); - let sourceIndex = 0; - let priorDestRowIndex; - let destIndex = 0; - for (let y = 0; y < sourceHeight; ++y) { - priorDestRowIndex = destIndex; - for (let x = 0; x < sourceWidth; ++x) { - const color = sourceBuf.readUInt32BE(sourceIndex, true); - for (let cx = 0; cx < factor; ++cx) { - destBuf.writeUInt32BE(color, destIndex); - destIndex += 4; - } - sourceIndex += 4; - } - for (let cy = 1; cy < factor; ++cy) { - destBuf.copy(destBuf, destIndex, priorDestRowIndex, destIndex); - destIndex += destByteWidth; - priorDestRowIndex += destByteWidth; - } - } - this.bitmap = { - width: sourceWidth * factor, - height: sourceHeight * factor, - data: destBuf - }; - return this; - } - - /** - * Scans all coordinates of the image, handing each in turn to the provided handler function. - * - * @param {function} scanHandler A function(x: number, y: number, bi: number) to be called for each pixel of the image with that pixel's x-coord, y-coord, and index into the `data` buffer. The function accesses the pixel at this coordinate by accessing the `this.data` at index `bi`. - * @see scanAllIndexes - */ - - scanAllCoords(scanHandler) { - const width = this.bitmap.width; - const bufferLength = this.bitmap.data.length; - let x = 0; - let y = 0; - - for (let bi = 0; bi < bufferLength; bi += 4) { - scanHandler(x, y, bi); - if (++x === width) { - x = 0; - ++y; - } - } - } - - /** - * Scans all pixels of the image, handing the index of each in turn to the provided handler function. Runs a bit faster than `scanAllCoords()`, should the handler not need pixel coordinates. - * - * @param {function} scanHandler A function(bi: number) to be called for each pixel of the image with that pixel's index into the `data` buffer. The pixels is found at index 'bi' within `this.data`. - * @see scanAllCoords - */ - - scanAllIndexes(scanHandler) { - const bufferLength = this.bitmap.data.length; - for (let bi = 0; bi < bufferLength; bi += 4) { - scanHandler(bi); - } - } -} - -module.exports = BitmapImage; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],66:[function(require,module,exports){ -'use strict'; - -/** @class Gif */ - -class Gif { - - // width - width of GIF in pixels - // height - height of GIF in pixels - // loops - 0 = unending; (n > 0) = iterate n times - // usesTransparency - whether any frames have transparent pixels - // colorScope - scope of color tables in GIF - // frames - array of frames - // buffer - GIF-formatted data - - /** - * Gif is a class representing an encoded GIF. It is intended to be a read-only representation of a byte-encoded GIF. Only encoders and decoders should be creating instances of this class. - * - * Property | Description - * --- | --- - * width | width of the GIF at its widest - * height | height of the GIF at its highest - * loops | the number of times the GIF should loop before stopping; 0 => loop indefinately - * usesTransparency | boolean indicating whether at least one frame contains at least one transparent pixel - * colorScope | the scope of the color tables as encoded within the GIF; either Gif.GlobalColorsOnly (== 1) or Gif.LocalColorsOnly (== 2). - * frames | a array of GifFrame instances, one for each frame of the GIF - * buffer | a Buffer holding the encoding's byte data - * - * Its constructor should only ever be called by the GIF encoder or decoder. - * - * @param {Buffer} buffer A Buffer containing the encoded bytes - * @param {GifFrame[]} frames Array of frames found in the encoding - * @param {object} spec Properties of the encoding as listed above - */ - - constructor(buffer, frames, spec) { - this.width = spec.width; - this.height = spec.height; - this.loops = spec.loops; - this.usesTransparency = spec.usesTransparency; - this.colorScope = spec.colorScope; - this.frames = frames; - this.buffer = buffer; - } -} - -Gif.GlobalColorsPreferred = 0; -Gif.GlobalColorsOnly = 1; -Gif.LocalColorsOnly = 2; - -/** @class GifError */ - -class GifError extends Error { - - /** - * GifError is a class representing a GIF-related error - * - * @param {string|Error} messageOrError - */ - - constructor(messageOrError) { - super(messageOrError); - if (messageOrError instanceof Error) { - this.stack = 'Gif' + messageOrError.stack; - } - } -} - -exports.Gif = Gif; -exports.GifError = GifError; - -},{}],67:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -const Omggif = require('omggif'); -const { Gif, GifError } = require('./gif'); -let GifUtil; // allow circular dependency with GifUtil -process.nextTick(() => { - GifUtil = require('./gifutil'); -}); - -const { GifFrame } = require('./gifframe'); - -const PER_GIF_OVERHEAD = 200; // these are guesses at upper limits -const PER_FRAME_OVERHEAD = 100; - -// Note: I experimented with accepting a global color table when encoding and returning the global color table when decoding. Doing this properly greatly increased the complexity of the code and the amount of clock cycles required. The main issue is that each frame can specify any color of the global color table to be transparent within the frame, while this GIF library strives to hide GIF formatting details from its clients. E.g. it's possible to have 256 colors in the global color table and different transparencies in each frame, requiring clients to either provide per-frame transparency indexes, or for arcane reasons that won't be apparent to client developers, encode some GIFs with local color tables that previously decoded with global tables. - -/** @class GifCodec */ - -class GifCodec -{ - // _transparentRGBA - RGB given to transparent pixels (alpha=0) on decode; defaults to null indicating 0x000000, which is fastest - - /** - * GifCodec is a class that both encodes and decodes GIFs. It implements both the `encode()` method expected of an encoder and the `decode()` method expected of a decoder, and it wraps the `omggif` GIF encoder/decoder package. GifCodec serves as this library's default encoder and decoder, but it's possible to wrap other GIF encoders and decoders for use by `gifwrap` as well. GifCodec will not encode GIFs with interlacing. - * - * Instances of this class are stateless and can be shared across multiple encodings and decodings. - * - * Its constructor takes one option argument: - * - * @param {object} options Optionally takes an objection whose only possible property is `transparentRGB`. Images are internally represented in RGBA format, where A is the alpha value of a pixel. When `transparentRGB` is provided, this RGB value (excluding alpha) is assigned to transparent pixels, which are also given alpha value 0x00. (All opaque pixels are given alpha value 0xFF). The RGB color of transparent pixels shouldn't matter for most applications. Defaults to 0x000000. - */ - - constructor(options = {}) { - this._transparentRGB = null; // 0x000000 - if (typeof options.transparentRGB === 'number' && - options.transparentRGB !== 0) - { - this._transparentRGBA = options.transparentRGB * 256; - } - this._testInitialBufferSize = 0; // assume no buffer scaling test - } - - /** - * Decodes a GIF from a Buffer to yield an instance of Gif. Transparent pixels of the GIF are given alpha values of 0x00, and opaque pixels are given alpha values of 0xFF. The RGB values of transparent pixels default to 0x000000 but can be overridden by the constructor's `transparentRGB` option. - * - * @param {Buffer} buffer Bytes of an encoded GIF to decode. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. - * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs. - */ - - decodeGif(buffer) { - try { - let reader; - try { - reader = new Omggif.GifReader(buffer); - } - catch (err) { - throw new GifError(err); - } - const frameCount = reader.numFrames(); - const frames = []; - const spec = { - width: reader.width, - height: reader.height, - loops: reader.loopCount() - }; - - spec.usesTransparency = false; - for (let i = 0; i < frameCount; ++i) { - const frameInfo = - this._decodeFrame(reader, i, spec.usesTransparency); - frames.push(frameInfo.frame); - if (frameInfo.usesTransparency) { - spec.usesTransparency = true; - } - } - return Promise.resolve(new Gif(buffer, frames, spec)); - } - catch (err) { - return Promise.reject(err); - } - } - - /** - * Encodes a GIF from provided frames. Each pixel having an alpha value of 0x00 renders as transparent within the encoding, while all pixels of non-zero alpha value render as opaque. - * - * @param {GifFrame[]} frames Array of frames to encode - * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. - * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs. - */ - - encodeGif(frames, spec = {}) { - try { - if (frames === null || frames.length === 0) { - throw new GifError("there are no frames"); - } - const dims = GifUtil.getMaxDimensions(frames); - - spec = Object.assign({}, spec); // don't munge caller's spec - spec.width = dims.maxWidth; - spec.height = dims.maxHeight; - spec.loops = spec.loops || 0; - spec.colorScope = spec.colorScope || Gif.GlobalColorsPreferred; - - return Promise.resolve(this._encodeGif(frames, spec)); - } - catch (err) { - return Promise.reject(err); - } - } - - _decodeFrame(reader, frameIndex, alreadyUsedTransparency) { - let info, buffer; - try { - info = reader.frameInfo(frameIndex); - buffer = new Buffer(reader.width * reader.height * 4); - reader.decodeAndBlitFrameRGBA(frameIndex, buffer); - if (info.width !== reader.width || info.height !== reader.height) { - if (info.y) { - // skip unused rows - buffer = buffer.slice(info.y * reader.width * 4); - } - if (reader.width > info.width) { - // skip scanstride - for (let ii = 0; ii < info.height; ++ii) { - buffer.copy(buffer, ii * info.width * 4, - (info.x + ii * reader.width) * 4, - (info.x + ii * reader.width) * 4 + info.width * 4); - } - } - // trim buffer to size - buffer = buffer.slice(0, info.width * info.height * 4); - } - } - catch (err) { - throw new GifError(err); - } - - let usesTransparency = false; - if (this._transparentRGBA === null) { - if (!alreadyUsedTransparency) { - for (let i = 3; i < buffer.length; i += 4) { - if (buffer[i] === 0) { - usesTransparency = true; - i = buffer.length; - } - } - } - } - else { - for (let i = 3; i < buffer.length; i += 4) { - if (buffer[i] === 0) { - buffer.writeUInt32BE(this._transparentRGBA, i - 3); - usesTransparency = true; // GIF might encode unused index - } - } - } - - const frame = new GifFrame(info.width, info.height, buffer, { - xOffset: info.x, - yOffset: info.y, - disposalMethod: info.disposal, - interlaced: info.interlaced, - delayCentisecs: info.delay - }); - return { frame, usesTransparency }; - } - - _encodeGif(frames, spec) { - let colorInfo; - if (spec.colorScope === Gif.LocalColorsOnly) { - colorInfo = GifUtil.getColorInfo(frames, 0); - } - else { - colorInfo = GifUtil.getColorInfo(frames, 256); - if (!colorInfo.colors) { // if global palette impossible - if (spec.colorScope === Gif.GlobalColorsOnly) { - throw new GifError( - "Too many color indexes for global color table"); - } - spec.colorScope = Gif.LocalColorsOnly - } - } - spec.usesTransparency = colorInfo.usesTransparency; - - const localPalettes = colorInfo.palettes; - if (spec.colorScope === Gif.LocalColorsOnly) { - const localSizeEst = 2000; //this._getSizeEstimateLocal(localPalettes, frames); - return _encodeLocal(frames, spec, localSizeEst, localPalettes); - } - - const globalSizeEst = 2000; //this._getSizeEstimateGlobal(colorInfo, frames); - return _encodeGlobal(frames, spec, globalSizeEst, colorInfo); - } - - _getSizeEstimateGlobal(globalPalette, frames) { - if (this._testInitialBufferSize > 0) { - return this._testInitialBufferSize; - } - let sizeEst = PER_GIF_OVERHEAD + 3*256 /* max palette size*/; - const pixelBitWidth = _getPixelBitWidth(globalPalette); - frames.forEach(frame => { - sizeEst += _getFrameSizeEst(frame, pixelBitWidth); - }); - return sizeEst; // should be the upper limit - } - - _getSizeEstimateLocal(palettes, frames) { - if (this._testInitialBufferSize > 0) { - return this._testInitialBufferSize; - } - let sizeEst = PER_GIF_OVERHEAD; - for (let i = 0; i < frames.length; ++i ) { - const palette = palettes[i]; - const pixelBitWidth = _getPixelBitWidth(palette); - sizeEst += _getFrameSizeEst(frames[i], pixelBitWidth); - } - return sizeEst; // should be the upper limit - } -} -exports.GifCodec = GifCodec; - -function _colorLookupLinear(colors, color) { - const index = colors.indexOf(color); - return (index === -1 ? null : index); -} - -function _colorLookupBinary(colors, color) { - // adapted from https://stackoverflow.com/a/10264318/650894 - var lo = 0, hi = colors.length - 1, mid; - while (lo <= hi) { - mid = Math.floor((lo + hi)/2); - if (colors[mid] > color) - hi = mid - 1; - else if (colors[mid] < color) - lo = mid + 1; - else - return mid; - } - return null; -} - -function _encodeGlobal(frames, spec, bufferSizeEst, globalPalette) { - // would be inefficient for frames to lookup colors in extended palette - const extendedGlobalPalette = { - colors: globalPalette.colors.slice(), - usesTransparency: globalPalette.usesTransparency - }; - _extendPaletteToPowerOf2(extendedGlobalPalette); - const options = { - palette: extendedGlobalPalette.colors, - loop: spec.loops - }; - let buffer = new Buffer(bufferSizeEst); - let gifWriter; - try { - gifWriter = new Omggif.GifWriter(buffer, spec.width, spec.height, - options); - } - catch (err) { - throw new GifError(err); - } - for (let i = 0; i < frames.length; ++i) { - buffer = _writeFrame(gifWriter, i, frames[i], globalPalette, false); - } - return new Gif(buffer.slice(0, gifWriter.end()), frames, spec); -} - -function _encodeLocal(frames, spec, bufferSizeEst, localPalettes) { - const options = { - loop: spec.loops - }; - let buffer = new Buffer(bufferSizeEst); - let gifWriter; - try { - gifWriter = new Omggif.GifWriter(buffer, spec.width, spec.height, - options); - } - catch (err) { - throw new GifError(err); - } - for (let i = 0; i < frames.length; ++i) { - buffer = _writeFrame(gifWriter, i, frames[i], localPalettes[i], true); - } - return new Gif(buffer.slice(0, gifWriter.end()), frames, spec); -} - -function _extendPaletteToPowerOf2(palette) { - const colors = palette.colors; - if (palette.usesTransparency) { - colors.push(0); - } - const colorCount = colors.length; - let powerOf2 = 2; - while (colorCount > powerOf2) { - powerOf2 <<= 1; - } - colors.length = powerOf2; - colors.fill(0, colorCount); -} - -function _getFrameSizeEst(frame, pixelBitWidth) { - let byteLength = frame.bitmap.width * frame.bitmap.height; - byteLength = Math.ceil(byteLength * pixelBitWidth / 8); - byteLength += Math.ceil(byteLength / 255); // add block size bytes - // assume maximum palete size because it might get extended for power of 2 - return (PER_FRAME_OVERHEAD + byteLength + 3 * 256 /* largest palette */); -} - -function _getIndexedImage(frameIndex, frame, palette) { - const colors = palette.colors; - const colorToIndexFunc = (colors.length <= 8 ? // guess at the break-even - _colorLookupLinear : _colorLookupBinary); - const colorBuffer = frame.bitmap.data; - const indexBuffer = new Buffer(colorBuffer.length/4); - let transparentIndex = colors.length; - let i = 0, j = 0; - - while (i < colorBuffer.length) { - if (colorBuffer[i + 3] !== 0) { - const color = (colorBuffer.readUInt32BE(i, true) >> 8) & 0xFFFFFF; - // caller guarantees that the color will be in the palette - indexBuffer[j] = colorToIndexFunc(colors, color); - } - else { - indexBuffer[j] = transparentIndex; - } - i += 4; // skip alpha - ++j; - } - - if (palette.usesTransparency) { - if (transparentIndex === 256) { - throw new GifError(`Frame ${frameIndex} already has 256 colors` + - `and so can't use transparency`); - } - } - else { - transparentIndex = null; - } - - return { buffer: indexBuffer, transparentIndex }; -} - -function _getPixelBitWidth(palette) { - let indexCount = palette.indexCount; - let pixelBitWidth = 0; - --indexCount; // start at maximum index - while (indexCount) { - ++pixelBitWidth; - indexCount >>= 1; - } - return (pixelBitWidth > 0 ? pixelBitWidth : 1); -} - -function _writeFrame(gifWriter, frameIndex, frame, palette, isLocalPalette) { - if (frame.interlaced) { - throw new GifError("writing interlaced GIFs is not supported"); - } - const frameInfo = _getIndexedImage(frameIndex, frame, palette); - const options = { - delay: frame.delayCentisecs, - disposal: frame.disposalMethod, - transparent: frameInfo.transparentIndex - }; - if (isLocalPalette) { - _extendPaletteToPowerOf2(palette); // ok 'cause palette never used again - options.palette = palette.colors; - } - try { - let buffer = gifWriter.getOutputBuffer(); - let startOfFrame = gifWriter.getOutputBufferPosition(); - let endOfFrame; - let tryAgain = true; - - while (tryAgain) { - endOfFrame = gifWriter.addFrame(frame.xOffset, frame.yOffset, - frame.bitmap.width, frame.bitmap.height, frameInfo.buffer, options); - tryAgain = false; - if (endOfFrame >= buffer.length - 1) { - const biggerBuffer = new Buffer(buffer.length * 1.5); - buffer.copy(biggerBuffer); - gifWriter.setOutputBuffer(biggerBuffer); - gifWriter.setOutputBufferPosition(startOfFrame); - buffer = biggerBuffer; - tryAgain = true; - } - } - return buffer; - } - catch (err) { - throw new GifError(err); - } -} - -}).call(this,require('_process'),require("buffer").Buffer) -},{"./gif":66,"./gifframe":68,"./gifutil":69,"_process":133,"buffer":48,"omggif":64}],68:[function(require,module,exports){ -'use strict'; - -const BitmapImage = require('./bitmapimage'); -const { GifError } = require('./gif'); - -/** @class GifFrame */ - -class GifFrame extends BitmapImage { - - // xOffset - x offset of bitmap on GIF (defaults to 0) - // yOffset - y offset of bitmap on GIF (defaults to 0) - // disposalMethod - pixel disposal method when handling partial images - // delayCentisecs - duration of frame in hundredths of a second - // interlaced - whether the image is interlaced (defaults to false) - - /** - * GifFrame is a class representing an image frame of a GIF. GIFs contain one or more instances of GifFrame. - * - * Property | Description - * --- | --- - * xOffset | x-coord of position within GIF at which to render the image (defaults to 0) - * yOffset | y-coord of position within GIF at which to render the image (defaults to 0) - * disposalMethod | GIF disposal method; only relevant when the frames aren't all the same size (defaults to 2, disposing to background color) - * delayCentisecs | duration of the frame in hundreths of a second - * interlaced | boolean indicating whether the frame renders interlaced - * - * Its constructor supports the following signatures: - * - * * new GifFrame(bitmap: {width: number, height: number, data: Buffer}, options?) - * * new GifFrame(bitmapImage: BitmapImage, options?) - * * new GifFrame(width: number, height: number, buffer: Buffer, options?) - * * new GifFrame(width: number, height: number, backgroundRGBA?: number, options?) - * * new GifFrame(frame: GifFrame) - * - * See the base class BitmapImage for a discussion of all parameters but `options` and `frame`. `options` is an optional argument providing initial values for the above-listed GifFrame properties. Each property within option is itself optional. - * - * Provide a `frame` to the constructor to create a clone of the provided frame. The new frame includes a copy of the provided frame's pixel data so that each can subsequently be modified without affecting each other. - */ - - constructor(...args) { - super(...args); - if (args[0] instanceof GifFrame) { - // copy a provided GifFrame - const source = args[0]; - this.xOffset = source.xOffset; - this.yOffset = source.yOffset; - this.disposalMethod = source.disposalMethod; - this.delayCentisecs = source.delayCentisecs; - this.interlaced = source.interlaced; - } - else { - const lastArg = args[args.length - 1]; - let options = {}; - if (typeof lastArg === 'object' && !(lastArg instanceof BitmapImage)) { - options = lastArg; - } - this.xOffset = options.xOffset || 0; - this.yOffset = options.yOffset || 0; - this.disposalMethod = (options.disposalMethod !== undefined ? - options.disposalMethod : GifFrame.DisposeToBackgroundColor); - this.delayCentisecs = options.delayCentisecs || 8; - this.interlaced = options.interlaced || false; - } - } - - /** - * Get a summary of the colors found within the frame. The return value is an object of the following form: - * - * Property | Description - * --- | --- - * colors | An array of all the opaque colors found within the frame. Each color is given as an RGB number of the form 0xRRGGBB. The array is sorted by increasing number. Will be an empty array when the image is completely transparent. - * usesTransparency | boolean indicating whether there are any transparent pixels within the frame. A pixel is considered transparent if its alpha value is 0x00. - * indexCount | The number of color indexes required to represent this palette of colors. It is equal to the number of opaque colors plus one if the image includes transparency. - * - * @return {object} An object representing a color palette as described above. - */ - - getPalette() { - // returns with colors sorted low to high - const colorSet = new Set(); - const buf = this.bitmap.data; - let i = 0; - let usesTransparency = false; - while (i < buf.length) { - if (buf[i + 3] === 0) { - usesTransparency = true; - } - else { - // can eliminate the bitshift by starting one byte prior - const color = (buf.readUInt32BE(i, true) >> 8) & 0xFFFFFF; - colorSet.add(color); - } - i += 4; // skip alpha - } - const colors = new Array(colorSet.size); - const iter = colorSet.values(); - for (i = 0; i < colors.length; ++i) { - colors[i] = iter.next().value; - } - colors.sort((a, b) => (a - b)); - let indexCount = colors.length; - if (usesTransparency) { - ++indexCount; - } - return { colors, usesTransparency, indexCount }; - } -} - -GifFrame.DisposeToAnything = 0; -GifFrame.DisposeNothing = 1; -GifFrame.DisposeToBackgroundColor = 2; -GifFrame.DisposeToPrevious = 3; - -exports.GifFrame = GifFrame; - -},{"./bitmapimage":65,"./gif":66}],69:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -/** @namespace GifUtil */ - -const fs = require('fs'); -const ImageQ = require('image-q'); - -const BitmapImage = require('./bitmapimage'); -const { GifFrame } = require('./gifframe'); -const { GifError } = require('./gif'); -const { GifCodec } = require('./gifcodec'); - -const INVALID_SUFFIXES = ['.jpg', '.jpeg', '.png', '.bmp']; - -const defaultCodec = new GifCodec(); - -/** - * cloneFrames() clones provided frames. It's a utility method for cloning an entire array of frames at once. - * - * @function cloneFrames - * @memberof GifUtil - * @param {GifFrame[]} frames An array of GifFrame instances to clone - * @return {GifFrame[]} An array of GifFrame clones of the provided frames. - */ - -exports.cloneFrames = function (frames) { - let clones = []; - frames.forEach(frame => { - - clones.push(new GifFrame(frame)); - }); - return clones; -} - -/** - * getColorInfo() gets information about the colors used in the provided frames. The method is able to return an array of all colors found across all frames. - * - * `maxGlobalIndex` controls whether the computation short-circuits to avoid doing work that the caller doesn't need. The method only returns `colors` and `indexCount` for the colors across all frames when the number of indexes required to store the colors and transparency in a GIF (which is the value of `indexCount`) is less than or equal to `maxGlobalIndex`. Such short-circuiting is useful when the caller just needs to determine whether any frame includes transparency. - * - * @function getColorInfo - * @memberof GifUtil - * @param {GifFrame[]} frames Frames to examine for color and transparency. - * @param {number} maxGlobalIndex Maximum number of color indexes (including one for transparency) allowed among the returned compilation of colors. `colors` and `indexCount` are not returned if the number of color indexes required to accommodate all frames exceeds this number. Returns `colors` and `indexCount` by default. - * @returns {object} Object containing at least `palettes` and `usesTransparency`. `palettes` is an array of all the palettes returned by GifFrame#getPalette(). `usesTransparency` indicates whether at least one frame uses transparency. If `maxGlobalIndex` is not exceeded, the object also contains `colors`, an array of all colors (RGB) found across all palettes, sorted by increasing value, and `indexCount` indicating the number of indexes required to store the colors and the transparency in a GIF. - * @throws {GifError} When any frame requires more than 256 color indexes. - */ - -exports.getColorInfo = function (frames, maxGlobalIndex) { - let usesTransparency = false; - const palettes = []; - for (let i = 0; i < frames.length; ++i) { - let palette = frames[i].getPalette(); - if (palette.usesTransparency) { - usesTransparency = true; - } - if (palette.indexCount > 256) { - throw new GifError(`Frame ${i} uses more than 256 color indexes`); - } - palettes.push(palette); - } - if (maxGlobalIndex === 0) { - return { usesTransparency, palettes }; - } - - const globalColorSet = new Set(); - palettes.forEach(palette => { - - palette.colors.forEach(color => { - - globalColorSet.add(color); - }); - }); - let indexCount = globalColorSet.size; - if (usesTransparency) { - // odd that GIF requires a color table entry at transparent index - ++indexCount; - } - if (maxGlobalIndex && indexCount > maxGlobalIndex) { - return { usesTransparency, palettes }; - } - - const colors = new Array(globalColorSet.size); - const iter = globalColorSet.values(); - for (let i = 0; i < colors.length; ++i) { - colors[i] = iter.next().value; - } - colors.sort((a, b) => (a - b)); - return { colors, indexCount, usesTransparency, palettes }; -}; - -/** - * copyAsJimp() returns a Jimp that contains a copy of the provided bitmap image (which may be either a BitmapImage or a GifFrame). Modifying the Jimp does not affect the provided bitmap image. This method serves as a macro for simplifying working with Jimp. - * - * @function copyAsJimp - * @memberof GifUtil - * @param {object} Reference to the Jimp package, keeping this library from being dependent on Jimp. - * @param {bitmapImageToCopy} Instance of BitmapImage (may be a GifUtil) with which to source the Jimp. - * @return {object} An new instance of Jimp containing a copy of the image in bitmapImageToCopy. - */ - -exports.copyAsJimp = function (jimp, bitmapImageToCopy) { - return exports.shareAsJimp(jimp, new BitmapImage(bitmapImageToCopy)); -}; - -/** - * getMaxDimensions() returns the pixel width and height required to accommodate all of the provided frames, according to the offsets and dimensions of each frame. - * - * @function getMaxDimensions - * @memberof GifUtil - * @param {GifFrame[]} frames Frames to measure for their aggregate maximum dimensions. - * @return {object} An object of the form {maxWidth, maxHeight} indicating the maximum width and height required to accommodate all frames. - */ - -exports.getMaxDimensions = function (frames) { - let maxWidth = 0, maxHeight = 0; - frames.forEach(frame => { - const width = frame.xOffset + frame.bitmap.width; - if (width > maxWidth) { - maxWidth = width; - } - const height = frame.yOffset + frame.bitmap.height; - if (height > maxHeight) { - maxHeight = height; - } - }); - return { maxWidth, maxHeight }; -}; - -/** - * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Anthony Dekker. - * - * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values. - * - * The method may increase the number of colors if there are fewer than the provided maximum. - * - * @function quantizeDekker - * @memberof GifUtil - * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame. - * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256. - * @param {object} dither (optional) An object configuring the dithering to apply. The properties are as followings, imported from the [`image-q` package](https://github.com/ibezkrovnyi/image-quantization) without explanation: { `ditherAlgorithm`: One of 'FloydSteinberg', 'FalseFloydSteinberg', 'Stucki', 'Atkinson', 'Jarvis', 'Burkes', 'Sierra', 'TwoSierra', 'SierraLite'; `minimumColorDistanceToDither`: (optional) A number defaulting to 0; `serpentine`: (optional) A boolean defaulting to true; `calculateErrorLikeGIMP`: (optional) A boolean defaulting to false. } - */ - -exports.quantizeDekker = function (imageOrImages, maxColorIndexes, dither) { - maxColorIndexes = maxColorIndexes || 256; - _quantize(imageOrImages, 'NeuQuantFloat', maxColorIndexes, 0, dither); -} - -/** - * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Leon Sorokin. This quantization method differs from the other two by likely never increasing the number of colors, should there be fewer than the provided maximum. - * - * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values. - * - * @function quantizeSorokin - * @memberof GifUtil - * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame. - * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256. - * @param {string} histogram (optional) Histogram method: 'top-pop' for global top-population, 'min-pop' for minimum-population threshhold within subregions. Defaults to 'min-pop'. - * @param {object} dither (optional) An object configuring the dithering to apply, as explained for `quantizeDekker()`. - */ - -exports.quantizeSorokin = function (imageOrImages, maxColorIndexes, histogram, dither) { - maxColorIndexes = maxColorIndexes || 256; - histogram = histogram || 'min-pop'; - let histogramID; - switch (histogram) { - case 'min-pop': - histogramID = 2; - break; - - case 'top-pop': - histogramID = 1; - break - - default: - throw new Error(`Invalid quantizeSorokin histogram '${histogram}'`); - } - _quantize(imageOrImages, 'RGBQuant', maxColorIndexes, histogramID, dither); -} - -/** - * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Xiaolin Wu. - * - * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values. - * - * The method may increase the number of colors if there are fewer than the provided maximum. - * - * @function quantizeWu - * @memberof GifUtil - * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame. - * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256. - * @param {number} significantBits (optional) This is the number of significant high bits in each RGB color channel. Takes integer values from 1 through 8. Higher values correspond to higher quality. Defaults to 5. - * @param {object} dither (optional) An object configuring the dithering to apply, as explained for `quantizeDekker()`. - */ - -exports.quantizeWu = function (imageOrImages, maxColorIndexes, significantBits, dither) { - maxColorIndexes = maxColorIndexes || 256; - significantBits = significantBits || 5; - if (significantBits < 1 || significantBits > 8) { - throw new Error("Invalid quantization quality"); - } - _quantize(imageOrImages, 'WuQuant', maxColorIndexes, significantBits, dither); -} - -/** - * read() decodes an encoded GIF, whether provided as a filename or as a byte buffer. - * - * @function read - * @memberof GifUtil - * @param {string|Buffer} source Source to decode. When a string, it's the GIF filename to load and parse. When a Buffer, it's an encoded GIF to parse. - * @param {object} decoder An optional GIF decoder object implementing the `decode` method of class GifCodec. When provided, the method decodes the GIF using this decoder. When not provided, the method uses GifCodec. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the decoded GIF. - */ - -exports.read = function (source, decoder) { - decoder = decoder || defaultCodec; - if (Buffer.isBuffer(source)) { - return decoder.decodeGif(source); - } - return _readBinary(source) - .then(buffer => { - - return decoder.decodeGif(buffer); - }); -}; - -/** - * shareAsJimp() returns a Jimp that shares a bitmap with the provided bitmap image (which may be either a BitmapImage or a GifFrame). Modifying the image in either the Jimp or the BitmapImage affects the other objects. This method serves as a macro for simplifying working with Jimp. - * - * @function shareAsJimp - * @memberof GifUtil - * @param {object} Reference to the Jimp package, keeping this library from being dependent on Jimp. - * @param {bitmapImageToShare} Instance of BitmapImage (may be a GifUtil) with which to source the Jimp. - * @return {object} An new instance of Jimp that shares the image in bitmapImageToShare. - */ - -exports.shareAsJimp = function (jimp, bitmapImageToShare) { - const jimpImage = new jimp(bitmapImageToShare.bitmap.width, - bitmapImageToShare.bitmap.height, 0); - jimpImage.bitmap.data = bitmapImageToShare.bitmap.data; - return jimpImage; -}; - -/** - * write() encodes a GIF and saves it as a file. - * - * @function write - * @memberof GifUtil - * @param {string} path Filename to write GIF out as. Will overwrite an existing file. - * @param {GifFrame[]} frames Array of frames to be written into GIF. - * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred. - * @param {object} encoder An optional GIF encoder object implementing the `encode` method of class GifCodec. When provided, the method encodes the GIF using this encoder. When not provided, the method uses GifCodec. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. - */ - -exports.write = function (path, frames, spec, encoder) { - encoder = encoder || defaultCodec; - const matches = path.match(/\.[a-zA-Z]+$/); // prevent accidents - if (matches !== null && - INVALID_SUFFIXES.includes(matches[0].toLowerCase())) - { - throw new Error(`GIF '${path}' has an unexpected suffix`); - } - - return encoder.encodeGif(frames, spec) - .then(gif => { - - return _writeBinary(path, gif.buffer) - .then(() => { - - return gif; - }); - }); -}; - -function _quantize(imageOrImages, method, maxColorIndexes, modifier, dither) { - const images = Array.isArray(imageOrImages) ? imageOrImages : [imageOrImages]; - const ditherAlgs = [ - 'FloydSteinberg', - 'FalseFloydSteinberg', - 'Stucki', - 'Atkinson', - 'Jarvis', - 'Burkes', - 'Sierra', - 'TwoSierra', - 'SierraLite' - ]; - - if (dither) { - if (ditherAlgs.indexOf(dither.ditherAlgorithm) < 0) { - throw new Error(`Invalid ditherAlgorithm '${dither.ditherAlgorithm}'`); - } - if (dither.serpentine === undefined) { - dither.serpentine = true; - } - if (dither.minimumColorDistanceToDither === undefined) { - dither.minimumColorDistanceToDither = 0; - } - if (dither.calculateErrorLikeGIMP === undefined) { - dither.calculateErrorLikeGIMP = false; - } - } - - const distCalculator = new ImageQ.distance.Euclidean(); - const quantizer = new ImageQ.palette[method](distCalculator, maxColorIndexes, modifier); - let imageMaker; - if (dither) { - imageMaker = new ImageQ.image.ErrorDiffusionArray( - distCalculator, - ImageQ.image.ErrorDiffusionArrayKernel[dither.ditherAlgorithm], - dither.serpentine, - dither.minimumColorDistanceToDither, - dither.calculateErrorLikeGIMP - ); - } - else { - imageMaker = new ImageQ.image.NearestColor(distCalculator); - } - - const inputContainers = []; - images.forEach(image => { - - const imageBuf = image.bitmap.data; - const inputBuf = new ArrayBuffer(imageBuf.length); - const inputArray = new Uint32Array(inputBuf); - for (let bi = 0, ai = 0; bi < imageBuf.length; bi += 4, ++ai) { - inputArray[ai] = imageBuf.readUInt32LE(bi, true); - } - const inputContainer = ImageQ.utils.PointContainer.fromUint32Array( - inputArray, image.bitmap.width, image.bitmap.height); - quantizer.sample(inputContainer); - inputContainers.push(inputContainer); - }); - - const limitedPalette = quantizer.quantize(); - - for (let i = 0; i < images.length; ++i) { - const imageBuf = images[i].bitmap.data; - const outputContainer = imageMaker.quantize(inputContainers[i], limitedPalette); - const outputArray = outputContainer.toUint32Array(); - for (let bi = 0, ai = 0; bi < imageBuf.length; bi += 4, ++ai) { - imageBuf.writeUInt32LE(outputArray[ai], bi); - } - } -} - -function _readBinary(path) { - // TBD: add support for URLs - return new Promise((resolve, reject) => { - - fs.readFile(path, (err, buffer) => { - - if (err) { - return reject(err); - } - return resolve(buffer); - }); - }); -} - -function _writeBinary(path, buffer) { - // TBD: add support for URLs - return new Promise((resolve, reject) => { - - fs.writeFile(path, buffer, err => { - - if (err) { - return reject(err); - } - return resolve(); - }); - }); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":76,"./bitmapimage":65,"./gif":66,"./gifcodec":67,"./gifframe":68,"fs":47,"image-q":74}],70:[function(require,module,exports){ -'use strict'; - -const BitmapImage = require('./bitmapimage'); -const { Gif, GifError } = require('./gif'); -const { GifCodec } = require('./gifcodec'); -const { GifFrame } = require('./gifframe'); -const GifUtil = require('./gifutil'); - -module.exports = { - BitmapImage, - Gif, - GifCodec, - GifFrame, - GifUtil, - GifError -}; - -},{"./bitmapimage":65,"./gif":66,"./gifcodec":67,"./gifframe":68,"./gifutil":69}],71:[function(require,module,exports){ -(function (global){ -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof global !== "undefined") { - win = global; -} else if (typeof self !== "undefined"){ - win = self; -} else { - win = {}; -} - -module.exports = win; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],72:[function(require,module,exports){ -var http = require('http') -var url = require('url') - -var https = module.exports - -for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key] -} - -https.request = function (params, cb) { - params = validateParams(params) - return http.request.call(this, params, cb) -} - -https.get = function (params, cb) { - params = validateParams(params) - return http.get.call(this, params, cb) -} - -function validateParams (params) { - if (typeof params === 'string') { - params = url.parse(params) - } - if (!params.protocol) { - params.protocol = 'https:' - } - if (params.protocol !== 'https:') { - throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"') - } - return params -} - -},{"http":156,"url":180}],73:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],74:[function(require,module,exports){ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("iq", [], factory); - else if(typeof exports === 'object') - exports["iq"] = factory(); - else - root["iq"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var constants = __webpack_require__(1); - exports.constants = constants; - var conversion = __webpack_require__(3); - exports.conversion = conversion; - var distance = __webpack_require__(12); - exports.distance = distance; - var palette = __webpack_require__(20); - exports.palette = palette; - var image = __webpack_require__(30); - exports.image = image; - var quality = __webpack_require__(35); - exports.quality = quality; - var utils = __webpack_require__(37); - exports.utils = utils; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * constants.ts - part of Image Quantization Library - */ - var bt709 = __webpack_require__(2); - exports.bt709 = bt709; - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * constants.ts - part of Image Quantization Library - */ - "use strict"; - /** - * sRGB (based on ITU-R Recommendation BT.709) - * http://en.wikipedia.org/wiki/SRGB - */ - var Y; - (function (Y) { - Y[Y["RED"] = 0.2126] = "RED"; - Y[Y["GREEN"] = 0.7152] = "GREEN"; - Y[Y["BLUE"] = 0.0722] = "BLUE"; - Y[Y["WHITE"] = 1] = "WHITE"; - })(Y || (Y = {})); - exports.Y = Y; - var x; - (function (x) { - x[x["RED"] = 0.64] = "RED"; - x[x["GREEN"] = 0.3] = "GREEN"; - x[x["BLUE"] = 0.15] = "BLUE"; - x[x["WHITE"] = 0.3127] = "WHITE"; - })(x || (x = {})); - exports.x = x; - var y; - (function (y) { - y[y["RED"] = 0.33] = "RED"; - y[y["GREEN"] = 0.6] = "GREEN"; - y[y["BLUE"] = 0.06] = "BLUE"; - y[y["WHITE"] = 0.329] = "WHITE"; - })(y || (y = {})); - exports.y = y; - - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var rgb2xyz_1 = __webpack_require__(4); - exports.rgb2xyz = rgb2xyz_1.rgb2xyz; - var rgb2hsl_1 = __webpack_require__(5); - exports.rgb2hsl = rgb2hsl_1.rgb2hsl; - var rgb2lab_1 = __webpack_require__(7); - exports.rgb2lab = rgb2lab_1.rgb2lab; - var lab2xyz_1 = __webpack_require__(9); - exports.lab2xyz = lab2xyz_1.lab2xyz; - var lab2rgb_1 = __webpack_require__(10); - exports.lab2rgb = lab2rgb_1.lab2rgb; - var xyz2lab_1 = __webpack_require__(8); - exports.xyz2lab = xyz2lab_1.xyz2lab; - var xyz2rgb_1 = __webpack_require__(11); - exports.xyz2rgb = xyz2rgb_1.xyz2rgb; - - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgb2xyz.ts - part of Image Quantization Library - */ - function correctGamma(n) { - return n > 0.04045 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92; - } - function rgb2xyz(r, g, b) { - // gamma correction, see https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation - r = correctGamma(r / 255); - g = correctGamma(g / 255); - b = correctGamma(b / 255); - // Observer. = 2°, Illuminant = D65 - return { - x: r * 0.4124 + g * 0.3576 + b * 0.1805, - y: r * 0.2126 + g * 0.7152 + b * 0.0722, - z: r * 0.0193 + g * 0.1192 + b * 0.9505 - }; - } - exports.rgb2xyz = rgb2xyz; - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgb2hsl.ts - part of Image Quantization Library - */ - var arithmetic_1 = __webpack_require__(6); - /** - * Calculate HSL from RGB - * Hue is in degrees [0..360] - * Lightness: [0..1] - * Saturation: [0..1] - * http://web.archive.org/web/20060914040436/http://local.wasp.uwa.edu.au/~pbourke/colour/hsl/ - */ - function rgb2hsl(r, g, b) { - var min = arithmetic_1.min3(r, g, b), max = arithmetic_1.max3(r, g, b), delta = max - min, l = (min + max) / 510; - var s = 0; - if (l > 0 && l < 1) - s = delta / (l < 0.5 ? (max + min) : (510 - max - min)); - var h = 0; - if (delta > 0) { - if (max === r) { - h = (g - b) / delta; - } - else if (max === g) { - h = (2 + (b - r) / delta); - } - else { - h = (4 + (r - g) / delta); - } - h *= 60; - if (h < 0) - h += 360; - } - return { h: h, s: s, l: l }; - } - exports.rgb2hsl = rgb2hsl; - - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - "use strict"; - function degrees2radians(n) { - return n * (Math.PI / 180); - } - exports.degrees2radians = degrees2radians; - function max3(a, b, c) { - var m = a; - (m < b) && (m = b); - (m < c) && (m = c); - return m; - } - exports.max3 = max3; - function min3(a, b, c) { - var m = a; - (m > b) && (m = b); - (m > c) && (m = c); - return m; - } - exports.min3 = min3; - function intInRange(value, low, high) { - if (value > high) - value = high; - if (value < low) - value = low; - return value | 0; - } - exports.intInRange = intInRange; - function inRange0to255Rounded(n) { - n = Math.round(n); - if (n > 255) - n = 255; - else if (n < 0) - n = 0; - return n; - } - exports.inRange0to255Rounded = inRange0to255Rounded; - function inRange0to255(n) { - if (n > 255) - n = 255; - else if (n < 0) - n = 0; - return n; - } - exports.inRange0to255 = inRange0to255; - function stableSort(arrayToSort, callback) { - var type = typeof arrayToSort[0]; - var sorted; - if (type === "number" || type === "string") { - var ord_1 = Object.create(null); - for (var i = 0, l = arrayToSort.length; i < l; i++) { - var val = arrayToSort[i]; - if (ord_1[val] || ord_1[val] === 0) - continue; - ord_1[val] = i; - } - sorted = arrayToSort.sort(function (a, b) { - return callback(a, b) || ord_1[a] - ord_1[b]; - }); - } - else { - var ord2_1 = arrayToSort.slice(0); - sorted = arrayToSort.sort(function (a, b) { - return callback(a, b) || ord2_1.indexOf(a) - ord2_1.indexOf(b); - }); - } - return sorted; - } - exports.stableSort = stableSort; - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgb2lab.ts - part of Image Quantization Library - */ - var rgb2xyz_1 = __webpack_require__(4); - var xyz2lab_1 = __webpack_require__(8); - function rgb2lab(r, g, b) { - var xyz = rgb2xyz_1.rgb2xyz(r, g, b); - return xyz2lab_1.xyz2lab(xyz.x, xyz.y, xyz.z); - } - exports.rgb2lab = rgb2lab; - - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * xyz2lab.ts - part of Image Quantization Library - */ - var refX = 0.95047, //ref_X = 95.047 Observer= 2°, Illuminant= D65 - refY = 1.00000, //ref_Y = 100.000 - refZ = 1.08883; //ref_Z = 108.883 - function pivot(n) { - return n > 0.008856 ? Math.pow(n, 1 / 3) : (7.787 * n + 16 / 116); - } - function xyz2lab(x, y, z) { - x = pivot(x / refX); - y = pivot(y / refY); - z = pivot(z / refZ); - if ((116 * y) - 16 < 0) - throw new Error("xxx"); - return { - L: Math.max(0, (116 * y) - 16), - a: 500 * (x - y), - b: 200 * (y - z) - }; - } - exports.xyz2lab = xyz2lab; - - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * lab2xyz.ts - part of Image Quantization Library - */ - var refX = 0.95047, //ref_X = 95.047 Observer= 2°, Illuminant = D65 - refY = 1.00000, //ref_Y = 100.000 - refZ = 1.08883; //ref_Z = 108.883 - function pivot(n) { - return n > 0.206893034 ? Math.pow(n, 3) : (n - 16 / 116) / 7.787; - } - function lab2xyz(L, a, b) { - var y = (L + 16) / 116, x = a / 500 + y, z = y - b / 200; - return { - x: refX * pivot(x), - y: refY * pivot(y), - z: refZ * pivot(z) - }; - } - exports.lab2xyz = lab2xyz; - - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * lab2rgb.ts - part of Image Quantization Library - */ - var lab2xyz_1 = __webpack_require__(9); - var xyz2rgb_1 = __webpack_require__(11); - function lab2rgb(L, a, b) { - var xyz = lab2xyz_1.lab2xyz(L, a, b); - return xyz2rgb_1.xyz2rgb(xyz.x, xyz.y, xyz.z); - } - exports.lab2rgb = lab2rgb; - - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * xyz2rgb.ts - part of Image Quantization Library - */ - var arithmetic_1 = __webpack_require__(6); - // gamma correction, see https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation - function correctGamma(n) { - return n > 0.0031308 ? 1.055 * Math.pow(n, 1 / 2.4) - 0.055 : 12.92 * n; - } - function xyz2rgb(x, y, z) { - // Observer. = 2°, Illuminant = D65 - var r = correctGamma(x * 3.2406 + y * -1.5372 + z * -0.4986), g = correctGamma(x * -0.9689 + y * 1.8758 + z * 0.0415), b = correctGamma(x * 0.0557 + y * -0.2040 + z * 1.0570); - return { - r: arithmetic_1.inRange0to255Rounded(r * 255), - g: arithmetic_1.inRange0to255Rounded(g * 255), - b: arithmetic_1.inRange0to255Rounded(b * 255) - }; - } - exports.xyz2rgb = xyz2rgb; - - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - exports.AbstractDistanceCalculator = abstractDistanceCalculator_1.AbstractDistanceCalculator; - var cie94_1 = __webpack_require__(14); - exports.CIE94Textiles = cie94_1.CIE94Textiles; - exports.CIE94GraphicArts = cie94_1.CIE94GraphicArts; - var ciede2000_1 = __webpack_require__(15); - exports.CIEDE2000 = ciede2000_1.CIEDE2000; - var cmetric_1 = __webpack_require__(16); - exports.CMETRIC = cmetric_1.CMETRIC; - var euclidean_1 = __webpack_require__(17); - exports.AbstractEuclidean = euclidean_1.AbstractEuclidean; - exports.Euclidean = euclidean_1.Euclidean; - exports.EuclideanRgbQuantWOAlpha = euclidean_1.EuclideanRgbQuantWOAlpha; - exports.EuclideanRgbQuantWithAlpha = euclidean_1.EuclideanRgbQuantWithAlpha; - var manhattan_1 = __webpack_require__(18); - exports.AbstractManhattan = manhattan_1.AbstractManhattan; - exports.Manhattan = manhattan_1.Manhattan; - exports.ManhattanSRGB = manhattan_1.ManhattanSRGB; - exports.ManhattanNommyde = manhattan_1.ManhattanNommyde; - var pngQuant_1 = __webpack_require__(19); - exports.PNGQUANT = pngQuant_1.PNGQUANT; - - -/***/ }, -/* 13 */ -/***/ function(module, exports) { - - "use strict"; - var AbstractDistanceCalculator = (function () { - function AbstractDistanceCalculator() { - this._setDefaults(); - // set default maximal color component deltas (255 - 0 = 255) - this.setWhitePoint(255, 255, 255, 255); - } - AbstractDistanceCalculator.prototype.setWhitePoint = function (r, g, b, a) { - this._whitePoint = { - r: (r > 0) ? 255 / r : 0, - g: (g > 0) ? 255 / g : 0, - b: (b > 0) ? 255 / b : 0, - a: (a > 0) ? 255 / a : 0 - }; - this._maxDistance = this.calculateRaw(r, g, b, a, 0, 0, 0, 0); - }; - AbstractDistanceCalculator.prototype.calculateNormalized = function (colorA, colorB) { - return this.calculateRaw(colorA.r, colorA.g, colorA.b, colorA.a, colorB.r, colorB.g, colorB.b, colorB.a) / this._maxDistance; - }; - AbstractDistanceCalculator.prototype._setDefaults = function () { - }; - return AbstractDistanceCalculator; - }()); - exports.AbstractDistanceCalculator = AbstractDistanceCalculator; - - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * cie94.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var rgb2lab_1 = __webpack_require__(7); - var arithmetic_1 = __webpack_require__(6); - /** - * CIE94 method of delta-e - * http://en.wikipedia.org/wiki/Color_difference#CIE94 - */ - var AbstractCIE94 = (function (_super) { - __extends(AbstractCIE94, _super); - function AbstractCIE94() { - _super.apply(this, arguments); - } - AbstractCIE94.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var lab1 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r1 * this._whitePoint.r), arithmetic_1.inRange0to255(g1 * this._whitePoint.g), arithmetic_1.inRange0to255(b1 * this._whitePoint.b)), lab2 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r2 * this._whitePoint.r), arithmetic_1.inRange0to255(g2 * this._whitePoint.g), arithmetic_1.inRange0to255(b2 * this._whitePoint.b)); - var dL = lab1.L - lab2.L, dA = lab1.a - lab2.a, dB = lab1.b - lab2.b, c1 = Math.sqrt(lab1.a * lab1.a + lab1.b * lab1.b), c2 = Math.sqrt(lab2.a * lab2.a + lab2.b * lab2.b), dC = c1 - c2; - var deltaH = dA * dA + dB * dB - dC * dC; - deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH); - var dAlpha = (a2 - a1) * this._whitePoint.a * this._kA; - // TODO: add alpha channel support - return Math.sqrt(Math.pow(dL / this._Kl, 2) + - Math.pow(dC / (1.0 + this._K1 * c1), 2) + - Math.pow(deltaH / (1.0 + this._K2 * c1), 2) + - Math.pow(dAlpha, 2)); - }; - return AbstractCIE94; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.AbstractCIE94 = AbstractCIE94; - var CIE94Textiles = (function (_super) { - __extends(CIE94Textiles, _super); - function CIE94Textiles() { - _super.apply(this, arguments); - } - CIE94Textiles.prototype._setDefaults = function () { - this._Kl = 2.0; - this._K1 = 0.048; - this._K2 = 0.014; - this._kA = 0.25 * 50 / 255; - }; - return CIE94Textiles; - }(AbstractCIE94)); - exports.CIE94Textiles = CIE94Textiles; - var CIE94GraphicArts = (function (_super) { - __extends(CIE94GraphicArts, _super); - function CIE94GraphicArts() { - _super.apply(this, arguments); - } - CIE94GraphicArts.prototype._setDefaults = function () { - this._Kl = 1.0; - this._K1 = 0.045; - this._K2 = 0.015; - this._kA = 0.25 * 100 / 255; - }; - return CIE94GraphicArts; - }(AbstractCIE94)); - exports.CIE94GraphicArts = CIE94GraphicArts; - - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * ciede2000.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var rgb2lab_1 = __webpack_require__(7); - var arithmetic_1 = __webpack_require__(6); - /** - * CIEDE2000 algorithm - Adapted from Sharma et al's MATLAB implementation at - * http://www.ece.rochester.edu/~gsharma/ciede2000/ - */ - var CIEDE2000 = (function (_super) { - __extends(CIEDE2000, _super); - function CIEDE2000() { - _super.apply(this, arguments); - } - CIEDE2000.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var lab1 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r1 * this._whitePoint.r), arithmetic_1.inRange0to255(g1 * this._whitePoint.g), arithmetic_1.inRange0to255(b1 * this._whitePoint.b)), lab2 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r2 * this._whitePoint.r), arithmetic_1.inRange0to255(g2 * this._whitePoint.g), arithmetic_1.inRange0to255(b2 * this._whitePoint.b)), dA = (a2 - a1) * this._whitePoint.a * CIEDE2000._kA, dE2 = this.calculateRawInLab(lab1, lab2); - return Math.sqrt(dE2 + dA * dA); - }; - CIEDE2000.prototype.calculateRawInLab = function (Lab1, Lab2) { - // Get L,a,b values for color 1 - var L1 = Lab1.L, a1 = Lab1.a, b1 = Lab1.b; - // Get L,a,b values for color 2 - var L2 = Lab2.L, a2 = Lab2.a, b2 = Lab2.b; - // Calculate Cprime1, Cprime2, Cabbar - var C1 = Math.sqrt(a1 * a1 + b1 * b1), C2 = Math.sqrt(a2 * a2 + b2 * b2), pow_a_C1_C2_to_7 = Math.pow((C1 + C2) / 2.0, 7.0), G = 0.5 * (1.0 - Math.sqrt(pow_a_C1_C2_to_7 / (pow_a_C1_C2_to_7 + CIEDE2000._pow25to7))), //25^7 - a1p = (1.0 + G) * a1, a2p = (1.0 + G) * a2, C1p = Math.sqrt(a1p * a1p + b1 * b1), C2p = Math.sqrt(a2p * a2p + b2 * b2), C1pC2p = C1p * C2p, - // Angles in Degree. - h1p = CIEDE2000._calculatehp(b1, a1p), h2p = CIEDE2000._calculatehp(b2, a2p), h_bar = Math.abs(h1p - h2p), dLp = L2 - L1, dCp = C2p - C1p, dHp = CIEDE2000._calculate_dHp(C1pC2p, h_bar, h2p, h1p), ahp = CIEDE2000._calculate_ahp(C1pC2p, h_bar, h1p, h2p), T = CIEDE2000._calculateT(ahp), aCp = (C1p + C2p) / 2.0, aLp_minus_50_square = Math.pow((L1 + L2) / 2.0 - 50.0, 2.0), S_L = 1.0 + (.015 * aLp_minus_50_square) / Math.sqrt(20.0 + aLp_minus_50_square), S_C = 1.0 + .045 * aCp, S_H = 1.0 + .015 * T * aCp, R_T = CIEDE2000._calculateRT(ahp, aCp), dLpSL = dLp / S_L, // S_L * kL, where kL is 1.0 - dCpSC = dCp / S_C, // S_C * kC, where kC is 1.0 - dHpSH = dHp / S_H; // S_H * kH, where kH is 1.0 - return Math.pow(dLpSL, 2) + Math.pow(dCpSC, 2) + Math.pow(dHpSH, 2) + R_T * dCpSC * dHpSH; - }; - CIEDE2000._calculatehp = function (b, ap) { - var hp = Math.atan2(b, ap); - if (hp >= 0) - return hp; - return hp + CIEDE2000._deg360InRad; - }; - CIEDE2000._calculateRT = function (ahp, aCp) { - var aCp_to_7 = Math.pow(aCp, 7.0), R_C = 2.0 * Math.sqrt(aCp_to_7 / (aCp_to_7 + CIEDE2000._pow25to7)), // 25^7 - delta_theta = CIEDE2000._deg30InRad * Math.exp(-Math.pow((ahp - CIEDE2000._deg275InRad) / CIEDE2000._deg25InRad, 2.0)); - return -Math.sin(2.0 * delta_theta) * R_C; - }; - CIEDE2000._calculateT = function (ahp) { - return 1.0 - .17 * Math.cos(ahp - CIEDE2000._deg30InRad) + .24 * Math.cos(ahp * 2.0) + .32 * Math.cos(ahp * 3.0 + CIEDE2000._deg6InRad) - .2 * Math.cos(ahp * 4.0 - CIEDE2000._deg63InRad); - }; - CIEDE2000._calculate_ahp = function (C1pC2p, h_bar, h1p, h2p) { - var hpSum = h1p + h2p; - if (C1pC2p == 0) - return hpSum; - if (h_bar <= CIEDE2000._deg180InRad) - return hpSum / 2.0; - if (hpSum < CIEDE2000._deg360InRad) - return (hpSum + CIEDE2000._deg360InRad) / 2.0; - return (hpSum - CIEDE2000._deg360InRad) / 2.0; - }; - CIEDE2000._calculate_dHp = function (C1pC2p, h_bar, h2p, h1p) { - var dhp; - if (C1pC2p == 0) { - dhp = 0; - } - else if (h_bar <= CIEDE2000._deg180InRad) { - dhp = h2p - h1p; - } - else if (h2p <= h1p) { - dhp = h2p - h1p + CIEDE2000._deg360InRad; - } - else { - dhp = h2p - h1p - CIEDE2000._deg360InRad; - } - return 2.0 * Math.sqrt(C1pC2p) * Math.sin(dhp / 2.0); - }; - /** - * Weight in distance: 0.25 - * Max DeltaE: 100 - * Max DeltaA: 255 - */ - CIEDE2000._kA = 0.25 * 100 / 255; - CIEDE2000._pow25to7 = Math.pow(25, 7); - CIEDE2000._deg360InRad = arithmetic_1.degrees2radians(360); - CIEDE2000._deg180InRad = arithmetic_1.degrees2radians(180); - CIEDE2000._deg30InRad = arithmetic_1.degrees2radians(30); - CIEDE2000._deg6InRad = arithmetic_1.degrees2radians(6); - CIEDE2000._deg63InRad = arithmetic_1.degrees2radians(63); - CIEDE2000._deg275InRad = arithmetic_1.degrees2radians(275); - CIEDE2000._deg25InRad = arithmetic_1.degrees2radians(25); - return CIEDE2000; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.CIEDE2000 = CIEDE2000; - - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * cmetric.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - /** - * TODO: Name it: http://www.compuphase.com/cmetric.htm - */ - var CMETRIC = (function (_super) { - __extends(CMETRIC, _super); - function CMETRIC() { - _super.apply(this, arguments); - } - CMETRIC.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var rmean = (r1 + r2) / 2 * this._whitePoint.r, r = (r1 - r2) * this._whitePoint.r, g = (g1 - g2) * this._whitePoint.g, b = (b1 - b2) * this._whitePoint.b, dE = ((((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8)), dA = (a2 - a1) * this._whitePoint.a; - return Math.sqrt(dE + dA * dA); - }; - return CMETRIC; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.CMETRIC = CMETRIC; - - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * euclidean.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var bt709_1 = __webpack_require__(2); - /** - * Euclidean color distance - */ - var AbstractEuclidean = (function (_super) { - __extends(AbstractEuclidean, _super); - function AbstractEuclidean() { - _super.apply(this, arguments); - } - AbstractEuclidean.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var dR = r2 - r1, dG = g2 - g1, dB = b2 - b1, dA = a2 - a1; - return Math.sqrt(this._kR * dR * dR + this._kG * dG * dG + this._kB * dB * dB + this._kA * dA * dA); - }; - return AbstractEuclidean; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.AbstractEuclidean = AbstractEuclidean; - var Euclidean = (function (_super) { - __extends(Euclidean, _super); - function Euclidean() { - _super.apply(this, arguments); - } - Euclidean.prototype._setDefaults = function () { - this._kR = 1; - this._kG = 1; - this._kB = 1; - this._kA = 1; - }; - return Euclidean; - }(AbstractEuclidean)); - exports.Euclidean = Euclidean; - /** - * Euclidean color distance (RgbQuant modification w Alpha) - */ - var EuclideanRgbQuantWithAlpha = (function (_super) { - __extends(EuclideanRgbQuantWithAlpha, _super); - function EuclideanRgbQuantWithAlpha() { - _super.apply(this, arguments); - } - EuclideanRgbQuantWithAlpha.prototype._setDefaults = function () { - this._kR = bt709_1.Y.RED; - this._kG = bt709_1.Y.GREEN; - this._kB = bt709_1.Y.BLUE; - // TODO: what is the best coefficient below? - this._kA = 1; - }; - return EuclideanRgbQuantWithAlpha; - }(AbstractEuclidean)); - exports.EuclideanRgbQuantWithAlpha = EuclideanRgbQuantWithAlpha; - /** - * Euclidean color distance (RgbQuant modification w/o Alpha) - */ - var EuclideanRgbQuantWOAlpha = (function (_super) { - __extends(EuclideanRgbQuantWOAlpha, _super); - function EuclideanRgbQuantWOAlpha() { - _super.apply(this, arguments); - } - EuclideanRgbQuantWOAlpha.prototype._setDefaults = function () { - this._kR = bt709_1.Y.RED; - this._kG = bt709_1.Y.GREEN; - this._kB = bt709_1.Y.BLUE; - this._kA = 0; - }; - return EuclideanRgbQuantWOAlpha; - }(AbstractEuclidean)); - exports.EuclideanRgbQuantWOAlpha = EuclideanRgbQuantWOAlpha; - - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * manhattanNeuQuant.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var bt709_1 = __webpack_require__(2); - /** - * Manhattan distance (NeuQuant modification) - w/o sRGB coefficients - */ - var AbstractManhattan = (function (_super) { - __extends(AbstractManhattan, _super); - function AbstractManhattan() { - _super.apply(this, arguments); - } - AbstractManhattan.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var dR = r2 - r1, dG = g2 - g1, dB = b2 - b1, dA = a2 - a1; - if (dR < 0) - dR = 0 - dR; - if (dG < 0) - dG = 0 - dG; - if (dB < 0) - dB = 0 - dB; - if (dA < 0) - dA = 0 - dA; - return this._kR * dR + this._kG * dG + this._kB * dB + this._kA * dA; - }; - return AbstractManhattan; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.AbstractManhattan = AbstractManhattan; - var Manhattan = (function (_super) { - __extends(Manhattan, _super); - function Manhattan() { - _super.apply(this, arguments); - } - Manhattan.prototype._setDefaults = function () { - this._kR = 1; - this._kG = 1; - this._kB = 1; - this._kA = 1; - }; - return Manhattan; - }(AbstractManhattan)); - exports.Manhattan = Manhattan; - /** - * Manhattan distance (Nommyde modification) - * https://github.com/igor-bezkrovny/image-quantization/issues/4#issuecomment-235155320 - */ - var ManhattanNommyde = (function (_super) { - __extends(ManhattanNommyde, _super); - function ManhattanNommyde() { - _super.apply(this, arguments); - } - ManhattanNommyde.prototype._setDefaults = function () { - this._kR = 0.4984; - this._kG = 0.8625; - this._kB = 0.2979; - // TODO: what is the best coefficient below? - this._kA = 1; - }; - return ManhattanNommyde; - }(AbstractManhattan)); - exports.ManhattanNommyde = ManhattanNommyde; - /** - * Manhattan distance (sRGB coefficients) - */ - var ManhattanSRGB = (function (_super) { - __extends(ManhattanSRGB, _super); - function ManhattanSRGB() { - _super.apply(this, arguments); - } - ManhattanSRGB.prototype._setDefaults = function () { - this._kR = bt709_1.Y.RED; - this._kG = bt709_1.Y.GREEN; - this._kB = bt709_1.Y.BLUE; - // TODO: what is the best coefficient below? - this._kA = 1; - }; - return ManhattanSRGB; - }(AbstractManhattan)); - exports.ManhattanSRGB = ManhattanSRGB; - - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * pngQuant.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - /** - * TODO: check quality of this distance equation - * TODO: ask author for usage rights - * taken from: - * {@link http://stackoverflow.com/questions/4754506/color-similarity-distance-in-rgba-color-space/8796867#8796867} - * {@link https://github.com/pornel/pngquant/blob/cc39b47799a7ff2ef17b529f9415ff6e6b213b8f/lib/pam.h#L148} - */ - var PNGQUANT = (function (_super) { - __extends(PNGQUANT, _super); - function PNGQUANT() { - _super.apply(this, arguments); - } - /** - * Author's comments - * px_b.rgb = px.rgb + 0*(1-px.a) // blend px on black - * px_b.a = px.a + 1*(1-px.a) - * px_w.rgb = px.rgb + 1*(1-px.a) // blend px on white - * px_w.a = px.a + 1*(1-px.a) - - * px_b.rgb = px.rgb // difference same as in opaque RGB - * px_b.a = 1 - * px_w.rgb = px.rgb - px.a // difference simplifies to formula below - * px_w.a = 1 - - * (px.rgb - px.a) - (py.rgb - py.a) - * (px.rgb - py.rgb) + (py.a - px.a) - * - */ - PNGQUANT.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var alphas = (a2 - a1) * this._whitePoint.a; - return this._colordifference_ch(r1 * this._whitePoint.r, r2 * this._whitePoint.r, alphas) + - this._colordifference_ch(g1 * this._whitePoint.g, g2 * this._whitePoint.g, alphas) + - this._colordifference_ch(b1 * this._whitePoint.b, b2 * this._whitePoint.b, alphas); - }; - PNGQUANT.prototype._colordifference_ch = function (x, y, alphas) { - // maximum of channel blended on white, and blended on black - // premultiplied alpha and backgrounds 0/1 shorten the formula - var black = x - y, white = black + alphas; - return black * black + white * white; - }; - return PNGQUANT; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.PNGQUANT = PNGQUANT; - - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var neuquant_1 = __webpack_require__(21); - exports.NeuQuant = neuquant_1.NeuQuant; - var neuquantFloat_1 = __webpack_require__(25); - exports.NeuQuantFloat = neuquantFloat_1.NeuQuantFloat; - var rgbquant_1 = __webpack_require__(26); - exports.RGBQuant = rgbquant_1.RGBQuant; - var colorHistogram_1 = __webpack_require__(27); - exports.ColorHistogram = colorHistogram_1.ColorHistogram; - var wuQuant_1 = __webpack_require__(29); - exports.WuQuant = wuQuant_1.WuQuant; - exports.WuColorCube = wuQuant_1.WuColorCube; - - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * NeuQuant Neural-Net Quantization Algorithm - * ------------------------------------------ - * - * Copyright (c) 1994 Anthony Dekker - * - * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See - * "Kohonen neural networks for optimal colour quantization" in "Network: - * Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of - * the algorithm. - * - * Any party obtaining a copy of these files from the author, directly or - * indirectly, is granted, free of charge, a full and unrestricted irrevocable, - * world-wide, paid up, royalty-free, nonexclusive right and license to deal in - * this software and documentation files (the "Software"), including without - * limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons who - * receive copies from any such party to do so, with the only requirement being - * that this copyright notice remain intact. - */ - "use strict"; - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * neuquant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - // bias for colour values - var networkBiasShift = 3; - var Neuron = (function () { - function Neuron(defaultValue) { - this.r = this.g = this.b = this.a = defaultValue; - } - /** - * There is a fix in original NEUQUANT by Anthony Dekker (http://members.ozemail.com.au/~dekker/NEUQUANT.HTML) - * @example - * r = Math.min(255, (neuron.r + (1 << (networkBiasShift - 1))) >> networkBiasShift); - */ - Neuron.prototype.toPoint = function () { - return point_1.Point.createByRGBA(this.r >> networkBiasShift, this.g >> networkBiasShift, this.b >> networkBiasShift, this.a >> networkBiasShift); - }; - Neuron.prototype.subtract = function (r, g, b, a) { - this.r -= r | 0; - this.g -= g | 0; - this.b -= b | 0; - this.a -= a | 0; - }; - return Neuron; - }()); - var NeuQuant = (function () { - function NeuQuant(colorDistanceCalculator, colors) { - if (colors === void 0) { colors = 256; } - this._distance = colorDistanceCalculator; - this._pointArray = []; - this._sampleFactor = 1; - this._networkSize = colors; - this._distance.setWhitePoint(255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift); - } - NeuQuant.prototype.sample = function (pointBuffer) { - this._pointArray = this._pointArray.concat(pointBuffer.getPointArray()); - }; - NeuQuant.prototype.quantize = function () { - this._init(); - this._learn(); - return this._buildPalette(); - }; - NeuQuant.prototype._init = function () { - this._freq = []; - this._bias = []; - this._radPower = []; - this._network = []; - for (var i = 0; i < this._networkSize; i++) { - this._network[i] = new Neuron((i << (networkBiasShift + 8)) / this._networkSize | 0); - // 1/this._networkSize - this._freq[i] = NeuQuant._initialBias / this._networkSize | 0; - this._bias[i] = 0; - } - }; - /** - * Main Learning Loop - */ - NeuQuant.prototype._learn = function () { - var sampleFactor = this._sampleFactor; - var pointsNumber = this._pointArray.length; - if (pointsNumber < NeuQuant._minpicturebytes) - sampleFactor = 1; - var alphadec = 30 + (sampleFactor - 1) / 3 | 0, pointsToSample = pointsNumber / sampleFactor | 0; - var delta = pointsToSample / NeuQuant._nCycles | 0, alpha = NeuQuant._initAlpha, radius = (this._networkSize >> 3) * NeuQuant._radiusBias; - var rad = radius >> NeuQuant._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var i = 0; i < rad; i++) { - this._radPower[i] = alpha * (((rad * rad - i * i) * NeuQuant._radBias) / (rad * rad)) >>> 0; - } - var step; - if (pointsNumber < NeuQuant._minpicturebytes) { - step = 1; - } - else if (pointsNumber % NeuQuant._prime1 != 0) { - step = NeuQuant._prime1; - } - else if ((pointsNumber % NeuQuant._prime2) != 0) { - step = NeuQuant._prime2; - } - else if ((pointsNumber % NeuQuant._prime3) != 0) { - step = NeuQuant._prime3; - } - else { - step = NeuQuant._prime4; - } - for (var i = 0, pointIndex = 0; i < pointsToSample;) { - var point = this._pointArray[pointIndex], b = point.b << networkBiasShift, g = point.g << networkBiasShift, r = point.r << networkBiasShift, a = point.a << networkBiasShift, neuronIndex = this._contest(b, g, r, a); - this._alterSingle(alpha, neuronIndex, b, g, r, a); - if (rad !== 0) - this._alterNeighbour(rad, neuronIndex, b, g, r, a); - /* alter neighbours */ - pointIndex += step; - if (pointIndex >= pointsNumber) - pointIndex -= pointsNumber; - i++; - if (delta === 0) - delta = 1; - if (i % delta === 0) { - alpha -= (alpha / alphadec) | 0; - radius -= (radius / NeuQuant._radiusDecrease) | 0; - rad = radius >> NeuQuant._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var j = 0; j < rad; j++) - this._radPower[j] = alpha * (((rad * rad - j * j) * NeuQuant._radBias) / (rad * rad)) >>> 0; - } - } - }; - NeuQuant.prototype._buildPalette = function () { - var palette = new palette_1.Palette(); - this._network.forEach(function (neuron) { - palette.add(neuron.toPoint()); - }); - palette.sort(); - return palette; - }; - /** - * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|] - */ - NeuQuant.prototype._alterNeighbour = function (rad, i, b, g, r, al) { - var lo = i - rad; - if (lo < -1) - lo = -1; - var hi = i + rad; - if (hi > this._networkSize) - hi = this._networkSize; - var j = i + 1, k = i - 1, m = 1; - while (j < hi || k > lo) { - var a = this._radPower[m++] / NeuQuant._alphaRadBias; - if (j < hi) { - var p = this._network[j++]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - if (k > lo) { - var p = this._network[k--]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - } - }; - /** - * Move neuron i towards biased (b,g,r) by factor alpha - */ - NeuQuant.prototype._alterSingle = function (alpha, i, b, g, r, a) { - alpha /= NeuQuant._initAlpha; - /* alter hit neuron */ - var n = this._network[i]; - n.subtract(alpha * (n.r - r), alpha * (n.g - g), alpha * (n.b - b), alpha * (n.a - a)); - }; - /** - * Search for biased BGR values - * description: - * finds closest neuron (min dist) and updates freq - * finds best neuron (min dist-bias) and returns position - * for frequently chosen neurons, freq[i] is high and bias[i] is negative - * bias[i] = _gamma*((1/this._networkSize)-freq[i]) - * - * Original distance equation: - * dist = abs(dR) + abs(dG) + abs(dB) - */ - NeuQuant.prototype._contest = function (b, g, r, a) { - var multiplier = (255 * 4) << networkBiasShift; - var bestd = ~(1 << 31), bestbiasd = bestd, bestpos = -1, bestbiaspos = bestpos; - for (var i = 0; i < this._networkSize; i++) { - var n = this._network[i], dist = this._distance.calculateNormalized(n, { r: r, g: g, b: b, a: a }) * multiplier | 0; - if (dist < bestd) { - bestd = dist; - bestpos = i; - } - var biasdist = dist - ((this._bias[i]) >> (NeuQuant._initialBiasShift - networkBiasShift)); - if (biasdist < bestbiasd) { - bestbiasd = biasdist; - bestbiaspos = i; - } - var betafreq = (this._freq[i] >> NeuQuant._betaShift); - this._freq[i] -= betafreq; - this._bias[i] += (betafreq << NeuQuant._gammaShift); - } - this._freq[bestpos] += NeuQuant._beta; - this._bias[bestpos] -= NeuQuant._betaGamma; - return bestbiaspos; - }; - /* - four primes near 500 - assume no image has a length so large - that it is divisible by all four primes - */ - NeuQuant._prime1 = 499; - NeuQuant._prime2 = 491; - NeuQuant._prime3 = 487; - NeuQuant._prime4 = 503; - NeuQuant._minpicturebytes = NeuQuant._prime4; - // no. of learning cycles - NeuQuant._nCycles = 100; - // defs for freq and bias - NeuQuant._initialBiasShift = 16; - // bias for fractions - NeuQuant._initialBias = (1 << NeuQuant._initialBiasShift); - NeuQuant._gammaShift = 10; - // gamma = 1024 - // TODO: why gamma is never used? - //private static _gamma : number = (1 << NeuQuant._gammaShift); - NeuQuant._betaShift = 10; - NeuQuant._beta = (NeuQuant._initialBias >> NeuQuant._betaShift); - // beta = 1/1024 - NeuQuant._betaGamma = (NeuQuant._initialBias << (NeuQuant._gammaShift - NeuQuant._betaShift)); - /* - * for 256 cols, radius starts - */ - NeuQuant._radiusBiasShift = 6; - // at 32.0 biased by 6 bits - NeuQuant._radiusBias = 1 << NeuQuant._radiusBiasShift; - // and decreases by a factor of 1/30 each cycle - NeuQuant._radiusDecrease = 30; - /* defs for decreasing alpha factor */ - // alpha starts at 1.0 - NeuQuant._alphaBiasShift = 10; - // biased by 10 bits - NeuQuant._initAlpha = (1 << NeuQuant._alphaBiasShift); - /* radBias and alphaRadBias used for radpower calculation */ - NeuQuant._radBiasShift = 8; - NeuQuant._radBias = 1 << NeuQuant._radBiasShift; - NeuQuant._alphaRadBiasShift = NeuQuant._alphaBiasShift + NeuQuant._radBiasShift; - NeuQuant._alphaRadBias = 1 << NeuQuant._alphaRadBiasShift; - return NeuQuant; - }()); - exports.NeuQuant = NeuQuant; - - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * palette.ts - part of Image Quantization Library - */ - "use strict"; - var pointContainer_1 = __webpack_require__(23); - var rgb2hsl_1 = __webpack_require__(5); - // TODO: make paletteArray via pointBuffer, so, export will be available via pointBuffer.exportXXX - var hueGroups = 10; - function hueGroup(hue, segmentsNumber) { - var maxHue = 360, seg = maxHue / segmentsNumber, half = seg / 2; - for (var i = 1, mid = seg - half; i < segmentsNumber; i++, mid += seg) { - if (hue >= mid && hue < mid + seg) - return i; - } - return 0; - } - exports.hueGroup = hueGroup; - var Palette = (function () { - function Palette() { - this._pointArray = []; - this._i32idx = {}; - this._pointContainer = new pointContainer_1.PointContainer(); - this._pointContainer.setHeight(1); - this._pointArray = this._pointContainer.getPointArray(); - } - Palette.prototype.add = function (color) { - this._pointArray.push(color); - this._pointContainer.setWidth(this._pointArray.length); - }; - Palette.prototype.has = function (color) { - for (var i = this._pointArray.length - 1; i >= 0; i--) { - if (color.uint32 === this._pointArray[i].uint32) - return true; - } - return false; - }; - // TOTRY: use HUSL - http://boronine.com/husl/ http://www.husl-colors.org/ https://github.com/husl-colors/husl - Palette.prototype.getNearestColor = function (colorDistanceCalculator, color) { - return this._pointArray[this.getNearestIndex(colorDistanceCalculator, color) | 0]; - }; - Palette.prototype.getPointContainer = function () { - return this._pointContainer; - }; - // TOTRY: use HUSL - http://boronine.com/husl/ - /* - public nearestIndexByUint32(i32) { - var idx : number = this._nearestPointFromCache("" + i32); - if (idx >= 0) return idx; - - var min = 1000, - rgb = [ - (i32 & 0xff), - (i32 >>> 8) & 0xff, - (i32 >>> 16) & 0xff, - (i32 >>> 24) & 0xff - ], - len = this._pointArray.length; - - idx = 0; - for (var i = 0; i < len; i++) { - var dist = Utils.distEuclidean(rgb, this._pointArray[i].rgba); - - if (dist < min) { - min = dist; - idx = i; - } - } - - this._i32idx[i32] = idx; - return idx; - } - */ - Palette.prototype._nearestPointFromCache = function (key) { - return typeof this._i32idx[key] === "number" ? this._i32idx[key] : -1; - }; - Palette.prototype.getNearestIndex = function (colorDistanceCalculator, point) { - var idx = this._nearestPointFromCache("" + point.uint32); - if (idx >= 0) - return idx; - var minimalDistance = Number.MAX_VALUE; - idx = 0; - for (var i = 0, l = this._pointArray.length; i < l; i++) { - var p = this._pointArray[i], distance = colorDistanceCalculator.calculateRaw(point.r, point.g, point.b, point.a, p.r, p.g, p.b, p.a); - if (distance < minimalDistance) { - minimalDistance = distance; - idx = i; - } - } - this._i32idx[point.uint32] = idx; - return idx; - }; - /* - public reduce(histogram : ColorHistogram, colors : number) { - if (this._pointArray.length > colors) { - var idxi32 = histogram.getImportanceSortedColorsIDXI32(); - - // quantize histogram to existing palette - var keep = [], uniqueColors = 0, idx, pruned = false; - - for (var i = 0, len = idxi32.length; i < len; i++) { - // palette length reached, unset all remaining colors (sparse palette) - if (uniqueColors >= colors) { - this.prunePal(keep); - pruned = true; - break; - } else { - idx = this.nearestIndexByUint32(idxi32[i]); - if (keep.indexOf(idx) < 0) { - keep.push(idx); - uniqueColors++; - } - } - } - - if (!pruned) { - this.prunePal(keep); - } - } - } - - // TODO: check usage, not tested! - public prunePal(keep : number[]) { - var colors = this._pointArray.length; - for (var colorIndex = colors - 1; colorIndex >= 0; colorIndex--) { - if (keep.indexOf(colorIndex) < 0) { - - if(colorIndex + 1 < colors) { - this._pointArray[ colorIndex ] = this._pointArray [ colors - 1 ]; - } - --colors; - //this._pointArray[colorIndex] = null; - } - } - console.log("colors pruned: " + (this._pointArray.length - colors)); - this._pointArray.length = colors; - this._i32idx = {}; - } - */ - // TODO: group very low lum and very high lum colors - // TODO: pass custom sort order - // TODO: sort criteria function should be placed to HueStats class - Palette.prototype.sort = function () { - this._i32idx = {}; - this._pointArray.sort(function (a, b) { - var hslA = rgb2hsl_1.rgb2hsl(a.r, a.g, a.b), hslB = rgb2hsl_1.rgb2hsl(b.r, b.g, b.b); - // sort all grays + whites together - var hueA = (a.r === a.g && a.g === a.b) ? 0 : 1 + hueGroup(hslA.h, hueGroups), hueB = (b.r === b.g && b.g === b.b) ? 0 : 1 + hueGroup(hslB.h, hueGroups); - /* - var hueA = (a.r === a.g && a.g === a.b) ? 0 : 1 + Utils.hueGroup(hslA.h, hueGroups); - var hueB = (b.r === b.g && b.g === b.b) ? 0 : 1 + Utils.hueGroup(hslB.h, hueGroups); - */ - var hueDiff = hueB - hueA; - if (hueDiff) - return -hueDiff; - /* - var lumDiff = Utils.lumGroup(+hslB.l.toFixed(2)) - Utils.lumGroup(+hslA.l.toFixed(2)); - if (lumDiff) return -lumDiff; - */ - var lA = a.getLuminosity(true), lB = b.getLuminosity(true); - if (lB - lA !== 0) - return lB - lA; - var satDiff = ((hslB.s * 100) | 0) - ((hslA.s * 100) | 0); - if (satDiff) - return -satDiff; - return 0; - }); - }; - return Palette; - }()); - exports.Palette = Palette; - - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * pointContainer.ts - part of Image Quantization Library - */ - var point_1 = __webpack_require__(24); - /** - * v8 optimizations done. - * fromXXX methods are static to move out polymorphic code from class instance itself. - */ - var PointContainer = (function () { - function PointContainer() { - this._width = 0; - this._height = 0; - this._pointArray = []; - } - PointContainer.prototype.getWidth = function () { - return this._width; - }; - PointContainer.prototype.getHeight = function () { - return this._height; - }; - PointContainer.prototype.setWidth = function (width) { - this._width = width; - }; - PointContainer.prototype.setHeight = function (height) { - this._height = height; - }; - PointContainer.prototype.getPointArray = function () { - return this._pointArray; - }; - PointContainer.prototype.clone = function () { - var clone = new PointContainer(); - clone._width = this._width; - clone._height = this._height; - for (var i = 0, l = this._pointArray.length; i < l; i++) { - clone._pointArray[i] = point_1.Point.createByUint32(this._pointArray[i].uint32 | 0); // "| 0" is added for v8 optimization - } - return clone; - }; - PointContainer.prototype.toUint32Array = function () { - var l = this._pointArray.length, uint32Array = new Uint32Array(l); - for (var i = 0; i < l; i++) { - uint32Array[i] = this._pointArray[i].uint32; - } - return uint32Array; - }; - PointContainer.prototype.toUint8Array = function () { - return new Uint8Array(this.toUint32Array().buffer); - }; - PointContainer.fromHTMLImageElement = function (img) { - var width = img.naturalWidth, height = img.naturalHeight; - var canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - var ctx = canvas.getContext("2d"); - ctx.drawImage(img, 0, 0, width, height, 0, 0, width, height); - return PointContainer.fromHTMLCanvasElement(canvas); - }; - PointContainer.fromHTMLCanvasElement = function (canvas) { - var width = canvas.width, height = canvas.height; - var ctx = canvas.getContext("2d"), imgData = ctx.getImageData(0, 0, width, height); - return PointContainer.fromImageData(imgData); - }; - PointContainer.fromNodeCanvas = function (canvas) { - return PointContainer.fromHTMLCanvasElement(canvas); - }; - PointContainer.fromImageData = function (imageData) { - var width = imageData.width, height = imageData.height; - return PointContainer.fromCanvasPixelArray(imageData.data, width, height); - /* - var buf8; - if (Utils.typeOf(imageData.data) == "CanvasPixelArray") - buf8 = new Uint8Array(imageData.data); - else - buf8 = imageData.data; - - this.fromUint32Array(new Uint32Array(buf8.buffer), width, height); - */ - }; - PointContainer.fromArray = function (byteArray, width, height) { - var uint8array = new Uint8Array(byteArray); - return PointContainer.fromUint8Array(uint8array, width, height); - }; - PointContainer.fromCanvasPixelArray = function (data, width, height) { - return PointContainer.fromArray(data, width, height); - }; - PointContainer.fromUint8Array = function (uint8array, width, height) { - return PointContainer.fromUint32Array(new Uint32Array(uint8array.buffer), width, height); - }; - PointContainer.fromUint32Array = function (uint32array, width, height) { - var container = new PointContainer(); - container._width = width; - container._height = height; - for (var i = 0, l = uint32array.length; i < l; i++) { - container._pointArray[i] = point_1.Point.createByUint32(uint32array[i] | 0); // "| 0" is added for v8 optimization - } - return container; - }; - return PointContainer; - }()); - exports.PointContainer = PointContainer; - - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * point.ts - part of Image Quantization Library - */ - var bt709_1 = __webpack_require__(2); - /** - * v8 optimized class - * 1) "constructor" should have initialization with worst types - * 2) "set" should have |0 / >>> 0 - */ - var Point = (function () { - function Point() { - this.uint32 = -1 >>> 0; - this.r = this.g = this.b = this.a = 0; - this.rgba = new Array(4); - /*[ this.r , this.g , this.b , this.a ]*/ - this.rgba[0] = 0; - this.rgba[1] = 0; - this.rgba[2] = 0; - this.rgba[3] = 0; - /* - this.Lab = { - L : 0.0, - a : 0.0, - b : 0.0 - }; - */ - } - Point.createByQuadruplet = function (quadruplet) { - var point = new Point(); - point.r = quadruplet[0] | 0; - point.g = quadruplet[1] | 0; - point.b = quadruplet[2] | 0; - point.a = quadruplet[3] | 0; - point._loadUINT32(); - point._loadQuadruplet(); - //point._loadLab(); - return point; - }; - Point.createByRGBA = function (red, green, blue, alpha) { - var point = new Point(); - point.r = red | 0; - point.g = green | 0; - point.b = blue | 0; - point.a = alpha | 0; - point._loadUINT32(); - point._loadQuadruplet(); - //point._loadLab(); - return point; - }; - Point.createByUint32 = function (uint32) { - var point = new Point(); - point.uint32 = uint32 >>> 0; - point._loadRGBA(); - point._loadQuadruplet(); - //point._loadLab(); - return point; - }; - Point.prototype.from = function (point) { - this.r = point.r; - this.g = point.g; - this.b = point.b; - this.a = point.a; - this.uint32 = point.uint32; - this.rgba[0] = point.r; - this.rgba[1] = point.g; - this.rgba[2] = point.b; - this.rgba[3] = point.a; - /* - this.Lab.L = point.Lab.L; - this.Lab.a = point.Lab.a; - this.Lab.b = point.Lab.b; - */ - }; - /* - * TODO: - Luminance from RGB: - - Luminance (standard for certain colour spaces): (0.2126*R + 0.7152*G + 0.0722*B) [1] - Luminance (perceived option 1): (0.299*R + 0.587*G + 0.114*B) [2] - Luminance (perceived option 2, slower to calculate): sqrt( 0.241*R^2 + 0.691*G^2 + 0.068*B^2 ) ? sqrt( 0.299*R^2 + 0.587*G^2 + 0.114*B^2 ) (thanks to @MatthewHerbst) [http://alienryderflex.com/hsp.html] - */ - Point.prototype.getLuminosity = function (useAlphaChannel) { - var r = this.r, g = this.g, b = this.b; - if (useAlphaChannel) { - r = Math.min(255, 255 - this.a + this.a * r / 255); - g = Math.min(255, 255 - this.a + this.a * g / 255); - b = Math.min(255, 255 - this.a + this.a * b / 255); - } - //var luma = this.r * Point._RED_COEFFICIENT + this.g * Point._GREEN_COEFFICIENT + this.b * Point._BLUE_COEFFICIENT; - /* - if(useAlphaChannel) { - luma = (luma * (255 - this.a)) / 255; - } - */ - return r * bt709_1.Y.RED + g * bt709_1.Y.GREEN + b * bt709_1.Y.BLUE; - }; - Point.prototype._loadUINT32 = function () { - this.uint32 = (this.a << 24 | this.b << 16 | this.g << 8 | this.r) >>> 0; - }; - Point.prototype._loadRGBA = function () { - this.r = this.uint32 & 0xff; - this.g = (this.uint32 >>> 8) & 0xff; - this.b = (this.uint32 >>> 16) & 0xff; - this.a = (this.uint32 >>> 24) & 0xff; - }; - Point.prototype._loadQuadruplet = function () { - this.rgba[0] = this.r; - this.rgba[1] = this.g; - this.rgba[2] = this.b; - this.rgba[3] = this.a; - /* - var xyz = rgb2xyz(this.r, this.g, this.b); - var lab = xyz2lab(xyz.x, xyz.y, xyz.z); - this.lab.l = lab.l; - this.lab.a = lab.a; - this.lab.b = lab.b; - */ - }; - return Point; - }()); - exports.Point = Point; - - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /* - * NeuQuantFloat Neural-Net Quantization Algorithm - * ------------------------------------------ - * - * Copyright (c) 1994 Anthony Dekker - * - * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See - * "Kohonen neural networks for optimal colour quantization" in "Network: - * Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of - * the algorithm. - * - * Any party obtaining a copy of these files from the author, directly or - * indirectly, is granted, free of charge, a full and unrestricted irrevocable, - * world-wide, paid up, royalty-free, nonexclusive right and license to deal in - * this software and documentation files (the "Software"), including without - * limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons who - * receive copies from any such party to do so, with the only requirement being - * that this copyright notice remain intact. - */ - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * neuquant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - // bias for colour values - var networkBiasShift = 3; - var NeuronFloat = (function () { - function NeuronFloat(defaultValue) { - this.r = this.g = this.b = this.a = defaultValue; - } - /** - * There is a fix in original NEUQUANT by Anthony Dekker (http://members.ozemail.com.au/~dekker/NEUQUANT.HTML) - * @example - * r = Math.min(255, (neuron.r + (1 << (networkBiasShift - 1))) >> networkBiasShift); - */ - NeuronFloat.prototype.toPoint = function () { - return point_1.Point.createByRGBA(this.r >> networkBiasShift, this.g >> networkBiasShift, this.b >> networkBiasShift, this.a >> networkBiasShift); - }; - NeuronFloat.prototype.subtract = function (r, g, b, a) { - this.r -= r; - this.g -= g; - this.b -= b; - this.a -= a; - }; - return NeuronFloat; - }()); - var NeuQuantFloat = (function () { - function NeuQuantFloat(colorDistanceCalculator, colors) { - if (colors === void 0) { colors = 256; } - this._distance = colorDistanceCalculator; - this._pointArray = []; - this._sampleFactor = 1; - this._networkSize = colors; - this._distance.setWhitePoint(255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift); - } - NeuQuantFloat.prototype.sample = function (pointBuffer) { - this._pointArray = this._pointArray.concat(pointBuffer.getPointArray()); - }; - NeuQuantFloat.prototype.quantize = function () { - this._init(); - this._learn(); - return this._buildPalette(); - }; - NeuQuantFloat.prototype._init = function () { - this._freq = []; - this._bias = []; - this._radPower = []; - this._network = []; - for (var i = 0; i < this._networkSize; i++) { - this._network[i] = new NeuronFloat((i << (networkBiasShift + 8)) / this._networkSize); - // 1/this._networkSize - this._freq[i] = NeuQuantFloat._initialBias / this._networkSize; - this._bias[i] = 0; - } - }; - /** - * Main Learning Loop - */ - NeuQuantFloat.prototype._learn = function () { - var sampleFactor = this._sampleFactor; - var pointsNumber = this._pointArray.length; - if (pointsNumber < NeuQuantFloat._minpicturebytes) - sampleFactor = 1; - var alphadec = 30 + (sampleFactor - 1) / 3, pointsToSample = pointsNumber / sampleFactor; - var delta = pointsToSample / NeuQuantFloat._nCycles | 0, alpha = NeuQuantFloat._initAlpha, radius = (this._networkSize >> 3) * NeuQuantFloat._radiusBias; - var rad = radius >> NeuQuantFloat._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var i = 0; i < rad; i++) { - this._radPower[i] = alpha * (((rad * rad - i * i) * NeuQuantFloat._radBias) / (rad * rad)); - } - var step; - if (pointsNumber < NeuQuantFloat._minpicturebytes) { - step = 1; - } - else if (pointsNumber % NeuQuantFloat._prime1 != 0) { - step = NeuQuantFloat._prime1; - } - else if ((pointsNumber % NeuQuantFloat._prime2) != 0) { - step = NeuQuantFloat._prime2; - } - else if ((pointsNumber % NeuQuantFloat._prime3) != 0) { - step = NeuQuantFloat._prime3; - } - else { - step = NeuQuantFloat._prime4; - } - for (var i = 0, pointIndex = 0; i < pointsToSample;) { - var point = this._pointArray[pointIndex], b = point.b << networkBiasShift, g = point.g << networkBiasShift, r = point.r << networkBiasShift, a = point.a << networkBiasShift, neuronIndex = this._contest(b, g, r, a); - this._alterSingle(alpha, neuronIndex, b, g, r, a); - if (rad != 0) - this._alterNeighbour(rad, neuronIndex, b, g, r, a); - /* alter neighbours */ - pointIndex += step; - if (pointIndex >= pointsNumber) - pointIndex -= pointsNumber; - i++; - if (delta == 0) - delta = 1; - if (i % delta == 0) { - alpha -= (alpha / alphadec); - radius -= (radius / NeuQuantFloat._radiusDecrease); - rad = radius >> NeuQuantFloat._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var j = 0; j < rad; j++) - this._radPower[j] = alpha * (((rad * rad - j * j) * NeuQuantFloat._radBias) / (rad * rad)); - } - } - }; - NeuQuantFloat.prototype._buildPalette = function () { - var palette = new palette_1.Palette(); - this._network.forEach(function (neuron) { - palette.add(neuron.toPoint()); - }); - palette.sort(); - return palette; - }; - /** - * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|] - */ - NeuQuantFloat.prototype._alterNeighbour = function (rad, i, b, g, r, al) { - var lo = i - rad; - if (lo < -1) - lo = -1; - var hi = i + rad; - if (hi > this._networkSize) - hi = this._networkSize; - var j = i + 1, k = i - 1, m = 1; - while (j < hi || k > lo) { - var a = this._radPower[m++] / NeuQuantFloat._alphaRadBias; - if (j < hi) { - var p = this._network[j++]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - if (k > lo) { - var p = this._network[k--]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - } - }; - /** - * Move neuron i towards biased (b,g,r) by factor alpha - */ - NeuQuantFloat.prototype._alterSingle = function (alpha, i, b, g, r, a) { - alpha /= NeuQuantFloat._initAlpha; - /* alter hit neuron */ - var n = this._network[i]; - n.subtract(alpha * (n.r - r), alpha * (n.g - g), alpha * (n.b - b), alpha * (n.a - a)); - }; - /** - * Search for biased BGR values - * description: - * finds closest neuron (min dist) and updates freq - * finds best neuron (min dist-bias) and returns position - * for frequently chosen neurons, freq[i] is high and bias[i] is negative - * bias[i] = _gamma*((1/this._networkSize)-freq[i]) - * - * Original distance equation: - * dist = abs(dR) + abs(dG) + abs(dB) - */ - NeuQuantFloat.prototype._contest = function (b, g, r, al) { - var multiplier = (255 * 4) << networkBiasShift; - var bestd = ~(1 << 31), bestbiasd = bestd, bestpos = -1, bestbiaspos = bestpos; - for (var i = 0; i < this._networkSize; i++) { - var n = this._network[i], dist = this._distance.calculateNormalized(n, { r: r, g: g, b: b, a: al }) * multiplier; - if (dist < bestd) { - bestd = dist; - bestpos = i; - } - var biasdist = dist - ((this._bias[i]) >> (NeuQuantFloat._initialBiasShift - networkBiasShift)); - if (biasdist < bestbiasd) { - bestbiasd = biasdist; - bestbiaspos = i; - } - var betafreq = (this._freq[i] >> NeuQuantFloat._betaShift); - this._freq[i] -= betafreq; - this._bias[i] += (betafreq << NeuQuantFloat._gammaShift); - } - this._freq[bestpos] += NeuQuantFloat._beta; - this._bias[bestpos] -= NeuQuantFloat._betaGamma; - return bestbiaspos; - }; - /* - four primes near 500 - assume no image has a length so large - that it is divisible by all four primes - */ - NeuQuantFloat._prime1 = 499; - NeuQuantFloat._prime2 = 491; - NeuQuantFloat._prime3 = 487; - NeuQuantFloat._prime4 = 503; - NeuQuantFloat._minpicturebytes = NeuQuantFloat._prime4; - // no. of learning cycles - NeuQuantFloat._nCycles = 100; - // defs for freq and bias - NeuQuantFloat._initialBiasShift = 16; - // bias for fractions - NeuQuantFloat._initialBias = (1 << NeuQuantFloat._initialBiasShift); - NeuQuantFloat._gammaShift = 10; - // gamma = 1024 - // TODO: why gamma is never used? - //private static _gamma : number = (1 << NeuQuantFloat._gammaShift); - NeuQuantFloat._betaShift = 10; - NeuQuantFloat._beta = (NeuQuantFloat._initialBias >> NeuQuantFloat._betaShift); - // beta = 1/1024 - NeuQuantFloat._betaGamma = (NeuQuantFloat._initialBias << (NeuQuantFloat._gammaShift - NeuQuantFloat._betaShift)); - /* - * for 256 cols, radius starts - */ - NeuQuantFloat._radiusBiasShift = 6; - // at 32.0 biased by 6 bits - NeuQuantFloat._radiusBias = 1 << NeuQuantFloat._radiusBiasShift; - // and decreases by a factor of 1/30 each cycle - NeuQuantFloat._radiusDecrease = 30; - /* defs for decreasing alpha factor */ - // alpha starts at 1.0 - NeuQuantFloat._alphaBiasShift = 10; - // biased by 10 bits - NeuQuantFloat._initAlpha = (1 << NeuQuantFloat._alphaBiasShift); - /* radBias and alphaRadBias used for radpower calculation */ - NeuQuantFloat._radBiasShift = 8; - NeuQuantFloat._radBias = 1 << NeuQuantFloat._radBiasShift; - NeuQuantFloat._alphaRadBiasShift = NeuQuantFloat._alphaBiasShift + NeuQuantFloat._radBiasShift; - NeuQuantFloat._alphaRadBias = 1 << NeuQuantFloat._alphaRadBiasShift; - return NeuQuantFloat; - }()); - exports.NeuQuantFloat = NeuQuantFloat; - - -/***/ }, -/* 26 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * Copyright (c) 2015, Leon Sorokin - * All rights reserved. (MIT Licensed) - * - * RgbQuant.js - an image quantization lib - */ - "use strict"; - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgbquant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - var colorHistogram_1 = __webpack_require__(27); - var arithmetic_1 = __webpack_require__(6); - var RemovedColor = (function () { - function RemovedColor(index, color, distance) { - this.index = index; - this.color = color; - this.distance = distance; - } - return RemovedColor; - }()); - // TODO: make input/output image and input/output palettes with instances of class Point only! - var RGBQuant = (function () { - function RGBQuant(colorDistanceCalculator, colors, method) { - if (colors === void 0) { colors = 256; } - if (method === void 0) { method = 2; } - this._distance = colorDistanceCalculator; - // desired final palette size - this._colors = colors; - // histogram to accumulate - this._histogram = new colorHistogram_1.ColorHistogram(method, colors); - this._initialDistance = 0.01; - this._distanceIncrement = 0.005; - } - // gathers histogram info - RGBQuant.prototype.sample = function (image) { - /* - var pointArray = image.getPointArray(), max = [0, 0, 0, 0], min = [255, 255, 255, 255]; - - for (var i = 0, l = pointArray.length; i < l; i++) { - var color = pointArray[i]; - for (var componentIndex = 0; componentIndex < 4; componentIndex++) { - if (max[componentIndex] < color.rgba[componentIndex]) max[componentIndex] = color.rgba[componentIndex]; - if (min[componentIndex] > color.rgba[componentIndex]) min[componentIndex] = color.rgba[componentIndex]; - } - } - var rd = max[0] - min[0], gd = max[1] - min[1], bd = max[2] - min[2], ad = max[3] - min[3]; - this._distance.setWhitePoint(rd, gd, bd, ad); - - this._initialDistance = (Math.sqrt(rd * rd + gd * gd + bd * bd + ad * ad) / Math.sqrt(255 * 255 + 255 * 255 + 255 * 255)) * 0.01; - */ - this._histogram.sample(image); - }; - // reduces histogram to palette, remaps & memoizes reduced colors - RGBQuant.prototype.quantize = function () { - var idxi32 = this._histogram.getImportanceSortedColorsIDXI32(); - if (idxi32.length === 0) { - throw new Error("No colors in image"); - } - var palette = this._buildPalette(idxi32); - palette.sort(); - return palette; - }; - // reduces similar colors from an importance-sorted Uint32 rgba array - RGBQuant.prototype._buildPalette = function (idxi32) { - // reduce histogram to create initial palette - // build full rgb palette - var palette = new palette_1.Palette(), colorArray = palette.getPointContainer().getPointArray(), usageArray = new Array(idxi32.length); - for (var i = 0; i < idxi32.length; i++) { - colorArray.push(point_1.Point.createByUint32(idxi32[i])); - usageArray[i] = 1; - } - var len = colorArray.length, memDist = []; - var palLen = len, thold = this._initialDistance; - // palette already at or below desired length - while (palLen > this._colors) { - memDist.length = 0; - // iterate palette - for (var i = 0; i < len; i++) { - if (usageArray[i] === 0) - continue; - var pxi = colorArray[i]; - //if (!pxi) continue; - for (var j = i + 1; j < len; j++) { - if (usageArray[j] === 0) - continue; - var pxj = colorArray[j]; - //if (!pxj) continue; - var dist = this._distance.calculateNormalized(pxi, pxj); - if (dist < thold) { - // store index,rgb,dist - memDist.push(new RemovedColor(j, pxj, dist)); - usageArray[j] = 0; - palLen--; - } - } - } - // palette reduction pass - // console.log("palette length: " + palLen); - // if palette is still much larger than target, increment by larger initDist - thold += (palLen > this._colors * 3) ? this._initialDistance : this._distanceIncrement; - } - // if palette is over-reduced, re-add removed colors with largest distances from last round - if (palLen < this._colors) { - // sort descending - arithmetic_1.stableSort(memDist, function (a, b) { - return b.distance - a.distance; - }); - var k = 0; - while (palLen < this._colors && k < memDist.length) { - var removedColor = memDist[k]; - // re-inject rgb into final palette - usageArray[removedColor.index] = 1; - palLen++; - k++; - } - } - var colors = colorArray.length; - for (var colorIndex = colors - 1; colorIndex >= 0; colorIndex--) { - if (usageArray[colorIndex] === 0) { - if (colorIndex !== colors - 1) { - colorArray[colorIndex] = colorArray[colors - 1]; - } - --colors; - } - } - colorArray.length = colors; - return palette; - }; - return RGBQuant; - }()); - exports.RGBQuant = RGBQuant; - - -/***/ }, -/* 27 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * Copyright (c) 2015, Leon Sorokin - * All rights reserved. (MIT Licensed) - * - * ColorHistogram.js - an image quantization lib - */ - "use strict"; - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * colorHistogram.ts - part of Image Quantization Library - */ - var hueStatistics_1 = __webpack_require__(28); - var arithmetic_1 = __webpack_require__(6); - var ColorHistogram = (function () { - function ColorHistogram(method, colors) { - // 1 = by global population, 2 = subregion population threshold - this._method = method; - // if > 0, enables hues stats and min-color retention per group - this._minHueCols = colors << 2; //opts.minHueCols || 0; - // # of highest-frequency colors to start with for palette reduction - this._initColors = colors << 2; - // HueStatistics instance - this._hueStats = new hueStatistics_1.HueStatistics(ColorHistogram._hueGroups, this._minHueCols); - this._histogram = Object.create(null); - } - ColorHistogram.prototype.sample = function (pointBuffer) { - switch (this._method) { - case 1: - this._colorStats1D(pointBuffer); - break; - case 2: - this._colorStats2D(pointBuffer); - break; - } - }; - ColorHistogram.prototype.getImportanceSortedColorsIDXI32 = function () { - var _this = this; - // TODO: fix typing issue in stableSort func - var sorted = arithmetic_1.stableSort(Object.keys(this._histogram), function (a, b) { return _this._histogram[b] - _this._histogram[a]; }); - if (sorted.length === 0) { - return []; - } - var idxi32; - switch (this._method) { - case 1: - var initialColorsLimit = Math.min(sorted.length, this._initColors), last = sorted[initialColorsLimit - 1], freq = this._histogram[last]; - idxi32 = sorted.slice(0, initialColorsLimit); - // add any cut off colors with same freq as last - var pos = initialColorsLimit, len = sorted.length; - while (pos < len && this._histogram[sorted[pos]] == freq) - idxi32.push(sorted[pos++]); - // inject min huegroup colors - this._hueStats.injectIntoArray(idxi32); - break; - case 2: - idxi32 = sorted; - break; - default: - // TODO: rethink errors - throw new Error("Incorrect method"); - } - // int32-ify values - return idxi32.map(function (v) { - return +v; - }); - }; - // global top-population - ColorHistogram.prototype._colorStats1D = function (pointBuffer) { - var histG = this._histogram, pointArray = pointBuffer.getPointArray(), len = pointArray.length; - for (var i = 0; i < len; i++) { - var col = pointArray[i].uint32; - // collect hue stats - this._hueStats.check(col); - if (col in histG) - histG[col]++; - else - histG[col] = 1; - } - }; - // population threshold within subregions - // FIXME: this can over-reduce (few/no colors same?), need a way to keep - // important colors that dont ever reach local thresholds (gradients?) - ColorHistogram.prototype._colorStats2D = function (pointBuffer) { - var _this = this; - var width = pointBuffer.getWidth(), height = pointBuffer.getHeight(), pointArray = pointBuffer.getPointArray(); - var boxW = ColorHistogram._boxSize[0], boxH = ColorHistogram._boxSize[1], area = boxW * boxH, boxes = this._makeBoxes(width, height, boxW, boxH), histG = this._histogram; - boxes.forEach(function (box) { - var effc = Math.round((box.w * box.h) / area) * ColorHistogram._boxPixels; - if (effc < 2) - effc = 2; - var histL = {}; - _this._iterateBox(box, width, function (i) { - var col = pointArray[i].uint32; - // collect hue stats - _this._hueStats.check(col); - if (col in histG) - histG[col]++; - else if (col in histL) { - if (++histL[col] >= effc) - histG[col] = histL[col]; - } - else - histL[col] = 1; - }); - }); - // inject min huegroup colors - this._hueStats.injectIntoDictionary(histG); - }; - // iterates @bbox within a parent rect of width @wid; calls @fn, passing index within parent - ColorHistogram.prototype._iterateBox = function (bbox, wid, fn) { - var b = bbox, i0 = b.y * wid + b.x, i1 = (b.y + b.h - 1) * wid + (b.x + b.w - 1), incr = wid - b.w + 1; - var cnt = 0, i = i0; - do { - fn.call(this, i); - i += (++cnt % b.w == 0) ? incr : 1; - } while (i <= i1); - }; - /** - * partitions a rectangle of width x height into - * array of boxes stepX x stepY (or less) - */ - ColorHistogram.prototype._makeBoxes = function (width, height, stepX, stepY) { - var wrem = width % stepX, hrem = height % stepY, xend = width - wrem, yend = height - hrem, boxesArray = []; - for (var y = 0; y < height; y += stepY) - for (var x = 0; x < width; x += stepX) - boxesArray.push({ x: x, y: y, w: (x == xend ? wrem : stepX), h: (y == yend ? hrem : stepY) }); - return boxesArray; - }; - ColorHistogram._boxSize = [64, 64]; - ColorHistogram._boxPixels = 2; - ColorHistogram._hueGroups = 10; - return ColorHistogram; - }()); - exports.ColorHistogram = ColorHistogram; - - -/***/ }, -/* 28 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * hueStatistics.ts - part of Image Quantization Library - */ - var rgb2hsl_1 = __webpack_require__(5); - var palette_1 = __webpack_require__(22); - var HueGroup = (function () { - function HueGroup() { - this.num = 0; - this.cols = []; - } - return HueGroup; - }()); - var HueStatistics = (function () { - function HueStatistics(numGroups, minCols) { - this._numGroups = numGroups; - this._minCols = minCols; - this._stats = []; - for (var i = 0; i <= numGroups; i++) { - this._stats[i] = new HueGroup(); - } - this._groupsFull = 0; - } - HueStatistics.prototype.check = function (i32) { - if (this._groupsFull == this._numGroups + 1) { - this.check = function () { - }; - } - var r = (i32 & 0xff), g = (i32 >>> 8) & 0xff, b = (i32 >>> 16) & 0xff, hg = (r == g && g == b) ? 0 : 1 + palette_1.hueGroup(rgb2hsl_1.rgb2hsl(r, g, b).h, this._numGroups), gr = this._stats[hg], min = this._minCols; - gr.num++; - if (gr.num > min) - return; - if (gr.num == min) - this._groupsFull++; - if (gr.num <= min) - this._stats[hg].cols.push(i32); - }; - HueStatistics.prototype.injectIntoDictionary = function (histG) { - for (var i = 0; i <= this._numGroups; i++) { - if (this._stats[i].num <= this._minCols) { - this._stats[i].cols.forEach(function (col) { - if (!histG[col]) - histG[col] = 1; - else - histG[col]++; - }); - } - } - }; - HueStatistics.prototype.injectIntoArray = function (histG) { - for (var i = 0; i <= this._numGroups; i++) { - if (this._stats[i].num <= this._minCols) { - this._stats[i].cols.forEach(function (col) { - if (histG.indexOf(col) == -1) - histG.push(col); - }); - } - } - }; - return HueStatistics; - }()); - exports.HueStatistics = HueStatistics; - - -/***/ }, -/* 29 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * wuQuant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - function createArray1D(dimension1) { - var a = []; - for (var k = 0; k < dimension1; k++) { - a[k] = 0; - } - return a; - } - function createArray4D(dimension1, dimension2, dimension3, dimension4) { - var a = new Array(dimension1); - for (var i = 0; i < dimension1; i++) { - a[i] = new Array(dimension2); - for (var j = 0; j < dimension2; j++) { - a[i][j] = new Array(dimension3); - for (var k = 0; k < dimension3; k++) { - a[i][j][k] = new Array(dimension4); - for (var l = 0; l < dimension4; l++) { - a[i][j][k][l] = 0; - } - } - } - } - return a; - } - function createArray3D(dimension1, dimension2, dimension3) { - var a = new Array(dimension1); - for (var i = 0; i < dimension1; i++) { - a[i] = new Array(dimension2); - for (var j = 0; j < dimension2; j++) { - a[i][j] = new Array(dimension3); - for (var k = 0; k < dimension3; k++) { - a[i][j][k] = 0; - } - } - } - return a; - } - function fillArray3D(a, dimension1, dimension2, dimension3, value) { - for (var i = 0; i < dimension1; i++) { - a[i] = []; - for (var j = 0; j < dimension2; j++) { - a[i][j] = []; - for (var k = 0; k < dimension3; k++) { - a[i][j][k] = value; - } - } - } - } - function fillArray1D(a, dimension1, value) { - for (var i = 0; i < dimension1; i++) { - a[i] = value; - } - } - var WuColorCube = (function () { - function WuColorCube() { - } - return WuColorCube; - }()); - exports.WuColorCube = WuColorCube; - var WuQuant = (function () { - function WuQuant(colorDistanceCalculator, colors, significantBitsPerChannel) { - if (colors === void 0) { colors = 256; } - if (significantBitsPerChannel === void 0) { significantBitsPerChannel = 5; } - this._distance = colorDistanceCalculator; - this._setQuality(significantBitsPerChannel); - this._initialize(colors); - } - WuQuant.prototype.sample = function (image) { - var pointArray = image.getPointArray(); - for (var i = 0, l = pointArray.length; i < l; i++) { - this._addColor(pointArray[i]); - } - this._pixels = this._pixels.concat(pointArray); - }; - WuQuant.prototype.quantize = function () { - this._preparePalette(); - var palette = new palette_1.Palette(); - // generates palette - for (var paletteIndex = 0; paletteIndex < this._colors; paletteIndex++) { - if (this._sums[paletteIndex] > 0) { - var sum = this._sums[paletteIndex], r = this._reds[paletteIndex] / sum, g = this._greens[paletteIndex] / sum, b = this._blues[paletteIndex] / sum, a = this._alphas[paletteIndex] / sum; - var color = point_1.Point.createByRGBA(r | 0, g | 0, b | 0, a | 0); - palette.add(color); - } - } - palette.sort(); - return palette; - }; - WuQuant.prototype._preparePalette = function () { - // preprocess the colors - this._calculateMoments(); - var next = 0, volumeVariance = createArray1D(this._colors); - // processes the cubes - for (var cubeIndex = 1; cubeIndex < this._colors; ++cubeIndex) { - // if cut is possible; make it - if (this._cut(this._cubes[next], this._cubes[cubeIndex])) { - volumeVariance[next] = this._cubes[next].volume > 1 ? this._calculateVariance(this._cubes[next]) : 0.0; - volumeVariance[cubeIndex] = this._cubes[cubeIndex].volume > 1 ? this._calculateVariance(this._cubes[cubeIndex]) : 0.0; - } - else { - // the cut was not possible, revert the index - volumeVariance[next] = 0.0; - cubeIndex--; - } - next = 0; - var temp = volumeVariance[0]; - for (var index = 1; index <= cubeIndex; ++index) { - if (volumeVariance[index] > temp) { - temp = volumeVariance[index]; - next = index; - } - } - if (temp <= 0.0) { - this._colors = cubeIndex + 1; - break; - } - } - var lookupRed = [], lookupGreen = [], lookupBlue = [], lookupAlpha = []; - // precalculates lookup tables - for (var k = 0; k < this._colors; ++k) { - var weight = WuQuant._volume(this._cubes[k], this._weights); - if (weight > 0) { - lookupRed[k] = (WuQuant._volume(this._cubes[k], this._momentsRed) / weight) | 0; - lookupGreen[k] = (WuQuant._volume(this._cubes[k], this._momentsGreen) / weight) | 0; - lookupBlue[k] = (WuQuant._volume(this._cubes[k], this._momentsBlue) / weight) | 0; - lookupAlpha[k] = (WuQuant._volume(this._cubes[k], this._momentsAlpha) / weight) | 0; - } - else { - lookupRed[k] = 0; - lookupGreen[k] = 0; - lookupBlue[k] = 0; - lookupAlpha[k] = 0; - } - } - this._reds = createArray1D(this._colors + 1); - this._greens = createArray1D(this._colors + 1); - this._blues = createArray1D(this._colors + 1); - this._alphas = createArray1D(this._colors + 1); - this._sums = createArray1D(this._colors + 1); - // scans and adds colors - for (var index = 0, l = this._pixels.length; index < l; index++) { - var color = this._pixels[index]; - var match = -1; - var bestMatch = match, bestDistance = Number.MAX_VALUE; - for (var lookup = 0; lookup < this._colors; lookup++) { - var foundRed = lookupRed[lookup], foundGreen = lookupGreen[lookup], foundBlue = lookupBlue[lookup], foundAlpha = lookupAlpha[lookup]; - var distance = this._distance.calculateRaw(foundRed, foundGreen, foundBlue, foundAlpha, color.r, color.g, color.b, color.a); - //var distance = this._distance.calculateRaw(Utils.Point.createByRGBA(foundRed, foundGreen, foundBlue, foundAlpha), color); - //deltaRed = color.r - foundRed, - //deltaGreen = color.g - foundGreen, - //deltaBlue = color.b - foundBlue, - //deltaAlpha = color.a - foundAlpha, - //distance = deltaRed * deltaRed + deltaGreen * deltaGreen + deltaBlue * deltaBlue + deltaAlpha * deltaAlpha; - if (distance < bestDistance) { - bestDistance = distance; - bestMatch = lookup; - } - } - this._reds[bestMatch] += color.r; - this._greens[bestMatch] += color.g; - this._blues[bestMatch] += color.b; - this._alphas[bestMatch] += color.a; - this._sums[bestMatch]++; - } - }; - WuQuant.prototype._addColor = function (color) { - var bitsToRemove = 8 - this._significantBitsPerChannel, indexRed = (color.r >> bitsToRemove) + 1, indexGreen = (color.g >> bitsToRemove) + 1, indexBlue = (color.b >> bitsToRemove) + 1, indexAlpha = (color.a >> bitsToRemove) + 1; - //if(color.a > 10) { - this._weights[indexAlpha][indexRed][indexGreen][indexBlue]++; - this._momentsRed[indexAlpha][indexRed][indexGreen][indexBlue] += color.r; - this._momentsGreen[indexAlpha][indexRed][indexGreen][indexBlue] += color.g; - this._momentsBlue[indexAlpha][indexRed][indexGreen][indexBlue] += color.b; - this._momentsAlpha[indexAlpha][indexRed][indexGreen][indexBlue] += color.a; - this._moments[indexAlpha][indexRed][indexGreen][indexBlue] += this._table[color.r] + this._table[color.g] + this._table[color.b] + this._table[color.a]; - // } - }; - /** - * Converts the histogram to a series of _moments. - */ - WuQuant.prototype._calculateMoments = function () { - var area = [], areaRed = [], areaGreen = [], areaBlue = [], areaAlpha = [], area2 = []; - var xarea = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaRed = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaGreen = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaBlue = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaAlpha = createArray3D(this._sideSize, this._sideSize, this._sideSize), xarea2 = createArray3D(this._sideSize, this._sideSize, this._sideSize); - for (var alphaIndex = 1; alphaIndex <= this._alphaMaxSideIndex; ++alphaIndex) { - fillArray3D(xarea, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaRed, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaGreen, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaBlue, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaAlpha, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xarea2, this._sideSize, this._sideSize, this._sideSize, 0); - for (var redIndex = 1; redIndex <= this._maxSideIndex; ++redIndex) { - fillArray1D(area, this._sideSize, 0); - fillArray1D(areaRed, this._sideSize, 0); - fillArray1D(areaGreen, this._sideSize, 0); - fillArray1D(areaBlue, this._sideSize, 0); - fillArray1D(areaAlpha, this._sideSize, 0); - fillArray1D(area2, this._sideSize, 0); - for (var greenIndex = 1; greenIndex <= this._maxSideIndex; ++greenIndex) { - var line = 0, lineRed = 0, lineGreen = 0, lineBlue = 0, lineAlpha = 0, line2 = 0.0; - for (var blueIndex = 1; blueIndex <= this._maxSideIndex; ++blueIndex) { - line += this._weights[alphaIndex][redIndex][greenIndex][blueIndex]; - lineRed += this._momentsRed[alphaIndex][redIndex][greenIndex][blueIndex]; - lineGreen += this._momentsGreen[alphaIndex][redIndex][greenIndex][blueIndex]; - lineBlue += this._momentsBlue[alphaIndex][redIndex][greenIndex][blueIndex]; - lineAlpha += this._momentsAlpha[alphaIndex][redIndex][greenIndex][blueIndex]; - line2 += this._moments[alphaIndex][redIndex][greenIndex][blueIndex]; - area[blueIndex] += line; - areaRed[blueIndex] += lineRed; - areaGreen[blueIndex] += lineGreen; - areaBlue[blueIndex] += lineBlue; - areaAlpha[blueIndex] += lineAlpha; - area2[blueIndex] += line2; - xarea[redIndex][greenIndex][blueIndex] = xarea[redIndex - 1][greenIndex][blueIndex] + area[blueIndex]; - xareaRed[redIndex][greenIndex][blueIndex] = xareaRed[redIndex - 1][greenIndex][blueIndex] + areaRed[blueIndex]; - xareaGreen[redIndex][greenIndex][blueIndex] = xareaGreen[redIndex - 1][greenIndex][blueIndex] + areaGreen[blueIndex]; - xareaBlue[redIndex][greenIndex][blueIndex] = xareaBlue[redIndex - 1][greenIndex][blueIndex] + areaBlue[blueIndex]; - xareaAlpha[redIndex][greenIndex][blueIndex] = xareaAlpha[redIndex - 1][greenIndex][blueIndex] + areaAlpha[blueIndex]; - xarea2[redIndex][greenIndex][blueIndex] = xarea2[redIndex - 1][greenIndex][blueIndex] + area2[blueIndex]; - this._weights[alphaIndex][redIndex][greenIndex][blueIndex] = this._weights[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xarea[redIndex][greenIndex][blueIndex]; - this._momentsRed[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsRed[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaRed[redIndex][greenIndex][blueIndex]; - this._momentsGreen[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsGreen[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaGreen[redIndex][greenIndex][blueIndex]; - this._momentsBlue[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsBlue[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaBlue[redIndex][greenIndex][blueIndex]; - this._momentsAlpha[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsAlpha[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaAlpha[redIndex][greenIndex][blueIndex]; - this._moments[alphaIndex][redIndex][greenIndex][blueIndex] = this._moments[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xarea2[redIndex][greenIndex][blueIndex]; - } - } - } - } - }; - /** - * Computes the volume of the cube in a specific moment. - */ - WuQuant._volumeFloat = function (cube, moment) { - return (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - }; - /** - * Computes the volume of the cube in a specific moment. - */ - WuQuant._volume = function (cube, moment) { - return WuQuant._volumeFloat(cube, moment) | 0; - }; - /** - * Splits the cube in given position][and color direction. - */ - WuQuant._top = function (cube, direction, position, moment) { - var result; - switch (direction) { - case WuQuant.alpha: - result = (moment[position][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] - - moment[position][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - - moment[position][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + - moment[position][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (moment[position][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - - moment[position][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - - moment[position][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[position][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - break; - case WuQuant.red: - result = (moment[cube.alphaMaximum][position][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMaximum][position][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMinimum][position][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMinimum][position][cube.greenMinimum][cube.blueMaximum]) - - (moment[cube.alphaMaximum][position][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMaximum][position][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMinimum][position][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][position][cube.greenMinimum][cube.blueMinimum]); - break; - case WuQuant.green: - result = (moment[cube.alphaMaximum][cube.redMaximum][position][cube.blueMaximum] - - moment[cube.alphaMaximum][cube.redMinimum][position][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMaximum][position][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][position][cube.blueMaximum]) - - (moment[cube.alphaMaximum][cube.redMaximum][position][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMinimum][position][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMaximum][position][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][position][cube.blueMinimum]); - break; - case WuQuant.blue: - result = (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][position] - - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][position] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][position] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][position]) - - (moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][position] - - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][position] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][position] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][position]); - break; - default: - throw new Error("impossible"); - } - return result | 0; - }; - /** - * Splits the cube in a given color direction at its minimum. - */ - WuQuant._bottom = function (cube, direction, moment) { - switch (direction) { - case WuQuant.alpha: - return (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - case WuQuant.red: - return (-moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (-moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - case WuQuant.green: - return (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - case WuQuant.blue: - return (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]) - - (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - default: - // TODO: why here is return 0, and in this._top there is no default at all (now it is throw error)? - return 0; - } - }; - /** - * Calculates statistical variance for a given cube. - */ - WuQuant.prototype._calculateVariance = function (cube) { - var volumeRed = WuQuant._volume(cube, this._momentsRed), volumeGreen = WuQuant._volume(cube, this._momentsGreen), volumeBlue = WuQuant._volume(cube, this._momentsBlue), volumeAlpha = WuQuant._volume(cube, this._momentsAlpha), volumeMoment = WuQuant._volumeFloat(cube, this._moments), volumeWeight = WuQuant._volume(cube, this._weights), distance = volumeRed * volumeRed + volumeGreen * volumeGreen + volumeBlue * volumeBlue + volumeAlpha * volumeAlpha; - return volumeMoment - (distance / volumeWeight); - }; - /** - * Finds the optimal (maximal) position for the cut. - */ - WuQuant.prototype._maximize = function (cube, direction, first, last, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight) { - var bottomRed = WuQuant._bottom(cube, direction, this._momentsRed) | 0, bottomGreen = WuQuant._bottom(cube, direction, this._momentsGreen) | 0, bottomBlue = WuQuant._bottom(cube, direction, this._momentsBlue) | 0, bottomAlpha = WuQuant._bottom(cube, direction, this._momentsAlpha) | 0, bottomWeight = WuQuant._bottom(cube, direction, this._weights) | 0; - var result = 0.0, cutPosition = -1; - for (var position = first; position < last; ++position) { - // determines the cube cut at a certain position - var halfRed = bottomRed + WuQuant._top(cube, direction, position, this._momentsRed), halfGreen = bottomGreen + WuQuant._top(cube, direction, position, this._momentsGreen), halfBlue = bottomBlue + WuQuant._top(cube, direction, position, this._momentsBlue), halfAlpha = bottomAlpha + WuQuant._top(cube, direction, position, this._momentsAlpha), halfWeight = bottomWeight + WuQuant._top(cube, direction, position, this._weights); - // the cube cannot be cut at bottom (this would lead to empty cube) - if (halfWeight != 0) { - var halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue + halfAlpha * halfAlpha, temp = halfDistance / halfWeight; - halfRed = wholeRed - halfRed; - halfGreen = wholeGreen - halfGreen; - halfBlue = wholeBlue - halfBlue; - halfAlpha = wholeAlpha - halfAlpha; - halfWeight = wholeWeight - halfWeight; - if (halfWeight != 0) { - halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue + halfAlpha * halfAlpha; - temp += halfDistance / halfWeight; - if (temp > result) { - result = temp; - cutPosition = position; - } - } - } - } - return { max: result, position: cutPosition }; - }; - // Cuts a cube with another one. - WuQuant.prototype._cut = function (first, second) { - var direction; - var wholeRed = WuQuant._volume(first, this._momentsRed), wholeGreen = WuQuant._volume(first, this._momentsGreen), wholeBlue = WuQuant._volume(first, this._momentsBlue), wholeAlpha = WuQuant._volume(first, this._momentsAlpha), wholeWeight = WuQuant._volume(first, this._weights), red = this._maximize(first, WuQuant.red, first.redMinimum + 1, first.redMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight), green = this._maximize(first, WuQuant.green, first.greenMinimum + 1, first.greenMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight), blue = this._maximize(first, WuQuant.blue, first.blueMinimum + 1, first.blueMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight), alpha = this._maximize(first, WuQuant.alpha, first.alphaMinimum + 1, first.alphaMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight); - if (alpha.max >= red.max && alpha.max >= green.max && alpha.max >= blue.max) { - direction = WuQuant.alpha; - // cannot split empty cube - if (alpha.position < 0) - return false; - } - else { - if (red.max >= alpha.max && red.max >= green.max && red.max >= blue.max) { - direction = WuQuant.red; - } - else if (green.max >= alpha.max && green.max >= red.max && green.max >= blue.max) { - direction = WuQuant.green; - } - else { - direction = WuQuant.blue; - } - } - second.redMaximum = first.redMaximum; - second.greenMaximum = first.greenMaximum; - second.blueMaximum = first.blueMaximum; - second.alphaMaximum = first.alphaMaximum; - // cuts in a certain direction - switch (direction) { - case WuQuant.red: - second.redMinimum = first.redMaximum = red.position; - second.greenMinimum = first.greenMinimum; - second.blueMinimum = first.blueMinimum; - second.alphaMinimum = first.alphaMinimum; - break; - case WuQuant.green: - second.greenMinimum = first.greenMaximum = green.position; - second.redMinimum = first.redMinimum; - second.blueMinimum = first.blueMinimum; - second.alphaMinimum = first.alphaMinimum; - break; - case WuQuant.blue: - second.blueMinimum = first.blueMaximum = blue.position; - second.redMinimum = first.redMinimum; - second.greenMinimum = first.greenMinimum; - second.alphaMinimum = first.alphaMinimum; - break; - case WuQuant.alpha: - second.alphaMinimum = first.alphaMaximum = alpha.position; - second.blueMinimum = first.blueMinimum; - second.redMinimum = first.redMinimum; - second.greenMinimum = first.greenMinimum; - break; - } - // determines the volumes after cut - first.volume = (first.redMaximum - first.redMinimum) * (first.greenMaximum - first.greenMinimum) * (first.blueMaximum - first.blueMinimum) * (first.alphaMaximum - first.alphaMinimum); - second.volume = (second.redMaximum - second.redMinimum) * (second.greenMaximum - second.greenMinimum) * (second.blueMaximum - second.blueMinimum) * (second.alphaMaximum - second.alphaMinimum); - // the cut was successful - return true; - }; - WuQuant.prototype._initialize = function (colors) { - this._colors = colors; - // creates all the _cubes - this._cubes = []; - // initializes all the _cubes - for (var cubeIndex = 0; cubeIndex < colors; cubeIndex++) { - this._cubes[cubeIndex] = new WuColorCube(); - } - // resets the reference minimums - this._cubes[0].redMinimum = 0; - this._cubes[0].greenMinimum = 0; - this._cubes[0].blueMinimum = 0; - this._cubes[0].alphaMinimum = 0; - // resets the reference maximums - this._cubes[0].redMaximum = this._maxSideIndex; - this._cubes[0].greenMaximum = this._maxSideIndex; - this._cubes[0].blueMaximum = this._maxSideIndex; - this._cubes[0].alphaMaximum = this._alphaMaxSideIndex; - this._weights = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsRed = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsGreen = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsBlue = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsAlpha = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._moments = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._table = []; - for (var tableIndex = 0; tableIndex < 256; ++tableIndex) { - this._table[tableIndex] = tableIndex * tableIndex; - } - this._pixels = []; - }; - WuQuant.prototype._setQuality = function (significantBitsPerChannel) { - if (significantBitsPerChannel === void 0) { significantBitsPerChannel = 5; } - this._significantBitsPerChannel = significantBitsPerChannel; - this._maxSideIndex = 1 << this._significantBitsPerChannel; - this._alphaMaxSideIndex = this._maxSideIndex; - this._sideSize = this._maxSideIndex + 1; - this._alphaSideSize = this._alphaMaxSideIndex + 1; - }; - WuQuant.alpha = 3; - WuQuant.red = 2; - WuQuant.green = 1; - WuQuant.blue = 0; - return WuQuant; - }()); - exports.WuQuant = WuQuant; - - -/***/ }, -/* 30 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var nearestColor_1 = __webpack_require__(31); - exports.NearestColor = nearestColor_1.NearestColor; - var array_1 = __webpack_require__(32); - exports.ErrorDiffusionArray = array_1.ErrorDiffusionArray; - exports.ErrorDiffusionArrayKernel = array_1.ErrorDiffusionArrayKernel; - var riemersma_1 = __webpack_require__(33); - exports.ErrorDiffusionRiemersma = riemersma_1.ErrorDiffusionRiemersma; - - -/***/ }, -/* 31 */ -/***/ function(module, exports) { - - "use strict"; - var NearestColor = (function () { - function NearestColor(colorDistanceCalculator) { - this._distance = colorDistanceCalculator; - } - NearestColor.prototype.quantize = function (pointBuffer, palette) { - var pointArray = pointBuffer.getPointArray(), width = pointBuffer.getWidth(), height = pointBuffer.getHeight(); - for (var y = 0; y < height; y++) { - for (var x = 0, idx = y * width; x < width; x++, idx++) { - // Image pixel - var point = pointArray[idx]; - // Reduced pixel - point.from(palette.getNearestColor(this._distance, point)); - } - } - return pointBuffer; - }; - return NearestColor; - }()); - exports.NearestColor = NearestColor; - - -/***/ }, -/* 32 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var point_1 = __webpack_require__(24); - var arithmetic_1 = __webpack_require__(6); - // TODO: is it the best name for this enum "kernel"? - (function (ErrorDiffusionArrayKernel) { - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["FloydSteinberg"] = 0] = "FloydSteinberg"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["FalseFloydSteinberg"] = 1] = "FalseFloydSteinberg"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Stucki"] = 2] = "Stucki"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Atkinson"] = 3] = "Atkinson"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Jarvis"] = 4] = "Jarvis"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Burkes"] = 5] = "Burkes"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Sierra"] = 6] = "Sierra"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["TwoSierra"] = 7] = "TwoSierra"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["SierraLite"] = 8] = "SierraLite"; - })(exports.ErrorDiffusionArrayKernel || (exports.ErrorDiffusionArrayKernel = {})); - var ErrorDiffusionArrayKernel = exports.ErrorDiffusionArrayKernel; - // http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/ - var ErrorDiffusionArray = (function () { - function ErrorDiffusionArray(colorDistanceCalculator, kernel, serpentine, minimumColorDistanceToDither, calculateErrorLikeGIMP) { - if (serpentine === void 0) { serpentine = true; } - if (minimumColorDistanceToDither === void 0) { minimumColorDistanceToDither = 0; } - if (calculateErrorLikeGIMP === void 0) { calculateErrorLikeGIMP = false; } - this._setKernel(kernel); - this._distance = colorDistanceCalculator; - this._minColorDistance = minimumColorDistanceToDither; - this._serpentine = serpentine; - this._calculateErrorLikeGIMP = calculateErrorLikeGIMP; - } - // adapted from http://jsbin.com/iXofIji/2/edit by PAEz - // fixed version. it doesn't use image pixels as error storage, also it doesn't have 0.3 + 0.3 + 0.3 + 0.3 = 0 error - ErrorDiffusionArray.prototype.quantize = function (pointBuffer, palette) { - var pointArray = pointBuffer.getPointArray(), originalPoint = new point_1.Point(), width = pointBuffer.getWidth(), height = pointBuffer.getHeight(), errorLines = []; - var dir = 1, maxErrorLines = 1; - // initial error lines (number is taken from dithering kernel) - for (var i = 0; i < this._kernel.length; i++) { - var kernelErrorLines = this._kernel[i][2] + 1; - if (maxErrorLines < kernelErrorLines) - maxErrorLines = kernelErrorLines; - } - for (var i = 0; i < maxErrorLines; i++) { - this._fillErrorLine(errorLines[i] = [], width); - } - for (var y = 0; y < height; y++) { - // always serpentine - if (this._serpentine) - dir = dir * -1; - var lni = y * width, xStart = dir == 1 ? 0 : width - 1, xEnd = dir == 1 ? width : -1; - // cyclic shift with erasing - this._fillErrorLine(errorLines[0], width); - // TODO: why it is needed to cast types here? - errorLines.push(errorLines.shift()); - var errorLine = errorLines[0]; - for (var x = xStart, idx = lni + xStart; x !== xEnd; x += dir, idx += dir) { - // Image pixel - var point = pointArray[idx], - //originalPoint = new Utils.Point(), - error = errorLine[x]; - originalPoint.from(point); - var correctedPoint = point_1.Point.createByRGBA(arithmetic_1.inRange0to255Rounded(point.r + error[0]), arithmetic_1.inRange0to255Rounded(point.g + error[1]), arithmetic_1.inRange0to255Rounded(point.b + error[2]), arithmetic_1.inRange0to255Rounded(point.a + error[3])); - // Reduced pixel - var palettePoint = palette.getNearestColor(this._distance, correctedPoint); - point.from(palettePoint); - // dithering strength - if (this._minColorDistance) { - var dist = this._distance.calculateNormalized(point, palettePoint); - if (dist < this._minColorDistance) - continue; - } - // Component distance - var er = void 0, eg = void 0, eb = void 0, ea = void 0; - if (this._calculateErrorLikeGIMP) { - er = correctedPoint.r - palettePoint.r; - eg = correctedPoint.g - palettePoint.g; - eb = correctedPoint.b - palettePoint.b; - ea = correctedPoint.a - palettePoint.a; - } - else { - er = originalPoint.r - palettePoint.r; - eg = originalPoint.g - palettePoint.g; - eb = originalPoint.b - palettePoint.b; - ea = originalPoint.a - palettePoint.a; - } - var dStart = dir == 1 ? 0 : this._kernel.length - 1, dEnd = dir == 1 ? this._kernel.length : -1; - for (var i = dStart; i !== dEnd; i += dir) { - var x1 = this._kernel[i][1] * dir, y1 = this._kernel[i][2]; - if (x1 + x >= 0 && x1 + x < width && y1 + y >= 0 && y1 + y < height) { - var d = this._kernel[i][0], e = errorLines[y1][x1 + x]; - e[0] = e[0] + er * d; - e[1] = e[1] + eg * d; - e[2] = e[2] + eb * d; - e[3] = e[3] + ea * d; - } - } - } - } - return pointBuffer; - }; - ErrorDiffusionArray.prototype._fillErrorLine = function (errorLine, width) { - // shrink - if (errorLine.length > width) { - errorLine.length = width; - } - // reuse existing arrays - var l = errorLine.length; - for (var i = 0; i < l; i++) { - var error = errorLine[i]; - error[0] = error[1] = error[2] = error[3] = 0; - } - // create missing arrays - for (var i = l; i < width; i++) { - errorLine[i] = [0.0, 0.0, 0.0, 0.0]; - } - }; - ErrorDiffusionArray.prototype._setKernel = function (kernel) { - switch (kernel) { - case ErrorDiffusionArrayKernel.FloydSteinberg: - this._kernel = [ - [7 / 16, 1, 0], - [3 / 16, -1, 1], - [5 / 16, 0, 1], - [1 / 16, 1, 1] - ]; - break; - case ErrorDiffusionArrayKernel.FalseFloydSteinberg: - this._kernel = [ - [3 / 8, 1, 0], - [3 / 8, 0, 1], - [2 / 8, 1, 1] - ]; - break; - case ErrorDiffusionArrayKernel.Stucki: - this._kernel = [ - [8 / 42, 1, 0], - [4 / 42, 2, 0], - [2 / 42, -2, 1], - [4 / 42, -1, 1], - [8 / 42, 0, 1], - [4 / 42, 1, 1], - [2 / 42, 2, 1], - [1 / 42, -2, 2], - [2 / 42, -1, 2], - [4 / 42, 0, 2], - [2 / 42, 1, 2], - [1 / 42, 2, 2] - ]; - break; - case ErrorDiffusionArrayKernel.Atkinson: - this._kernel = [ - [1 / 8, 1, 0], - [1 / 8, 2, 0], - [1 / 8, -1, 1], - [1 / 8, 0, 1], - [1 / 8, 1, 1], - [1 / 8, 0, 2] - ]; - break; - case ErrorDiffusionArrayKernel.Jarvis: - this._kernel = [ - [7 / 48, 1, 0], - [5 / 48, 2, 0], - [3 / 48, -2, 1], - [5 / 48, -1, 1], - [7 / 48, 0, 1], - [5 / 48, 1, 1], - [3 / 48, 2, 1], - [1 / 48, -2, 2], - [3 / 48, -1, 2], - [5 / 48, 0, 2], - [3 / 48, 1, 2], - [1 / 48, 2, 2] - ]; - break; - case ErrorDiffusionArrayKernel.Burkes: - this._kernel = [ - [8 / 32, 1, 0], - [4 / 32, 2, 0], - [2 / 32, -2, 1], - [4 / 32, -1, 1], - [8 / 32, 0, 1], - [4 / 32, 1, 1], - [2 / 32, 2, 1], - ]; - break; - case ErrorDiffusionArrayKernel.Sierra: - this._kernel = [ - [5 / 32, 1, 0], - [3 / 32, 2, 0], - [2 / 32, -2, 1], - [4 / 32, -1, 1], - [5 / 32, 0, 1], - [4 / 32, 1, 1], - [2 / 32, 2, 1], - [2 / 32, -1, 2], - [3 / 32, 0, 2], - [2 / 32, 1, 2] - ]; - break; - case ErrorDiffusionArrayKernel.TwoSierra: - this._kernel = [ - [4 / 16, 1, 0], - [3 / 16, 2, 0], - [1 / 16, -2, 1], - [2 / 16, -1, 1], - [3 / 16, 0, 1], - [2 / 16, 1, 1], - [1 / 16, 2, 1] - ]; - break; - case ErrorDiffusionArrayKernel.SierraLite: - this._kernel = [ - [2 / 4, 1, 0], - [1 / 4, -1, 1], - [1 / 4, 0, 1] - ]; - break; - default: - throw new Error("ErrorDiffusionArray: unknown kernel = " + kernel); - } - }; - return ErrorDiffusionArray; - }()); - exports.ErrorDiffusionArray = ErrorDiffusionArray; - - -/***/ }, -/* 33 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var hilbertCurve_1 = __webpack_require__(34); - var point_1 = __webpack_require__(24); - var arithmetic_1 = __webpack_require__(6); - var ErrorDiffusionRiemersma = (function () { - function ErrorDiffusionRiemersma(colorDistanceCalculator, errorQueueSize, errorPropagation) { - if (errorQueueSize === void 0) { errorQueueSize = 16; } - if (errorPropagation === void 0) { errorPropagation = 1; } - this._distance = colorDistanceCalculator; - this._errorPropagation = errorPropagation; - this._errorQueueSize = errorQueueSize; - this._max = this._errorQueueSize; - this._createWeights(); - } - ErrorDiffusionRiemersma.prototype.quantize = function (pointBuffer, palette) { - var _this = this; - var curve = new hilbertCurve_1.HilbertCurveBase(), pointArray = pointBuffer.getPointArray(), width = pointBuffer.getWidth(), height = pointBuffer.getHeight(), errorQueue = []; - var head = 0; - for (var i = 0; i < this._errorQueueSize; i++) { - errorQueue[i] = { r: 0, g: 0, b: 0, a: 0 }; - } - curve.walk(width, height, function (x, y) { - var p = pointArray[x + y * width]; - var r = p.r, g = p.g, b = p.b, a = p.a; - for (var i = 0; i < _this._errorQueueSize; i++) { - var weight = _this._weights[i], e = errorQueue[(i + head) % _this._errorQueueSize]; - r += e.r * weight; - g += e.g * weight; - b += e.b * weight; - a += e.a * weight; - } - var correctedPoint = point_1.Point.createByRGBA(arithmetic_1.inRange0to255Rounded(r), arithmetic_1.inRange0to255Rounded(g), arithmetic_1.inRange0to255Rounded(b), arithmetic_1.inRange0to255Rounded(a)); - var quantizedPoint = palette.getNearestColor(_this._distance, correctedPoint); - // update head and calculate tail - head = (head + 1) % _this._errorQueueSize; - var tail = (head + _this._errorQueueSize - 1) % _this._errorQueueSize; - // update error with new value - errorQueue[tail].r = p.r - quantizedPoint.r; - errorQueue[tail].g = p.g - quantizedPoint.g; - errorQueue[tail].b = p.b - quantizedPoint.b; - errorQueue[tail].a = p.a - quantizedPoint.a; - // update point - p.from(quantizedPoint); - }); - return pointBuffer; - }; - ErrorDiffusionRiemersma.prototype._createWeights = function () { - this._weights = []; - var multiplier = Math.exp(Math.log(this._max) / (this._errorQueueSize - 1)); - for (var i = 0, next = 1; i < this._errorQueueSize; i++) { - this._weights[i] = (((next + 0.5) | 0) / this._max) * this._errorPropagation; - next *= multiplier; - } - }; - return ErrorDiffusionRiemersma; - }()); - exports.ErrorDiffusionRiemersma = ErrorDiffusionRiemersma; - - -/***/ }, -/* 34 */ -/***/ function(module, exports) { - - "use strict"; - var Direction; - (function (Direction) { - Direction[Direction["NONE"] = 0] = "NONE"; - Direction[Direction["UP"] = 1] = "UP"; - Direction[Direction["LEFT"] = 2] = "LEFT"; - Direction[Direction["RIGHT"] = 3] = "RIGHT"; - Direction[Direction["DOWN"] = 4] = "DOWN"; - })(Direction || (Direction = {})); - // Check code against double-entrance into walk (walk=> callback => walk) - var HilbertCurveBase = (function () { - function HilbertCurveBase() { - } - HilbertCurveBase.prototype.walk = function (width, height, visitorCallback) { - this._x = 0; - this._y = 0; - this._d = 0; - this._width = width; - this._height = height; - this._callback = visitorCallback; - var maxBound = Math.max(width, height); - this._level = (Math.log(maxBound) / Math.log(2) + 1) | 0; - this._walkHilbert(Direction.UP); - this._visit(Direction.NONE); - }; - HilbertCurveBase.prototype._walkHilbert = function (direction) { - if (this._level < 1) - return; - this._level--; - switch (direction) { - case Direction.LEFT: - this._walkHilbert(Direction.UP); - this._visit(Direction.RIGHT); - this._walkHilbert(Direction.LEFT); - this._visit(Direction.DOWN); - this._walkHilbert(Direction.LEFT); - this._visit(Direction.LEFT); - this._walkHilbert(Direction.DOWN); - break; - case Direction.RIGHT: - this._walkHilbert(Direction.DOWN); - this._visit(Direction.LEFT); - this._walkHilbert(Direction.RIGHT); - this._visit(Direction.UP); - this._walkHilbert(Direction.RIGHT); - this._visit(Direction.RIGHT); - this._walkHilbert(Direction.UP); - break; - case Direction.UP: - this._walkHilbert(Direction.LEFT); - this._visit(Direction.DOWN); - this._walkHilbert(Direction.UP); - this._visit(Direction.RIGHT); - this._walkHilbert(Direction.UP); - this._visit(Direction.UP); - this._walkHilbert(Direction.RIGHT); - break; - case Direction.DOWN: - this._walkHilbert(Direction.RIGHT); - this._visit(Direction.UP); - this._walkHilbert(Direction.DOWN); - this._visit(Direction.LEFT); - this._walkHilbert(Direction.DOWN); - this._visit(Direction.DOWN); - this._walkHilbert(Direction.LEFT); - break; - default: - break; - } - this._level++; - }; - HilbertCurveBase.prototype._visit = function (direction) { - if (this._x >= 0 && this._x < this._width && this._y >= 0 && this._y < this._height) { - this._callback(this._x, this._y, this._d); - this._d++; - } - switch (direction) { - case Direction.LEFT: - this._x--; - break; - case Direction.RIGHT: - this._x++; - break; - case Direction.UP: - this._y--; - break; - case Direction.DOWN: - this._y++; - break; - } - }; - return HilbertCurveBase; - }()); - exports.HilbertCurveBase = HilbertCurveBase; - - -/***/ }, -/* 35 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var ssim_1 = __webpack_require__(36); - exports.SSIM = ssim_1.SSIM; - - -/***/ }, -/* 36 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var bt709_1 = __webpack_require__(2); - // based on https://github.com/rhys-e/structural-similarity - // http://en.wikipedia.org/wiki/Structural_similarity - var K1 = 0.01, K2 = 0.03; - var SSIM = (function () { - function SSIM() { - } - SSIM.prototype.compare = function (image1, image2) { - if (image1.getHeight() !== image2.getHeight() || image1.getWidth() !== image2.getWidth()) { - throw new Error("Images have different sizes!"); - } - var bitsPerComponent = 8, L = (1 << bitsPerComponent) - 1, c1 = Math.pow((K1 * L), 2), c2 = Math.pow((K2 * L), 2); - var numWindows = 0, mssim = 0.0; - //calculate ssim for each window - this._iterate(image1, image2, function (lumaValues1, lumaValues2, averageLumaValue1, averageLumaValue2) { - //calculate variance and covariance - var sigxy = 0.0, sigsqx = 0.0, sigsqy = 0.0; - for (var i = 0; i < lumaValues1.length; i++) { - sigsqx += Math.pow((lumaValues1[i] - averageLumaValue1), 2); - sigsqy += Math.pow((lumaValues2[i] - averageLumaValue2), 2); - sigxy += (lumaValues1[i] - averageLumaValue1) * (lumaValues2[i] - averageLumaValue2); - } - var numPixelsInWin = lumaValues1.length - 1; - sigsqx /= numPixelsInWin; - sigsqy /= numPixelsInWin; - sigxy /= numPixelsInWin; - //perform ssim calculation on window - var numerator = (2 * averageLumaValue1 * averageLumaValue2 + c1) * (2 * sigxy + c2), denominator = (Math.pow(averageLumaValue1, 2) + Math.pow(averageLumaValue2, 2) + c1) * (sigsqx + sigsqy + c2), ssim = numerator / denominator; - mssim += ssim; - numWindows++; - }); - return mssim / numWindows; - }; - SSIM.prototype._iterate = function (image1, image2, callback) { - var windowSize = 8, width = image1.getWidth(), height = image1.getHeight(); - for (var y = 0; y < height; y += windowSize) { - for (var x = 0; x < width; x += windowSize) { - // avoid out-of-width/height - var windowWidth = Math.min(windowSize, width - x), windowHeight = Math.min(windowSize, height - y); - var lumaValues1 = this._calculateLumaValuesForWindow(image1, x, y, windowWidth, windowHeight), lumaValues2 = this._calculateLumaValuesForWindow(image2, x, y, windowWidth, windowHeight), averageLuma1 = this._calculateAverageLuma(lumaValues1), averageLuma2 = this._calculateAverageLuma(lumaValues2); - callback(lumaValues1, lumaValues2, averageLuma1, averageLuma2); - } - } - }; - SSIM.prototype._calculateLumaValuesForWindow = function (image, x, y, width, height) { - var pointArray = image.getPointArray(), lumaValues = []; - var counter = 0; - for (var j = y; j < y + height; j++) { - var offset = j * image.getWidth(); - for (var i = x; i < x + width; i++) { - var point = pointArray[offset + i]; - lumaValues[counter] = point.r * bt709_1.Y.RED + point.g * bt709_1.Y.GREEN + point.b * bt709_1.Y.BLUE; - counter++; - } - } - return lumaValues; - }; - SSIM.prototype._calculateAverageLuma = function (lumaValues) { - var sumLuma = 0.0; - for (var i = 0; i < lumaValues.length; i++) { - sumLuma += lumaValues[i]; - } - return sumLuma / lumaValues.length; - }; - return SSIM; - }()); - exports.SSIM = SSIM; - - -/***/ }, -/* 37 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var arithmetic = __webpack_require__(6); - exports.arithmetic = arithmetic; - var hueStatistics_1 = __webpack_require__(28); - exports.HueStatistics = hueStatistics_1.HueStatistics; - var palette_1 = __webpack_require__(22); - exports.Palette = palette_1.Palette; - var point_1 = __webpack_require__(24); - exports.Point = point_1.Point; - var pointContainer_1 = __webpack_require__(23); - exports.PointContainer = pointContainer_1.PointContainer; - - -/***/ } -/******/ ]) -}); -; - -},{}],75:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} - -},{}],76:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - -},{}],77:[function(require,module,exports){ -'use strict'; - -var fnToStr = Function.prototype.toString; - -var constructorRegex = /^\s*class\b/; -var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; // not a function - } -}; - -var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { return false; } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } -}; -var toStr = Object.prototype.toString; -var fnClass = '[object Function]'; -var genClass = '[object GeneratorFunction]'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; - -module.exports = function isCallable(value) { - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - if (typeof value === 'function' && !value.prototype) { return true; } - if (hasToStringTag) { return tryFunctionObject(value); } - if (isES6ClassFn(value)) { return false; } - var strClass = toStr.call(value); - return strClass === fnClass || strClass === genClass; -}; - -},{}],78:[function(require,module,exports){ -module.exports = isFunction - -var toString = Object.prototype.toString - -function isFunction (fn) { - var string = toString.call(fn) - return string === '[object Function]' || - (typeof fn === 'function' && string !== '[object RegExp]') || - (typeof window !== 'undefined' && - // IE8 and below - (fn === window.setTimeout || - fn === window.alert || - fn === window.confirm || - fn === window.prompt)) -}; - -},{}],79:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -},{}],80:[function(require,module,exports){ -var encode = require('./lib/encoder'), - decode = require('./lib/decoder'); - -module.exports = { - encode: encode, - decode: decode -}; - -},{"./lib/decoder":81,"./lib/encoder":82}],81:[function(require,module,exports){ -(function (Buffer){ -/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ -/* - Copyright 2011 notmasteryet - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -// - The JPEG specification can be found in the ITU CCITT Recommendation T.81 -// (www.w3.org/Graphics/JPEG/itu-t81.pdf) -// - The JFIF specification can be found in the JPEG File Interchange Format -// (www.w3.org/Graphics/JPEG/jfif3.pdf) -// - The Adobe Application-Specific JPEG markers in the Supporting the DCT Filters -// in PostScript Level 2, Technical Note #5116 -// (partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf) - -var JpegImage = (function jpegImage() { - "use strict"; - var dctZigZag = new Int32Array([ - 0, - 1, 8, - 16, 9, 2, - 3, 10, 17, 24, - 32, 25, 18, 11, 4, - 5, 12, 19, 26, 33, 40, - 48, 41, 34, 27, 20, 13, 6, - 7, 14, 21, 28, 35, 42, 49, 56, - 57, 50, 43, 36, 29, 22, 15, - 23, 30, 37, 44, 51, 58, - 59, 52, 45, 38, 31, - 39, 46, 53, 60, - 61, 54, 47, - 55, 62, - 63 - ]); - - var dctCos1 = 4017 // cos(pi/16) - var dctSin1 = 799 // sin(pi/16) - var dctCos3 = 3406 // cos(3*pi/16) - var dctSin3 = 2276 // sin(3*pi/16) - var dctCos6 = 1567 // cos(6*pi/16) - var dctSin6 = 3784 // sin(6*pi/16) - var dctSqrt2 = 5793 // sqrt(2) - var dctSqrt1d2 = 2896 // sqrt(2) / 2 - - function constructor() { - } - - function buildHuffmanTable(codeLengths, values) { - var k = 0, code = [], i, j, length = 16; - while (length > 0 && !codeLengths[length - 1]) - length--; - code.push({children: [], index: 0}); - var p = code[0], q; - for (i = 0; i < length; i++) { - for (j = 0; j < codeLengths[i]; j++) { - p = code.pop(); - p.children[p.index] = values[k]; - while (p.index > 0) { - if (code.length === 0) - throw new Error('Could not recreate Huffman Table'); - p = code.pop(); - } - p.index++; - code.push(p); - while (code.length <= i) { - code.push(q = {children: [], index: 0}); - p.children[p.index] = q.children; - p = q; - } - k++; - } - if (i + 1 < length) { - // p here points to last code - code.push(q = {children: [], index: 0}); - p.children[p.index] = q.children; - p = q; - } - } - return code[0].children; - } - - function decodeScan(data, offset, - frame, components, resetInterval, - spectralStart, spectralEnd, - successivePrev, successive, opts) { - var precision = frame.precision; - var samplesPerLine = frame.samplesPerLine; - var scanLines = frame.scanLines; - var mcusPerLine = frame.mcusPerLine; - var progressive = frame.progressive; - var maxH = frame.maxH, maxV = frame.maxV; - - var startOffset = offset, bitsData = 0, bitsCount = 0; - function readBit() { - if (bitsCount > 0) { - bitsCount--; - return (bitsData >> bitsCount) & 1; - } - bitsData = data[offset++]; - if (bitsData == 0xFF) { - var nextByte = data[offset++]; - if (nextByte) { - throw new Error("unexpected marker: " + ((bitsData << 8) | nextByte).toString(16)); - } - // unstuff 0 - } - bitsCount = 7; - return bitsData >>> 7; - } - function decodeHuffman(tree) { - var node = tree, bit; - while ((bit = readBit()) !== null) { - node = node[bit]; - if (typeof node === 'number') - return node; - if (typeof node !== 'object') - throw new Error("invalid huffman sequence"); - } - return null; - } - function receive(length) { - var n = 0; - while (length > 0) { - var bit = readBit(); - if (bit === null) return; - n = (n << 1) | bit; - length--; - } - return n; - } - function receiveAndExtend(length) { - var n = receive(length); - if (n >= 1 << (length - 1)) - return n; - return n + (-1 << length) + 1; - } - function decodeBaseline(component, zz) { - var t = decodeHuffman(component.huffmanTableDC); - var diff = t === 0 ? 0 : receiveAndExtend(t); - zz[0]= (component.pred += diff); - var k = 1; - while (k < 64) { - var rs = decodeHuffman(component.huffmanTableAC); - var s = rs & 15, r = rs >> 4; - if (s === 0) { - if (r < 15) - break; - k += 16; - continue; - } - k += r; - var z = dctZigZag[k]; - zz[z] = receiveAndExtend(s); - k++; - } - } - function decodeDCFirst(component, zz) { - var t = decodeHuffman(component.huffmanTableDC); - var diff = t === 0 ? 0 : (receiveAndExtend(t) << successive); - zz[0] = (component.pred += diff); - } - function decodeDCSuccessive(component, zz) { - zz[0] |= readBit() << successive; - } - var eobrun = 0; - function decodeACFirst(component, zz) { - if (eobrun > 0) { - eobrun--; - return; - } - var k = spectralStart, e = spectralEnd; - while (k <= e) { - var rs = decodeHuffman(component.huffmanTableAC); - var s = rs & 15, r = rs >> 4; - if (s === 0) { - if (r < 15) { - eobrun = receive(r) + (1 << r) - 1; - break; - } - k += 16; - continue; - } - k += r; - var z = dctZigZag[k]; - zz[z] = receiveAndExtend(s) * (1 << successive); - k++; - } - } - var successiveACState = 0, successiveACNextValue; - function decodeACSuccessive(component, zz) { - var k = spectralStart, e = spectralEnd, r = 0; - while (k <= e) { - var z = dctZigZag[k]; - var direction = zz[z] < 0 ? -1 : 1; - switch (successiveACState) { - case 0: // initial state - var rs = decodeHuffman(component.huffmanTableAC); - var s = rs & 15, r = rs >> 4; - if (s === 0) { - if (r < 15) { - eobrun = receive(r) + (1 << r); - successiveACState = 4; - } else { - r = 16; - successiveACState = 1; - } - } else { - if (s !== 1) - throw new Error("invalid ACn encoding"); - successiveACNextValue = receiveAndExtend(s); - successiveACState = r ? 2 : 3; - } - continue; - case 1: // skipping r zero items - case 2: - if (zz[z]) - zz[z] += (readBit() << successive) * direction; - else { - r--; - if (r === 0) - successiveACState = successiveACState == 2 ? 3 : 0; - } - break; - case 3: // set value for a zero item - if (zz[z]) - zz[z] += (readBit() << successive) * direction; - else { - zz[z] = successiveACNextValue << successive; - successiveACState = 0; - } - break; - case 4: // eob - if (zz[z]) - zz[z] += (readBit() << successive) * direction; - break; - } - k++; - } - if (successiveACState === 4) { - eobrun--; - if (eobrun === 0) - successiveACState = 0; - } - } - function decodeMcu(component, decode, mcu, row, col) { - var mcuRow = (mcu / mcusPerLine) | 0; - var mcuCol = mcu % mcusPerLine; - var blockRow = mcuRow * component.v + row; - var blockCol = mcuCol * component.h + col; - // If the block is missing and we're in tolerant mode, just skip it. - if (component.blocks[blockRow] === undefined && opts.tolerantDecoding) - return; - decode(component, component.blocks[blockRow][blockCol]); - } - function decodeBlock(component, decode, mcu) { - var blockRow = (mcu / component.blocksPerLine) | 0; - var blockCol = mcu % component.blocksPerLine; - // If the block is missing and we're in tolerant mode, just skip it. - if (component.blocks[blockRow] === undefined && opts.tolerantDecoding) - return; - decode(component, component.blocks[blockRow][blockCol]); - } - - var componentsLength = components.length; - var component, i, j, k, n; - var decodeFn; - if (progressive) { - if (spectralStart === 0) - decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; - else - decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; - } else { - decodeFn = decodeBaseline; - } - - var mcu = 0, marker; - var mcuExpected; - if (componentsLength == 1) { - mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; - } else { - mcuExpected = mcusPerLine * frame.mcusPerColumn; - } - if (!resetInterval) resetInterval = mcuExpected; - - var h, v; - while (mcu < mcuExpected) { - // reset interval stuff - for (i = 0; i < componentsLength; i++) - components[i].pred = 0; - eobrun = 0; - - if (componentsLength == 1) { - component = components[0]; - for (n = 0; n < resetInterval; n++) { - decodeBlock(component, decodeFn, mcu); - mcu++; - } - } else { - for (n = 0; n < resetInterval; n++) { - for (i = 0; i < componentsLength; i++) { - component = components[i]; - h = component.h; - v = component.v; - for (j = 0; j < v; j++) { - for (k = 0; k < h; k++) { - decodeMcu(component, decodeFn, mcu, j, k); - } - } - } - mcu++; - - // If we've reached our expected MCU's, stop decoding - if (mcu === mcuExpected) break; - } - } - - if (mcu === mcuExpected) { - // Skip trailing bytes at the end of the scan - until we reach the next marker - do { - if (data[offset] === 0xFF) { - if (data[offset + 1] !== 0x00) { - break; - } - } - offset += 1; - } while (offset < data.length - 2); - } - - // find marker - bitsCount = 0; - marker = (data[offset] << 8) | data[offset + 1]; - if (marker < 0xFF00) { - throw new Error("marker was not found"); - } - - if (marker >= 0xFFD0 && marker <= 0xFFD7) { // RSTx - offset += 2; - } - else - break; - } - - return offset - startOffset; - } - - function buildComponentData(frame, component) { - var lines = []; - var blocksPerLine = component.blocksPerLine; - var blocksPerColumn = component.blocksPerColumn; - var samplesPerLine = blocksPerLine << 3; - // Only 1 used per invocation of this function and garbage collected after invocation, so no need to account for its memory footprint. - var R = new Int32Array(64), r = new Uint8Array(64); - - // A port of poppler's IDCT method which in turn is taken from: - // Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz, - // "Practical Fast 1-D DCT Algorithms with 11 Multiplications", - // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, - // 988-991. - function quantizeAndInverse(zz, dataOut, dataIn) { - var qt = component.quantizationTable; - var v0, v1, v2, v3, v4, v5, v6, v7, t; - var p = dataIn; - var i; - - // dequant - for (i = 0; i < 64; i++) - p[i] = zz[i] * qt[i]; - - // inverse DCT on rows - for (i = 0; i < 8; ++i) { - var row = 8 * i; - - // check for all-zero AC coefficients - if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && - p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && - p[7 + row] == 0) { - t = (dctSqrt2 * p[0 + row] + 512) >> 10; - p[0 + row] = t; - p[1 + row] = t; - p[2 + row] = t; - p[3 + row] = t; - p[4 + row] = t; - p[5 + row] = t; - p[6 + row] = t; - p[7 + row] = t; - continue; - } - - // stage 4 - v0 = (dctSqrt2 * p[0 + row] + 128) >> 8; - v1 = (dctSqrt2 * p[4 + row] + 128) >> 8; - v2 = p[2 + row]; - v3 = p[6 + row]; - v4 = (dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128) >> 8; - v7 = (dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128) >> 8; - v5 = p[3 + row] << 4; - v6 = p[5 + row] << 4; - - // stage 3 - t = (v0 - v1+ 1) >> 1; - v0 = (v0 + v1 + 1) >> 1; - v1 = t; - t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8; - v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8; - v3 = t; - t = (v4 - v6 + 1) >> 1; - v4 = (v4 + v6 + 1) >> 1; - v6 = t; - t = (v7 + v5 + 1) >> 1; - v5 = (v7 - v5 + 1) >> 1; - v7 = t; - - // stage 2 - t = (v0 - v3 + 1) >> 1; - v0 = (v0 + v3 + 1) >> 1; - v3 = t; - t = (v1 - v2 + 1) >> 1; - v1 = (v1 + v2 + 1) >> 1; - v2 = t; - t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; - v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; - v7 = t; - t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; - v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; - v6 = t; - - // stage 1 - p[0 + row] = v0 + v7; - p[7 + row] = v0 - v7; - p[1 + row] = v1 + v6; - p[6 + row] = v1 - v6; - p[2 + row] = v2 + v5; - p[5 + row] = v2 - v5; - p[3 + row] = v3 + v4; - p[4 + row] = v3 - v4; - } - - // inverse DCT on columns - for (i = 0; i < 8; ++i) { - var col = i; - - // check for all-zero AC coefficients - if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 && - p[4*8 + col] == 0 && p[5*8 + col] == 0 && p[6*8 + col] == 0 && - p[7*8 + col] == 0) { - t = (dctSqrt2 * dataIn[i+0] + 8192) >> 14; - p[0*8 + col] = t; - p[1*8 + col] = t; - p[2*8 + col] = t; - p[3*8 + col] = t; - p[4*8 + col] = t; - p[5*8 + col] = t; - p[6*8 + col] = t; - p[7*8 + col] = t; - continue; - } - - // stage 4 - v0 = (dctSqrt2 * p[0*8 + col] + 2048) >> 12; - v1 = (dctSqrt2 * p[4*8 + col] + 2048) >> 12; - v2 = p[2*8 + col]; - v3 = p[6*8 + col]; - v4 = (dctSqrt1d2 * (p[1*8 + col] - p[7*8 + col]) + 2048) >> 12; - v7 = (dctSqrt1d2 * (p[1*8 + col] + p[7*8 + col]) + 2048) >> 12; - v5 = p[3*8 + col]; - v6 = p[5*8 + col]; - - // stage 3 - t = (v0 - v1 + 1) >> 1; - v0 = (v0 + v1 + 1) >> 1; - v1 = t; - t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12; - v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12; - v3 = t; - t = (v4 - v6 + 1) >> 1; - v4 = (v4 + v6 + 1) >> 1; - v6 = t; - t = (v7 + v5 + 1) >> 1; - v5 = (v7 - v5 + 1) >> 1; - v7 = t; - - // stage 2 - t = (v0 - v3 + 1) >> 1; - v0 = (v0 + v3 + 1) >> 1; - v3 = t; - t = (v1 - v2 + 1) >> 1; - v1 = (v1 + v2 + 1) >> 1; - v2 = t; - t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; - v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; - v7 = t; - t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; - v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; - v6 = t; - - // stage 1 - p[0*8 + col] = v0 + v7; - p[7*8 + col] = v0 - v7; - p[1*8 + col] = v1 + v6; - p[6*8 + col] = v1 - v6; - p[2*8 + col] = v2 + v5; - p[5*8 + col] = v2 - v5; - p[3*8 + col] = v3 + v4; - p[4*8 + col] = v3 - v4; - } - - // convert to 8-bit integers - for (i = 0; i < 64; ++i) { - var sample = 128 + ((p[i] + 8) >> 4); - dataOut[i] = sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample; - } - } - - requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8); - - var i, j; - for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { - var scanLine = blockRow << 3; - for (i = 0; i < 8; i++) - lines.push(new Uint8Array(samplesPerLine)); - for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { - quantizeAndInverse(component.blocks[blockRow][blockCol], r, R); - - var offset = 0, sample = blockCol << 3; - for (j = 0; j < 8; j++) { - var line = lines[scanLine + j]; - for (i = 0; i < 8; i++) - line[sample + i] = r[offset++]; - } - } - } - return lines; - } - - function clampTo8bit(a) { - return a < 0 ? 0 : a > 255 ? 255 : a; - } - - constructor.prototype = { - load: function load(path) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", path, true); - xhr.responseType = "arraybuffer"; - xhr.onload = (function() { - // TODO catch parse error - var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer); - this.parse(data); - if (this.onload) - this.onload(); - }).bind(this); - xhr.send(null); - }, - parse: function parse(data) { - var maxResolutionInPixels = this.opts.maxResolutionInMP * 1000 * 1000; - var offset = 0, length = data.length; - function readUint16() { - var value = (data[offset] << 8) | data[offset + 1]; - offset += 2; - return value; - } - function readDataBlock() { - var length = readUint16(); - var array = data.subarray(offset, offset + length - 2); - offset += array.length; - return array; - } - function prepareComponents(frame) { - // According to the JPEG standard, the sampling factor must be between 1 and 4 - // See https://github.com/libjpeg-turbo/libjpeg-turbo/blob/9abeff46d87bd201a952e276f3e4339556a403a3/libjpeg.txt#L1138-L1146 - var maxH = 1, maxV = 1; - var component, componentId; - for (componentId in frame.components) { - if (frame.components.hasOwnProperty(componentId)) { - component = frame.components[componentId]; - if (maxH < component.h) maxH = component.h; - if (maxV < component.v) maxV = component.v; - } - } - var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / maxH); - var mcusPerColumn = Math.ceil(frame.scanLines / 8 / maxV); - for (componentId in frame.components) { - if (frame.components.hasOwnProperty(componentId)) { - component = frame.components[componentId]; - var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / maxH); - var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / maxV); - var blocksPerLineForMcu = mcusPerLine * component.h; - var blocksPerColumnForMcu = mcusPerColumn * component.v; - var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu; - var blocks = []; - - // Each block is a Int32Array of length 64 (4 x 64 = 256 bytes) - requestMemoryAllocation(blocksToAllocate * 256); - - for (var i = 0; i < blocksPerColumnForMcu; i++) { - var row = []; - for (var j = 0; j < blocksPerLineForMcu; j++) - row.push(new Int32Array(64)); - blocks.push(row); - } - component.blocksPerLine = blocksPerLine; - component.blocksPerColumn = blocksPerColumn; - component.blocks = blocks; - } - } - frame.maxH = maxH; - frame.maxV = maxV; - frame.mcusPerLine = mcusPerLine; - frame.mcusPerColumn = mcusPerColumn; - } - var jfif = null; - var adobe = null; - var pixels = null; - var frame, resetInterval; - var quantizationTables = [], frames = []; - var huffmanTablesAC = [], huffmanTablesDC = []; - var fileMarker = readUint16(); - var malformedDataOffset = -1; - this.comments = []; - if (fileMarker != 0xFFD8) { // SOI (Start of Image) - throw new Error("SOI not found"); - } - - fileMarker = readUint16(); - while (fileMarker != 0xFFD9) { // EOI (End of image) - var i, j, l; - switch(fileMarker) { - case 0xFF00: break; - case 0xFFE0: // APP0 (Application Specific) - case 0xFFE1: // APP1 - case 0xFFE2: // APP2 - case 0xFFE3: // APP3 - case 0xFFE4: // APP4 - case 0xFFE5: // APP5 - case 0xFFE6: // APP6 - case 0xFFE7: // APP7 - case 0xFFE8: // APP8 - case 0xFFE9: // APP9 - case 0xFFEA: // APP10 - case 0xFFEB: // APP11 - case 0xFFEC: // APP12 - case 0xFFED: // APP13 - case 0xFFEE: // APP14 - case 0xFFEF: // APP15 - case 0xFFFE: // COM (Comment) - var appData = readDataBlock(); - - if (fileMarker === 0xFFFE) { - var comment = String.fromCharCode.apply(null, appData); - this.comments.push(comment); - } - - if (fileMarker === 0xFFE0) { - if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && - appData[3] === 0x46 && appData[4] === 0) { // 'JFIF\x00' - jfif = { - version: { major: appData[5], minor: appData[6] }, - densityUnits: appData[7], - xDensity: (appData[8] << 8) | appData[9], - yDensity: (appData[10] << 8) | appData[11], - thumbWidth: appData[12], - thumbHeight: appData[13], - thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) - }; - } - } - // TODO APP1 - Exif - if (fileMarker === 0xFFE1) { - if (appData[0] === 0x45 && - appData[1] === 0x78 && - appData[2] === 0x69 && - appData[3] === 0x66 && - appData[4] === 0) { // 'EXIF\x00' - this.exifBuffer = appData.subarray(5, appData.length); - } - } - - if (fileMarker === 0xFFEE) { - if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && - appData[3] === 0x62 && appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\x00' - adobe = { - version: appData[6], - flags0: (appData[7] << 8) | appData[8], - flags1: (appData[9] << 8) | appData[10], - transformCode: appData[11] - }; - } - } - break; - - case 0xFFDB: // DQT (Define Quantization Tables) - var quantizationTablesLength = readUint16(); - var quantizationTablesEnd = quantizationTablesLength + offset - 2; - while (offset < quantizationTablesEnd) { - var quantizationTableSpec = data[offset++]; - requestMemoryAllocation(64 * 4); - var tableData = new Int32Array(64); - if ((quantizationTableSpec >> 4) === 0) { // 8 bit values - for (j = 0; j < 64; j++) { - var z = dctZigZag[j]; - tableData[z] = data[offset++]; - } - } else if ((quantizationTableSpec >> 4) === 1) { //16 bit - for (j = 0; j < 64; j++) { - var z = dctZigZag[j]; - tableData[z] = readUint16(); - } - } else - throw new Error("DQT: invalid table spec"); - quantizationTables[quantizationTableSpec & 15] = tableData; - } - break; - - case 0xFFC0: // SOF0 (Start of Frame, Baseline DCT) - case 0xFFC1: // SOF1 (Start of Frame, Extended DCT) - case 0xFFC2: // SOF2 (Start of Frame, Progressive DCT) - readUint16(); // skip data length - frame = {}; - frame.extended = (fileMarker === 0xFFC1); - frame.progressive = (fileMarker === 0xFFC2); - frame.precision = data[offset++]; - frame.scanLines = readUint16(); - frame.samplesPerLine = readUint16(); - frame.components = {}; - frame.componentsOrder = []; - - var pixelsInFrame = frame.scanLines * frame.samplesPerLine; - if (pixelsInFrame > maxResolutionInPixels) { - var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6); - throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`); - } - - var componentsCount = data[offset++], componentId; - var maxH = 0, maxV = 0; - for (i = 0; i < componentsCount; i++) { - componentId = data[offset]; - var h = data[offset + 1] >> 4; - var v = data[offset + 1] & 15; - var qId = data[offset + 2]; - - if ( h <= 0 || v <= 0 ) { - throw new Error('Invalid sampling factor, expected values above 0'); - } - - frame.componentsOrder.push(componentId); - frame.components[componentId] = { - h: h, - v: v, - quantizationIdx: qId - }; - offset += 3; - } - prepareComponents(frame); - frames.push(frame); - break; - - case 0xFFC4: // DHT (Define Huffman Tables) - var huffmanLength = readUint16(); - for (i = 2; i < huffmanLength;) { - var huffmanTableSpec = data[offset++]; - var codeLengths = new Uint8Array(16); - var codeLengthSum = 0; - for (j = 0; j < 16; j++, offset++) { - codeLengthSum += (codeLengths[j] = data[offset]); - } - requestMemoryAllocation(16 + codeLengthSum); - var huffmanValues = new Uint8Array(codeLengthSum); - for (j = 0; j < codeLengthSum; j++, offset++) - huffmanValues[j] = data[offset]; - i += 17 + codeLengthSum; - - ((huffmanTableSpec >> 4) === 0 ? - huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = - buildHuffmanTable(codeLengths, huffmanValues); - } - break; - - case 0xFFDD: // DRI (Define Restart Interval) - readUint16(); // skip data length - resetInterval = readUint16(); - break; - - case 0xFFDC: // Number of Lines marker - readUint16() // skip data length - readUint16() // Ignore this data since it represents the image height - break; - - case 0xFFDA: // SOS (Start of Scan) - var scanLength = readUint16(); - var selectorsCount = data[offset++]; - var components = [], component; - for (i = 0; i < selectorsCount; i++) { - component = frame.components[data[offset++]]; - var tableSpec = data[offset++]; - component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; - component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; - components.push(component); - } - var spectralStart = data[offset++]; - var spectralEnd = data[offset++]; - var successiveApproximation = data[offset++]; - var processed = decodeScan(data, offset, - frame, components, resetInterval, - spectralStart, spectralEnd, - successiveApproximation >> 4, successiveApproximation & 15, this.opts); - offset += processed; - break; - - case 0xFFFF: // Fill bytes - if (data[offset] !== 0xFF) { // Avoid skipping a valid marker. - offset--; - } - break; - default: - if (data[offset - 3] == 0xFF && - data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) { - // could be incorrect encoding -- last 0xFF byte of the previous - // block was eaten by the encoder - offset -= 3; - break; - } - else if (fileMarker === 0xE0 || fileMarker == 0xE1) { - // Recover from malformed APP1 markers popular in some phone models. - // See https://github.com/eugeneware/jpeg-js/issues/82 - if (malformedDataOffset !== -1) { - throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`); - } - malformedDataOffset = offset - 1; - const nextOffset = readUint16(); - if (data[offset + nextOffset - 2] === 0xFF) { - offset += nextOffset - 2; - break; - } - } - throw new Error("unknown JPEG marker " + fileMarker.toString(16)); - } - fileMarker = readUint16(); - } - if (frames.length != 1) - throw new Error("only single frame JPEGs supported"); - - // set each frame's components quantization table - for (var i = 0; i < frames.length; i++) { - var cp = frames[i].components; - for (var j in cp) { - cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; - delete cp[j].quantizationIdx; - } - } - - this.width = frame.samplesPerLine; - this.height = frame.scanLines; - this.jfif = jfif; - this.adobe = adobe; - this.components = []; - for (var i = 0; i < frame.componentsOrder.length; i++) { - var component = frame.components[frame.componentsOrder[i]]; - this.components.push({ - lines: buildComponentData(frame, component), - scaleX: component.h / frame.maxH, - scaleY: component.v / frame.maxV - }); - } - }, - getData: function getData(width, height) { - var scaleX = this.width / width, scaleY = this.height / height; - - var component1, component2, component3, component4; - var component1Line, component2Line, component3Line, component4Line; - var x, y; - var offset = 0; - var Y, Cb, Cr, K, C, M, Ye, R, G, B; - var colorTransform; - var dataLength = width * height * this.components.length; - requestMemoryAllocation(dataLength); - var data = new Uint8Array(dataLength); - switch (this.components.length) { - case 1: - component1 = this.components[0]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - - data[offset++] = Y; - } - } - break; - case 2: - // PDF might compress two component data in custom colorspace - component1 = this.components[0]; - component2 = this.components[1]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - data[offset++] = Y; - Y = component2Line[0 | (x * component2.scaleX * scaleX)]; - data[offset++] = Y; - } - } - break; - case 3: - // The default transform for three components is true - colorTransform = true; - // The adobe transform marker overrides any previous setting - if (this.adobe && this.adobe.transformCode) - colorTransform = true; - else if (typeof this.opts.colorTransform !== 'undefined') - colorTransform = !!this.opts.colorTransform; - - component1 = this.components[0]; - component2 = this.components[1]; - component3 = this.components[2]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; - component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - if (!colorTransform) { - R = component1Line[0 | (x * component1.scaleX * scaleX)]; - G = component2Line[0 | (x * component2.scaleX * scaleX)]; - B = component3Line[0 | (x * component3.scaleX * scaleX)]; - } else { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - Cb = component2Line[0 | (x * component2.scaleX * scaleX)]; - Cr = component3Line[0 | (x * component3.scaleX * scaleX)]; - - R = clampTo8bit(Y + 1.402 * (Cr - 128)); - G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128)); - B = clampTo8bit(Y + 1.772 * (Cb - 128)); - } - - data[offset++] = R; - data[offset++] = G; - data[offset++] = B; - } - } - break; - case 4: - if (!this.adobe) - throw new Error('Unsupported color mode (4 components)'); - // The default transform for four components is false - colorTransform = false; - // The adobe transform marker overrides any previous setting - if (this.adobe && this.adobe.transformCode) - colorTransform = true; - else if (typeof this.opts.colorTransform !== 'undefined') - colorTransform = !!this.opts.colorTransform; - - component1 = this.components[0]; - component2 = this.components[1]; - component3 = this.components[2]; - component4 = this.components[3]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; - component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)]; - component4Line = component4.lines[0 | (y * component4.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - if (!colorTransform) { - C = component1Line[0 | (x * component1.scaleX * scaleX)]; - M = component2Line[0 | (x * component2.scaleX * scaleX)]; - Ye = component3Line[0 | (x * component3.scaleX * scaleX)]; - K = component4Line[0 | (x * component4.scaleX * scaleX)]; - } else { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - Cb = component2Line[0 | (x * component2.scaleX * scaleX)]; - Cr = component3Line[0 | (x * component3.scaleX * scaleX)]; - K = component4Line[0 | (x * component4.scaleX * scaleX)]; - - C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128)); - M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128)); - Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128)); - } - data[offset++] = 255-C; - data[offset++] = 255-M; - data[offset++] = 255-Ye; - data[offset++] = 255-K; - } - } - break; - default: - throw new Error('Unsupported color mode'); - } - return data; - }, - copyToImageData: function copyToImageData(imageData, formatAsRGBA) { - var width = imageData.width, height = imageData.height; - var imageDataArray = imageData.data; - var data = this.getData(width, height); - var i = 0, j = 0, x, y; - var Y, K, C, M, R, G, B; - switch (this.components.length) { - case 1: - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - Y = data[i++]; - - imageDataArray[j++] = Y; - imageDataArray[j++] = Y; - imageDataArray[j++] = Y; - if (formatAsRGBA) { - imageDataArray[j++] = 255; - } - } - } - break; - case 3: - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - R = data[i++]; - G = data[i++]; - B = data[i++]; - - imageDataArray[j++] = R; - imageDataArray[j++] = G; - imageDataArray[j++] = B; - if (formatAsRGBA) { - imageDataArray[j++] = 255; - } - } - } - break; - case 4: - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - C = data[i++]; - M = data[i++]; - Y = data[i++]; - K = data[i++]; - - R = 255 - clampTo8bit(C * (1 - K / 255) + K); - G = 255 - clampTo8bit(M * (1 - K / 255) + K); - B = 255 - clampTo8bit(Y * (1 - K / 255) + K); - - imageDataArray[j++] = R; - imageDataArray[j++] = G; - imageDataArray[j++] = B; - if (formatAsRGBA) { - imageDataArray[j++] = 255; - } - } - } - break; - default: - throw new Error('Unsupported color mode'); - } - } - }; - - - // We cap the amount of memory used by jpeg-js to avoid unexpected OOMs from untrusted content. - var totalBytesAllocated = 0; - var maxMemoryUsageBytes = 0; - function requestMemoryAllocation(increaseAmount = 0) { - var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount; - if (totalMemoryImpactBytes > maxMemoryUsageBytes) { - var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024); - throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`); - } - - totalBytesAllocated = totalMemoryImpactBytes; - } - - constructor.resetMaxMemoryUsage = function (maxMemoryUsageBytes_) { - totalBytesAllocated = 0; - maxMemoryUsageBytes = maxMemoryUsageBytes_; - }; - - constructor.getBytesAllocated = function () { - return totalBytesAllocated; - }; - - constructor.requestMemoryAllocation = requestMemoryAllocation; - - return constructor; -})(); - -if (typeof module !== 'undefined') { - module.exports = decode; -} else if (typeof window !== 'undefined') { - window['jpeg-js'] = window['jpeg-js'] || {}; - window['jpeg-js'].decode = decode; -} - -function decode(jpegData, userOpts = {}) { - var defaultOpts = { - // "undefined" means "Choose whether to transform colors based on the image’s color model." - colorTransform: undefined, - useTArray: false, - formatAsRGBA: true, - tolerantDecoding: true, - maxResolutionInMP: 100, // Don't decode more than 100 megapixels - maxMemoryUsageInMB: 512, // Don't decode if memory footprint is more than 512MB - }; - - var opts = {...defaultOpts, ...userOpts}; - var arr = new Uint8Array(jpegData); - var decoder = new JpegImage(); - decoder.opts = opts; - // If this constructor ever supports async decoding this will need to be done differently. - // Until then, treating as singleton limit is fine. - JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024); - decoder.parse(arr); - - var channels = (opts.formatAsRGBA) ? 4 : 3; - var bytesNeeded = decoder.width * decoder.height * channels; - try { - JpegImage.requestMemoryAllocation(bytesNeeded); - var image = { - width: decoder.width, - height: decoder.height, - exifBuffer: decoder.exifBuffer, - data: opts.useTArray ? - new Uint8Array(bytesNeeded) : - Buffer.alloc(bytesNeeded) - }; - if(decoder.comments.length > 0) { - image["comments"] = decoder.comments; - } - } catch (err) { - if (err instanceof RangeError) { - throw new Error("Could not allocate enough memory for the image. " + - "Required: " + bytesNeeded); - } - - if (err instanceof ReferenceError) { - if (err.message === "Buffer is not defined") { - throw new Error("Buffer is not globally defined in this environment. " + - "Consider setting useTArray to true"); - } - } - throw err; - } - - decoder.copyToImageData(image, opts.formatAsRGBA); - - return image; -} - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],82:[function(require,module,exports){ -(function (Buffer){ -/* - Copyright (c) 2008, Adobe Systems Incorporated - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Adobe Systems Incorporated nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -/* -JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 - -Basic GUI blocking jpeg encoder -*/ - -var btoa = btoa || function(buf) { - return Buffer.from(buf).toString('base64'); -}; - -function JPEGEncoder(quality) { - var self = this; - var fround = Math.round; - var ffloor = Math.floor; - var YTable = new Array(64); - var UVTable = new Array(64); - var fdtbl_Y = new Array(64); - var fdtbl_UV = new Array(64); - var YDC_HT; - var UVDC_HT; - var YAC_HT; - var UVAC_HT; - - var bitcode = new Array(65535); - var category = new Array(65535); - var outputfDCTQuant = new Array(64); - var DU = new Array(64); - var byteout = []; - var bytenew = 0; - var bytepos = 7; - - var YDU = new Array(64); - var UDU = new Array(64); - var VDU = new Array(64); - var clt = new Array(256); - var RGB_YUV_TABLE = new Array(2048); - var currentQuality; - - var ZigZag = [ - 0, 1, 5, 6,14,15,27,28, - 2, 4, 7,13,16,26,29,42, - 3, 8,12,17,25,30,41,43, - 9,11,18,24,31,40,44,53, - 10,19,23,32,39,45,52,54, - 20,22,33,38,46,51,55,60, - 21,34,37,47,50,56,59,61, - 35,36,48,49,57,58,62,63 - ]; - - var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; - var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; - var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; - var std_ac_luminance_values = [ - 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, - 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, - 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, - 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, - 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, - 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, - 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, - 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, - 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, - 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, - 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, - 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, - 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, - 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, - 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, - 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, - 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, - 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, - 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, - 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, - 0xf9,0xfa - ]; - - var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; - var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; - var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; - var std_ac_chrominance_values = [ - 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, - 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, - 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, - 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, - 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, - 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, - 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, - 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, - 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, - 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, - 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, - 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, - 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, - 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, - 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, - 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, - 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, - 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, - 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, - 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, - 0xf9,0xfa - ]; - - function initQuantTables(sf){ - var YQT = [ - 16, 11, 10, 16, 24, 40, 51, 61, - 12, 12, 14, 19, 26, 58, 60, 55, - 14, 13, 16, 24, 40, 57, 69, 56, - 14, 17, 22, 29, 51, 87, 80, 62, - 18, 22, 37, 56, 68,109,103, 77, - 24, 35, 55, 64, 81,104,113, 92, - 49, 64, 78, 87,103,121,120,101, - 72, 92, 95, 98,112,100,103, 99 - ]; - - for (var i = 0; i < 64; i++) { - var t = ffloor((YQT[i]*sf+50)/100); - if (t < 1) { - t = 1; - } else if (t > 255) { - t = 255; - } - YTable[ZigZag[i]] = t; - } - var UVQT = [ - 17, 18, 24, 47, 99, 99, 99, 99, - 18, 21, 26, 66, 99, 99, 99, 99, - 24, 26, 56, 99, 99, 99, 99, 99, - 47, 66, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99 - ]; - for (var j = 0; j < 64; j++) { - var u = ffloor((UVQT[j]*sf+50)/100); - if (u < 1) { - u = 1; - } else if (u > 255) { - u = 255; - } - UVTable[ZigZag[j]] = u; - } - var aasf = [ - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - ]; - var k = 0; - for (var row = 0; row < 8; row++) - { - for (var col = 0; col < 8; col++) - { - fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - k++; - } - } - } - - function computeHuffmanTbl(nrcodes, std_table){ - var codevalue = 0; - var pos_in_table = 0; - var HT = new Array(); - for (var k = 1; k <= 16; k++) { - for (var j = 1; j <= nrcodes[k]; j++) { - HT[std_table[pos_in_table]] = []; - HT[std_table[pos_in_table]][0] = codevalue; - HT[std_table[pos_in_table]][1] = k; - pos_in_table++; - codevalue++; - } - codevalue*=2; - } - return HT; - } - - function initHuffmanTbl() - { - YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); - UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); - YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); - UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); - } - - function initCategoryNumber() - { - var nrlower = 1; - var nrupper = 2; - for (var cat = 1; cat <= 15; cat++) { - //Positive numbers - for (var nr = nrlower; nr>0] = 38470 * i; - RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; - RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; - RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; - RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; - RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; - RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; - } - } - - // IO functions - function writeBits(bs) - { - var value = bs[0]; - var posval = bs[1]-1; - while ( posval >= 0 ) { - if (value & (1 << posval) ) { - bytenew |= (1 << bytepos); - } - posval--; - bytepos--; - if (bytepos < 0) { - if (bytenew == 0xFF) { - writeByte(0xFF); - writeByte(0); - } - else { - writeByte(bytenew); - } - bytepos=7; - bytenew=0; - } - } - } - - function writeByte(value) - { - //byteout.push(clt[value]); // write char directly instead of converting later - byteout.push(value); - } - - function writeWord(value) - { - writeByte((value>>8)&0xFF); - writeByte((value )&0xFF); - } - - // DCT & quantization core - function fDCTQuant(data, fdtbl) - { - var d0, d1, d2, d3, d4, d5, d6, d7; - /* Pass 1: process rows. */ - var dataOff=0; - var i; - var I8 = 8; - var I64 = 64; - for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); - //outputfDCTQuant[i] = fround(fDCTQuant); - - } - return outputfDCTQuant; - } - - function writeAPP0() - { - writeWord(0xFFE0); // marker - writeWord(16); // length - writeByte(0x4A); // J - writeByte(0x46); // F - writeByte(0x49); // I - writeByte(0x46); // F - writeByte(0); // = "JFIF",'\0' - writeByte(1); // versionhi - writeByte(1); // versionlo - writeByte(0); // xyunits - writeWord(1); // xdensity - writeWord(1); // ydensity - writeByte(0); // thumbnwidth - writeByte(0); // thumbnheight - } - - function writeAPP1(exifBuffer) { - if (!exifBuffer) return; - - writeWord(0xFFE1); // APP1 marker - - if (exifBuffer[0] === 0x45 && - exifBuffer[1] === 0x78 && - exifBuffer[2] === 0x69 && - exifBuffer[3] === 0x66) { - // Buffer already starts with EXIF, just use it directly - writeWord(exifBuffer.length + 2); // length is buffer + length itself! - } else { - // Buffer doesn't start with EXIF, write it for them - writeWord(exifBuffer.length + 5 + 2); // length is buffer + EXIF\0 + length itself! - writeByte(0x45); // E - writeByte(0x78); // X - writeByte(0x69); // I - writeByte(0x66); // F - writeByte(0); // = "EXIF",'\0' - } - - for (var i = 0; i < exifBuffer.length; i++) { - writeByte(exifBuffer[i]); - } - } - - function writeSOF0(width, height) - { - writeWord(0xFFC0); // marker - writeWord(17); // length, truecolor YUV JPG - writeByte(8); // precision - writeWord(height); - writeWord(width); - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0x11); // HVY - writeByte(0); // QTY - writeByte(2); // IdU - writeByte(0x11); // HVU - writeByte(1); // QTU - writeByte(3); // IdV - writeByte(0x11); // HVV - writeByte(1); // QTV - } - - function writeDQT() - { - writeWord(0xFFDB); // marker - writeWord(132); // length - writeByte(0); - for (var i=0; i<64; i++) { - writeByte(YTable[i]); - } - writeByte(1); - for (var j=0; j<64; j++) { - writeByte(UVTable[j]); - } - } - - function writeDHT() - { - writeWord(0xFFC4); // marker - writeWord(0x01A2); // length - - writeByte(0); // HTYDCinfo - for (var i=0; i<16; i++) { - writeByte(std_dc_luminance_nrcodes[i+1]); - } - for (var j=0; j<=11; j++) { - writeByte(std_dc_luminance_values[j]); - } - - writeByte(0x10); // HTYACinfo - for (var k=0; k<16; k++) { - writeByte(std_ac_luminance_nrcodes[k+1]); - } - for (var l=0; l<=161; l++) { - writeByte(std_ac_luminance_values[l]); - } - - writeByte(1); // HTUDCinfo - for (var m=0; m<16; m++) { - writeByte(std_dc_chrominance_nrcodes[m+1]); - } - for (var n=0; n<=11; n++) { - writeByte(std_dc_chrominance_values[n]); - } - - writeByte(0x11); // HTUACinfo - for (var o=0; o<16; o++) { - writeByte(std_ac_chrominance_nrcodes[o+1]); - } - for (var p=0; p<=161; p++) { - writeByte(std_ac_chrominance_values[p]); - } - } - - function writeCOM(comments) - { - if (typeof comments === "undefined" || comments.constructor !== Array) return; - comments.forEach(e => { - if (typeof e !== "string") return; - writeWord(0xFFFE); // marker - var l = e.length; - writeWord(l + 2); // length itself as well - var i; - for (i = 0; i < l; i++) - writeByte(e.charCodeAt(i)); - }); - } - - function writeSOS() - { - writeWord(0xFFDA); // marker - writeWord(12); // length - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0); // HTY - writeByte(2); // IdU - writeByte(0x11); // HTU - writeByte(3); // IdV - writeByte(0x11); // HTV - writeByte(0); // Ss - writeByte(0x3f); // Se - writeByte(0); // Bf - } - - function processDU(CDU, fdtbl, DC, HTDC, HTAC){ - var EOB = HTAC[0x00]; - var M16zeroes = HTAC[0xF0]; - var pos; - var I16 = 16; - var I63 = 63; - var I64 = 64; - var DU_DCT = fDCTQuant(CDU, fdtbl); - //ZigZag reorder - for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; - //end0pos = first element in reverse order !=0 - if ( end0pos == 0) { - writeBits(EOB); - return DC; - } - var i = 1; - var lng; - while ( i <= end0pos ) { - var startpos = i; - for (; (DU[i]==0) && (i<=end0pos); ++i) {} - var nrzeroes = i-startpos; - if ( nrzeroes >= I16 ) { - lng = nrzeroes>>4; - for (var nrmarker=1; nrmarker <= lng; ++nrmarker) - writeBits(M16zeroes); - nrzeroes = nrzeroes&0xF; - } - pos = 32767+DU[i]; - writeBits(HTAC[(nrzeroes<<4)+category[pos]]); - writeBits(bitcode[pos]); - i++; - } - if ( end0pos != I63 ) { - writeBits(EOB); - } - return DC; - } - - function initCharLookupTable(){ - var sfcc = String.fromCharCode; - for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 - clt[i] = sfcc(i); - } - } - - this.encode = function(image,quality) // image data object - { - var time_start = new Date().getTime(); - - if(quality) setQuality(quality); - - // Initialize bit writer - byteout = new Array(); - bytenew=0; - bytepos=7; - - // Add JPEG headers - writeWord(0xFFD8); // SOI - writeAPP0(); - writeCOM(image.comments); - writeAPP1(image.exifBuffer); - writeDQT(); - writeSOF0(image.width,image.height); - writeDHT(); - writeSOS(); - - - // Encode 8x8 macroblocks - var DCY=0; - var DCU=0; - var DCV=0; - - bytenew=0; - bytepos=7; - - - this.encode.displayName = "_encode_"; - - var imageData = image.data; - var width = image.width; - var height = image.height; - - var quadWidth = width*4; - var tripleWidth = width*3; - - var x, y = 0; - var r, g, b; - var start,p, col,row,pos; - while(y < height){ - x = 0; - while(x < quadWidth){ - start = quadWidth * y + x; - p = start; - col = -1; - row = 0; - - for(pos=0; pos < 64; pos++){ - row = pos >> 3;// /8 - col = ( pos & 7 ) * 4; // %8 - p = start + ( row * quadWidth ) + col; - - if(y+row >= height){ // padding bottom - p-= (quadWidth*(y+1+row-height)); - } - - if(x+col >= quadWidth){ // padding right - p-= ((x+col) - quadWidth +4) - } - - r = imageData[ p++ ]; - g = imageData[ p++ ]; - b = imageData[ p++ ]; - - - /* // calculate YUV values dynamically - YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 - UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); - VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); - */ - - // use lookup table (slightly faster) - YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; - UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; - VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; - - } - - DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); - DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); - DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); - x+=32; - } - y+=8; - } - - - //////////////////////////////////////////////////////////////// - - // Do the bit alignment of the EOI marker - if ( bytepos >= 0 ) { - var fillbits = []; - fillbits[1] = bytepos+1; - fillbits[0] = (1<<(bytepos+1))-1; - writeBits(fillbits); - } - - writeWord(0xFFD9); //EOI - - if (typeof module === 'undefined') return new Uint8Array(byteout); - return Buffer.from(byteout); - - var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); - - byteout = []; - - // benchmarking - var duration = new Date().getTime() - time_start; - //console.log('Encoding time: '+ duration + 'ms'); - // - - return jpegDataUri - } - - function setQuality(quality){ - if (quality <= 0) { - quality = 1; - } - if (quality > 100) { - quality = 100; - } - - if(currentQuality == quality) return // don't recalc if unchanged - - var sf = 0; - if (quality < 50) { - sf = Math.floor(5000 / quality); - } else { - sf = Math.floor(200 - quality*2); - } - - initQuantTables(sf); - currentQuality = quality; - //console.log('Quality set to: '+quality +'%'); - } - - function init(){ - var time_start = new Date().getTime(); - if(!quality) quality = 50; - // Create tables - initCharLookupTable() - initHuffmanTbl(); - initCategoryNumber(); - initRGBYUVTable(); - - setQuality(quality); - var duration = new Date().getTime() - time_start; - //console.log('Initialization '+ duration + 'ms'); - } - - init(); - -}; - -if (typeof module !== 'undefined') { - module.exports = encode; -} else if (typeof window !== 'undefined') { - window['jpeg-js'] = window['jpeg-js'] || {}; - window['jpeg-js'].encode = encode; -} - -function encode(imgData, qu) { - if (typeof qu === 'undefined') qu = 50; - var encoder = new JPEGEncoder(qu); - var data = encoder.encode(imgData, qu); - return { - data: data, - width: imgData.width, - height: imgData.height, - }; -} - -// helper function to get the imageData of an existing image on the current page. -function getImageDataFromImage(idOrElement){ - var theImg = (typeof(idOrElement)=='string')? document.getElementById(idOrElement):idOrElement; - var cvs = document.createElement('canvas'); - cvs.width = theImg.width; - cvs.height = theImg.height; - var ctx = cvs.getContext("2d"); - ctx.drawImage(theImg,0,0); - - return (ctx.getImageData(0, 0, cvs.width, cvs.height)); -} - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],83:[function(require,module,exports){ -(function (process){ -var path = require('path'); -var fs = require('fs'); -var _0777 = parseInt('0777', 8); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), opts, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 & (~process.umask()); - } - if (!made) made = null; - - p = path.resolve(p); - - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; - -}).call(this,require('_process')) -},{"_process":133,"fs":47,"path":107}],84:[function(require,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - -},{}],85:[function(require,module,exports){ -arguments[4][64][0].apply(exports,arguments) -},{"dup":64}],86:[function(require,module,exports){ -// Top level file is just a mixin of submodules & constants -'use strict'; - -var assign = require('./lib/utils/common').assign; - -var deflate = require('./lib/deflate'); -var inflate = require('./lib/inflate'); -var constants = require('./lib/zlib/constants'); - -var pako = {}; - -assign(pako, deflate, inflate, constants); - -module.exports = pako; - -},{"./lib/deflate":87,"./lib/inflate":88,"./lib/utils/common":89,"./lib/zlib/constants":92}],87:[function(require,module,exports){ -'use strict'; - - -var zlib_deflate = require('./zlib/deflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); - -var toString = Object.prototype.toString; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - -var Z_NO_FLUSH = 0; -var Z_FINISH = 4; - -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_SYNC_FLUSH = 2; - -var Z_DEFAULT_COMPRESSION = -1; - -var Z_DEFAULT_STRATEGY = 0; - -var Z_DEFLATED = 8; - -/* ===========================================================================*/ - - -/** - * class Deflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[deflate]], - * [[deflateRaw]] and [[gzip]]. - **/ - -/* internal - * Deflate.chunks -> Array - * - * Chunks of output data, if [[Deflate#onData]] not overridden. - **/ - -/** - * Deflate.result -> Uint8Array|Array - * - * Compressed result, generated by default [[Deflate#onData]] - * and [[Deflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Deflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Deflate.err -> Number - * - * Error code after deflate finished. 0 (Z_OK) on success. - * You will not need it in real life, because deflate errors - * are possible only on wrong options or bad `onData` / `onEnd` - * custom handlers. - **/ - -/** - * Deflate.msg -> String - * - * Error message, if [[Deflate.err]] != 0 - **/ - - -/** - * new Deflate(options) - * - options (Object): zlib deflate options. - * - * Creates new deflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `level` - * - `windowBits` - * - `memLevel` - * - `strategy` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw deflate - * - `gzip` (Boolean) - create gzip wrapper - * - `to` (String) - if equal to 'string', then result will be "binary string" - * (each char code [0..255]) - * - `header` (Object) - custom header for gzip - * - `text` (Boolean) - true if compressed data believed to be text - * - `time` (Number) - modification time, unix timestamp - * - `os` (Number) - operation system code - * - `extra` (Array) - array of bytes with extra data (max 65536) - * - `name` (String) - file name (binary string) - * - `comment` (String) - comment (binary string) - * - `hcrc` (Boolean) - true if header crc should be added - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var deflate = new pako.Deflate({ level: 3}); - * - * deflate.push(chunk1, false); - * deflate.push(chunk2, true); // true -> last chunk - * - * if (deflate.err) { throw new Error(deflate.err); } - * - * console.log(deflate.result); - * ``` - **/ -function Deflate(options) { - if (!(this instanceof Deflate)) return new Deflate(options); - - this.options = utils.assign({ - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY, - to: '' - }, options || {}); - - var opt = this.options; - - if (opt.raw && (opt.windowBits > 0)) { - opt.windowBits = -opt.windowBits; - } - - else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { - opt.windowBits += 16; - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_deflate.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy - ); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - if (opt.header) { - zlib_deflate.deflateSetHeader(this.strm, opt.header); - } - - if (opt.dictionary) { - var dict; - // Convert data if needed - if (typeof opt.dictionary === 'string') { - // If we need to compress text, change encoding to utf8. - dict = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - - status = zlib_deflate.deflateSetDictionary(this.strm, dict); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - this._dict_set = true; - } -} - -/** - * Deflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be - * converted to utf8 byte sequence. - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. - * - * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with - * new compressed chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the compression context. - * - * On fail call [[Deflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * array format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Deflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var status, _mode; - - if (this.ended) { return false; } - - _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // If we need to compress text, change encoding to utf8. - strm.input = strings.string2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ - - if (status !== Z_STREAM_END && status !== Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { - if (this.options.to === 'string') { - this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); - - // Finalize on the last chunk. - if (_mode === Z_FINISH) { - status = zlib_deflate.deflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === Z_OK; - } - - // callback interim results if Z_SYNC_FLUSH. - if (_mode === Z_SYNC_FLUSH) { - this.onEnd(Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Deflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): output data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Deflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Deflate#onEnd(status) -> Void - * - status (Number): deflate status. 0 (Z_OK) on success, - * other if not. - * - * Called once after you tell deflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `results` / `err` properties. - **/ -Deflate.prototype.onEnd = function (status) { - // On success - join - if (status === Z_OK) { - if (this.options.to === 'string') { - this.result = this.chunks.join(''); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * deflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * Compress `data` with deflate algorithm and `options`. - * - * Supported options are: - * - * - level - * - windowBits - * - memLevel - * - strategy - * - dictionary - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then result will be "binary string" - * (each char code [0..255]) - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); - * - * console.log(pako.deflate(data)); - * ``` - **/ -function deflate(input, options) { - var deflator = new Deflate(options); - - deflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (deflator.err) { throw deflator.msg || msg[deflator.err]; } - - return deflator.result; -} - - -/** - * deflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function deflateRaw(input, options) { - options = options || {}; - options.raw = true; - return deflate(input, options); -} - - -/** - * gzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but create gzip wrapper instead of - * deflate one. - **/ -function gzip(input, options) { - options = options || {}; - options.gzip = true; - return deflate(input, options); -} - - -exports.Deflate = Deflate; -exports.deflate = deflate; -exports.deflateRaw = deflateRaw; -exports.gzip = gzip; - -},{"./utils/common":89,"./utils/strings":90,"./zlib/deflate":94,"./zlib/messages":99,"./zlib/zstream":101}],88:[function(require,module,exports){ -'use strict'; - - -var zlib_inflate = require('./zlib/inflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var c = require('./zlib/constants'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); -var GZheader = require('./zlib/gzheader'); - -var toString = Object.prototype.toString; - -/** - * class Inflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[inflate]] - * and [[inflateRaw]]. - **/ - -/* internal - * inflate.chunks -> Array - * - * Chunks of output data, if [[Inflate#onData]] not overridden. - **/ - -/** - * Inflate.result -> Uint8Array|Array|String - * - * Uncompressed result, generated by default [[Inflate#onData]] - * and [[Inflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Inflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Inflate.err -> Number - * - * Error code after inflate finished. 0 (Z_OK) on success. - * Should be checked if broken data possible. - **/ - -/** - * Inflate.msg -> String - * - * Error message, if [[Inflate.err]] != 0 - **/ - - -/** - * new Inflate(options) - * - options (Object): zlib inflate options. - * - * Creates new inflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `windowBits` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw inflate - * - `to` (String) - if equal to 'string', then result will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * By default, when no options set, autodetect deflate/gzip data format via - * wrapper header. - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var inflate = new pako.Inflate({ level: 3}); - * - * inflate.push(chunk1, false); - * inflate.push(chunk2, true); // true -> last chunk - * - * if (inflate.err) { throw new Error(inflate.err); } - * - * console.log(inflate.result); - * ``` - **/ -function Inflate(options) { - if (!(this instanceof Inflate)) return new Inflate(options); - - this.options = utils.assign({ - chunkSize: 16384, - windowBits: 0, - to: '' - }, options || {}); - - var opt = this.options; - - // Force window size for `raw` data, if not set directly, - // because we have no header for autodetect. - if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { opt.windowBits = -15; } - } - - // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate - if ((opt.windowBits >= 0) && (opt.windowBits < 16) && - !(options && options.windowBits)) { - opt.windowBits += 32; - } - - // Gzip header has no info about windows size, we can do autodetect only - // for deflate. So, if window size not set, force it to max when gzip possible - if ((opt.windowBits > 15) && (opt.windowBits < 48)) { - // bit 3 (16) -> gzipped data - // bit 4 (32) -> autodetect gzip/deflate - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_inflate.inflateInit2( - this.strm, - opt.windowBits - ); - - if (status !== c.Z_OK) { - throw new Error(msg[status]); - } - - this.header = new GZheader(); - - zlib_inflate.inflateGetHeader(this.strm, this.header); -} - -/** - * Inflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. - * - * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with - * new output chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the decompression context. - * - * On fail call [[Inflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Inflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var dictionary = this.options.dictionary; - var status, _mode; - var next_out_utf8, tail, utf8str; - var dict; - - // Flag to properly process Z_BUF_ERROR on testing inflate call - // when we check that all output data was flushed. - var allowBufError = false; - - if (this.ended) { return false; } - _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // Only binary strings can be decompressed on practice - strm.input = strings.binstring2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - - status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ - - if (status === c.Z_NEED_DICT && dictionary) { - // Convert data if needed - if (typeof dictionary === 'string') { - dict = strings.string2buf(dictionary); - } else if (toString.call(dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(dictionary); - } else { - dict = dictionary; - } - - status = zlib_inflate.inflateSetDictionary(this.strm, dict); - - } - - if (status === c.Z_BUF_ERROR && allowBufError === true) { - status = c.Z_OK; - allowBufError = false; - } - - if (status !== c.Z_STREAM_END && status !== c.Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - - if (strm.next_out) { - if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { - - if (this.options.to === 'string') { - - next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - - tail = strm.next_out - next_out_utf8; - utf8str = strings.buf2string(strm.output, next_out_utf8); - - // move tail - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } - - this.onData(utf8str); - - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } - - // When no more input data, we should check that internal inflate buffers - // are flushed. The only way to do it when avail_out = 0 - run one more - // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. - // Here we set flag to process this error properly. - // - // NOTE. Deflate does not return error in this case and does not needs such - // logic. - if (strm.avail_in === 0 && strm.avail_out === 0) { - allowBufError = true; - } - - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); - - if (status === c.Z_STREAM_END) { - _mode = c.Z_FINISH; - } - - // Finalize on the last chunk. - if (_mode === c.Z_FINISH) { - status = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === c.Z_OK; - } - - // callback interim results if Z_SYNC_FLUSH. - if (_mode === c.Z_SYNC_FLUSH) { - this.onEnd(c.Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Inflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): output data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Inflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Inflate#onEnd(status) -> Void - * - status (Number): inflate status. 0 (Z_OK) on success, - * other if not. - * - * Called either after you tell inflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `results` / `err` properties. - **/ -Inflate.prototype.onEnd = function (status) { - // On success - join - if (status === c.Z_OK) { - if (this.options.to === 'string') { - // Glue & convert here, until we teach pako to send - // utf8 aligned strings to onData - this.result = this.chunks.join(''); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * inflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Decompress `data` with inflate/ungzip and `options`. Autodetect - * format via wrapper header by default. That's why we don't provide - * separate `ungzip` method. - * - * Supported options are: - * - * - windowBits - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then result will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) - * , output; - * - * try { - * output = pako.inflate(input); - * } catch (err) - * console.log(err); - * } - * ``` - **/ -function inflate(input, options) { - var inflator = new Inflate(options); - - inflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (inflator.err) { throw inflator.msg || msg[inflator.err]; } - - return inflator.result; -} - - -/** - * inflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * The same as [[inflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function inflateRaw(input, options) { - options = options || {}; - options.raw = true; - return inflate(input, options); -} - - -/** - * ungzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Just shortcut to [[inflate]], because it autodetects format - * by header.content. Done for convenience. - **/ - - -exports.Inflate = Inflate; -exports.inflate = inflate; -exports.inflateRaw = inflateRaw; -exports.ungzip = inflate; - -},{"./utils/common":89,"./utils/strings":90,"./zlib/constants":92,"./zlib/gzheader":95,"./zlib/inflate":97,"./zlib/messages":99,"./zlib/zstream":101}],89:[function(require,module,exports){ -arguments[4][36][0].apply(exports,arguments) -},{"dup":36}],90:[function(require,module,exports){ -// String encode/decode helpers -'use strict'; - - -var utils = require('./common'); - - -// Quick check if we can use fast array to bin string conversion -// -// - apply(Array) can fail on Android 2.2 -// - apply(Uint8Array) can fail on iOS 5.1 Safari -// -var STR_APPLY_OK = true; -var STR_APPLY_UIA_OK = true; - -try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } -try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } - - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new utils.Buf8(256); -for (var q = 0; q < 256; q++) { - _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); -} -_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - - -// convert string to array (typed, when possible) -exports.string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - buf = new utils.Buf8(buf_len); - - // convert - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Helper (used in 2 places) -function buf2binstring(buf, len) { - // use fallback for big arrays to avoid stack overflow - if (len < 65537) { - if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { - return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); - } - } - - var result = ''; - for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); - } - return result; -} - - -// Convert byte array to binary string -exports.buf2binstring = function (buf) { - return buf2binstring(buf, buf.length); -}; - - -// Convert binary string (typed, when possible) -exports.binstring2buf = function (str) { - var buf = new utils.Buf8(str.length); - for (var i = 0, len = buf.length; i < len; i++) { - buf[i] = str.charCodeAt(i); - } - return buf; -}; - - -// convert array to string -exports.buf2string = function (buf, max) { - var i, out, c, c_len; - var len = max || buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len * 2); - - for (out = 0, i = 0; i < len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - return buf2binstring(utf16buf, out); -}; - - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -exports.utf8border = function (buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max - 1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means buffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -},{"./common":89}],91:[function(require,module,exports){ -arguments[4][37][0].apply(exports,arguments) -},{"dup":37}],92:[function(require,module,exports){ -arguments[4][38][0].apply(exports,arguments) -},{"dup":38}],93:[function(require,module,exports){ -arguments[4][39][0].apply(exports,arguments) -},{"dup":39}],94:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var trees = require('./trees'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var msg = require('./messages'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -//var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -//var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -//var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - - -/* compression levels */ -//var Z_NO_COMPRESSION = 0; -//var Z_BEST_SPEED = 1; -//var Z_BEST_COMPRESSION = 9; -var Z_DEFAULT_COMPRESSION = -1; - - -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_RLE = 3; -var Z_FIXED = 4; -var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//var Z_BINARY = 0; -//var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - - -/* The deflate compression method */ -var Z_DEFLATED = 8; - -/*============================================================================*/ - - -var MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_MEM_LEVEL = 8; - - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -var LITERALS = 256; -/* number of literal bytes 0..255 */ -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -var D_CODES = 30; -/* number of distance codes */ -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var EXTRA_STATE = 69; -var NAME_STATE = 73; -var COMMENT_STATE = 91; -var HCRC_STATE = 103; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ -var BS_BLOCK_DONE = 2; /* block flush performed */ -var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ -var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - -var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - - -function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -} - - -function put_byte(s, b) { - s.pending_buf[s.pending++] = b; -} - - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s, b) { -// put_byte(s, (Byte)(b >> 8)); -// put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; -//#if MIN_MATCH != 3 -// Call update_hash() MIN_MATCH-3 more times -//#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ -// if (s.high_water < s.window_size) { -// var curr = s.strstart + s.lookahead; -// var init = 0; -// -// if (s.high_water < curr) { -// /* Previous high water mark below current data -- zero WIN_INIT -// * bytes or up to end of window, whichever is less. -// */ -// init = s.window_size - curr; -// if (init > WIN_INIT) -// init = WIN_INIT; -// zmemzero(s->window + curr, (unsigned)init); -// s->high_water = curr + init; -// } -// else if (s->high_water < (ulg)curr + WIN_INIT) { -// /* High water mark at or above current data, but below current data -// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up -// * to end of window, whichever is less. -// */ -// init = (ulg)curr + WIN_INIT - s->high_water; -// if (init > s->window_size - s->high_water) -// init = s->window_size - s->high_water; -// zmemzero(s->window + s->high_water, (unsigned)init); -// s->high_water += init; -// } -// } -// -// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, -// "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); -// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || -// s.block_start >= s.w_size)) { -// throw new Error("slide too late"); -// } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); -// if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - -//#if MIN_MATCH != 3 -// Call UPDATE_HASH() MIN_MATCH-3 more times -//#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} - -var configuration_table; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ -]; - - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - - -function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ -} - - -function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - - -function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - - -function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; -} - - -function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -} - - -function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - -//#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } -//#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; -} - - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} - - -exports.deflateInit = deflateInit; -exports.deflateInit2 = deflateInit2; -exports.deflateReset = deflateReset; -exports.deflateResetKeep = deflateResetKeep; -exports.deflateSetHeader = deflateSetHeader; -exports.deflate = deflate; -exports.deflateEnd = deflateEnd; -exports.deflateSetDictionary = deflateSetDictionary; -exports.deflateInfo = 'pako deflate (from Nodeca project)'; - -/* Not implemented -exports.deflateBound = deflateBound; -exports.deflateCopy = deflateCopy; -exports.deflateParams = deflateParams; -exports.deflatePending = deflatePending; -exports.deflatePrime = deflatePrime; -exports.deflateTune = deflateTune; -*/ - -},{"../utils/common":89,"./adler32":91,"./crc32":93,"./messages":99,"./trees":100}],95:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function GZheader() { - /* true if compressed data believed to be text */ - this.text = 0; - /* modification time */ - this.time = 0; - /* extra flags (not used when writing a gzip file) */ - this.xflags = 0; - /* operating system */ - this.os = 0; - /* pointer to extra field or Z_NULL if none */ - this.extra = null; - /* extra field length (valid if extra != Z_NULL) */ - this.extra_len = 0; // Actually, we don't need it in JS, - // but leave for few code modifications - - // - // Setup limits is not necessary because in js we should not preallocate memory - // for inflate use constant limit in 65536 bytes - // - - /* space at extra (only when reading header) */ - // this.extra_max = 0; - /* pointer to zero-terminated file name or Z_NULL */ - this.name = ''; - /* space at name (only when reading header) */ - // this.name_max = 0; - /* pointer to zero-terminated comment or Z_NULL */ - this.comment = ''; - /* space at comment (only when reading header) */ - // this.comm_max = 0; - /* true if there was or will be a header crc */ - this.hcrc = 0; - /* true when done reading gzip header (not used when writing a gzip file) */ - this.done = false; -} - -module.exports = GZheader; - -},{}],96:[function(require,module,exports){ -arguments[4][41][0].apply(exports,arguments) -},{"dup":41}],97:[function(require,module,exports){ -arguments[4][42][0].apply(exports,arguments) -},{"../utils/common":89,"./adler32":91,"./crc32":93,"./inffast":96,"./inftrees":98,"dup":42}],98:[function(require,module,exports){ -arguments[4][43][0].apply(exports,arguments) -},{"../utils/common":89,"dup":43}],99:[function(require,module,exports){ -arguments[4][44][0].apply(exports,arguments) -},{"dup":44}],100:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -//var Z_FILTERED = 1; -//var Z_HUFFMAN_ONLY = 2; -//var Z_RLE = 3; -var Z_FIXED = 4; -//var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -var Z_BINARY = 0; -var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - -/*============================================================================*/ - - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - -// From zutil.h - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; -/* The three kinds of block type */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -var LITERALS = 256; -/* number of literal bytes 0..255 */ - -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -var D_CODES = 30; -/* number of distance codes */ - -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var Buf_size = 16; -/* size of bit buffer in bi_buf */ - - -/* =========================================================================== - * Constants - */ - -var MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -var END_BLOCK = 256; -/* end of block literal code */ - -var REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -var REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -var REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - -var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - -var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - -var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 -var static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -var static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -var _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -var base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -var base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - - -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; -} - - -var static_l_desc; -var static_d_desc; -var static_bl_desc; - - -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ -} - - - -function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s, w) { -// put_byte(s, (uch)((w) & 0xff)); -// put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - - -function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); -} - - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } -} - - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree, max_code, bl_count) -// ct_data *tree; /* the tree to decorate */ -// int max_code; /* largest code with non zero frequency */ -// ushf *bl_count; /* number of codes at each bit length */ -{ - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; -} - - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s) -{ - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s, buf, len, header) -//DeflateState *s; -//charf *buf; /* the input data */ -//unsigned len; /* its length */ -//int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } -// while (len--) { -// put_byte(s, *buf++); -// } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s, tree, k) -// deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - - -// inlined manually -// var SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s, ltree, dtree) -// deflate_state *s; -// const ct_data *ltree; /* literal tree */ -// const ct_data *dtree; /* distance tree */ -{ - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s, lcodes, dcodes, blcodes) -// deflate_state *s; -// int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - - -var static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -function _tr_init(s) -{ - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - - -/* =========================================================================== - * Send a stored block - */ -function _tr_stored_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -function _tr_flush_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block, or NULL if too old */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -function _tr_tally(s, dist, lc) -// deflate_state *s; -// unsigned dist; /* distance of matched string */ -// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility - -//#ifdef TRUNCATE_BLOCK -// /* Try to guess if it is profitable to stop the current block here */ -// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { -// /* Compute an upper bound for the compressed length */ -// out_length = s.last_lit*8; -// in_length = s.strstart - s.block_start; -// -// for (dcode = 0; dcode < D_CODES; dcode++) { -// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); -// } -// out_length >>>= 3; -// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", -// // s->last_lit, in_length, out_length, -// // 100L - out_length*100L/in_length)); -// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { -// return true; -// } -// } -//#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -exports._tr_init = _tr_init; -exports._tr_stored_block = _tr_stored_block; -exports._tr_flush_block = _tr_flush_block; -exports._tr_tally = _tr_tally; -exports._tr_align = _tr_align; - -},{"../utils/common":89}],101:[function(require,module,exports){ -arguments[4][46][0].apply(exports,arguments) -},{"dup":46}],102:[function(require,module,exports){ -module.exports = function parseBMFontAscii(data) { - if (!data) - throw new Error('no data provided') - data = data.toString().trim() - - var output = { - pages: [], - chars: [], - kernings: [] - } - - var lines = data.split(/\r\n?|\n/g) - - if (lines.length === 0) - throw new Error('no data in BMFont file') - - for (var i = 0; i < lines.length; i++) { - var lineData = splitLine(lines[i], i) - if (!lineData) //skip empty lines - continue - - if (lineData.key === 'page') { - if (typeof lineData.data.id !== 'number') - throw new Error('malformed file at line ' + i + ' -- needs page id=N') - if (typeof lineData.data.file !== 'string') - throw new Error('malformed file at line ' + i + ' -- needs page file="path"') - output.pages[lineData.data.id] = lineData.data.file - } else if (lineData.key === 'chars' || lineData.key === 'kernings') { - //... do nothing for these two ... - } else if (lineData.key === 'char') { - output.chars.push(lineData.data) - } else if (lineData.key === 'kerning') { - output.kernings.push(lineData.data) - } else { - output[lineData.key] = lineData.data - } - } - - return output -} - -function splitLine(line, idx) { - line = line.replace(/\t+/g, ' ').trim() - if (!line) - return null - - var space = line.indexOf(' ') - if (space === -1) - throw new Error("no named row at line " + idx) - - var key = line.substring(0, space) - - line = line.substring(space + 1) - //clear "letter" field as it is non-standard and - //requires additional complexity to parse " / = symbols - line = line.replace(/letter=[\'\"]\S+[\'\"]/gi, '') - line = line.split("=") - line = line.map(function(str) { - return str.trim().match((/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)) - }) - - var data = [] - for (var i = 0; i < line.length; i++) { - var dt = line[i] - if (i === 0) { - data.push({ - key: dt[0], - data: "" - }) - } else if (i === line.length - 1) { - data[data.length - 1].data = parseData(dt[0]) - } else { - data[data.length - 1].data = parseData(dt[0]) - data.push({ - key: dt[1], - data: "" - }) - } - } - - var out = { - key: key, - data: {} - } - - data.forEach(function(v) { - out.data[v.key] = v.data; - }) - - return out -} - -function parseData(data) { - if (!data || data.length === 0) - return "" - - if (data.indexOf('"') === 0 || data.indexOf("'") === 0) - return data.substring(1, data.length - 1) - if (data.indexOf(',') !== -1) - return parseIntList(data) - return parseInt(data, 10) -} - -function parseIntList(data) { - return data.split(',').map(function(val) { - return parseInt(val, 10) - }) -} -},{}],103:[function(require,module,exports){ -var HEADER = [66, 77, 70] - -module.exports = function readBMFontBinary(buf) { - if (buf.length < 6) - throw new Error('invalid buffer length for BMFont') - - var header = HEADER.every(function(byte, i) { - return buf.readUInt8(i) === byte - }) - - if (!header) - throw new Error('BMFont missing BMF byte header') - - var i = 3 - var vers = buf.readUInt8(i++) - if (vers > 3) - throw new Error('Only supports BMFont Binary v3 (BMFont App v1.10)') - - var target = { kernings: [], chars: [] } - for (var b=0; b<5; b++) - i += readBlock(target, buf, i) - return target -} - -function readBlock(target, buf, i) { - if (i > buf.length-1) - return 0 - - var blockID = buf.readUInt8(i++) - var blockSize = buf.readInt32LE(i) - i += 4 - - switch(blockID) { - case 1: - target.info = readInfo(buf, i) - break - case 2: - target.common = readCommon(buf, i) - break - case 3: - target.pages = readPages(buf, i, blockSize) - break - case 4: - target.chars = readChars(buf, i, blockSize) - break - case 5: - target.kernings = readKernings(buf, i, blockSize) - break - } - return 5 + blockSize -} - -function readInfo(buf, i) { - var info = {} - info.size = buf.readInt16LE(i) - - var bitField = buf.readUInt8(i+2) - info.smooth = (bitField >> 7) & 1 - info.unicode = (bitField >> 6) & 1 - info.italic = (bitField >> 5) & 1 - info.bold = (bitField >> 4) & 1 - - //fixedHeight is only mentioned in binary spec - if ((bitField >> 3) & 1) - info.fixedHeight = 1 - - info.charset = buf.readUInt8(i+3) || '' - info.stretchH = buf.readUInt16LE(i+4) - info.aa = buf.readUInt8(i+6) - info.padding = [ - buf.readInt8(i+7), - buf.readInt8(i+8), - buf.readInt8(i+9), - buf.readInt8(i+10) - ] - info.spacing = [ - buf.readInt8(i+11), - buf.readInt8(i+12) - ] - info.outline = buf.readUInt8(i+13) - info.face = readStringNT(buf, i+14) - return info -} - -function readCommon(buf, i) { - var common = {} - common.lineHeight = buf.readUInt16LE(i) - common.base = buf.readUInt16LE(i+2) - common.scaleW = buf.readUInt16LE(i+4) - common.scaleH = buf.readUInt16LE(i+6) - common.pages = buf.readUInt16LE(i+8) - var bitField = buf.readUInt8(i+10) - common.packed = 0 - common.alphaChnl = buf.readUInt8(i+11) - common.redChnl = buf.readUInt8(i+12) - common.greenChnl = buf.readUInt8(i+13) - common.blueChnl = buf.readUInt8(i+14) - return common -} - -function readPages(buf, i, size) { - var pages = [] - var text = readNameNT(buf, i) - var len = text.length+1 - var count = size / len - for (var c=0; c element') - var pages = pageRoot.getElementsByTagName('page') - for (var i=0; i 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; - -function basename(path) { - if (typeof path !== 'string') path = path + ''; - - var start = 0; - var end = -1; - var matchedSlash = true; - var i; - - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ''; - return path.slice(start, end); -} - -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -}).call(this,require('_process')) -},{"_process":133}],108:[function(require,module,exports){ -(function (Buffer){ -'use strict';var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};var http=require('http');var https=require('https');var url=require('url');var qs=require('querystring');var zlib=require('zlib');var util=require('util');var phin=function phin(opts,cb){if(typeof opts!=='string'){if(!opts.hasOwnProperty('url')){throw new Error('Missing url option from options for request method.')}}var addr=(typeof opts==='undefined'?'undefined':_typeof(opts))==='object'?url.parse(opts.url):url.parse(opts);var options={'hostname':addr.hostname,'port':addr.port||(addr.protocol.toLowerCase()==='http:'?80:443),'path':addr.path,'method':'GET','headers':{},'auth':addr.auth||null,'parse':'none','stream':false};if((typeof opts==='undefined'?'undefined':_typeof(opts))==='object'){options=Object.assign(options,opts)}options.port=Number(options.port);if(options.hasOwnProperty('timeout'))delete options.timeout;if(options.compressed===true){options.headers['accept-encoding']='gzip, deflate'}if(opts.hasOwnProperty('form')){if(_typeof(opts.form)!=='object'){throw new Error('phin \'form\' option must be of type Object if present.')}var formDataString=qs.stringify(opts.form);options.headers['Content-Type']='application/x-www-form-urlencoded';options.headers['Content-Length']=Buffer.byteLength(formDataString);opts.data=formDataString}var req=void 0;var resHandler=function resHandler(res){var stream=res;if(options.compressed===true){if(res.headers['content-encoding']==='gzip'){stream=res.pipe(zlib.createGunzip())}else if(res.headers['content-encoding']==='deflate'){stream=res.pipe(zlib.createInflate())}}if(options.stream===true){res.stream=stream;cb(null,res)}else{res.body=new Buffer([]);stream.on('data',function(chunk){res.body=Buffer.concat([res.body,chunk])});stream.on('end',function(){if(cb){if(options.parse==='json'){try{res.body=JSON.parse(res.body.toString())}catch(err){cb('Invalid JSON received.',res);return}}cb(null,res)}})}};switch(addr.protocol.toLowerCase()){case'http:':req=http.request(options,resHandler);break;case'https:':req=https.request(options,resHandler);break;default:if(cb){cb(new Error('Invalid / unknown URL protocol. Expected HTTP or HTTPS.'),null)}return;}if(typeof opts.timeout==='number'){req.setTimeout(opts.timeout,function(){req.abort();cb(new Error('Timeout has been reached.'),null);cb=null})}req.on('error',function(err){if(cb){cb(err,null)}});if(opts.hasOwnProperty('data')){var postData=opts.data;if(!(opts.data instanceof Buffer)&&_typeof(opts.data)==='object'){var contentType=options.headers['content-type']||options.headers['Content-Type'];if(contentType==='application/x-www-form-urlencoded'){postData=qs.stringify(opts.data)}else{try{postData=JSON.stringify(opts.data)}catch(err){cb(new Error('Couldn\'t stringify object. (Likely due to a circular reference.)'),null)}}}req.write(postData)}req.end()};phin.promisified=function(opts,http){return new Promise(function(resolve,reject){phin(opts,function(err,res){if(err){reject(err)}else{resolve(res)}},http)})};if(util.promisify){phin[util.promisify.custom]=phin.promisified}module.exports=phin; - -}).call(this,require("buffer").Buffer) -},{"buffer":48,"http":156,"https":72,"querystring":137,"url":180,"util":186,"zlib":35}],109:[function(require,module,exports){ -'use strict'; - -module.exports = pixelmatch; - -function pixelmatch(img1, img2, output, width, height, options) { - - if (!options) options = {}; - - var threshold = options.threshold === undefined ? 0.1 : options.threshold; - - // maximum acceptable square distance between two colors; - // 35215 is the maximum possible value for the YIQ difference metric - var maxDelta = 35215 * threshold * threshold, - diff = 0; - - // compare each pixel of one image against the other one - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - - var pos = (y * width + x) * 4; - - // squared YUV distance between colors at this pixel position - var delta = colorDelta(img1, img2, pos, pos); - - // the color difference is above the threshold - if (delta > maxDelta) { - // check it's a real rendering difference or just anti-aliasing - if (!options.includeAA && (antialiased(img1, x, y, width, height, img2) || - antialiased(img2, x, y, width, height, img1))) { - // one of the pixels is anti-aliasing; draw as yellow and do not count as difference - if (output) drawPixel(output, pos, 255, 255, 0); - - } else { - // found substantial difference not caused by anti-aliasing; draw it as red - if (output) drawPixel(output, pos, 255, 0, 0); - diff++; - } - - } else if (output) { - // pixels are similar; draw background as grayscale image blended with white - var val = blend(grayPixel(img1, pos), 0.1); - drawPixel(output, pos, val, val, val); - } - } - } - - // return the number of different pixels - return diff; -} - -// check if a pixel is likely a part of anti-aliasing; -// based on "Anti-aliased Pixel and Intensity Slope Detector" paper by V. Vysniauskas, 2009 - -function antialiased(img, x1, y1, width, height, img2) { - var x0 = Math.max(x1 - 1, 0), - y0 = Math.max(y1 - 1, 0), - x2 = Math.min(x1 + 1, width - 1), - y2 = Math.min(y1 + 1, height - 1), - pos = (y1 * width + x1) * 4, - zeroes = 0, - positives = 0, - negatives = 0, - min = 0, - max = 0, - minX, minY, maxX, maxY; - - // go through 8 adjacent pixels - for (var x = x0; x <= x2; x++) { - for (var y = y0; y <= y2; y++) { - if (x === x1 && y === y1) continue; - - // brightness delta between the center pixel and adjacent one - var delta = colorDelta(img, img, pos, (y * width + x) * 4, true); - - // count the number of equal, darker and brighter adjacent pixels - if (delta === 0) zeroes++; - else if (delta < 0) negatives++; - else if (delta > 0) positives++; - - // if found more than 2 equal siblings, it's definitely not anti-aliasing - if (zeroes > 2) return false; - - if (!img2) continue; - - // remember the darkest pixel - if (delta < min) { - min = delta; - minX = x; - minY = y; - } - // remember the brightest pixel - if (delta > max) { - max = delta; - maxX = x; - maxY = y; - } - } - } - - if (!img2) return true; - - // if there are no both darker and brighter pixels among siblings, it's not anti-aliasing - if (negatives === 0 || positives === 0) return false; - - // if either the darkest or the brightest pixel has more than 2 equal siblings in both images - // (definitely not anti-aliased), this pixel is anti-aliased - return (!antialiased(img, minX, minY, width, height) && !antialiased(img2, minX, minY, width, height)) || - (!antialiased(img, maxX, maxY, width, height) && !antialiased(img2, maxX, maxY, width, height)); -} - -// calculate color difference according to the paper "Measuring perceived color difference -// using YIQ NTSC transmission color space in mobile applications" by Y. Kotsarenko and F. Ramos - -function colorDelta(img1, img2, k, m, yOnly) { - var a1 = img1[k + 3] / 255, - a2 = img2[m + 3] / 255, - - r1 = blend(img1[k + 0], a1), - g1 = blend(img1[k + 1], a1), - b1 = blend(img1[k + 2], a1), - - r2 = blend(img2[m + 0], a2), - g2 = blend(img2[m + 1], a2), - b2 = blend(img2[m + 2], a2), - - y = rgb2y(r1, g1, b1) - rgb2y(r2, g2, b2); - - if (yOnly) return y; // brightness difference only - - var i = rgb2i(r1, g1, b1) - rgb2i(r2, g2, b2), - q = rgb2q(r1, g1, b1) - rgb2q(r2, g2, b2); - - return 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q; -} - -function rgb2y(r, g, b) { return r * 0.29889531 + g * 0.58662247 + b * 0.11448223; } -function rgb2i(r, g, b) { return r * 0.59597799 - g * 0.27417610 - b * 0.32180189; } -function rgb2q(r, g, b) { return r * 0.21147017 - g * 0.52261711 + b * 0.31114694; } - -// blend semi-transparent color with white -function blend(c, a) { - return 255 + (c - 255) * a; -} - -function drawPixel(output, pos, r, g, b) { - output[pos + 0] = r; - output[pos + 1] = g; - output[pos + 2] = b; - output[pos + 3] = 255; -} - -function grayPixel(img, i) { - var a = img[i + 3] / 255, - r = blend(img[i + 0], a), - g = blend(img[i + 1], a), - b = blend(img[i + 2], a); - return rgb2y(r, g, b); -} - -},{}],110:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var interlaceUtils = require('./interlace'); - -var pixelBppMap = { - 1: { // L - 0: 0, - 1: 0, - 2: 0, - 3: 0xff - }, - 2: { // LA - 0: 0, - 1: 0, - 2: 0, - 3: 1 - }, - 3: { // RGB - 0: 0, - 1: 1, - 2: 2, - 3: 0xff - }, - 4: { // RGBA - 0: 0, - 1: 1, - 2: 2, - 3: 3 - } -}; - -function bitRetriever(data, depth) { - - var leftOver = []; - var i = 0; - - function split() { - if (i === data.length) { - throw new Error('Ran out of data'); - } - var byte = data[i]; - i++; - var byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; - switch (depth) { - default: - throw new Error('unrecognised depth'); - case 16: - byte2 = data[i]; - i++; - leftOver.push(((byte << 8) + byte2)); - break; - case 4: - byte2 = byte & 0x0f; - byte1 = byte >> 4; - leftOver.push(byte1, byte2); - break; - case 2: - byte4 = byte & 3; - byte3 = byte >> 2 & 3; - byte2 = byte >> 4 & 3; - byte1 = byte >> 6 & 3; - leftOver.push(byte1, byte2, byte3, byte4); - break; - case 1: - byte8 = byte & 1; - byte7 = byte >> 1 & 1; - byte6 = byte >> 2 & 1; - byte5 = byte >> 3 & 1; - byte4 = byte >> 4 & 1; - byte3 = byte >> 5 & 1; - byte2 = byte >> 6 & 1; - byte1 = byte >> 7 & 1; - leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8); - break; - } - } - - return { - get: function(count) { - while (leftOver.length < count) { - split(); - } - var returner = leftOver.slice(0, count); - leftOver = leftOver.slice(count); - return returner; - }, - resetAfterLine: function() { - leftOver.length = 0; - }, - end: function() { - if (i !== data.length) { - throw new Error('extra data found'); - } - } - }; -} - -function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pxPos = getPxPos(x, y, imagePass); - - for (var i = 0; i < 4; i++) { - var idx = pixelBppMap[bpp][i]; - if (idx === 0xff) { - pxData[pxPos + i] = 0xff; - } else { - var dataPos = idx + rawPos; - if (dataPos === data.length) { - throw new Error('Ran out of data'); - } - pxData[pxPos + i] = data[dataPos]; - } - } - rawPos += bpp; //eslint-disable-line no-param-reassign - } - } - return rawPos; -} - -function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pixelData = bits.get(bpp); - var pxPos = getPxPos(x, y, imagePass); - - for (var i = 0; i < 4; i++) { - var idx = pixelBppMap[bpp][i]; - pxData[pxPos + i] = idx !== 0xff ? pixelData[idx] : maxBit; - } - } - bits.resetAfterLine(); - } -} - -exports.dataToBitMap = function(data, bitmapInfo) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var depth = bitmapInfo.depth; - var bpp = bitmapInfo.bpp; - var interlace = bitmapInfo.interlace; - - if (depth !== 8) { - var bits = bitRetriever(data, depth); - } - var pxData; - if (depth <= 8) { - pxData = new Buffer(width * height * 4); - } - else { - pxData = new Uint16Array(width * height * 4); - } - var maxBit = Math.pow(2, depth) - 1; - var rawPos = 0; - var images; - var getPxPos; - - if (interlace) { - images = interlaceUtils.getImagePasses(width, height); - getPxPos = interlaceUtils.getInterlaceIterator(width, height); - } - else { - var nonInterlacedPxPos = 0; - getPxPos = function() { - var returner = nonInterlacedPxPos; - nonInterlacedPxPos += 4; - return returner; - }; - images = [{ width: width, height: height }]; - } - - for (var imageIndex = 0; imageIndex < images.length; imageIndex++) { - if (depth === 8) { - rawPos = mapImage8Bit(images[imageIndex], pxData, getPxPos, bpp, data, rawPos); - } - else { - mapImageCustomBit(images[imageIndex], pxData, getPxPos, bpp, bits, maxBit); - } - } - if (depth === 8) { - if (rawPos !== data.length) { - throw new Error('extra data found'); - } - } - else { - bits.end(); - } - - return pxData; -}; - -}).call(this,require("buffer").Buffer) -},{"./interlace":120,"buffer":48}],111:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); - -module.exports = function(dataIn, width, height, options) { - var outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(options.colorType) !== -1; - if (options.colorType === options.inputColorType) { - var bigEndian = (function() { - var buffer = new ArrayBuffer(2); - new DataView(buffer).setInt16(0, 256, true /* littleEndian */); - // Int16Array uses the platform's endianness. - return new Int16Array(buffer)[0] !== 256; - })(); - // If no need to convert to grayscale and alpha is present/absent in both, take a fast route - if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)){ - return dataIn; - } - } - - // map to a UInt16 array if data is 16bit, fix endianness below - var data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); - - var maxValue = 255; - var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; - if (inBpp == 4 && !options.inputHasAlpha) inBpp = 3; - var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; - if (options.bitDepth === 16) { - maxValue = 65535; - outBpp *= 2; - } - var outData = new Buffer(width * height * outBpp); - - var inIndex = 0; - var outIndex = 0; - - var bgColor = options.bgColor || {}; - if (bgColor.red === undefined) { - bgColor.red = maxValue; - } - if (bgColor.green === undefined) { - bgColor.green = maxValue; - } - if (bgColor.blue === undefined) { - bgColor.blue = maxValue; - } - - function getRGBA(data, inIndex) { - var red, green, blue, alpha = maxValue; - switch (options.inputColorType) { - case constants.COLORTYPE_COLOR_ALPHA: - alpha = data[inIndex + 3]; - red = data[inIndex]; - green = data[inIndex+1]; - blue = data[inIndex+2]; - break; - case constants.COLORTYPE_COLOR: - red = data[inIndex]; - green = data[inIndex+1]; - blue = data[inIndex+2]; - break; - case constants.COLORTYPE_ALPHA: - alpha = data[inIndex + 1]; - red = data[inIndex]; - green = red; - blue = red; - break; - case constants.COLORTYPE_GRAYSCALE: - red = data[inIndex]; - green = red; - blue = red; - break; - default: - throw new Error('input color type:' + options.inputColorType + ' is not supported at present'); - } - - if (options.inputHasAlpha) { - if (!outHasAlpha) { - alpha /= maxValue; - red = Math.min(Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), maxValue); - green = Math.min(Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), maxValue); - blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue); - } - } - return {red: red, green: green, blue: blue, alpha: alpha}; - } - - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var rgba = getRGBA(data, inIndex); - - switch (options.colorType) { - case constants.COLORTYPE_COLOR_ALPHA: - case constants.COLORTYPE_COLOR: - if (options.bitDepth === 8) { - outData[outIndex] = rgba.red; - outData[outIndex + 1] = rgba.green; - outData[outIndex + 2] = rgba.blue; - if (outHasAlpha) { - outData[outIndex + 3] = rgba.alpha; - } - } else { - outData.writeUInt16BE(rgba.red, outIndex); - outData.writeUInt16BE(rgba.green, outIndex + 2); - outData.writeUInt16BE(rgba.blue, outIndex + 4); - if (outHasAlpha) { - outData.writeUInt16BE(rgba.alpha, outIndex + 6); - } - } - break; - case constants.COLORTYPE_ALPHA: - case constants.COLORTYPE_GRAYSCALE: - // Convert to grayscale and alpha - var grayscale = (rgba.red + rgba.green + rgba.blue) / 3; - if (options.bitDepth === 8) { - outData[outIndex] = grayscale; - if (outHasAlpha) { - outData[outIndex + 1] = rgba.alpha; - } - } else { - outData.writeUInt16BE(grayscale, outIndex); - if (outHasAlpha) { - outData.writeUInt16BE(rgba.alpha, outIndex + 2); - } - } - break; - } - - inIndex += inBpp; - outIndex += outBpp; - } - } - - return outData; -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"buffer":48}],112:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - - -var util = require('util'); -var Stream = require('stream'); - - -var ChunkStream = module.exports = function() { - Stream.call(this); - - this._buffers = []; - this._buffered = 0; - - this._reads = []; - this._paused = false; - - this._encoding = 'utf8'; - this.writable = true; -}; -util.inherits(ChunkStream, Stream); - - -ChunkStream.prototype.read = function(length, callback) { - - this._reads.push({ - length: Math.abs(length), // if length < 0 then at most this length - allowLess: length < 0, - func: callback - }); - - process.nextTick(function() { - this._process(); - - // its paused and there is not enought data then ask for more - if (this._paused && this._reads.length > 0) { - this._paused = false; - - this.emit('drain'); - } - }.bind(this)); -}; - -ChunkStream.prototype.write = function(data, encoding) { - - if (!this.writable) { - this.emit('error', new Error('Stream not writable')); - return false; - } - - var dataBuffer; - if (Buffer.isBuffer(data)) { - dataBuffer = data; - } - else { - dataBuffer = new Buffer(data, encoding || this._encoding); - } - - this._buffers.push(dataBuffer); - this._buffered += dataBuffer.length; - - this._process(); - - // ok if there are no more read requests - if (this._reads && this._reads.length === 0) { - this._paused = true; - } - - return this.writable && !this._paused; -}; - -ChunkStream.prototype.end = function(data, encoding) { - - if (data) { - this.write(data, encoding); - } - - this.writable = false; - - // already destroyed - if (!this._buffers) { - return; - } - - // enqueue or handle end - if (this._buffers.length === 0) { - this._end(); - } - else { - this._buffers.push(null); - this._process(); - } -}; - -ChunkStream.prototype.destroySoon = ChunkStream.prototype.end; - -ChunkStream.prototype._end = function() { - - if (this._reads.length > 0) { - this.emit('error', - new Error('There are some read requests waiting on finished stream') - ); - } - - this.destroy(); -}; - -ChunkStream.prototype.destroy = function() { - - if (!this._buffers) { - return; - } - - this.writable = false; - this._reads = null; - this._buffers = null; - - this.emit('close'); -}; - -ChunkStream.prototype._processReadAllowingLess = function(read) { - // ok there is any data so that we can satisfy this request - this._reads.shift(); // == read - - // first we need to peek into first buffer - var smallerBuf = this._buffers[0]; - - // ok there is more data than we need - if (smallerBuf.length > read.length) { - - this._buffered -= read.length; - this._buffers[0] = smallerBuf.slice(read.length); - - read.func.call(this, smallerBuf.slice(0, read.length)); - - } - else { - // ok this is less than maximum length so use it all - this._buffered -= smallerBuf.length; - this._buffers.shift(); // == smallerBuf - - read.func.call(this, smallerBuf); - } -}; - -ChunkStream.prototype._processRead = function(read) { - this._reads.shift(); // == read - - var pos = 0; - var count = 0; - var data = new Buffer(read.length); - - // create buffer for all data - while (pos < read.length) { - - var buf = this._buffers[count++]; - var len = Math.min(buf.length, read.length - pos); - - buf.copy(data, pos, 0, len); - pos += len; - - // last buffer wasn't used all so just slice it and leave - if (len !== buf.length) { - this._buffers[--count] = buf.slice(len); - } - } - - // remove all used buffers - if (count > 0) { - this._buffers.splice(0, count); - } - - this._buffered -= read.length; - - read.func.call(this, data); -}; - -ChunkStream.prototype._process = function() { - - try { - // as long as there is any data and read requests - while (this._buffered > 0 && this._reads && this._reads.length > 0) { - - var read = this._reads[0]; - - // read any data (but no more than length) - if (read.allowLess) { - this._processReadAllowingLess(read); - - } - else if (this._buffered >= read.length) { - // ok we can meet some expectations - - this._processRead(read); - } - else { - // not enought data to satisfy first request in queue - // so we need to wait for more - break; - } - } - - if (this._buffers && this._buffers.length > 0 && this._buffers[0] === null) { - this._end(); - } - } - catch (ex) { - this.emit('error', ex); - } -}; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":133,"buffer":48,"stream":155,"util":186}],113:[function(require,module,exports){ -'use strict'; - - -module.exports = { - - PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], - - TYPE_IHDR: 0x49484452, - TYPE_IEND: 0x49454e44, - TYPE_IDAT: 0x49444154, - TYPE_PLTE: 0x504c5445, - TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase - TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase - - // color-type bits - COLORTYPE_GRAYSCALE: 0, - COLORTYPE_PALETTE: 1, - COLORTYPE_COLOR: 2, - COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha - - // color-type combinations - COLORTYPE_PALETTE_COLOR: 3, - COLORTYPE_COLOR_ALPHA: 6, - - COLORTYPE_TO_BPP_MAP: { - 0: 1, - 2: 3, - 3: 1, - 4: 2, - 6: 4 - }, - - GAMMA_DIVISION: 100000 -}; - -},{}],114:[function(require,module,exports){ -'use strict'; - -var crcTable = []; - -(function() { - for (var i = 0; i < 256; i++) { - var currentCrc = i; - for (var j = 0; j < 8; j++) { - if (currentCrc & 1) { - currentCrc = 0xedb88320 ^ (currentCrc >>> 1); - } - else { - currentCrc = currentCrc >>> 1; - } - } - crcTable[i] = currentCrc; - } -}()); - -var CrcCalculator = module.exports = function() { - this._crc = -1; -}; - -CrcCalculator.prototype.write = function(data) { - - for (var i = 0; i < data.length; i++) { - this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8); - } - return true; -}; - -CrcCalculator.prototype.crc32 = function() { - return this._crc ^ -1; -}; - - -CrcCalculator.crc32 = function(buf) { - - var crc = -1; - for (var i = 0; i < buf.length; i++) { - crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8); - } - return crc ^ -1; -}; - -},{}],115:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var paethPredictor = require('./paeth-predictor'); - -function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { - rawData[rawPos + x] = pxData[pxPos + x]; - } -} - -function filterSumNone(pxData, pxPos, byteWidth) { - - var sum = 0; - var length = pxPos + byteWidth; - - for (var i = pxPos; i < length; i++) { - sum += Math.abs(pxData[i]); - } - return sum; -} - -function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; - - rawData[rawPos + x] = val; - } -} - -function filterSumSub(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; - - sum += Math.abs(val); - } - - return sum; -} - -function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { - - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - up; - - rawData[rawPos + x] = val; - } -} - -function filterSumUp(pxData, pxPos, byteWidth) { - - var sum = 0; - var length = pxPos + byteWidth; - for (var x = pxPos; x < length; x++) { - - var up = pxPos > 0 ? pxData[x - byteWidth] : 0; - var val = pxData[x] - up; - - sum += Math.abs(val); - } - - return sum; -} - -function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); - - rawData[rawPos + x] = val; - } -} - -function filterSumAvg(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); - - sum += Math.abs(val); - } - - return sum; -} - -function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); - - rawData[rawPos + x] = val; - } -} - -function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); - - sum += Math.abs(val); - } - - return sum; -} - -var filters = { - 0: filterNone, - 1: filterSub, - 2: filterUp, - 3: filterAvg, - 4: filterPaeth -}; - -var filterSums = { - 0: filterSumNone, - 1: filterSumSub, - 2: filterSumUp, - 3: filterSumAvg, - 4: filterSumPaeth -}; - -module.exports = function(pxData, width, height, options, bpp) { - - var filterTypes; - if (!('filterType' in options) || options.filterType === -1) { - filterTypes = [0, 1, 2, 3, 4]; - } - else if (typeof options.filterType === 'number') { - filterTypes = [options.filterType]; - } - else { - throw new Error('unrecognised filter types'); - } - - if (options.bitDepth === 16) bpp *= 2; - var byteWidth = width * bpp; - var rawPos = 0; - var pxPos = 0; - var rawData = new Buffer((byteWidth + 1) * height); - - var sel = filterTypes[0]; - - for (var y = 0; y < height; y++) { - - if (filterTypes.length > 1) { - // find best filter for this line (with lowest sum of values) - var min = Infinity; - - for (var i = 0; i < filterTypes.length; i++) { - var sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); - if (sum < min) { - sel = filterTypes[i]; - min = sum; - } - } - } - - rawData[rawPos] = sel; - rawPos++; - filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp); - rawPos += byteWidth; - pxPos += byteWidth; - } - return rawData; -}; - -}).call(this,require("buffer").Buffer) -},{"./paeth-predictor":124,"buffer":48}],116:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var util = require('util'); -var ChunkStream = require('./chunkstream'); -var Filter = require('./filter-parse'); - - -var FilterAsync = module.exports = function(bitmapInfo) { - ChunkStream.call(this); - - var buffers = []; - var that = this; - this._filter = new Filter(bitmapInfo, { - read: this.read.bind(this), - write: function(buffer) { - buffers.push(buffer); - }, - complete: function() { - that.emit('complete', Buffer.concat(buffers)); - } - }); - - this._filter.start(); -}; -util.inherits(FilterAsync, ChunkStream); - -}).call(this,require("buffer").Buffer) -},{"./chunkstream":112,"./filter-parse":118,"buffer":48,"util":186}],117:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var SyncReader = require('./sync-reader'); -var Filter = require('./filter-parse'); - - -exports.process = function(inBuffer, bitmapInfo) { - - var outBuffers = []; - var reader = new SyncReader(inBuffer); - var filter = new Filter(bitmapInfo, { - read: reader.read.bind(reader), - write: function(bufferPart) { - outBuffers.push(bufferPart); - }, - complete: function() { - } - }); - - filter.start(); - reader.process(); - - return Buffer.concat(outBuffers); -}; -}).call(this,require("buffer").Buffer) -},{"./filter-parse":118,"./sync-reader":131,"buffer":48}],118:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var interlaceUtils = require('./interlace'); -var paethPredictor = require('./paeth-predictor'); - -function getByteWidth(width, bpp, depth) { - var byteWidth = width * bpp; - if (depth !== 8) { - byteWidth = Math.ceil(byteWidth / (8 / depth)); - } - return byteWidth; -} - -var Filter = module.exports = function(bitmapInfo, dependencies) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var interlace = bitmapInfo.interlace; - var bpp = bitmapInfo.bpp; - var depth = bitmapInfo.depth; - - this.read = dependencies.read; - this.write = dependencies.write; - this.complete = dependencies.complete; - - this._imageIndex = 0; - this._images = []; - if (interlace) { - var passes = interlaceUtils.getImagePasses(width, height); - for (var i = 0; i < passes.length; i++) { - this._images.push({ - byteWidth: getByteWidth(passes[i].width, bpp, depth), - height: passes[i].height, - lineIndex: 0 - }); - } - } - else { - this._images.push({ - byteWidth: getByteWidth(width, bpp, depth), - height: height, - lineIndex: 0 - }); - } - - // when filtering the line we look at the pixel to the left - // the spec also says it is done on a byte level regardless of the number of pixels - // so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back - // a pixel rather than just a different byte part. However if we are sub byte, we ignore. - if (depth === 8) { - this._xComparison = bpp; - } - else if (depth === 16) { - this._xComparison = bpp * 2; - } - else { - this._xComparison = 1; - } -}; - -Filter.prototype.start = function() { - this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this)); -}; - -Filter.prototype._unFilterType1 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - unfilteredLine[x] = rawByte + f1Left; - } -}; - -Filter.prototype._unFilterType2 = function(rawData, unfilteredLine, byteWidth) { - - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f2Up = lastLine ? lastLine[x] : 0; - unfilteredLine[x] = rawByte + f2Up; - } -}; - -Filter.prototype._unFilterType3 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f3Up = lastLine ? lastLine[x] : 0; - var f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f3Add = Math.floor((f3Left + f3Up) / 2); - unfilteredLine[x] = rawByte + f3Add; - } -}; - -Filter.prototype._unFilterType4 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f4Up = lastLine ? lastLine[x] : 0; - var f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; - var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); - unfilteredLine[x] = rawByte + f4Add; - } -}; - -Filter.prototype._reverseFilterLine = function(rawData) { - - var filter = rawData[0]; - var unfilteredLine; - var currentImage = this._images[this._imageIndex]; - var byteWidth = currentImage.byteWidth; - - if (filter === 0) { - unfilteredLine = rawData.slice(1, byteWidth + 1); - } - else { - - unfilteredLine = new Buffer(byteWidth); - - switch (filter) { - case 1: - this._unFilterType1(rawData, unfilteredLine, byteWidth); - break; - case 2: - this._unFilterType2(rawData, unfilteredLine, byteWidth); - break; - case 3: - this._unFilterType3(rawData, unfilteredLine, byteWidth); - break; - case 4: - this._unFilterType4(rawData, unfilteredLine, byteWidth); - break; - default: - throw new Error('Unrecognised filter type - ' + filter); - } - } - - this.write(unfilteredLine); - - currentImage.lineIndex++; - if (currentImage.lineIndex >= currentImage.height) { - this._lastLine = null; - this._imageIndex++; - currentImage = this._images[this._imageIndex]; - } - else { - this._lastLine = unfilteredLine; - } - - if (currentImage) { - // read, using the byte width that may be from the new current image - this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this)); - } - else { - this._lastLine = null; - this.complete(); - } -}; - -}).call(this,require("buffer").Buffer) -},{"./interlace":120,"./paeth-predictor":124,"buffer":48}],119:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -function dePalette(indata, outdata, width, height, palette) { - var pxPos = 0; - // use values from palette - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var color = palette[indata[pxPos]]; - - if (!color) { - throw new Error('index ' + indata[pxPos] + ' not in palette'); - } - - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = color[i]; - } - pxPos += 4; - } - } -} - -function replaceTransparentColor(indata, outdata, width, height, transColor) { - var pxPos = 0; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var makeTrans = false; - - if (transColor.length === 1) { - if (transColor[0] === indata[pxPos]) { - makeTrans = true; - } - } - else if (transColor[0] === indata[pxPos] && transColor[1] === indata[pxPos + 1] && transColor[2] === indata[pxPos + 2]) { - makeTrans = true; - } - if (makeTrans) { - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = 0; - } - } - pxPos += 4; - } - } -} - -function scaleDepth(indata, outdata, width, height, depth) { - var maxOutSample = 255; - var maxInSample = Math.pow(2, depth) - 1; - var pxPos = 0; - - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5); - } - pxPos += 4; - } - } -} - -module.exports = function(indata, imageData) { - - var depth = imageData.depth; - var width = imageData.width; - var height = imageData.height; - var colorType = imageData.colorType; - var transColor = imageData.transColor; - var palette = imageData.palette; - - var outdata = indata; // only different for 16 bits - - if (colorType === 3) { // paletted - dePalette(indata, outdata, width, height, palette); - } - else { - if (transColor) { - replaceTransparentColor(indata, outdata, width, height, transColor); - } - // if it needs scaling - if (depth !== 8) { - // if we need to change the buffer size - if (depth === 16) { - outdata = new Buffer(width * height * 4); - } - scaleDepth(indata, outdata, width, height, depth); - } - } - return outdata; -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],120:[function(require,module,exports){ -'use strict'; - -// Adam 7 -// 0 1 2 3 4 5 6 7 -// 0 x 6 4 6 x 6 4 6 -// 1 7 7 7 7 7 7 7 7 -// 2 5 6 5 6 5 6 5 6 -// 3 7 7 7 7 7 7 7 7 -// 4 3 6 4 6 3 6 4 6 -// 5 7 7 7 7 7 7 7 7 -// 6 5 6 5 6 5 6 5 6 -// 7 7 7 7 7 7 7 7 7 - - -var imagePasses = [ - { // pass 1 - 1px - x: [0], - y: [0] - }, - { // pass 2 - 1px - x: [4], - y: [0] - }, - { // pass 3 - 2px - x: [0, 4], - y: [4] - }, - { // pass 4 - 4px - x: [2, 6], - y: [0, 4] - }, - { // pass 5 - 8px - x: [0, 2, 4, 6], - y: [2, 6] - }, - { // pass 6 - 16px - x: [1, 3, 5, 7], - y: [0, 2, 4, 6] - }, - { // pass 7 - 32px - x: [0, 1, 2, 3, 4, 5, 6, 7], - y: [1, 3, 5, 7] - } -]; - -exports.getImagePasses = function(width, height) { - var images = []; - var xLeftOver = width % 8; - var yLeftOver = height % 8; - var xRepeats = (width - xLeftOver) / 8; - var yRepeats = (height - yLeftOver) / 8; - for (var i = 0; i < imagePasses.length; i++) { - var pass = imagePasses[i]; - var passWidth = xRepeats * pass.x.length; - var passHeight = yRepeats * pass.y.length; - for (var j = 0; j < pass.x.length; j++) { - if (pass.x[j] < xLeftOver) { - passWidth++; - } - else { - break; - } - } - for (j = 0; j < pass.y.length; j++) { - if (pass.y[j] < yLeftOver) { - passHeight++; - } - else { - break; - } - } - if (passWidth > 0 && passHeight > 0) { - images.push({ width: passWidth, height: passHeight, index: i }); - } - } - return images; -}; - -exports.getInterlaceIterator = function(width) { - return function(x, y, pass) { - var outerXLeftOver = x % imagePasses[pass].x.length; - var outerX = (((x - outerXLeftOver) / imagePasses[pass].x.length) * 8) + imagePasses[pass].x[outerXLeftOver]; - var outerYLeftOver = y % imagePasses[pass].y.length; - var outerY = (((y - outerYLeftOver) / imagePasses[pass].y.length) * 8) + imagePasses[pass].y[outerYLeftOver]; - return (outerX * 4) + (outerY * width * 4); - }; -}; -},{}],121:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var util = require('util'); -var Stream = require('stream'); -var constants = require('./constants'); -var Packer = require('./packer'); - -var PackerAsync = module.exports = function(opt) { - Stream.call(this); - - var options = opt || {}; - - this._packer = new Packer(options); - this._deflate = this._packer.createDeflate(); - - this.readable = true; -}; -util.inherits(PackerAsync, Stream); - - -PackerAsync.prototype.pack = function(data, width, height, gamma) { - // Signature - this.emit('data', new Buffer(constants.PNG_SIGNATURE)); - this.emit('data', this._packer.packIHDR(width, height)); - - if (gamma) { - this.emit('data', this._packer.packGAMA(gamma)); - } - - var filteredData = this._packer.filterData(data, width, height); - - // compress it - this._deflate.on('error', this.emit.bind(this, 'error')); - - this._deflate.on('data', function(compressedData) { - this.emit('data', this._packer.packIDAT(compressedData)); - }.bind(this)); - - this._deflate.on('end', function() { - this.emit('data', this._packer.packIEND()); - this.emit('end'); - }.bind(this)); - - this._deflate.end(filteredData); -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"./packer":123,"buffer":48,"stream":155,"util":186}],122:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var hasSyncZlib = true; -var zlib = require('zlib'); -if (!zlib.deflateSync) { - hasSyncZlib = false; -} -var constants = require('./constants'); -var Packer = require('./packer'); - -module.exports = function(metaData, opt) { - - if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); - } - - var options = opt || {}; - - var packer = new Packer(options); - - var chunks = []; - - // Signature - chunks.push(new Buffer(constants.PNG_SIGNATURE)); - - // Header - chunks.push(packer.packIHDR(metaData.width, metaData.height)); - - if (metaData.gamma) { - chunks.push(packer.packGAMA(metaData.gamma)); - } - - var filteredData = packer.filterData(metaData.data, metaData.width, metaData.height); - - // compress it - var compressedData = zlib.deflateSync(filteredData, packer.getDeflateOptions()); - filteredData = null; - - if (!compressedData || !compressedData.length) { - throw new Error('bad png - invalid compressed data response'); - } - chunks.push(packer.packIDAT(compressedData)); - - // End - chunks.push(packer.packIEND()); - - return Buffer.concat(chunks); -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"./packer":123,"buffer":48,"zlib":35}],123:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); -var CrcStream = require('./crc'); -var bitPacker = require('./bitpacker'); -var filter = require('./filter-pack'); -var zlib = require('zlib'); - -var Packer = module.exports = function(options) { - this._options = options; - - options.deflateChunkSize = options.deflateChunkSize || 32 * 1024; - options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9; - options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3; - options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true; - options.deflateFactory = options.deflateFactory || zlib.createDeflate; - options.bitDepth = options.bitDepth || 8; - // This is outputColorType - options.colorType = (typeof options.colorType === 'number') ? options.colorType : constants.COLORTYPE_COLOR_ALPHA; - options.inputColorType = (typeof options.inputColorType === 'number') ? options.inputColorType : constants.COLORTYPE_COLOR_ALPHA; - - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.colorType) === -1) { - throw new Error('option color type:' + options.colorType + ' is not supported at present'); - } - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.inputColorType) === -1) { - throw new Error('option input color type:' + options.inputColorType + ' is not supported at present'); - } - if (options.bitDepth !== 8 && options.bitDepth !== 16) { - throw new Error('option bit depth:' + options.bitDepth + ' is not supported at present'); - } -}; - -Packer.prototype.getDeflateOptions = function() { - return { - chunkSize: this._options.deflateChunkSize, - level: this._options.deflateLevel, - strategy: this._options.deflateStrategy - }; -}; - -Packer.prototype.createDeflate = function() { - return this._options.deflateFactory(this.getDeflateOptions()); -}; - -Packer.prototype.filterData = function(data, width, height) { - // convert to correct format for filtering (e.g. right bpp and bit depth) - var packedData = bitPacker(data, width, height, this._options); - - // filter pixel data - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; - var filteredData = filter(packedData, width, height, this._options, bpp); - return filteredData; -}; - -Packer.prototype._packChunk = function(type, data) { - - var len = (data ? data.length : 0); - var buf = new Buffer(len + 12); - - buf.writeUInt32BE(len, 0); - buf.writeUInt32BE(type, 4); - - if (data) { - data.copy(buf, 8); - } - - buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4); - return buf; -}; - -Packer.prototype.packGAMA = function(gamma) { - var buf = new Buffer(4); - buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); - return this._packChunk(constants.TYPE_gAMA, buf); -}; - -Packer.prototype.packIHDR = function(width, height) { - - var buf = new Buffer(13); - buf.writeUInt32BE(width, 0); - buf.writeUInt32BE(height, 4); - buf[8] = this._options.bitDepth; // Bit depth - buf[9] = this._options.colorType; // colorType - buf[10] = 0; // compression - buf[11] = 0; // filter - buf[12] = 0; // interlace - - return this._packChunk(constants.TYPE_IHDR, buf); -}; - -Packer.prototype.packIDAT = function(data) { - return this._packChunk(constants.TYPE_IDAT, data); -}; - -Packer.prototype.packIEND = function() { - return this._packChunk(constants.TYPE_IEND, null); -}; - -}).call(this,require("buffer").Buffer) -},{"./bitpacker":111,"./constants":113,"./crc":114,"./filter-pack":115,"buffer":48,"zlib":35}],124:[function(require,module,exports){ -'use strict'; - -module.exports = function paethPredictor(left, above, upLeft) { - - var paeth = left + above - upLeft; - var pLeft = Math.abs(paeth - left); - var pAbove = Math.abs(paeth - above); - var pUpLeft = Math.abs(paeth - upLeft); - - if (pLeft <= pAbove && pLeft <= pUpLeft) { - return left; - } - if (pAbove <= pUpLeft) { - return above; - } - return upLeft; -}; -},{}],125:[function(require,module,exports){ -'use strict'; - -var util = require('util'); -var zlib = require('zlib'); -var ChunkStream = require('./chunkstream'); -var FilterAsync = require('./filter-parse-async'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - -var ParserAsync = module.exports = function(options) { - ChunkStream.call(this); - - this._parser = new Parser(options, { - read: this.read.bind(this), - error: this._handleError.bind(this), - metadata: this._handleMetaData.bind(this), - gamma: this.emit.bind(this, 'gamma'), - palette: this._handlePalette.bind(this), - transColor: this._handleTransColor.bind(this), - finished: this._finished.bind(this), - inflateData: this._inflateData.bind(this) - }); - this._options = options; - this.writable = true; - - this._parser.start(); -}; -util.inherits(ParserAsync, ChunkStream); - - -ParserAsync.prototype._handleError = function(err) { - - this.emit('error', err); - - this.writable = false; - - this.destroy(); - - if (this._inflate && this._inflate.destroy) { - this._inflate.destroy(); - } - - if (this._filter) { - this._filter.destroy(); - // For backward compatibility with Node 7 and below. - // Suppress errors due to _inflate calling write() even after - // it's destroy()'ed. - this._filter.on('error', function() {}); - } - - this.errord = true; -}; - -ParserAsync.prototype._inflateData = function(data) { - if (!this._inflate) { - if (this._bitmapInfo.interlace) { - this._inflate = zlib.createInflate(); - - this._inflate.on('error', this.emit.bind(this, 'error')); - this._filter.on('complete', this._complete.bind(this)); - - this._inflate.pipe(this._filter); - } else { - var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1; - var imageSize = rowSize * this._bitmapInfo.height; - var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); - - this._inflate = zlib.createInflate({ chunkSize: chunkSize }); - var leftToInflate = imageSize; - - var emitError = this.emit.bind(this, 'error'); - this._inflate.on('error', function(err) { - if (!leftToInflate) { - return; - } - - emitError(err); - }); - this._filter.on('complete', this._complete.bind(this)); - - var filterWrite = this._filter.write.bind(this._filter); - this._inflate.on('data', function(chunk) { - if (!leftToInflate) { - return; - } - - if (chunk.length > leftToInflate) { - chunk = chunk.slice(0, leftToInflate); - } - - leftToInflate -= chunk.length; - - filterWrite(chunk); - }); - - this._inflate.on('end', this._filter.end.bind(this._filter)); - } - } - this._inflate.write(data); -}; - -ParserAsync.prototype._handleMetaData = function(metaData) { - - this.emit('metadata', metaData); - - this._bitmapInfo = Object.create(metaData); - - this._filter = new FilterAsync(this._bitmapInfo); -}; - -ParserAsync.prototype._handleTransColor = function(transColor) { - this._bitmapInfo.transColor = transColor; -}; - -ParserAsync.prototype._handlePalette = function(palette) { - this._bitmapInfo.palette = palette; -}; - - -ParserAsync.prototype._finished = function() { - if (this.errord) { - return; - } - - if (!this._inflate) { - this.emit('error', 'No Inflate block'); - } - else { - // no more data to inflate - this._inflate.end(); - } - this.destroySoon(); -}; - -ParserAsync.prototype._complete = function(filteredData) { - - if (this.errord) { - return; - } - - try { - var bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); - - var normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo); - bitmapData = null; - } - catch (ex) { - this._handleError(ex); - return; - } - - this.emit('parsed', normalisedBitmapData); -}; - -},{"./bitmapper":110,"./chunkstream":112,"./filter-parse-async":116,"./format-normaliser":119,"./parser":127,"util":186,"zlib":35}],126:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var hasSyncZlib = true; -var zlib = require('zlib'); -var inflateSync = require('./sync-inflate'); -if (!zlib.deflateSync) { - hasSyncZlib = false; -} -var SyncReader = require('./sync-reader'); -var FilterSync = require('./filter-parse-sync'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - - -module.exports = function(buffer, options) { - - if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); - } - - var err; - function handleError(_err_) { - err = _err_; - } - - var metaData; - function handleMetaData(_metaData_) { - metaData = _metaData_; - } - - function handleTransColor(transColor) { - metaData.transColor = transColor; - } - - function handlePalette(palette) { - metaData.palette = palette; - } - - var gamma; - function handleGamma(_gamma_) { - gamma = _gamma_; - } - - var inflateDataList = []; - function handleInflateData(inflatedData) { - inflateDataList.push(inflatedData); - } - - var reader = new SyncReader(buffer); - - var parser = new Parser(options, { - read: reader.read.bind(reader), - error: handleError, - metadata: handleMetaData, - gamma: handleGamma, - palette: handlePalette, - transColor: handleTransColor, - inflateData: handleInflateData - }); - - parser.start(); - reader.process(); - - if (err) { - throw err; - } - - //join together the inflate datas - var inflateData = Buffer.concat(inflateDataList); - inflateDataList.length = 0; - - var inflatedData; - if (metaData.interlace) { - inflatedData = zlib.inflateSync(inflateData); - } else { - var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; - var imageSize = rowSize * metaData.height; - inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize }); - } - inflateData = null; - - if (!inflatedData || !inflatedData.length) { - throw new Error('bad png - invalid inflate data response'); - } - - var unfilteredData = FilterSync.process(inflatedData, metaData); - inflateData = null; - - var bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); - unfilteredData = null; - - var normalisedBitmapData = formatNormaliser(bitmapData, metaData); - - metaData.data = normalisedBitmapData; - metaData.gamma = gamma || 0; - - return metaData; -}; - -}).call(this,require("buffer").Buffer) -},{"./bitmapper":110,"./filter-parse-sync":117,"./format-normaliser":119,"./parser":127,"./sync-inflate":130,"./sync-reader":131,"buffer":48,"zlib":35}],127:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); -var CrcCalculator = require('./crc'); - - -var Parser = module.exports = function(options, dependencies) { - - this._options = options; - options.checkCRC = options.checkCRC !== false; - - this._hasIHDR = false; - this._hasIEND = false; - - // input flags/metadata - this._palette = []; - this._colorType = 0; - - this._chunks = {}; - this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this); - this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this); - this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this); - this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this); - this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this); - this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this); - - this.read = dependencies.read; - this.error = dependencies.error; - this.metadata = dependencies.metadata; - this.gamma = dependencies.gamma; - this.transColor = dependencies.transColor; - this.palette = dependencies.palette; - this.parsed = dependencies.parsed; - this.inflateData = dependencies.inflateData; - this.finished = dependencies.finished; -}; - -Parser.prototype.start = function() { - this.read(constants.PNG_SIGNATURE.length, - this._parseSignature.bind(this) - ); -}; - -Parser.prototype._parseSignature = function(data) { - - var signature = constants.PNG_SIGNATURE; - - for (var i = 0; i < signature.length; i++) { - if (data[i] !== signature[i]) { - this.error(new Error('Invalid file signature')); - return; - } - } - this.read(8, this._parseChunkBegin.bind(this)); -}; - -Parser.prototype._parseChunkBegin = function(data) { - - // chunk content length - var length = data.readUInt32BE(0); - - // chunk type - var type = data.readUInt32BE(4); - var name = ''; - for (var i = 4; i < 8; i++) { - name += String.fromCharCode(data[i]); - } - - //console.log('chunk ', name, length); - - // chunk flags - var ancillary = Boolean(data[4] & 0x20); // or critical -// priv = Boolean(data[5] & 0x20), // or public -// safeToCopy = Boolean(data[7] & 0x20); // or unsafe - - if (!this._hasIHDR && type !== constants.TYPE_IHDR) { - this.error(new Error('Expected IHDR on beggining')); - return; - } - - this._crc = new CrcCalculator(); - this._crc.write(new Buffer(name)); - - if (this._chunks[type]) { - return this._chunks[type](length); - } - - if (!ancillary) { - this.error(new Error('Unsupported critical chunk type ' + name)); - return; - } - - this.read(length + 4, this._skipChunk.bind(this)); -}; - -Parser.prototype._skipChunk = function(/*data*/) { - this.read(8, this._parseChunkBegin.bind(this)); -}; - -Parser.prototype._handleChunkEnd = function() { - this.read(4, this._parseChunkEnd.bind(this)); -}; - -Parser.prototype._parseChunkEnd = function(data) { - - var fileCrc = data.readInt32BE(0); - var calcCrc = this._crc.crc32(); - - // check CRC - if (this._options.checkCRC && calcCrc !== fileCrc) { - this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc)); - return; - } - - if (!this._hasIEND) { - this.read(8, this._parseChunkBegin.bind(this)); - } -}; - -Parser.prototype._handleIHDR = function(length) { - this.read(length, this._parseIHDR.bind(this)); -}; -Parser.prototype._parseIHDR = function(data) { - - this._crc.write(data); - - var width = data.readUInt32BE(0); - var height = data.readUInt32BE(4); - var depth = data[8]; - var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha - var compr = data[10]; - var filter = data[11]; - var interlace = data[12]; - - // console.log(' width', width, 'height', height, - // 'depth', depth, 'colorType', colorType, - // 'compr', compr, 'filter', filter, 'interlace', interlace - // ); - - if (depth !== 8 && depth !== 4 && depth !== 2 && depth !== 1 && depth !== 16) { - this.error(new Error('Unsupported bit depth ' + depth)); - return; - } - if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) { - this.error(new Error('Unsupported color type')); - return; - } - if (compr !== 0) { - this.error(new Error('Unsupported compression method')); - return; - } - if (filter !== 0) { - this.error(new Error('Unsupported filter method')); - return; - } - if (interlace !== 0 && interlace !== 1) { - this.error(new Error('Unsupported interlace method')); - return; - } - - this._colorType = colorType; - - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; - - this._hasIHDR = true; - - this.metadata({ - width: width, - height: height, - depth: depth, - interlace: Boolean(interlace), - palette: Boolean(colorType & constants.COLORTYPE_PALETTE), - color: Boolean(colorType & constants.COLORTYPE_COLOR), - alpha: Boolean(colorType & constants.COLORTYPE_ALPHA), - bpp: bpp, - colorType: colorType - }); - - this._handleChunkEnd(); -}; - - -Parser.prototype._handlePLTE = function(length) { - this.read(length, this._parsePLTE.bind(this)); -}; -Parser.prototype._parsePLTE = function(data) { - - this._crc.write(data); - - var entries = Math.floor(data.length / 3); - // console.log('Palette:', entries); - - for (var i = 0; i < entries; i++) { - this._palette.push([ - data[i * 3], - data[i * 3 + 1], - data[i * 3 + 2], - 0xff - ]); - } - - this.palette(this._palette); - - this._handleChunkEnd(); -}; - -Parser.prototype._handleTRNS = function(length) { - this.read(length, this._parseTRNS.bind(this)); -}; -Parser.prototype._parseTRNS = function(data) { - - this._crc.write(data); - - // palette - if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) { - if (this._palette.length === 0) { - this.error(new Error('Transparency chunk must be after palette')); - return; - } - if (data.length > this._palette.length) { - this.error(new Error('More transparent colors than palette size')); - return; - } - for (var i = 0; i < data.length; i++) { - this._palette[i][3] = data[i]; - } - this.palette(this._palette); - } - - // for colorType 0 (grayscale) and 2 (rgb) - // there might be one gray/color defined as transparent - if (this._colorType === constants.COLORTYPE_GRAYSCALE) { - // grey, 2 bytes - this.transColor([data.readUInt16BE(0)]); - } - if (this._colorType === constants.COLORTYPE_COLOR) { - this.transColor([data.readUInt16BE(0), data.readUInt16BE(2), data.readUInt16BE(4)]); - } - - this._handleChunkEnd(); -}; - -Parser.prototype._handleGAMA = function(length) { - this.read(length, this._parseGAMA.bind(this)); -}; -Parser.prototype._parseGAMA = function(data) { - - this._crc.write(data); - this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION); - - this._handleChunkEnd(); -}; - -Parser.prototype._handleIDAT = function(length) { - this.read(-length, this._parseIDAT.bind(this, length)); -}; -Parser.prototype._parseIDAT = function(length, data) { - - this._crc.write(data); - - if (this._colorType === constants.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) { - throw new Error('Expected palette not found'); - } - - this.inflateData(data); - var leftOverLength = length - data.length; - - if (leftOverLength > 0) { - this._handleIDAT(leftOverLength); - } - else { - this._handleChunkEnd(); - } -}; - -Parser.prototype._handleIEND = function(length) { - this.read(length, this._parseIEND.bind(this)); -}; -Parser.prototype._parseIEND = function(data) { - - this._crc.write(data); - - this._hasIEND = true; - this._handleChunkEnd(); - - if (this.finished) { - this.finished(); - } -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"./crc":114,"buffer":48}],128:[function(require,module,exports){ -'use strict'; - - -var parse = require('./parser-sync'); -var pack = require('./packer-sync'); - - -exports.read = function(buffer, options) { - - return parse(buffer, options || {}); -}; - -exports.write = function(png, options) { - - return pack(png, options); -}; - -},{"./packer-sync":122,"./parser-sync":126}],129:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -var util = require('util'); -var Stream = require('stream'); -var Parser = require('./parser-async'); -var Packer = require('./packer-async'); -var PNGSync = require('./png-sync'); - - -var PNG = exports.PNG = function(options) { - Stream.call(this); - - options = options || {}; // eslint-disable-line no-param-reassign - - // coerce pixel dimensions to integers (also coerces undefined -> 0): - this.width = options.width | 0; - this.height = options.height | 0; - - this.data = this.width > 0 && this.height > 0 ? - new Buffer(4 * this.width * this.height) : null; - - if (options.fill && this.data) { - this.data.fill(0); - } - - this.gamma = 0; - this.readable = this.writable = true; - - this._parser = new Parser(options); - - this._parser.on('error', this.emit.bind(this, 'error')); - this._parser.on('close', this._handleClose.bind(this)); - this._parser.on('metadata', this._metadata.bind(this)); - this._parser.on('gamma', this._gamma.bind(this)); - this._parser.on('parsed', function(data) { - this.data = data; - this.emit('parsed', data); - }.bind(this)); - - this._packer = new Packer(options); - this._packer.on('data', this.emit.bind(this, 'data')); - this._packer.on('end', this.emit.bind(this, 'end')); - this._parser.on('close', this._handleClose.bind(this)); - this._packer.on('error', this.emit.bind(this, 'error')); - -}; -util.inherits(PNG, Stream); - -PNG.sync = PNGSync; - -PNG.prototype.pack = function() { - - if (!this.data || !this.data.length) { - this.emit('error', 'No data provided'); - return this; - } - - process.nextTick(function() { - this._packer.pack(this.data, this.width, this.height, this.gamma); - }.bind(this)); - - return this; -}; - - -PNG.prototype.parse = function(data, callback) { - - if (callback) { - var onParsed, onError; - - onParsed = function(parsedData) { - this.removeListener('error', onError); - - this.data = parsedData; - callback(null, this); - }.bind(this); - - onError = function(err) { - this.removeListener('parsed', onParsed); - - callback(err, null); - }.bind(this); - - this.once('parsed', onParsed); - this.once('error', onError); - } - - this.end(data); - return this; -}; - -PNG.prototype.write = function(data) { - this._parser.write(data); - return true; -}; - -PNG.prototype.end = function(data) { - this._parser.end(data); -}; - -PNG.prototype._metadata = function(metadata) { - this.width = metadata.width; - this.height = metadata.height; - - this.emit('metadata', metadata); -}; - -PNG.prototype._gamma = function(gamma) { - this.gamma = gamma; -}; - -PNG.prototype._handleClose = function() { - if (!this._parser.writable && !this._packer.readable) { - this.emit('close'); - } -}; - - -PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params - // coerce pixel dimensions to integers (also coerces undefined -> 0): - /* eslint-disable no-param-reassign */ - srcX |= 0; - srcY |= 0; - width |= 0; - height |= 0; - deltaX |= 0; - deltaY |= 0; - /* eslint-enable no-param-reassign */ - - if (srcX > src.width || srcY > src.height || srcX + width > src.width || srcY + height > src.height) { - throw new Error('bitblt reading outside image'); - } - - if (deltaX > dst.width || deltaY > dst.height || deltaX + width > dst.width || deltaY + height > dst.height) { - throw new Error('bitblt writing outside image'); - } - - for (var y = 0; y < height; y++) { - src.data.copy(dst.data, - ((deltaY + y) * dst.width + deltaX) << 2, - ((srcY + y) * src.width + srcX) << 2, - ((srcY + y) * src.width + srcX + width) << 2 - ); - } -}; - - -PNG.prototype.bitblt = function(dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params - - PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); - return this; -}; - -PNG.adjustGamma = function(src) { - if (src.gamma) { - for (var y = 0; y < src.height; y++) { - for (var x = 0; x < src.width; x++) { - var idx = (src.width * y + x) << 2; - - for (var i = 0; i < 3; i++) { - var sample = src.data[idx + i] / 255; - sample = Math.pow(sample, 1 / 2.2 / src.gamma); - src.data[idx + i] = Math.round(sample * 255); - } - } - } - src.gamma = 0; - } -}; - -PNG.prototype.adjustGamma = function() { - PNG.adjustGamma(this); -}; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"./packer-async":121,"./parser-async":125,"./png-sync":128,"_process":133,"buffer":48,"stream":155,"util":186}],130:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -var assert = require('assert').ok; -var zlib = require('zlib'); -var util = require('util'); - -var kMaxLength = require('buffer').kMaxLength; - -function Inflate(opts) { - if (!(this instanceof Inflate)) { - return new Inflate(opts); - } - - if (opts && opts.chunkSize < zlib.Z_MIN_CHUNK) { - opts.chunkSize = zlib.Z_MIN_CHUNK; - } - - zlib.Inflate.call(this, opts); - - // Node 8 --> 9 compatibility check - this._offset = this._offset === undefined ? this._outOffset : this._offset; - this._buffer = this._buffer || this._outBuffer; - - if (opts && opts.maxLength != null) { - this._maxLength = opts.maxLength; - } -} - -function createInflate(opts) { - return new Inflate(opts); -} - -function _close(engine, callback) { - if (callback) { - process.nextTick(callback); - } - - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) { - return; - } - - engine._handle.close(); - engine._handle = null; -} - -Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { - if (typeof asyncCb === 'function') { - return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb); - } - - var self = this; - - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var leftToInflate = this._maxLength; - var inOff = 0; - - var buffers = []; - var nread = 0; - - var error; - this.on('error', function(err) { - error = err; - }); - - function handleChunk(availInAfter, availOutAfter) { - if (self._hadError) { - return; - } - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - - if (out.length > leftToInflate) { - out = out.slice(0, leftToInflate); - } - - buffers.push(out); - nread += out.length; - leftToInflate -= out.length; - - if (leftToInflate === 0) { - return false; - } - } - - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } - - if (availOutAfter === 0) { - inOff += (availInBefore - availInAfter); - availInBefore = availInAfter; - - return true; - } - - return false; - } - - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, - chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - // Node 8 --> 9 compatibility check - res = res || this._writeState; - } while (!this._hadError && handleChunk(res[0], res[1])); - - if (this._hadError) { - throw error; - } - - if (nread >= kMaxLength) { - _close(this); - throw new RangeError('Cannot create final Buffer. It would be larger than 0x' + kMaxLength.toString(16) + ' bytes'); - } - - var buf = Buffer.concat(buffers, nread); - _close(this); - - return buf; -}; - -util.inherits(Inflate, zlib.Inflate); - -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') { - buffer = Buffer.from(buffer); - } - if (!(buffer instanceof Buffer)) { - throw new TypeError('Not a string or buffer'); - } - - var flushFlag = engine._finishFlushFlag; - if (flushFlag == null) { - flushFlag = zlib.Z_FINISH; - } - - return engine._processChunk(buffer, flushFlag); -} - -function inflateSync(buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -} - -module.exports = exports = inflateSync; -exports.Inflate = Inflate; -exports.createInflate = createInflate; -exports.inflateSync = inflateSync; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":133,"assert":25,"buffer":48,"util":186,"zlib":35}],131:[function(require,module,exports){ -'use strict'; - -var SyncReader = module.exports = function(buffer) { - - this._buffer = buffer; - this._reads = []; -}; - -SyncReader.prototype.read = function(length, callback) { - - this._reads.push({ - length: Math.abs(length), // if length < 0 then at most this length - allowLess: length < 0, - func: callback - }); -}; - -SyncReader.prototype.process = function() { - - // as long as there is any data and read requests - while (this._reads.length > 0 && this._buffer.length) { - - var read = this._reads[0]; - - if (this._buffer.length && (this._buffer.length >= read.length || read.allowLess)) { - - // ok there is any data so that we can satisfy this request - this._reads.shift(); // == read - - var buf = this._buffer; - - this._buffer = buf.slice(read.length); - - read.func.call(this, buf.slice(0, read.length)); - - } - else { - break; - } - - } - - if (this._reads.length > 0) { - return new Error('There are some read requests waitng on finished stream'); - } - - if (this._buffer.length > 0) { - return new Error('unrecognised content at end of stream'); - } - -}; - -},{}],132:[function(require,module,exports){ -(function (process){ -'use strict'; - -if (typeof process === 'undefined' || - !process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - - -}).call(this,require('_process')) -},{"_process":133}],133:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],134:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { - - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } - -}(this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],135:[function(require,module,exports){ -// 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. - -'use strict'; - -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -},{}],136:[function(require,module,exports){ -// 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. - -'use strict'; - -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } -}; - -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); - } - return res; -} - -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); - } - return res; -}; - -},{}],137:[function(require,module,exports){ -'use strict'; - -exports.decode = exports.parse = require('./decode'); -exports.encode = exports.stringify = require('./encode'); - -},{"./decode":135,"./encode":136}],138:[function(require,module,exports){ -module.exports = require('./lib/_stream_duplex.js'); - -},{"./lib/_stream_duplex.js":139}],139:[function(require,module,exports){ -// 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. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ - -module.exports = Duplex; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -{ - // avoid scope creep, the keys array can then be collected - var keys = objectKeys(Writable.prototype); - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - - this.once('end', onend); -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - pna.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); - -Duplex.prototype._destroy = function (err, cb) { - this.push(null); - this.end(); - - pna.nextTick(cb, err); -}; -},{"./_stream_readable":141,"./_stream_writable":143,"core-util-is":51,"inherits":75,"process-nextick-args":132}],140:[function(require,module,exports){ -// 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. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":142,"core-util-is":51,"inherits":75}],141:[function(require,module,exports){ -(function (process,global){ -// 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. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - -/**/ -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = require('events').EventEmitter; - -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var BufferList = require('./internal/streams/BufferList'); -var destroyImpl = require('./internal/streams/destroy'); -var StringDecoder; - -util.inherits(Readable, Stream); - -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - - // has it been destroyed - this.destroyed = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - if (!(this instanceof Readable)) return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined) { - return false; - } - return this._readableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } -}); - -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; -Readable.prototype._destroy = function (err, cb) { - this.push(null); - cb(err); -}; - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new Error('stream.push() after EOF')); - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - } - } - - return needMoreData(state); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - - return ret; -}; - -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { hasUnpiped: false }; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, unpipeInfo); - }return this; - } - - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this, unpipeInfo); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - pna.nextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._readableState.highWaterMark; - } -}); - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } - - return ret; -} - -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} - -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":139,"./internal/streams/BufferList":144,"./internal/streams/destroy":145,"./internal/streams/stream":146,"_process":133,"core-util-is":51,"events":52,"inherits":75,"isarray":79,"process-nextick-args":132,"safe-buffer":147,"string_decoder/":148,"util":33}],142:[function(require,module,exports){ -// 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. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) { - return this.emit('error', new Error('write callback called multiple times')); - } - - ts.writechunk = null; - ts.writecb = null; - - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - - cb(er); - - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - - Duplex.call(this, options); - - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function') { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - var _this2 = this; - - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - _this2.emit('close'); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); - - return stream.push(null); -} -},{"./_stream_duplex":139,"core-util-is":51,"inherits":75}],143:[function(require,module,exports){ -(function (process,global,setImmediate){ -// 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. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Writable; - -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; -/**/ - -/**/ -var Duplex; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -var destroyImpl = require('./internal/streams/destroy'); - -util.inherits(Writable, Stream); - -function nop() {} - -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var writableHwm = options.writableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // if _final has been called - this.finalCalled = false; - - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // has it been destroyed - this.destroyed = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // count buffered requests - this.bufferedRequestCount = 0; - - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); - -// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function (object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function (object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { - return new Writable(options); - } - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); -}; - -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - pna.nextTick(cb, er); -} - -// Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. -function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - - if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - if (er) { - stream.emit('error', er); - pna.nextTick(cb, er); - valid = false; - } - return valid; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - pna.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - pna.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - if (err) { - stream.emit('error', err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function') { - state.pendingcb++; - state.finalCalled = true; - pna.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - } - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = corkReq; - } else { - state.corkedRequestsFree = corkReq; - } -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - get: function () { - if (this._writableState === undefined) { - return false; - } - return this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } -}); - -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - this.end(); - cb(err); -}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) -},{"./_stream_duplex":139,"./internal/streams/destroy":145,"./internal/streams/stream":146,"_process":133,"core-util-is":51,"inherits":75,"process-nextick-args":132,"safe-buffer":147,"timers":176,"util-deprecate":183}],144:[function(require,module,exports){ -'use strict'; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Buffer = require('safe-buffer').Buffer; -var util = require('util'); - -function copyBuffer(src, target, offset) { - src.copy(target, offset); -} - -module.exports = function () { - function BufferList() { - _classCallCheck(this, BufferList); - - this.head = null; - this.tail = null; - this.length = 0; - } - - BufferList.prototype.push = function push(v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - }; - - BufferList.prototype.unshift = function unshift(v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - BufferList.prototype.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - BufferList.prototype.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - BufferList.prototype.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; - }; - - BufferList.prototype.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - if (this.length === 1) return this.head.data; - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - }; - - return BufferList; -}(); - -if (util && util.inspect && util.inspect.custom) { - module.exports.prototype[util.inspect.custom] = function () { - var obj = util.inspect({ length: this.length }); - return this.constructor.name + ' ' + obj; - }; -} -},{"safe-buffer":147,"util":33}],145:[function(require,module,exports){ -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - pna.nextTick(emitErrorNT, this, err); - } - return this; - } - - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - if (this._readableState) { - this._readableState.destroyed = true; - } - - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - pna.nextTick(emitErrorNT, _this, err); - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - cb(err); - } - }); - - return this; -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; -},{"process-nextick-args":132}],146:[function(require,module,exports){ -module.exports = require('events').EventEmitter; - -},{"events":52}],147:[function(require,module,exports){ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":48}],148:[function(require,module,exports){ -// 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. - -'use strict'; - -/**/ - -var Buffer = require('safe-buffer').Buffer; -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} -},{"safe-buffer":147}],149:[function(require,module,exports){ -module.exports = require('./readable').PassThrough - -},{"./readable":150}],150:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -},{"./lib/_stream_duplex.js":139,"./lib/_stream_passthrough.js":140,"./lib/_stream_readable.js":141,"./lib/_stream_transform.js":142,"./lib/_stream_writable.js":143}],151:[function(require,module,exports){ -module.exports = require('./readable').Transform - -},{"./readable":150}],152:[function(require,module,exports){ -module.exports = require('./lib/_stream_writable.js'); - -},{"./lib/_stream_writable.js":143}],153:[function(require,module,exports){ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -var runtime = (function (exports) { - "use strict"; - - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; // More compressible than void 0. - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); - - // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - generator._invoke = makeInvokeMethod(innerFn, self, context); - - return generator; - } - exports.wrap = wrap; - - // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - function tryCatch(fn, obj, arg) { - try { - return { type: "normal", arg: fn.call(obj, arg) }; - } catch (err) { - return { type: "throw", arg: err }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; - - // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - var ContinueSentinel = {}; - - // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - - // This is a polyfill for %IteratorPrototype% for environments that - // don't natively support it. - var IteratorPrototype = {}; - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; - - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - if (NativeIteratorPrototype && - NativeIteratorPrototype !== Op && - hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - // This environment has a native %IteratorPrototype%; use it instead - // of the polyfill. - IteratorPrototype = NativeIteratorPrototype; - } - - var Gp = GeneratorFunctionPrototype.prototype = - Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunctionPrototype[toStringTagSymbol] = - GeneratorFunction.displayName = "GeneratorFunction"; - - // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function(method) { - prototype[method] = function(arg) { - return this._invoke(method, arg); - }; - }); - } - - exports.isGeneratorFunction = function(genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor - ? ctor === GeneratorFunction || - // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" - : false; - }; - - exports.mark = function(genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - if (!(toStringTagSymbol in genFun)) { - genFun[toStringTagSymbol] = "GeneratorFunction"; - } - } - genFun.prototype = Object.create(Gp); - return genFun; - }; - - // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `hasOwn.call(value, "__await")` to determine if the yielded value is - // meant to be awaited. - exports.awrap = function(arg) { - return { __await: arg }; - }; - - function AsyncIterator(generator) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - if (value && - typeof value === "object" && - hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function(value) { - invoke("next", value, resolve, reject); - }, function(err) { - invoke("throw", err, resolve, reject); - }); - } - - return Promise.resolve(value).then(function(unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function(error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); - }); - } - } - - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new Promise(function(resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - - return previousPromise = - // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then( - callInvokeWithMethodAndArg, - // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg - ) : callInvokeWithMethodAndArg(); - } - - // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - exports.AsyncIterator = AsyncIterator; - - // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - exports.async = function(innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList) - ); - - return exports.isGeneratorFunction(outerFn) - ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - - // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - return doneResult(); - } - - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - - context.dispatchException(context.arg); - - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - - state = GenStateExecuting; - - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done - ? GenStateCompleted - : GenStateSuspendedYield; - - if (record.arg === ContinueSentinel) { - continue; - } - - return { - value: record.arg, - done: context.done - }; - - } else if (record.type === "throw") { - state = GenStateCompleted; - // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } - - // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - // Note: ["return"] must be used for ES3 parsing compatibility. - if (delegate.iterator["return"]) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } - } - - context.method = "throw"; - context.arg = new TypeError( - "The iterator does not provide a 'throw' method"); - } - - return ContinueSentinel; - } - - var record = tryCatch(method, delegate.iterator, context.arg); - - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } - - var info = record.arg; - - if (! info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; - } - - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; - - // Resume execution at the desired location (see delegateYield). - context.next = delegate.nextLoc; - - // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - - } else { - // Re-yield the result returned by the delegate method. - return info; - } - - // The delegate iterator is finished, so forget it and continue with - // the outer generator. - context.delegate = null; - return ContinueSentinel; - } - - // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - defineIteratorMethods(Gp); - - Gp[toStringTagSymbol] = "Generator"; - - // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. - Gp[iteratorSymbol] = function() { - return this; - }; - - Gp.toString = function() { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - exports.keys = function(object) { - var keys = []; - for (var key in object) { - keys.push(key); - } - keys.reverse(); - - // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } - - // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - - return next; - }; - - return next.next = next; - } - } - - // Return an iterator with no values. - return { next: doneResult }; - } - exports.values = values; - - function doneResult() { - return { value: undefined, done: true }; - } - - Context.prototype = { - constructor: Context, - - reset: function(skipTempReset) { - this.prev = 0; - this.next = 0; - // Resetting context._sent for legacy support of Babel's - // function.sent implementation. - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - - this.method = "next"; - this.arg = undefined; - - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - - stop: function() { - this.done = true; - - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - - dispatchException: function(exception) { - if (this.done) { - throw exception; - } - - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } - - return !! caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - - abrupt: function(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && - (type === "break" || - type === "continue") && - finallyEntry.tryLoc <= arg && - arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } - - return this.complete(record); - }, - - complete: function(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || - record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - - return ContinueSentinel; - }, - - finish: function(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - - "catch": function(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - - // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - throw new Error("illegal catch attempt"); - }, - - delegateYield: function(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; - } - - return ContinueSentinel; - } - }; - - // Regardless of whether this script is executing as a CommonJS module - // or not, return the runtime object so that we can declare the variable - // regeneratorRuntime in the outer scope, which allows this module to be - // injected easily by `bin/regenerator --include-runtime script.js`. - return exports; - -}( - // If this script is executing as a CommonJS module, use module.exports - // as the regeneratorRuntime namespace. Otherwise create a new empty - // object. Either way, the resulting object will be used to initialize - // the regeneratorRuntime variable at the top of this file. - typeof module === "object" ? module.exports : {} -)); - -try { - regeneratorRuntime = runtime; -} catch (accidentalStrictMode) { - // This module should not be running in strict mode, so the above - // assignment should always work unless something is misconfigured. Just - // in case runtime.js accidentally runs in strict mode, we can escape - // strict mode using a global Function call. This could conceivably fail - // if a Content Security Policy forbids using Function, but in that case - // the proper solution is to fix the accidental strict mode problem. If - // you've misconfigured your bundler to force strict mode and applied a - // CSP to forbid Function, and you're not willing to fix either of those - // problems, please detail your unique predicament in a GitHub issue. - Function("r", "regeneratorRuntime = r")(runtime); -} - -},{}],154:[function(require,module,exports){ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":48}],155:[function(require,module,exports){ -// 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. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } - - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); - } - - - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - -},{"events":52,"inherits":75,"readable-stream/duplex.js":138,"readable-stream/passthrough.js":149,"readable-stream/readable.js":150,"readable-stream/transform.js":151,"readable-stream/writable.js":152}],156:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var response = require('./lib/response') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') - -var http = exports - -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) - - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' - - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' - - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} - - // Also valid opts.auth, opts.mode - - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req -} - -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req -} - -http.ClientRequest = ClientRequest -http.IncomingMessage = response.IncomingMessage - -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.globalAgent = new http.Agent() - -http.STATUS_CODES = statusCodes - -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":158,"./lib/response":159,"builtin-status-codes":50,"url":180,"xtend":189}],157:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) - -exports.writableStream = isFunction(global.WritableStream) - -exports.abortController = isFunction(global.AbortController) - -// The xhr request to example.com may violate some restrictive CSP configurations, -// so if we're running in a browser that supports `fetch`, avoid calling getXHR() -// and assume support for certain features below. -var xhr -function getXHR () { - // Cache the xhr value - if (xhr !== undefined) return xhr - - if (global.XMLHttpRequest) { - xhr = new global.XMLHttpRequest() - // If XDomainRequest is available (ie only, where xhr might not work - // cross domain), use the page location. Otherwise use example.com - // Note: this doesn't actually make an http request. - try { - xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') - } catch(e) { - xhr = null - } - } else { - // Service workers don't have XHR - xhr = null - } - return xhr -} - -function checkTypeSupport (type) { - var xhr = getXHR() - if (!xhr) return false - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false -} - -// If fetch is supported, then arraybuffer will be supported too. Skip calling -// checkTypeSupport(), since that calls getXHR(). -exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer') - -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer') - -// If fetch is supported, then overrideMimeType will be supported too. Skip calling -// getXHR(). -exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) - -function isFunction (value) { - return typeof value === 'function' -} - -xhr = null // Help gc - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],158:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('readable-stream') - -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates - -function decideMode (preferBinary, useFetch) { - if (capability.fetch && useFetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else { - return 'text' - } -} - -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) - - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + Buffer.from(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) - - var preferBinary - var useFetch = true - if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) { - // If the use of XHR should be preferred. Not typically needed. - useFetch = false - preferBinary = true - } else if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') - } - self._mode = decideMode(preferBinary, useFetch) - self._fetchTimer = null - - self.on('finish', function () { - self._onFinish() - }) -} - -inherits(ClientRequest, stream.Writable) - -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return - - self._headers[lowerName] = { - name: name, - value: value - } -} - -ClientRequest.prototype.getHeader = function (name) { - var header = this._headers[name.toLowerCase()] - if (header) - return header.value - return null -} - -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] -} - -ClientRequest.prototype._onFinish = function () { - var self = this - - if (self._destroyed) - return - var opts = self._opts - - var headersObj = self._headers - var body = null - if (opts.method !== 'GET' && opts.method !== 'HEAD') { - body = new Blob(self._body, { - type: (headersObj['content-type'] || {}).value || '' - }); - } - - // create flattened list of headers - var headersList = [] - Object.keys(headersObj).forEach(function (keyName) { - var name = headersObj[keyName].name - var value = headersObj[keyName].value - if (Array.isArray(value)) { - value.forEach(function (v) { - headersList.push([name, v]) - }) - } else { - headersList.push([name, value]) - } - }) - - if (self._mode === 'fetch') { - var signal = null - var fetchTimer = null - if (capability.abortController) { - var controller = new AbortController() - signal = controller.signal - self._fetchAbortController = controller - - if ('requestTimeout' in opts && opts.requestTimeout !== 0) { - self._fetchTimer = global.setTimeout(function () { - self.emit('requestTimeout') - if (self._fetchAbortController) - self._fetchAbortController.abort() - }, opts.requestTimeout) - } - } - - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headersList, - body: body || undefined, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin', - signal: signal - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - global.clearTimeout(self._fetchTimer) - if (!self._destroyed) - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode - - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials - - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') - - if ('requestTimeout' in opts) { - xhr.timeout = opts.requestTimeout - xhr.ontimeout = function () { - self.emit('requestTimeout') - } - } - - headersList.forEach(function (header) { - xhr.setRequestHeader(header[0], header[1]) - }) - - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break - } - } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() - } - } - - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } - - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } -} - -/** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 - */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } -} - -ClientRequest.prototype._onXHRProgress = function () { - var self = this - - if (!statusValid(self._xhr) || self._destroyed) - return - - if (!self._response) - self._connect() - - self._response._onXHRProgress() -} - -ClientRequest.prototype._connect = function () { - var self = this - - if (self._destroyed) - return - - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer) - self._response.on('error', function(err) { - self.emit('error', err) - }) - - self.emit('response', self._response) -} - -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this - - self._body.push(chunk) - cb() -} - -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - global.clearTimeout(self._fetchTimer) - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - else if (self._fetchAbortController) - self._fetchAbortController.abort() -} - -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } - - stream.Writable.prototype.end.call(self, data, encoding, cb) -} - -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} - -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'via' -] - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":157,"./response":159,"_process":133,"buffer":48,"inherits":75,"readable-stream":174}],159:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('readable-stream') - -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -} - -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) { - var self = this - stream.Readable.call(self) - - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] - - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) - - if (mode === 'fetch') { - self._fetchResponse = response - - self.url = response.url - self.statusCode = response.status - self.statusMessage = response.statusText - - response.headers.forEach(function (header, key){ - self.headers[key.toLowerCase()] = header - self.rawHeaders.push(key, header) - }) - - if (capability.writableStream) { - var writable = new WritableStream({ - write: function (chunk) { - return new Promise(function (resolve, reject) { - if (self._destroyed) { - reject() - } else if(self.push(Buffer.from(chunk))) { - resolve() - } else { - self._resumeFetch = resolve - } - }) - }, - close: function () { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.push(null) - }, - abort: function (err) { - if (!self._destroyed) - self.emit('error', err) - } - }) - - try { - response.body.pipeTo(writable).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - return - } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this - } - // fallback for when writableStream or pipeTo aren't available - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - global.clearTimeout(fetchTimer) - self.push(null) - return - } - self.push(Buffer.from(result.value)) - read() - }).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - } - read() - } else { - self._xhr = xhr - self._pos = 0 - - self.url = xhr.responseURL - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) - - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } -} - -inherits(IncomingMessage, stream.Readable) - -IncomingMessage.prototype._read = function () { - var self = this - - var resolve = self._resumeFetch - if (resolve) { - self._resumeFetch = null - resolve() - } -} - -IncomingMessage.prototype._onXHRProgress = function () { - var self = this - - var xhr = self._xhr - - var response = null - switch (self._mode) { - case 'text': - response = xhr.responseText - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = Buffer.alloc(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff - - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE || !xhr.response) - break - response = xhr.response - self.push(Buffer.from(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(Buffer.from(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } - - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":157,"_process":133,"buffer":48,"inherits":75,"readable-stream":174}],160:[function(require,module,exports){ -'use strict'; - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -var codes = {}; - -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - - function getMessage(arg1, arg2, arg3) { - if (typeof message === 'string') { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - - var NodeError = - /*#__PURE__*/ - function (_Base) { - _inheritsLoose(NodeError, _Base); - - function NodeError(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - - return NodeError; - }(Base); - - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; -} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js - - -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function (i) { - return String(i); - }); - - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith - - -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith - - -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; - } - - return str.substring(this_len - search.length, this_len) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes - - -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } -} - -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - var determiner; - - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - var msg; - - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } else { - var type = includes(name, '.') ? 'property' : 'argument'; - msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } - - msg += ". Received type ".concat(typeof actual); - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented'; -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg; -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); -module.exports.codes = codes; - -},{}],161:[function(require,module,exports){ -(function (process){ -'use strict' - -var experimentalWarnings = new Set(); - -function emitExperimentalWarning(feature) { - if (experimentalWarnings.has(feature)) return; - var msg = feature + ' is an experimental feature. This feature could ' + - 'change at any time'; - experimentalWarnings.add(feature); - process.emitWarning(msg, 'ExperimentalWarning'); -} - -function noop() {} - -module.exports.emitExperimentalWarning = process.emitWarning - ? emitExperimentalWarning - : noop; - -}).call(this,require('_process')) -},{"_process":133}],162:[function(require,module,exports){ -(function (process){ -// 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. -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. -'use strict'; -/**/ - -var objectKeys = Object.keys || function (obj) { - var keys = []; - - for (var key in obj) { - keys.push(key); - } - - return keys; -}; -/**/ - - -module.exports = Duplex; - -var Readable = require('./_stream_readable'); - -var Writable = require('./_stream_writable'); - -require('inherits')(Duplex, Readable); - -{ - // Allow the keys array to be GC'ed. - var keys = objectKeys(Writable.prototype); - - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - - if (options) { - if (options.readable === false) this.readable = false; - if (options.writable === false) this.writable = false; - - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once('end', onend); - } - } -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); -Object.defineProperty(Duplex.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -Object.defineProperty(Duplex.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); // the no-half-open enforcer - -function onend() { - // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. - - process.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); -}).call(this,require('_process')) -},{"./_stream_readable":164,"./_stream_writable":166,"_process":133,"inherits":75}],163:[function(require,module,exports){ -// 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. -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -require('inherits')(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":165,"inherits":75}],164:[function(require,module,exports){ -(function (process,global){ -// 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. -'use strict'; - -module.exports = Readable; -/**/ - -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; -/**/ - -var EE = require('events').EventEmitter; - -var EElistenerCount = function EElistenerCount(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ - - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} -/**/ - - -var debugUtil = require('util'); - -var debug; - -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function debug() {}; -} -/**/ - - -var BufferList = require('./internal/streams/buffer_list'); - -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - -var _require2 = require('../experimentalWarning'), - emitExperimentalWarning = _require2.emitExperimentalWarning; // Lazy loaded to improve the startup performance. - - -var StringDecoder; -var createReadableStreamAsyncIterator; - -require('inherits')(Readable, Stream); - -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - - this.sync = true; // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // has it been destroyed - - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s - - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled - - this.readingMore = false; - this.decoder = null; - this.encoding = null; - - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy - - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined) { - return false; - } - - return this._readableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - } -}); -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; - -Readable.prototype._destroy = function (err, cb) { - cb(err); -}; // Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. - - -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() - - -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug('readableAddChunk', chunk); - var state = stream._readableState; - - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) stream.emit('error', new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - - - return !state.ended && (state.length < state.highWaterMark || state.length === 0); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit('data', chunk); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } - - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); - } - - return er; -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; // backwards compatibility. - - -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); // if setEncoding(null), decoder.encoding equals utf8 - - this._readableState.encoding = this._readableState.decoder.encoding; - return this; -}; // Don't raise the hwm > 8MB - - -var MAX_HWM = 0x800000; - -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. - - -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } // If we're asking for more than the current hwm, then raise the hwm. - - - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; // Don't have enough - - if (!state.ended) { - state.needReadable = true; - return 0; - } - - return state.length; -} // you can override either this method, or the async _read(n) below. - - -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. - - - var doRead = state.needReadable; - debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - - - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; // if the length is currently zero, then we *need* a readable event. - - if (state.length === 0) state.needReadable = true; // call internal read method - - this._read(state.highWaterMark); - - state.sync = false; // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. - - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - return ret; -}; - -function onEofChunk(stream, state) { - if (state.ended) return; - - if (state.decoder) { - var chunk = state.decoder.end(); - - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - - state.ended = true; - - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; - - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } -} // Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. - - -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } -} - -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); - - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - } // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - - - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); -} // at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. - - -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. - break; - } - - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. - - -Readable.prototype._read = function (n) { - this.emit('error', new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - - case 1: - state.pipes = [state.pipes, dest]; - break; - - default: - state.pipes.push(dest); - break; - } - - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); - - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - - - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; - - function cleanup() { - debug('cleanup'); // cleanup event handlers once the pipe is broken - - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - src.on('data', ondata); - - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); - - if (ret === false) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - } - - src.pause(); - } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - - - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } // Make sure our error handler is attached before userland ones. - - - prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - - dest.once('close', onclose); - - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } // tell the dest that it's being piped to - - - dest.emit('pipe', src); // start the flow if it hasn't been started already. - - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. - - if (state.pipesCount === 0) return this; // just one destination. most common case. - - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; // got a match. - - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } // slow case. multiple pipe destinations. - - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } - - return this; - } // try to find the right one. - - - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something - - -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused - - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); - - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - - return res; -}; - -Readable.prototype.addListener = Readable.prototype.on; - -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - - return res; -}; - -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - - return res; -}; - -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; - - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); - } -} - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} // pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. - - -Readable.prototype.resume = function () { - var state = this._readableState; - - if (!state.flowing) { - debug('resume'); // we flow only if there is no one listening - // for readable, but we still have to call - // resume() - - state.flowing = !state.readableListening; - resume(this, state); - } - - state.paused = false; - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - debug('resume', state.reading); - - if (!state.reading) { - stream.read(0); - } - - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - - if (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - - this._readableState.paused = true; - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - - while (state.flowing && stream.read() !== null) { - ; - } -} // wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. - - -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); - - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - - if (!ret) { - paused = true; - stream.pause(); - } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. - - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } // proxy certain important events. - - - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. - - - this._read = function (n) { - debug('wrapped _read', n); - - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - emitExperimentalWarning('Readable[Symbol.asyncIterator]'); - - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); - } - - return createReadableStreamAsyncIterator(this); - }; -} - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.highWaterMark; - } -}); -Object.defineProperty(Readable.prototype, 'readableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState && this._readableState.buffer; - } -}); -Object.defineProperty(Readable.prototype, 'readableFlowing', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } -}); // exposed for testing purposes only. - -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); // Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. - -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. - - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - - return -1; -} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":160,"../experimentalWarning":161,"./_stream_duplex":162,"./internal/streams/async_iterator":167,"./internal/streams/buffer_list":168,"./internal/streams/destroy":169,"./internal/streams/state":172,"./internal/streams/stream":173,"_process":133,"buffer":48,"events":52,"inherits":75,"string_decoder/":175,"util":33}],165:[function(require,module,exports){ -// 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. -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. -'use strict'; - -module.exports = Transform; - -var _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - -var Duplex = require('./_stream_duplex'); - -require('inherits')(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - - if (cb === null) { - return this.emit('error', new ERR_MULTIPLE_CALLBACK()); - } - - ts.writechunk = null; - ts.writecb = null; - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; // start out asking for a readable event once data is transformed. - - this._readableState.needReadable = true; // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') this._flush = options.flush; - } // When the writable side finishes, then flush out anything remaining. - - - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function' && !this._readableState.destroyed) { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; // This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. - - -Transform.prototype._transform = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; // Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. - - -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); // TODO(BridgeAR): Write a test for these two error cases - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); -} -},{"../errors":160,"./_stream_duplex":162,"inherits":75}],166:[function(require,module,exports){ -(function (process,global){ -// 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. -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. -'use strict'; - -module.exports = Writable; -/* */ - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} // It seems a linked list but it is not -// there will be only 2 of these for each stream - - -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ - - -var Duplex; -/**/ - -Writable.WritableState = WritableState; -/**/ - -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - -require('inherits')(Writable, Stream); - -function nop() {} - -function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream - // contains buffers or objects. - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - - this.finalCalled = false; // drain event flag. - - this.needDrain = false; // at the start of calling end() - - this.ending = false; // when end() has been called, and returned - - this.ended = false; // when 'finish' is emitted - - this.finished = false; // has it been destroyed - - this.destroyed = false; // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - - this.length = 0; // a flag to see when we're in the middle of a write. - - this.writing = false; // when true all writes will be buffered until .uncork() call - - this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - - this.sync = true; // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - - this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - - this.onwrite = function (er) { - onwrite(stream, er); - }; // the callback that the user supplies to write(chunk,encoding,cb) - - - this.writecb = null; // the amount that is being written when _write is called. - - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - - this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - - this.prefinished = false; // True if the error was already emitted and should not be thrown again - - this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // count buffered requests - - this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - - while (current) { - out.push(current); - current = current.next; - } - - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); // Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. - - -var realHasInstance; - -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function realHasInstance(object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); // legacy. - - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} // Otherwise people can pipe Writable streams, which is just wrong. - - -Writable.prototype.pipe = function () { - this.emit('error', new ERR_STREAM_CANNOT_PIPE()); -}; - -function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - - stream.emit('error', er); - process.nextTick(cb, er); -} // Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. - - -function validChunk(stream, state, chunk, cb) { - var er; - - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== 'string' && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); - } - - if (er) { - stream.emit('error', er); - process.nextTick(cb, er); - return false; - } - - return true; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; -}; - -Writable.prototype.cork = function () { - this._writableState.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); // if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. - -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. - - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); // this can emit finish, and it will always happen - // after error - - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); // this can emit finish, but finish must - // always follow error - - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state) || stream.destroyed; - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} // Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. - - -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} // if there's something in the buffer waiting, then process it - - -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - - state.pendingcb++; - state.lastBufferedRequest = null; - - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks - - if (state.corked) { - state.corked = 1; - this.uncork(); - } // ignore unnecessary end() calls. - - - if (!state.ending) endWritable(this, state, cb); - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} - -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - - if (err) { - stream.emit('error', err); - } - - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} - -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - - if (need) { - prefinish(stream, state); - - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - } - } - - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); - } - - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } // reuse the free corkReq. - - - state.corkedRequestsFree.next = corkReq; -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; - } - - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._writableState.destroyed = value; - } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; - -Writable.prototype._destroy = function (err, cb) { - cb(err); -}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":160,"./_stream_duplex":162,"./internal/streams/destroy":169,"./internal/streams/state":172,"./internal/streams/stream":173,"_process":133,"buffer":48,"inherits":75,"util-deprecate":183}],167:[function(require,module,exports){ -(function (process){ -'use strict'; - -var _Object$setPrototypeO; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var finished = require('./end-of-stream'); - -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); - -function createIterResult(value, done) { - return { - value: value, - done: done - }; -} - -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; - - if (resolve !== null) { - var data = iter[kStream].read(); // we defer if data is null - // we can be expecting either 'end' or - // 'error' - - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); - } - } -} - -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); -} - -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } - - iter[kHandlePromise](resolve, reject); - }, reject); - }; -} - -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - - next: function next() { - var _this = this; - - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - - if (error !== null) { - return Promise.reject(error); - } - - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time - - - var lastPromise = this[kLastPromise]; - var promise; - - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - - promise = new Promise(this[kHandlePromise]); - } - - this[kLastPromise] = promise; - return promise; - } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); - -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; - - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); - - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise - // returned by next() and store the error - - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - - iterator[kError] = err; - return; - } - - var resolve = iterator[kLastResolve]; - - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } - - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; - -module.exports = createReadableStreamAsyncIterator; -}).call(this,require('_process')) -},{"./end-of-stream":170,"_process":133}],168:[function(require,module,exports){ -'use strict'; - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var _require = require('buffer'), - Buffer = _require.Buffer; - -var _require2 = require('util'), - inspect = _require2.inspect; - -var custom = inspect && inspect.custom || 'inspect'; - -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} - -module.exports = -/*#__PURE__*/ -function () { - function BufferList() { - this.head = null; - this.tail = null; - this.length = 0; - } - - var _proto = BufferList.prototype; - - _proto.push = function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - }; - - _proto.unshift = function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - _proto.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - _proto.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - _proto.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - - while (p = p.next) { - ret += s + p.data; - } - - return ret; - }; - - _proto.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - - return ret; - } // Consumes a specified amount of bytes or characters from the buffered data. - ; - - _proto.consume = function consume(n, hasStrings) { - var ret; - - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - - return ret; - }; - - _proto.first = function first() { - return this.head.data; - } // Consumes a specified amount of characters from the buffered data. - ; - - _proto._getString = function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - - break; - } - - ++c; - } - - this.length -= c; - return ret; - } // Consumes a specified amount of bytes from the buffered data. - ; - - _proto._getBuffer = function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } - - break; - } - - ++c; - } - - this.length -= c; - return ret; - } // Make sure the linked list only shows the minimal necessary information. - ; - - _proto[custom] = function (_, options) { - return inspect(this, _objectSpread({}, options, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - }; - - return BufferList; -}(); -},{"buffer":48,"util":33}],169:[function(require,module,exports){ -(function (process){ -'use strict'; // undocumented cb() API, needed for core, not for public API - -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - process.nextTick(emitErrorNT, this, err); - } - - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well - - - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - process.nextTick(emitErrorAndCloseNT, _this, err); - - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - - return this; -} - -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); -} - -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; -}).call(this,require('_process')) -},{"_process":133}],170:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; - -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; - -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - callback.apply(this, args); - }; -} - -function noop() {} - -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} - -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; - - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; - - var writableEnded = stream._writableState && stream._writableState.finished; - - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; - - var readableEnded = stream._readableState && stream._readableState.endEmitted; - - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; - - var onerror = function onerror(err) { - callback.call(stream, err); - }; - - var onclose = function onclose() { - var err; - - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; - - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } - - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; -} - -module.exports = eos; -},{"../../../errors":160}],171:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; - -var eos; - -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; -} - -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} - -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} - -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; // request.destroy just do .end - .abort is what we want - - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} - -function call(fn) { - fn(); -} - -function pipe(from, to) { - return from.pipe(to); -} - -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} - -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); - } - - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); -} - -module.exports = pipeline; -},{"../../../errors":160,"./end-of-stream":170}],172:[function(require,module,exports){ -'use strict'; - -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; - -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} - -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - - return Math.floor(hwm); - } // Default value - - - return state.objectMode ? 16 : 16 * 1024; -} - -module.exports = { - getHighWaterMark: getHighWaterMark -}; -},{"../../../errors":160}],173:[function(require,module,exports){ -arguments[4][146][0].apply(exports,arguments) -},{"dup":146,"events":52}],174:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); -exports.finished = require('./lib/internal/streams/end-of-stream.js'); -exports.pipeline = require('./lib/internal/streams/pipeline.js'); - -},{"./lib/_stream_duplex.js":162,"./lib/_stream_passthrough.js":163,"./lib/_stream_readable.js":164,"./lib/_stream_transform.js":165,"./lib/_stream_writable.js":166,"./lib/internal/streams/end-of-stream.js":170,"./lib/internal/streams/pipeline.js":171}],175:[function(require,module,exports){ -arguments[4][148][0].apply(exports,arguments) -},{"dup":148,"safe-buffer":154}],176:[function(require,module,exports){ -(function (setImmediate,clearImmediate){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; - -// DOM APIs, for completeness - -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; - -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; -} -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; - -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; - -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; - -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; - -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - - immediateIds[id] = true; - - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); - - return id; -}; - -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":133,"timers":176}],177:[function(require,module,exports){ -(function (process){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -exports.clone = clone; -exports.addLast = addLast; -exports.addFirst = addFirst; -exports.removeLast = removeLast; -exports.removeFirst = removeFirst; -exports.insert = insert; -exports.removeAt = removeAt; -exports.replaceAt = replaceAt; -exports.getIn = getIn; -exports.set = set; -exports.setIn = setIn; -exports.update = update; -exports.updateIn = updateIn; -exports.merge = merge; -exports.mergeDeep = mergeDeep; -exports.mergeIn = mergeIn; -exports.omit = omit; -exports.addDefaults = addDefaults; - - -/*! - * Timm - * - * Immutability helpers with fast reads and acceptable writes. - * - * @copyright Guillermo Grau Panea 2016 - * @license MIT - */ - -var INVALID_ARGS = 'INVALID_ARGS'; - -// =============================================== -// ### Helpers -// =============================================== - - -function throwStr(msg) { - throw new Error(msg); -} - -function getKeysAndSymbols(obj) { - var keys = Object.keys(obj); - if (Object.getOwnPropertySymbols) { - return keys.concat(Object.getOwnPropertySymbols(obj)); - } - return keys; -} - -var hasOwnProperty = {}.hasOwnProperty; - -function clone(obj) { - if (Array.isArray(obj)) return obj.slice(); - var keys = getKeysAndSymbols(obj); - var out = {}; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - out[key] = obj[key]; - } - return out; -} - -function doMerge(fAddDefaults, fDeep, first) { - var out = first; - !(out != null) && throwStr(process.env.NODE_ENV !== 'production' ? 'At least one object should be provided to merge()' : INVALID_ARGS); - var fChanged = false; - - for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - rest[_key - 3] = arguments[_key]; - } - - for (var idx = 0; idx < rest.length; idx++) { - var obj = rest[idx]; - if (obj == null) continue; - var keys = getKeysAndSymbols(obj); - if (!keys.length) continue; - for (var j = 0; j <= keys.length; j++) { - var key = keys[j]; - if (fAddDefaults && out[key] !== undefined) continue; - var nextVal = obj[key]; - if (fDeep && isObject(out[key]) && isObject(nextVal)) { - nextVal = doMerge(fAddDefaults, fDeep, out[key], nextVal); - } - if (nextVal === undefined || nextVal === out[key]) continue; - if (!fChanged) { - fChanged = true; - out = clone(out); - } - out[key] = nextVal; - } - } - return out; -} - -function isObject(o) { - var type = typeof o === 'undefined' ? 'undefined' : _typeof(o); - return o != null && type === 'object'; -} - -// _deepFreeze = (obj) -> -// Object.freeze obj -// for key in Object.getOwnPropertyNames obj -// val = obj[key] -// if isObject(val) and not Object.isFrozen val -// _deepFreeze val -// obj - -// =============================================== -// -- ### Arrays -// =============================================== - -// -- #### addLast() -// -- Returns a new array with an appended item or items. -// -- -// -- Usage: `addLast(array: Array, val: Array|T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = addLast(arr, 'c') -// -- // ['a', 'b', 'c'] -// -- arr2 === arr -// -- // false -// -- arr3 = addLast(arr, ['c', 'd']) -// -- // ['a', 'b', 'c', 'd'] -// -- ``` -// `array.concat(val)` also handles the scalar case, -// but is apparently very slow -function addLast(array, val) { - if (Array.isArray(val)) return array.concat(val); - return array.concat([val]); -} - -// -- #### addFirst() -// -- Returns a new array with a prepended item or items. -// -- -// -- Usage: `addFirst(array: Array, val: Array|T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = addFirst(arr, 'c') -// -- // ['c', 'a', 'b'] -// -- arr2 === arr -// -- // false -// -- arr3 = addFirst(arr, ['c', 'd']) -// -- // ['c', 'd', 'a', 'b'] -// -- ``` -function addFirst(array, val) { - if (Array.isArray(val)) return val.concat(array); - return [val].concat(array); -} - -// -- #### removeLast() -// -- Returns a new array removing the last item. -// -- -// -- Usage: `removeLast(array: Array): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = removeLast(arr) -// -- // ['a'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same array is returned if there are no changes: -// -- arr3 = [] -// -- removeLast(arr3) === arr3 -// -- // true -// -- ``` -function removeLast(array) { - if (!array.length) return array; - return array.slice(0, array.length - 1); -} - -// -- #### removeFirst() -// -- Returns a new array removing the first item. -// -- -// -- Usage: `removeFirst(array: Array): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = removeFirst(arr) -// -- // ['b'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same array is returned if there are no changes: -// -- arr3 = [] -// -- removeFirst(arr3) === arr3 -// -- // true -// -- ``` -function removeFirst(array) { - if (!array.length) return array; - return array.slice(1); -} - -// -- #### insert() -// -- Returns a new array obtained by inserting an item or items -// -- at a specified index. -// -- -// -- Usage: `insert(array: Array, idx: number, val: Array|T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b', 'c'] -// -- arr2 = insert(arr, 1, 'd') -// -- // ['a', 'd', 'b', 'c'] -// -- arr2 === arr -// -- // false -// -- insert(arr, 1, ['d', 'e']) -// -- // ['a', 'd', 'e', 'b', 'c'] -// -- ``` -function insert(array, idx, val) { - return array.slice(0, idx).concat(Array.isArray(val) ? val : [val]).concat(array.slice(idx)); -} - -// -- #### removeAt() -// -- Returns a new array obtained by removing an item at -// -- a specified index. -// -- -// -- Usage: `removeAt(array: Array, idx: number): Array` -// -- -// -- ```js -// -- arr = ['a', 'b', 'c'] -// -- arr2 = removeAt(arr, 1) -// -- // ['a', 'c'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same array is returned if there are no changes: -// -- removeAt(arr, 4) === arr -// -- // true -// -- ``` -function removeAt(array, idx) { - if (idx >= array.length || idx < 0) return array; - return array.slice(0, idx).concat(array.slice(idx + 1)); -} - -// -- #### replaceAt() -// -- Returns a new array obtained by replacing an item at -// -- a specified index. If the provided item is the same as -// -- (*referentially equal to*) the previous item at that position, -// -- the original array is returned. -// -- -// -- Usage: `replaceAt(array: Array, idx: number, newItem: T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b', 'c'] -// -- arr2 = replaceAt(arr, 1, 'd') -// -- // ['a', 'd', 'c'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- replaceAt(arr, 1, 'b') === arr -// -- // true -// -- ``` -function replaceAt(array, idx, newItem) { - if (array[idx] === newItem) return array; - var len = array.length; - var result = Array(len); - for (var i = 0; i < len; i++) { - result[i] = array[i]; - } - result[idx] = newItem; - return result; -} - -// =============================================== -// -- ### Collections (objects and arrays) -// =============================================== -// -- The following types are used throughout this section -// -- ```js -// -- type ArrayOrObject = Array|Object; -// -- type Key = number|string; -// -- ``` - -// -- #### getIn() -// -- Returns a value from an object at a given path. Works with -// -- nested arrays and objects. If the path does not exist, it returns -// -- `undefined`. -// -- -// -- Usage: `getIn(obj: ?ArrayOrObject, path: Array): any` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: ['a', 'b', 'c'] } -// -- getIn(obj, ['d', 'd1']) -// -- // 3 -// -- getIn(obj, ['e', 1]) -// -- // 'b' -// -- ``` -function getIn(obj, path) { - !Array.isArray(path) && throwStr(process.env.NODE_ENV !== 'production' ? 'A path array should be provided when calling getIn()' : INVALID_ARGS); - if (obj == null) return undefined; - var ptr = obj; - for (var i = 0; i < path.length; i++) { - var key = path[i]; - ptr = ptr != null ? ptr[key] : undefined; - if (ptr === undefined) return ptr; - } - return ptr; -} - -// -- #### set() -// -- Returns a new object with a modified attribute. -// -- If the provided value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- -// -- Usage: `set(obj: ?T, key: Key, val: any): T` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, c: 3 } -// -- obj2 = set(obj, 'b', 5) -// -- // { a: 1, b: 5, c: 3 } -// -- obj2 === obj -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- set(obj, 'b', 2) === obj -// -- // true -// -- ``` -function set(obj, key, val) { - var fallback = typeof key === 'number' ? [] : {}; - var finalObj = obj == null ? fallback : obj; - if (finalObj[key] === val) return finalObj; - var obj2 = clone(finalObj); - obj2[key] = val; - return obj2; -} - -// -- #### setIn() -// -- Returns a new object with a modified **nested** attribute. -// -- -// -- Notes: -// -- -// -- * If the provided value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- * If the path does not exist, it will be created before setting -// -- the new value. -// -- -// -- Usage: `setIn(obj: T, path: Array, val: any): T` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } } -// -- obj2 = setIn(obj, ['d', 'd1'], 4) -// -- // { a: 1, b: 2, d: { d1: 4, d2: 4 }, e: { e1: 'foo', e2: 'bar' } } -// -- obj2 === obj -// -- // false -// -- obj2.d === obj.d -// -- // false -// -- obj2.e === obj.e -// -- // true -// -- -// -- // The same object is returned if there are no changes: -// -- obj3 = setIn(obj, ['d', 'd1'], 3) -// -- // { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } } -// -- obj3 === obj -// -- // true -// -- obj3.d === obj.d -// -- // true -// -- obj3.e === obj.e -// -- // true -// -- -// -- // ... unknown paths create intermediate keys. Numeric segments are treated as array indices: -// -- setIn({ a: 3 }, ['unknown', 0, 'path'], 4) -// -- // { a: 3, unknown: [{ path: 4 }] } -// -- ``` -function doSetIn(obj, path, val, idx) { - var newValue = void 0; - var key = path[idx]; - if (idx === path.length - 1) { - newValue = val; - } else { - var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === 'number' ? [] : {}; - newValue = doSetIn(nestedObj, path, val, idx + 1); - } - return set(obj, key, newValue); -} - -function setIn(obj, path, val) { - if (!path.length) return val; - return doSetIn(obj, path, val, 0); -} - -// -- #### update() -// -- Returns a new object with a modified attribute, -// -- calculated via a user-provided callback based on the current value. -// -- If the calculated value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- -// -- Usage: `update(obj: T, key: Key, -// -- fnUpdate: (prevValue: any) => any): T` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, c: 3 } -// -- obj2 = update(obj, 'b', (val) => val + 1) -// -- // { a: 1, b: 3, c: 3 } -// -- obj2 === obj -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- update(obj, 'b', (val) => val) === obj -// -- // true -// -- ``` -function update(obj, key, fnUpdate) { - var prevVal = obj == null ? undefined : obj[key]; - var nextVal = fnUpdate(prevVal); - return set(obj, key, nextVal); -} - -// -- #### updateIn() -// -- Returns a new object with a modified **nested** attribute, -// -- calculated via a user-provided callback based on the current value. -// -- If the calculated value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- -// -- Usage: `updateIn(obj: T, path: Array, -// -- fnUpdate: (prevValue: any) => any): T` -// -- -// -- ```js -// -- obj = { a: 1, d: { d1: 3, d2: 4 } } -// -- obj2 = updateIn(obj, ['d', 'd1'], (val) => val + 1) -// -- // { a: 1, d: { d1: 4, d2: 4 } } -// -- obj2 === obj -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- obj3 = updateIn(obj, ['d', 'd1'], (val) => val) -// -- // { a: 1, d: { d1: 3, d2: 4 } } -// -- obj3 === obj -// -- // true -// -- ``` -function updateIn(obj, path, fnUpdate) { - var prevVal = getIn(obj, path); - var nextVal = fnUpdate(prevVal); - return setIn(obj, path, nextVal); -} - -// -- #### merge() -// -- Returns a new object built as follows: the overlapping keys from the -// -- second one overwrite the corresponding entries from the first one. -// -- Similar to `Object.assign()`, but immutable. -// -- -// -- Usage: -// -- -// -- * `merge(obj1: Object, obj2: ?Object): Object` -// -- * `merge(obj1: Object, ...objects: Array): Object` -// -- -// -- The unmodified `obj1` is returned if `obj2` does not *provide something -// -- new to* `obj1`, i.e. if either of the following -// -- conditions are true: -// -- -// -- * `obj2` is `null` or `undefined` -// -- * `obj2` is an object, but it is empty -// -- * All attributes of `obj2` are `undefined` -// -- * All attributes of `obj2` are referentially equal to the -// -- corresponding attributes of `obj1` -// -- -// -- Note that `undefined` attributes in `obj2` do not modify the -// -- corresponding attributes in `obj1`. -// -- -// -- ```js -// -- obj1 = { a: 1, b: 2, c: 3 } -// -- obj2 = { c: 4, d: 5 } -// -- obj3 = merge(obj1, obj2) -// -- // { a: 1, b: 2, c: 4, d: 5 } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- merge(obj1, { c: 3 }) === obj1 -// -- // true -// -- ``` -function merge(a, b, c, d, e, f) { - for (var _len2 = arguments.length, rest = Array(_len2 > 6 ? _len2 - 6 : 0), _key2 = 6; _key2 < _len2; _key2++) { - rest[_key2 - 6] = arguments[_key2]; - } - - return rest.length ? doMerge.call.apply(doMerge, [null, false, false, a, b, c, d, e, f].concat(rest)) : doMerge(false, false, a, b, c, d, e, f); -} - -// -- #### mergeDeep() -// -- Returns a new object built as follows: the overlapping keys from the -// -- second one overwrite the corresponding entries from the first one. -// -- If both the first and second entries are objects they are merged recursively. -// -- Similar to `Object.assign()`, but immutable, and deeply merging. -// -- -// -- Usage: -// -- -// -- * `mergeDeep(obj1: Object, obj2: ?Object): Object` -// -- * `mergeDeep(obj1: Object, ...objects: Array): Object` -// -- -// -- The unmodified `obj1` is returned if `obj2` does not *provide something -// -- new to* `obj1`, i.e. if either of the following -// -- conditions are true: -// -- -// -- * `obj2` is `null` or `undefined` -// -- * `obj2` is an object, but it is empty -// -- * All attributes of `obj2` are `undefined` -// -- * All attributes of `obj2` are referentially equal to the -// -- corresponding attributes of `obj1` -// -- -// -- Note that `undefined` attributes in `obj2` do not modify the -// -- corresponding attributes in `obj1`. -// -- -// -- ```js -// -- obj1 = { a: 1, b: 2, c: { a: 1 } } -// -- obj2 = { b: 3, c: { b: 2 } } -// -- obj3 = mergeDeep(obj1, obj2) -// -- // { a: 1, b: 3, c: { a: 1, b: 2 } } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- mergeDeep(obj1, { c: { a: 1 } }) === obj1 -// -- // true -// -- ``` -function mergeDeep(a, b, c, d, e, f) { - for (var _len3 = arguments.length, rest = Array(_len3 > 6 ? _len3 - 6 : 0), _key3 = 6; _key3 < _len3; _key3++) { - rest[_key3 - 6] = arguments[_key3]; - } - - return rest.length ? doMerge.call.apply(doMerge, [null, false, true, a, b, c, d, e, f].concat(rest)) : doMerge(false, true, a, b, c, d, e, f); -} - -// -- #### mergeIn() -// -- Similar to `merge()`, but merging the value at a given nested path. -// -- Note that the returned type is the same as that of the first argument. -// -- -// -- Usage: -// -- -// -- * `mergeIn(obj1: T, path: Array, obj2: ?Object): T` -// -- * `mergeIn(obj1: T, path: Array, -// -- ...objects: Array): T` -// -- -// -- ```js -// -- obj1 = { a: 1, d: { b: { d1: 3, d2: 4 } } } -// -- obj2 = { d3: 5 } -// -- obj3 = mergeIn(obj1, ['d', 'b'], obj2) -// -- // { a: 1, d: { b: { d1: 3, d2: 4, d3: 5 } } } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- mergeIn(obj1, ['d', 'b'], { d2: 4 }) === obj1 -// -- // true -// -- ``` -function mergeIn(a, path, b, c, d, e, f) { - var prevVal = getIn(a, path); - if (prevVal == null) prevVal = {}; - var nextVal = void 0; - - for (var _len4 = arguments.length, rest = Array(_len4 > 7 ? _len4 - 7 : 0), _key4 = 7; _key4 < _len4; _key4++) { - rest[_key4 - 7] = arguments[_key4]; - } - - if (rest.length) { - nextVal = doMerge.call.apply(doMerge, [null, false, false, prevVal, b, c, d, e, f].concat(rest)); - } else { - nextVal = doMerge(false, false, prevVal, b, c, d, e, f); - } - return setIn(a, path, nextVal); -} - -// -- #### omit() -// -- Returns an object excluding one or several attributes. -// -- -// -- Usage: `omit(obj: Object, attrs: Array|string): Object` -// -// -- ```js -// -- obj = { a: 1, b: 2, c: 3, d: 4 } -// -- omit(obj, 'a') -// -- // { b: 2, c: 3, d: 4 } -// -- omit(obj, ['b', 'c']) -// -- // { a: 1, d: 4 } -// -- -// -- // The same object is returned if there are no changes: -// -- omit(obj, 'z') === obj1 -// -- // true -// -- ``` -function omit(obj, attrs) { - var omitList = Array.isArray(attrs) ? attrs : [attrs]; - var fDoSomething = false; - for (var i = 0; i < omitList.length; i++) { - if (hasOwnProperty.call(obj, omitList[i])) { - fDoSomething = true; - break; - } - } - if (!fDoSomething) return obj; - var out = {}; - var keys = getKeysAndSymbols(obj); - for (var _i = 0; _i < keys.length; _i++) { - var key = keys[_i]; - if (omitList.indexOf(key) >= 0) continue; - out[key] = obj[key]; - } - return out; -} - -// -- #### addDefaults() -// -- Returns a new object built as follows: `undefined` keys in the first one -// -- are filled in with the corresponding values from the second one -// -- (even if they are `null`). -// -- -// -- Usage: -// -- -// -- * `addDefaults(obj: Object, defaults: Object): Object` -// -- * `addDefaults(obj: Object, ...defaultObjects: Array): Object` -// -- -// -- ```js -// -- obj1 = { a: 1, b: 2, c: 3 } -// -- obj2 = { c: 4, d: 5, e: null } -// -- obj3 = addDefaults(obj1, obj2) -// -- // { a: 1, b: 2, c: 3, d: 5, e: null } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- addDefaults(obj1, { c: 4 }) === obj1 -// -- // true -// -- ``` -function addDefaults(a, b, c, d, e, f) { - for (var _len5 = arguments.length, rest = Array(_len5 > 6 ? _len5 - 6 : 0), _key5 = 6; _key5 < _len5; _key5++) { - rest[_key5 - 6] = arguments[_key5]; - } - - return rest.length ? doMerge.call.apply(doMerge, [null, true, false, a, b, c, d, e, f].concat(rest)) : doMerge(true, false, a, b, c, d, e, f); -} - -// =============================================== -// ### Public API -// =============================================== -var timm = { - clone: clone, - addLast: addLast, - addFirst: addFirst, - removeLast: removeLast, - removeFirst: removeFirst, - insert: insert, - removeAt: removeAt, - replaceAt: replaceAt, - - getIn: getIn, - // eslint-disable-next-line object-shorthand - set: set, // so that flow doesn't complain - setIn: setIn, - update: update, - updateIn: updateIn, - merge: merge, - mergeDeep: mergeDeep, - mergeIn: mergeIn, - omit: omit, - addDefaults: addDefaults -}; - -exports.default = timm; - -}).call(this,require('_process')) -},{"_process":133}],178:[function(require,module,exports){ -// TinyColor v1.4.1 -// https://github.com/bgrins/TinyColor -// Brian Grinstead, MIT License - -(function(Math) { - -var trimLeft = /^\s+/, - trimRight = /\s+$/, - tinyCounter = 0, - mathRound = Math.round, - mathMin = Math.min, - mathMax = Math.max, - mathRandom = Math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - opts = opts || { }; - - // If input is already a tinycolor, return itself - if (color instanceof tinycolor) { - return color; - } - // If we are called as a function, call using new instead - if (!(this instanceof tinycolor)) { - return new tinycolor(color, opts); - } - - var rgb = inputToRGB(color); - this._originalInput = color, - this._r = rgb.r, - this._g = rgb.g, - this._b = rgb.b, - this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, - this._format = opts.format || rgb.format; - this._gradientType = opts.gradientType; - - // Don't let the range of [0,255] come back in [0,1]. - // Potentially lose a little bit of precision here, but will fix issues where - // .5 gets interpreted as half of the total, instead of half of 1 - // If it was supposed to be 128, this was already taken care of by `inputToRgb` - if (this._r < 1) { this._r = mathRound(this._r); } - if (this._g < 1) { this._g = mathRound(this._g); } - if (this._b < 1) { this._b = mathRound(this._b); } - - this._ok = rgb.ok; - this._tc_id = tinyCounter++; -} - -tinycolor.prototype = { - isDark: function() { - return this.getBrightness() < 128; - }, - isLight: function() { - return !this.isDark(); - }, - isValid: function() { - return this._ok; - }, - getOriginalInput: function() { - return this._originalInput; - }, - getFormat: function() { - return this._format; - }, - getAlpha: function() { - return this._a; - }, - getBrightness: function() { - //http://www.w3.org/TR/AERT#color-contrast - var rgb = this.toRgb(); - return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; - }, - getLuminance: function() { - //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - var rgb = this.toRgb(); - var RsRGB, GsRGB, BsRGB, R, G, B; - RsRGB = rgb.r/255; - GsRGB = rgb.g/255; - BsRGB = rgb.b/255; - - if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} - if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} - if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} - return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); - }, - setAlpha: function(value) { - this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; - return this; - }, - toHsv: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; - }, - toHsvString: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (this._a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; - }, - toHsl: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; - }, - toHslString: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (this._a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; - }, - toHex: function(allow3Char) { - return rgbToHex(this._r, this._g, this._b, allow3Char); - }, - toHexString: function(allow3Char) { - return '#' + this.toHex(allow3Char); - }, - toHex8: function(allow4Char) { - return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); - }, - toHex8String: function(allow4Char) { - return '#' + this.toHex8(allow4Char); - }, - toRgb: function() { - return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; - }, - toRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : - "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; - }, - toPercentageRgb: function() { - return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; - }, - toPercentageRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; - }, - toName: function() { - if (this._a === 0) { - return "transparent"; - } - - if (this._a < 1) { - return false; - } - - return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; - }, - toFilter: function(secondColor) { - var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); - var secondHex8String = hex8String; - var gradientType = this._gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); - } - - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; - }, - toString: function(format) { - var formatSet = !!format; - format = format || this._format; - - var formattedString = false; - var hasAlpha = this._a < 1 && this._a >= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); - } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); - }, - clone: function() { - return tinycolor(this.toString()); - }, - - _applyModification: function(fn, args) { - var color = fn.apply(null, [this].concat([].slice.call(args))); - this._r = color._r; - this._g = color._g; - this._b = color._b; - this.setAlpha(color._a); - return this; - }, - lighten: function() { - return this._applyModification(lighten, arguments); - }, - brighten: function() { - return this._applyModification(brighten, arguments); - }, - darken: function() { - return this._applyModification(darken, arguments); - }, - desaturate: function() { - return this._applyModification(desaturate, arguments); - }, - saturate: function() { - return this._applyModification(saturate, arguments); - }, - greyscale: function() { - return this._applyModification(greyscale, arguments); - }, - spin: function() { - return this._applyModification(spin, arguments); - }, - - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); - }, - analogous: function() { - return this._applyCombination(analogous, arguments); - }, - complement: function() { - return this._applyCombination(complement, arguments); - }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); - }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); - }, - triad: function() { - return this._applyCombination(triad, arguments); - }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); - } -}; - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color, opts) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - if (color.hasOwnProperty(i)) { - if (i === "a") { - newColor[i] = color[i]; - } - else { - newColor[i] = convertToPercentage(color[i]); - } - } - } - color = newColor; - } - - return tinycolor(color, opts); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 0, g: 0, b: 0 }; - var a = 1; - var s = null; - var v = null; - var l = null; - var ok = false; - var format = false; - - if (typeof color == "string") { - color = stringInputToObject(color); - } - - if (typeof color == "object") { - if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s = convertToPercentage(color.s); - v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s, v); - ok = true; - format = "hsv"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s = convertToPercentage(color.s); - l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s, l); - ok = true; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } - } - - a = boundAlpha(a); - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - - -// Conversion Functions -// -------------------- - -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ - return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 - }; -} - -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - - if(max == min) { - h = s = 0; // achromatic - } - else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - - h /= 6; - } - - return { h: h, s: s, l: l }; -} - -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { - var r, g, b; - - h = bound01(h, 360); - s = bound01(s, 100); - l = bound01(l, 100); - - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - } - - if(s === 0) { - r = g = b = l; // achromatic - } - else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); - } - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; - - var d = max - min; - s = max === 0 ? 0 : d / max; - - if(max == min) { - h = 0; // achromatic - } - else { - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h, s: s, v: v }; -} - -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - function hsvToRgb(h, s, v) { - - h = bound01(h, 360) * 6; - s = bound01(s, 100); - v = bound01(v, 100); - - var i = Math.floor(h), - f = h - i, - p = v * (1 - s), - q = v * (1 - f * s), - t = v * (1 - (1 - f) * s), - mod = i % 6, - r = [v, q, p, p, t, v][mod], - g = [t, v, v, q, p, p][mod], - b = [p, p, t, v, v, q][mod]; - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b, allow3Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - // Return a 3 character hex if possible - if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); - } - - return hex.join(""); -} - -// `rgbaToHex` -// Converts an RGBA color plus alpha transparency to hex -// Assumes r, g, b are contained in the set [0, 255] and -// a in [0, 1]. Returns a 4 or 8 character rgba hex -function rgbaToHex(r, g, b, a, allow4Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)), - pad2(convertDecimalToHex(a)) - ]; - - // Return a 4 character hex if possible - if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); - } - - return hex.join(""); -} - -// `rgbaToArgbHex` -// Converts an RGBA color to an ARGB Hex8 string -// Rarely used, but required for "toFilter()" -function rgbaToArgbHex(r, g, b, a) { - - var hex = [ - pad2(convertDecimalToHex(a)), - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - return hex.join(""); -} - -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } - return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); -}; - -tinycolor.random = function() { - return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() - }); -}; - - -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// - -function desaturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s -= amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function saturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s += amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function greyscale(color) { - return tinycolor(color).desaturate(100); -} - -function lighten (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l += amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} - -function brighten(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var rgb = tinycolor(color).toRgb(); - rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); - rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); - rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); - return tinycolor(rgb); -} - -function darken (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l -= amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} - -// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -// Values outside of this range will be wrapped into this range. -function spin(color, amount) { - var hsl = tinycolor(color).toHsl(); - var hue = (hsl.h + amount) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return tinycolor(hsl); -} - -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// - -function complement(color) { - var hsl = tinycolor(color).toHsl(); - hsl.h = (hsl.h + 180) % 360; - return tinycolor(hsl); -} - -function triad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function tetrad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function splitcomplement(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), - tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) - ]; -} - -function analogous(color, results, slices) { - results = results || 6; - slices = slices || 30; - - var hsl = tinycolor(color).toHsl(); - var part = 360 / slices; - var ret = [tinycolor(color)]; - - for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { - hsl.h = (hsl.h + part) % 360; - ret.push(tinycolor(hsl)); - } - return ret; -} - -function monochromatic(color, results) { - results = results || 6; - var hsv = tinycolor(color).toHsv(); - var h = hsv.h, s = hsv.s, v = hsv.v; - var ret = []; - var modification = 1 / results; - - while (results--) { - ret.push(tinycolor({ h: h, s: s, v: v})); - v = (v + modification) % 1; - } - - return ret; -} - -// Utility Functions -// --------------------- - -tinycolor.mix = function(color1, color2, amount) { - amount = (amount === 0) ? 0 : (amount || 50); - - var rgb1 = tinycolor(color1).toRgb(); - var rgb2 = tinycolor(color2).toRgb(); - - var p = amount / 100; - - var rgba = { - r: ((rgb2.r - rgb1.r) * p) + rgb1.r, - g: ((rgb2.g - rgb1.g) * p) + rgb1.g, - b: ((rgb2.b - rgb1.b) * p) + rgb1.b, - a: ((rgb2.a - rgb1.a) * p) + rgb1.a - }; - - return tinycolor(rgba); -}; - - -// Readability Functions -// --------------------- -// false -// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false -tinycolor.isReadable = function(color1, color2, wcag2) { - var readability = tinycolor.readability(color1, color2); - var wcag2Parms, out; - - out = false; - - wcag2Parms = validateWCAG2Parms(wcag2); - switch (wcag2Parms.level + wcag2Parms.size) { - case "AAsmall": - case "AAAlarge": - out = readability >= 4.5; - break; - case "AAlarge": - out = readability >= 3; - break; - case "AAAsmall": - out = readability >= 7; - break; - } - return out; - -}; - -// `mostReadable` -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Optionally returns Black or White if the most readable color is unreadable. -// *Example* -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" -tinycolor.mostReadable = function(baseColor, colorList, args) { - var bestColor = null; - var bestScore = 0; - var readability; - var includeFallbackColors, level, size ; - args = args || {}; - includeFallbackColors = args.includeFallbackColors ; - level = args.level; - size = args.size; - - for (var i= 0; i < colorList.length ; i++) { - readability = tinycolor.readability(baseColor, colorList[i]); - if (readability > bestScore) { - bestScore = readability; - bestColor = tinycolor(colorList[i]); - } - } - - if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { - return bestColor; - } - else { - args.includeFallbackColors=false; - return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); - } -}; - - -// Big List of Colors -// ------------------ -// -var names = tinycolor.names = { - aliceblue: "f0f8ff", - antiquewhite: "faebd7", - aqua: "0ff", - aquamarine: "7fffd4", - azure: "f0ffff", - beige: "f5f5dc", - bisque: "ffe4c4", - black: "000", - blanchedalmond: "ffebcd", - blue: "00f", - blueviolet: "8a2be2", - brown: "a52a2a", - burlywood: "deb887", - burntsienna: "ea7e5d", - cadetblue: "5f9ea0", - chartreuse: "7fff00", - chocolate: "d2691e", - coral: "ff7f50", - cornflowerblue: "6495ed", - cornsilk: "fff8dc", - crimson: "dc143c", - cyan: "0ff", - darkblue: "00008b", - darkcyan: "008b8b", - darkgoldenrod: "b8860b", - darkgray: "a9a9a9", - darkgreen: "006400", - darkgrey: "a9a9a9", - darkkhaki: "bdb76b", - darkmagenta: "8b008b", - darkolivegreen: "556b2f", - darkorange: "ff8c00", - darkorchid: "9932cc", - darkred: "8b0000", - darksalmon: "e9967a", - darkseagreen: "8fbc8f", - darkslateblue: "483d8b", - darkslategray: "2f4f4f", - darkslategrey: "2f4f4f", - darkturquoise: "00ced1", - darkviolet: "9400d3", - deeppink: "ff1493", - deepskyblue: "00bfff", - dimgray: "696969", - dimgrey: "696969", - dodgerblue: "1e90ff", - firebrick: "b22222", - floralwhite: "fffaf0", - forestgreen: "228b22", - fuchsia: "f0f", - gainsboro: "dcdcdc", - ghostwhite: "f8f8ff", - gold: "ffd700", - goldenrod: "daa520", - gray: "808080", - green: "008000", - greenyellow: "adff2f", - grey: "808080", - honeydew: "f0fff0", - hotpink: "ff69b4", - indianred: "cd5c5c", - indigo: "4b0082", - ivory: "fffff0", - khaki: "f0e68c", - lavender: "e6e6fa", - lavenderblush: "fff0f5", - lawngreen: "7cfc00", - lemonchiffon: "fffacd", - lightblue: "add8e6", - lightcoral: "f08080", - lightcyan: "e0ffff", - lightgoldenrodyellow: "fafad2", - lightgray: "d3d3d3", - lightgreen: "90ee90", - lightgrey: "d3d3d3", - lightpink: "ffb6c1", - lightsalmon: "ffa07a", - lightseagreen: "20b2aa", - lightskyblue: "87cefa", - lightslategray: "789", - lightslategrey: "789", - lightsteelblue: "b0c4de", - lightyellow: "ffffe0", - lime: "0f0", - limegreen: "32cd32", - linen: "faf0e6", - magenta: "f0f", - maroon: "800000", - mediumaquamarine: "66cdaa", - mediumblue: "0000cd", - mediumorchid: "ba55d3", - mediumpurple: "9370db", - mediumseagreen: "3cb371", - mediumslateblue: "7b68ee", - mediumspringgreen: "00fa9a", - mediumturquoise: "48d1cc", - mediumvioletred: "c71585", - midnightblue: "191970", - mintcream: "f5fffa", - mistyrose: "ffe4e1", - moccasin: "ffe4b5", - navajowhite: "ffdead", - navy: "000080", - oldlace: "fdf5e6", - olive: "808000", - olivedrab: "6b8e23", - orange: "ffa500", - orangered: "ff4500", - orchid: "da70d6", - palegoldenrod: "eee8aa", - palegreen: "98fb98", - paleturquoise: "afeeee", - palevioletred: "db7093", - papayawhip: "ffefd5", - peachpuff: "ffdab9", - peru: "cd853f", - pink: "ffc0cb", - plum: "dda0dd", - powderblue: "b0e0e6", - purple: "800080", - rebeccapurple: "663399", - red: "f00", - rosybrown: "bc8f8f", - royalblue: "4169e1", - saddlebrown: "8b4513", - salmon: "fa8072", - sandybrown: "f4a460", - seagreen: "2e8b57", - seashell: "fff5ee", - sienna: "a0522d", - silver: "c0c0c0", - skyblue: "87ceeb", - slateblue: "6a5acd", - slategray: "708090", - slategrey: "708090", - snow: "fffafa", - springgreen: "00ff7f", - steelblue: "4682b4", - tan: "d2b48c", - teal: "008080", - thistle: "d8bfd8", - tomato: "ff6347", - turquoise: "40e0d0", - violet: "ee82ee", - wheat: "f5deb3", - white: "fff", - whitesmoke: "f5f5f5", - yellow: "ff0", - yellowgreen: "9acd32" -}; - -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); - - -// Utilities -// --------- - -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; - for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } - } - return flipped; -} - -// Return a valid alpha value [0,1] with all invalid values being set to 1 -function boundAlpha(a) { - a = parseFloat(a); - - if (isNaN(a) || a < 0 || a > 1) { - a = 1; - } - - return a; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } - - var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); - - // Automatically convert percentage into number - if (processPercent) { - n = parseInt(n * max, 10) / 100; - } - - // Handle floating point rounding errors - if ((Math.abs(n - max) < 0.000001)) { - return 1; - } - - // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} - -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} - -// Parse a base-16 hex value into a base-10 integer -function parseIntFromHex(val) { - return parseInt(val, 16); -} - -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} - -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} - -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} - -// Replace a decimal with it's percentage value -function convertToPercentage(n) { - if (n <= 1) { - n = (n * 100) + "%"; - } - - return n; -} - -// Converts a decimal to a hex value -function convertDecimalToHex(d) { - return Math.round(parseFloat(d) * 255).toString(16); -} -// Converts a hex value to a decimal -function convertHexToDecimal(h) { - return (parseIntFromHex(h) / 255); -} - -var matchers = (function() { - - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; - - // - var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; - - // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. - var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; - - // Actual matching. - // Parentheses and commas are optional, but not required. - // Whitespace can take the place of commas or opening paren - var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - - return { - CSS_UNIT: new RegExp(CSS_UNIT), - rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), - rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), - hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), - hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), - hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), - hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), - hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, - hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ - }; -})(); - -// `isValidCSSUnit` -// Take in a single string / number and check to see if it looks like a CSS unit -// (see `matchers` above for definition). -function isValidCSSUnit(color) { - return !!matchers.CSS_UNIT.exec(color); -} - -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -function stringInputToObject(color) { - - color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); - var named = false; - if (names[color]) { - color = names[color]; - named = true; - } - else if (color == 'transparent') { - return { r: 0, g: 0, b: 0, a: 0, format: "name" }; - } - - // Try to match string input using regular expressions. - // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] - // Just return an object and let the conversion functions handle that. - // This way the result will be the same whether the tinycolor is initialized with string or object. - var match; - if ((match = matchers.rgb.exec(color))) { - return { r: match[1], g: match[2], b: match[3] }; - } - if ((match = matchers.rgba.exec(color))) { - return { r: match[1], g: match[2], b: match[3], a: match[4] }; - } - if ((match = matchers.hsl.exec(color))) { - return { h: match[1], s: match[2], l: match[3] }; - } - if ((match = matchers.hsla.exec(color))) { - return { h: match[1], s: match[2], l: match[3], a: match[4] }; - } - if ((match = matchers.hsv.exec(color))) { - return { h: match[1], s: match[2], v: match[3] }; - } - if ((match = matchers.hsva.exec(color))) { - return { h: match[1], s: match[2], v: match[3], a: match[4] }; - } - if ((match = matchers.hex8.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - a: convertHexToDecimal(match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex6.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - format: named ? "name" : "hex" - }; - } - if ((match = matchers.hex4.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - a: convertHexToDecimal(match[4] + '' + match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex3.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - format: named ? "name" : "hex" - }; - } - - return false; -} - -function validateWCAG2Parms(parms) { - // return valid WCAG2 parms for isReadable. - // If input parms are invalid, return {"level":"AA", "size":"small"} - var level, size; - parms = parms || {"level":"AA", "size":"small"}; - level = (parms.level || "AA").toUpperCase(); - size = (parms.size || "small").toLowerCase(); - if (level !== "AA" && level !== "AAA") { - level = "AA"; - } - if (size !== "small" && size !== "large") { - size = "small"; - } - return {"level":level, "size":size}; -} - -// Node: Export function -if (typeof module !== "undefined" && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define === 'function' && define.amd) { - define(function () {return tinycolor;}); -} -// Browser: Expose to window -else { - window.tinycolor = tinycolor; -} - -})(Math); - -},{}],179:[function(require,module,exports){ - -exports = module.exports = trim; - -function trim(str){ - return str.replace(/^\s*|\s*$/g, ''); -} - -exports.left = function(str){ - return str.replace(/^\s*/, ''); -}; - -exports.right = function(str){ - return str.replace(/\s*$/, ''); -}; - -},{}],180:[function(require,module,exports){ -// 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. - -'use strict'; - -var punycode = require('punycode'); -var util = require('./util'); - -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; - -exports.Url = Url; - -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; -} - -// Reference: RFC 3986, RFC 1808, RFC 2396 - -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = require('querystring'); - -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; -} - -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; - -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} - -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; -}; - -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} - -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; - -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); -} - -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; - -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; - -},{"./util":181,"punycode":134,"querystring":137}],181:[function(require,module,exports){ -'use strict'; - -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; - -},{}],182:[function(require,module,exports){ -(function (process){ - - - - -;(function(){ -var UTIF = {}; - -// Make available for import by `require()` -if (typeof module == "object") {module.exports = UTIF;} -else {self.UTIF = UTIF;} - -var pako; -if (typeof require == "function") {pako = require("pako");} -else {pako = self.pako;} - -function log() { if (typeof process=="undefined" || process.env.NODE_ENV=="development") console.log.apply(console, arguments); } - -(function(UTIF, pako){ - -// Following lines add a JPEG decoder to UTIF.JpegDecoder -(function(){var V="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"===typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},D=function(){function g(g){this.message="JPEG error: "+g}g.prototype=Error();g.prototype.name="JpegError";return g.constructor=g}(),P=function(){function g(g,D){this.message=g;this.g=D}g.prototype=Error();g.prototype.name="DNLMarkerError";return g.constructor=g}();(function(){function g(){this.M= -null;this.B=-1}function W(a,d){for(var f=0,e=[],b,B,k=16;0>x&1;z=a[d++];if(255=== -z){var c=a[d++];if(c){if(220===c&&g){d+=2;var b=a[d++]<<8|a[d++];if(0>>7}function q(a){for(;;){a=a[n()];if("number"===typeof a)return a;if("object"!==("undefined"===typeof a?"undefined":V(a)))throw new D("invalid huffman sequence");}}function h(a){for(var c=0;0= -1<d;){var h=q(a.o),k=h&15;h>>=4;if(0===k){if(15>h)break;d+=16}else d+=h,a.a[b+J[d]]=c(k),d++}}function w(a,d){var b=q(a.D);b=0===b?0:c(b)<>=4;if(0===f){if(15>e){A=h(e)+(1<a.a[f]? --1:1;switch(E){case 0:e=q(a.o);f=e&15;e>>=4;if(0===f)15>e?(A=h(e)+(1<=y)throw new D("marker was not found"); -if(65488<=y&&65495>=y)d+=2;else break}(y=N(a,d))&&y.f&&((0,_util.warn)("decodeScan - unexpected Scan data, current marker is: "+y.f),d=y.offset);return d-v}function Y(a,d){for(var f=d.c,e=d.l,b=new Int16Array(64),B=0;Bh;h+=8){var c=q[l+h];var C=q[l+h+1];var w=q[l+h+2];var p=q[l+h+3];var m=q[l+h+4];var t=q[l+h+5];var g=q[l+h+6];var u=q[l+h+7];c*=n[h];if(0===(C| -w|p|m|t|g|u))c=5793*c+512>>10,r[h]=c,r[h+1]=c,r[h+2]=c,r[h+3]=c,r[h+4]=c,r[h+5]=c,r[h+6]=c,r[h+7]=c;else{C*=n[h+1];w*=n[h+2];p*=n[h+3];m*=n[h+4];t*=n[h+5];g*=n[h+6];u*=n[h+7];var v=5793*c+128>>8;var z=5793*m+128>>8;var x=w;var A=g;m=2896*(C-u)+128>>8;u=2896*(C+u)+128>>8;p<<=4;t<<=4;v=v+z+1>>1;z=v-z;c=3784*x+1567*A+128>>8;x=1567*x-3784*A+128>>8;A=c;m=m+t+1>>1;t=m-t;u=u+p+1>>1;p=u-p;v=v+A+1>>1;A=v-A;z=z+x+1>>1;x=z-x;c=2276*m+3406*u+2048>>12;m=3406*m-2276*u+2048>>12;u=c;c=799*p+4017*t+2048>>12;p=4017* -p-799*t+2048>>12;t=c;r[h]=v+u;r[h+7]=v-u;r[h+1]=z+t;r[h+6]=z-t;r[h+2]=x+p;r[h+5]=x-p;r[h+3]=A+m;r[h+4]=A-m}}for(n=0;8>n;++n)c=r[n],C=r[n+8],w=r[n+16],p=r[n+24],m=r[n+32],t=r[n+40],g=r[n+48],u=r[n+56],0===(C|w|p|m|t|g|u)?(c=5793*c+8192>>14,c=-2040>c?0:2024<=c?255:c+2056>>4,q[l+n]=c,q[l+n+8]=c,q[l+n+16]=c,q[l+n+24]=c,q[l+n+32]=c,q[l+n+40]=c,q[l+n+48]=c,q[l+n+56]=c):(v=5793*c+2048>>12,z=5793*m+2048>>12,x=w,A=g,m=2896*(C-u)+2048>>12,u=2896*(C+u)+2048>>12,v=(v+z+1>>1)+4112,z=v-z,c=3784*x+1567*A+2048>> -12,x=1567*x-3784*A+2048>>12,A=c,m=m+t+1>>1,t=m-t,u=u+p+1>>1,p=u-p,v=v+A+1>>1,A=v-A,z=z+x+1>>1,x=z-x,c=2276*m+3406*u+2048>>12,m=3406*m-2276*u+2048>>12,u=c,c=799*p+4017*t+2048>>12,p=4017*p-799*t+2048>>12,t=c,c=v+u,u=v-u,C=z+t,g=z-t,w=x+p,t=x-p,p=A+m,m=A-m,c=16>c?0:4080<=c?255:c>>4,C=16>C?0:4080<=C?255:C>>4,w=16>w?0:4080<=w?255:w>>4,p=16>p?0:4080<=p?255:p>>4,m=16>m?0:4080<=m?255:m>>4,t=16>t?0:4080<=t?255:t>>4,g=16>g?0:4080<=g?255:g>>4,u=16>u?0:4080<=u?255:u>>4,q[l+n]=c,q[l+n+8]=C,q[l+n+16]=w,q[l+n+24]= -p,q[l+n+32]=m,q[l+n+40]=t,q[l+n+48]=g,q[l+n+56]=u)}return d.a}function N(a,d){var f=2=e)return null;var b=a[d]<<8|a[d+1];if(65472<=b&&65534>=b)return{f:null,F:b,offset:d};for(var B=a[f]<<8|a[f+1];!(65472<=B&&65534>=B);){if(++f>=e)return null;B=a[f]<<8|a[f+1]}return{f:b.toString(16),F:B,offset:f}}var J=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56, -57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);g.prototype={parse:function(a){function d(){var d=a[k]<<8|a[k+1];k+=2;return d}function f(){var b=d();b=k+b-2;var c=N(a,b,k);c&&c.f&&((0,_util.warn)("readDataBlock - incorrect length, current marker is: "+c.f),b=c.offset);b=a.subarray(k,b);k+=b.length;return b}function e(a){for(var b=Math.ceil(a.v/8/a.s),c=Math.ceil(a.g/8/a.u),d=0;d>4)for(c=0;64>c;c++)g=J[c],p[g]=a[k++];else if(1===w>>4)for(c=0;64>c;c++)g=J[c],p[g]=d();else throw new D("DQT - invalid table spec");b[w&15]=p}break;case 65472:case 65473:case 65474:if(m)throw new D("Only single frame JPEGs supported");d();var m={};m.X=65473===h;m.S=65474===h;m.precision=a[k++];h=d();m.g= -B||h;m.v=d();m.b=[];m.C={};c=a[k++];for(h=p=w=0;h>4;var H=a[k+1]&15;wc;c++,k++)t+=p[c]=a[k];H=new Uint8Array(t);for(c=0;c>4?q:n)[w&15]=W(p,H)}break;case 65501:d();var u=d();break;case 65498:c=1===++r&&!B;d();w=a[k++];g=[];for(h=0;h>4];v.o=n[p&15];g.push(v)}h=a[k++];w=a[k++];p=a[k++];try{var z=X(a,k,m,g,u,h,w,p>>4,p&15,c);k+=z}catch(x){if(x instanceof P)return(0,_util.warn)('Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.'),this.parse(a,{N:x.g});throw x;}break;case 65500:k+=4;break;case 65535:255!==a[k]&&k--;break;default:if(255===a[k-3]&&192<=a[k-2]&&254>=a[k-2])k-=3;else if((c=N(a,k-2))&&c.f)(0,_util.warn)("JpegImage.parse - unexpected data, current marker is: "+ -c.f),k=c.offset;else throw new D("unknown marker "+h.toString(16));}h=d()}this.width=m.v;this.height=m.g;this.A=l;this.b=[];for(h=0;h>8)+e[f+1];return r},w:function(){return this.A?!!this.A.W:3===this.i?0===this.B?!1:!0:1===this.B?!0:!1},I:function(a){for(var d,f,e,b=0,g=a.length;b>>3)]; if(bcnt==null) bcnt = img["t325"]; - var bytes = new Uint8Array(img.height*(bipl>>>3)), bilen = 0; - - if(img["t322"]!=null) // tiled - { - var tw = img["t322"][0], th = img["t323"][0]; - var tx = Math.floor((img.width + tw - 1) / tw); - var ty = Math.floor((img.height + th - 1) / th); - var tbuff = new Uint8Array(Math.ceil(tw*th*bipp/8)|0); - for(var y=0; y>>8); } - else if(bps==12) for(var i=0; i>>4); tgt[toff++] = ((out[i]<<4)|(out[i+1]>>>8))&255; tgt[toff++] = out[i+1]&255; } - else throw new Error("unsupported bit depth "+bps); - } - else - { - var parser = new UTIF.JpegDecoder(); parser.parse(buff); - var decoded = parser.getData(parser.width, parser.height); - for (var i=0; i 1); - } - - if(!isTiled) - { - if(data[off]==255 && data[off+1]==SOI) return { jpegOffset: off }; - if(jpgIchgFmt!=null) - { - if(data[off+jifoff]==255 && data[off+jifoff+1]==SOI) joff = off+jifoff; - else log("JPEGInterchangeFormat does not point to SOI"); - - if(jpgIchgFmtLen==null) log("JPEGInterchangeFormatLength field is missing"); - else if(jifoff >= soff || (jifoff+jiflen) <= soff) log("JPEGInterchangeFormatLength field value is invalid"); - - if(joff != null) return { jpegOffset: joff }; - } - } - - if(ycbcrss!=null) { ssx = ycbcrss[0]; ssy = ycbcrss[1]; } - - if(jpgIchgFmt!=null) - if(jpgIchgFmtLen!=null) - if(jiflen >= 2 && (jifoff+jiflen) <= soff) - { - if(data[off+jifoff+jiflen-2]==255 && data[off+jifoff+jiflen-1]==SOI) tables = new Uint8Array(jiflen-2); - else tables = new Uint8Array(jiflen); - - for(i=0; i offset to first strip or tile"); - - if(tables == null) - { - var ooff = 0, out = []; - out[ooff++] = 255; out[ooff++] = SOI; - - var qtables = img["t519"]; - if(qtables==null) throw new Error("JPEGQTables tag is missing"); - for(i=0; i>> 8); out[ooff++] = nc & 255; - out[ooff++] = (i | (k << 4)); - for(j=0; j<16; j++) out[ooff++] = data[off+htables[i]+j]; - for(j=0; j>> 8) & 255; out[ooff++] = img.height & 255; - out[ooff++] = (img.width >>> 8) & 255; out[ooff++] = img.width & 255; - out[ooff++] = spp; - if(spp==1) { out[ooff++] = 1; out[ooff++] = 17; out[ooff++] = 0; } - else for(i=0; i<3; i++) - { - out[ooff++] = i + 1; - out[ooff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); - out[ooff++] = i; - } - - if(jpgresint!=null && jpgresint[0]!=0) - { - out[ooff++] = 255; out[ooff++] = DRI; out[ooff++] = 0; out[ooff++] = 4; - out[ooff++] = (jpgresint[0] >>> 8) & 255; - out[ooff++] = jpgresint[0] & 255; - } - - tables = new Uint8Array(out); - } - - var sofpos = -1; - i = 0; - while(i < (tables.length - 1)) { - if(tables[i]==255 && tables[i+1]==SOF0) { sofpos = i; break; } - i++; - } - - if(sofpos == -1) - { - var tmptab = new Uint8Array(tables.length + 10 + 3*spp); - tmptab.set(tables); - var tmpoff = tables.length; - sofpos = tables.length; - tables = tmptab; - - tables[tmpoff++] = 255; tables[tmpoff++] = SOF0; - tables[tmpoff++] = 0; tables[tmpoff++] = 8 + 3*spp; tables[tmpoff++] = 8; - tables[tmpoff++] = (img.height >>> 8) & 255; tables[tmpoff++] = img.height & 255; - tables[tmpoff++] = (img.width >>> 8) & 255; tables[tmpoff++] = img.width & 255; - tables[tmpoff++] = spp; - if(spp==1) { tables[tmpoff++] = 1; tables[tmpoff++] = 17; tables[tmpoff++] = 0; } - else for(i=0; i<3; i++) - { - tables[tmpoff++] = i + 1; - tables[tmpoff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); - tables[tmpoff++] = i; - } - } - - if(data[soff]==255 && data[soff+1]==SOS) - { - var soslen = (data[soff+2]<<8) | data[soff+3]; - sosMarker = new Uint8Array(soslen+2); - sosMarker[0] = data[soff]; sosMarker[1] = data[soff+1]; sosMarker[2] = data[soff+2]; sosMarker[3] = data[soff+3]; - for(i=0; i<(soslen-2); i++) sosMarker[i+4] = data[soff+i+4]; - } - else - { - sosMarker = new Uint8Array(2 + 6 + 2*spp); - var sosoff = 0; - sosMarker[sosoff++] = 255; sosMarker[sosoff++] = SOS; - sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 6 + 2*spp; sosMarker[sosoff++] = spp; - if(spp==1) { sosMarker[sosoff++] = 1; sosMarker[sosoff++] = 0; } - else for(i=0; i<3; i++) - { - sosMarker[sosoff++] = i+1; sosMarker[sosoff++] = (i << 4) | i; - } - sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 63; sosMarker[sosoff++] = 0; - } - - return { jpegOffset: off, tables: tables, sosMarker: sosMarker, sofPosition: sofpos }; -} - -UTIF.decode._decodeOldJPEG = function(img, data, off, len, tgt, toff) -{ - var i, dlen, tlen, buff, buffoff; - var jpegData = UTIF.decode._decodeOldJPEGInit(img, data, off, len); - - if(jpegData.jpegOffset!=null) - { - dlen = off+len-jpegData.jpegOffset; - buff = new Uint8Array(dlen); - for(i=0; i>> 8) & 255; buff[jpegData.sofPosition+6] = img.height & 255; - buff[jpegData.sofPosition+7] = (img.width >>> 8) & 255; buff[jpegData.sofPosition+8] = img.width & 255; - - if(data[off]!=255 || data[off+1]!=SOS) - { - buff.set(jpegData.sosMarker, bufoff); - bufoff += sosMarker.length; - } - for(i=0; i=0 && n<128) for(var i=0; i< n+1; i++) { ta[toff]=sa[off]; toff++; off++; } - if(n>=-127 && n<0) { for(var i=0; i<-n+1; i++) { ta[toff]=sa[off]; toff++; } off++; } - } -} - -UTIF.decode._decodeThunder = function(data, off, len, tgt, toff) -{ - var d2 = [ 0, 1, 0, -1 ], d3 = [ 0, 1, 2, 3, 0, -3, -2, -1 ]; - var lim = off+len, qoff = toff*2, px = 0; - while(off>>6), n = (b&63); off++; - if(msk==3) { px=(n&15); tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } - if(msk==0) for(var i=0; i>>1] |= (px<<(4*(1-qoff&1))); qoff++; } - if(msk==2) for(var i=0; i<2; i++) { var d=(n>>>(3*(1-i)))&7; if(d!=4) { px+=d3[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } - if(msk==1) for(var i=0; i<3; i++) { var d=(n>>>(2*(2-i)))&3; if(d!=2) { px+=d2[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } - } -} - -UTIF.decode._dmap = { "1":0,"011":1,"000011":2,"0000011":3, "010":-1,"000010":-2,"0000010":-3 }; -UTIF.decode._lens = ( function() -{ - var addKeys = function(lens, arr, i0, inc) { for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1; - if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; - boff++; wrd+=bit; - if(mode=="H") - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } - } - } - else - { - if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } - if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } - if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } - } - if(line.length==w && mode=="") - { - U._writeBits(line, tgt, toff*8+y*bipl); - clr=0; y++; a0=0; - pline=U._makeDiff(line); line=[]; - } - //if(wrd.length>150) { log(wrd); break; throw "e"; } - } -} - -UTIF.decode._findDiff = function(line, x, clr) { for(var i=0; i=x && line[i+1]==clr) return line[i]; } - -UTIF.decode._makeDiff = function(line) -{ - var out = []; if(line[0]==1) out.push(0,1); - for(var i=1; i>>3)>>3]>>>(7-(boff&7)))&1; - if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; - boff++; wrd+=bit; - - if(is1D) - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); clr=1-clr; len=0; } - } - } - else - { - if(mode=="H") - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } - } - } - else - { - if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } - if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } - if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } - } - } - if(wrd.endsWith("000000000001")) // needed for some files - { - if(y>=0) U._writeBits(line, tgt, toff*8+y*bipl); - if(fo==1) is1D = ((data[boff>>>3]>>>(7-(boff&7)))&1)==1; - if(fo==2) is1D = ((data[boff>>>3]>>>( (boff&7)))&1)==1; - boff++; - if(U._decodeG3.allow2D==null) U._decodeG3.allow2D=is1D; - if(!U._decodeG3.allow2D) { is1D = true; boff--; } - //log("EOL",y, "next 1D:", is1D); - wrd=""; clr=0; y++; a0=0; - pline=U._makeDiff(line); line=[]; - } - } - if(line.length==w) U._writeBits(line, tgt, toff*8+y*bipl); -} - -UTIF.decode._addNtimes = function(arr, n, val) { for(var i=0; i>>3] |= (bits[i]<<(7-((boff+i)&7))); -} - -UTIF.decode._decodeLZW = function(data, off, tgt, toff) -{ - if(UTIF.decode._lzwTab==null) - { - var tb=new Uint32Array(0xffff), tn=new Uint16Array(0xffff), chr=new Uint8Array(2e6); - for(var i=0; i<256; i++) { chr[i<<2]=i; tb[i]=i<<2; tn[i]=1; } - UTIF.decode._lzwTab = [tb,tn,chr]; - } - var copy = UTIF.decode._copyData; - var tab = UTIF.decode._lzwTab[0], tln=UTIF.decode._lzwTab[1], chr=UTIF.decode._lzwTab[2], totl = 258, chrl = 258<<2; - var bits = 9, boff = off<<3; // offset in bits - - var ClearCode = 256, EoiCode = 257; - var v = 0, Code = 0, OldCode = 0; - while(true) - { - v = (data[boff>>>3]<<16) | (data[(boff+8)>>>3]<<8) | data[(boff+16)>>>3]; - Code = ( v>>(24-(boff&7)-bits) ) & ((1<>>3]<<16) | (data[(boff+8)>>>3]<<8) | data[(boff+16)>>>3]; - Code = ( v>>(24-(boff&7)-bits) ) & ((1<=totl) { tab[totl] = chrl; chr[tab[totl]] = cd[0]; tln[totl]=1; chrl=(chrl+1+3)&~0x03; totl++; } - else - { - tab[totl] = chrl; - var nit = tab[OldCode], nil = tln[OldCode]; - copy(chr,nit,chr,chrl,nil); - chr[chrl+nil]=chr[cd]; nil++; - tln[totl]=nil; totl++; - - chrl=(chrl+nil+3)&~0x03; - } - if(totl+1==(1<=totl) { tab[totl] = chrl; tln[totl]=0; totl++; } - else - { - tab[totl] = chrl; - var nit = tab[OldCode], nil = tln[OldCode]; - copy(chr,nit,chr,chrl,nil); - chr[chrl+nil]=chr[chrl]; nil++; - tln[totl]=nil; totl++; - - copy(chr,chrl,tgt,toff,nil); toff += nil; - chrl=(chrl+nil+3)&~0x03; - } - if(totl+1==(1<>>----------------"); - for(var i=0; i4) { bin.writeUint(data, offset, eoff); toff=eoff; } - - if(type==2) { bin.writeASCII(data, toff, val); } - if(type==3) { for(var i=0; i4) { dlen += (dlen&1); eoff += dlen; } - offset += 4; - } - return [offset, eoff]; -} - -UTIF.toRGBA8 = function(out) -{ - var w = out.width, h = out.height, area = w*h, qarea = area*4, data = out.data; - var img = new Uint8Array(area*4); - // 0: WhiteIsZero, 1: BlackIsZero, 2: RGB, 3: Palette color, 4: Transparency mask, 5: CMYK - var intp = out["t262"][0], bps = (out["t258"]?Math.min(32,out["t258"][0]):1), isLE = out.isLE ? 1 : 0; - //log("interpretation: ", intp, "bps", bps, out); - if(false) {} - else if(intp==0) - { - var bpl = Math.ceil(bps*w/8); - for(var y=0; y>3)])>>(7- (i&7)))& 1; img[qi]=img[qi+1]=img[qi+2]=( 1-px)*255; img[qi+3]=255; } - if(bps== 4) for(var i=0; i>1)])>>(4-4*(i&1)))&15; img[qi]=img[qi+1]=img[qi+2]=(15-px)* 17; img[qi+3]=255; } - if(bps== 8) for(var i=0; i>3)])>>(7- (i&7)))&1; img[qi]=img[qi+1]=img[qi+2]=(px)*255; img[qi+3]=255; } - if(bps== 2) for(var i=0; i>2)])>>(6-2*(i&3)))&3; img[qi]=img[qi+1]=img[qi+2]=(px)* 85; img[qi+3]=255; } - if(bps== 8) for(var i=0; i0) for(var i=0; i>8); img[qi+1]=(map[256+mi]>>8); img[qi+2]=(map[512+mi]>>8); img[qi+3]=255; } - } - else if(intp==5) - { - var smpls = out["t258"]?out["t258"].length : 4; - var gotAlpha = smpls>4 ? 1 : 0; - for(var i=0; i> 8)&255; buff[p+1] = n&255; }, - writeUint : function(buff, p, n) { buff[p] = (n>>24)&255; buff[p+1] = (n>>16)&255; buff[p+2] = (n>>8)&255; buff[p+3] = (n>>0)&255; }, - writeASCII : function(buff, p, s) { for(var i = 0; i < s.length; i++) buff[p+i] = s.charCodeAt(i); }, - writeDouble: function(buff, p, n) - { - UTIF._binBE.fl64[0] = n; - for (var i = 0; i < 8; i++) buff[p + i] = UTIF._binBE.ui8[7 - i]; - } -} -UTIF._binBE.ui8 = new Uint8Array (8); -UTIF._binBE.i16 = new Int16Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.i32 = new Int32Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.ui32 = new Uint32Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.fl32 = new Float32Array(UTIF._binBE.ui8.buffer); -UTIF._binBE.fl64 = new Float64Array(UTIF._binBE.ui8.buffer); - -UTIF._binLE = -{ - nextZero : UTIF._binBE.nextZero, - readUshort : function(buff, p) { return (buff[p+1]<< 8) | buff[p]; }, - readShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; return UTIF._binBE. i16[0]; }, - readInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE. i32[0]; }, - readUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE.ui32[0]; }, - readASCII : UTIF._binBE.readASCII, - readFloat : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<4;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl32[0]; }, - readDouble : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<8;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl64[0]; } -} -UTIF._copyTile = function(tb, tw, th, b, w, h, xoff, yoff) -{ - //log("copyTile", tw, th, w, h, xoff, yoff); - var xlim = Math.min(tw, w-xoff); - var ylim = Math.min(th, h-yoff); - for(var y=0; y 0 ) { - timeoutTimer = setTimeout(function(){ - if (aborted) return - aborted = true//IE9 may still call readystatechange - xhr.abort("timeout") - var e = new Error("XMLHttpRequest timeout") - e.code = "ETIMEDOUT" - errorFunc(e) - }, options.timeout ) - } - - if (xhr.setRequestHeader) { - for(key in headers){ - if(headers.hasOwnProperty(key)){ - xhr.setRequestHeader(key, headers[key]) - } - } - } else if (options.headers && !isEmpty(options.headers)) { - throw new Error("Headers cannot be set on an XDomainRequest object") - } - - if ("responseType" in options) { - xhr.responseType = options.responseType - } - - if ("beforeSend" in options && - typeof options.beforeSend === "function" - ) { - options.beforeSend(xhr) - } - - // Microsoft Edge browser sends "undefined" when send is called with undefined value. - // XMLHttpRequest spec says to pass null as body to indicate no body - // See https://github.com/naugtur/xhr/issues/100. - xhr.send(body || null) - - return xhr - - -} - -function getXml(xhr) { - // xhr.responseXML will throw Exception "InvalidStateError" or "DOMException" - // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML. - try { - if (xhr.responseType === "document") { - return xhr.responseXML - } - var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror" - if (xhr.responseType === "" && !firefoxBugTakenEffect) { - return xhr.responseXML - } - } catch (e) {} - - return null -} - -function noop() {} - -},{"global/window":71,"is-function":78,"parse-headers":106,"xtend":189}],188:[function(require,module,exports){ -module.exports = (function xmlparser() { - //common browsers - if (typeof self.DOMParser !== 'undefined') { - return function(str) { - var parser = new self.DOMParser() - return parser.parseFromString(str, 'application/xml') - } - } - - //IE8 fallback - if (typeof self.ActiveXObject !== 'undefined' - && new self.ActiveXObject('Microsoft.XMLDOM')) { - return function(str) { - var xmlDoc = new self.ActiveXObject("Microsoft.XMLDOM") - xmlDoc.async = "false" - xmlDoc.loadXML(str) - return xmlDoc - } - } - - //last resort fallback - return function(str) { - var div = document.createElement('div') - div.innerHTML = str - return div - } -})() - -},{}],189:[function(require,module,exports){ -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} - -},{}],190:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.srcOver = srcOver; -exports.dstOver = dstOver; -exports.multiply = multiply; -exports.add = add; -exports.screen = screen; -exports.overlay = overlay; -exports.darken = darken; -exports.lighten = lighten; -exports.hardLight = hardLight; -exports.difference = difference; -exports.exclusion = exclusion; - -function srcOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; - var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; - var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function dstOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; - var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; - var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function multiply(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function add(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra) / a; - var g = (sga + dga) / a; - var b = (sba + dba) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function screen(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function overlay(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function darken(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function lighten(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function hardLight(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function difference(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; - var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; - var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function exclusion(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -},{}],191:[function(require,module,exports){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = composite; - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var compositeModes = _interopRequireWildcard(require("./composite-modes")); - -/** - * Composites a source image over to this image respecting alpha channels - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {object} options determine what mode to use - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function composite(src, x, y) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var cb = arguments.length > 4 ? arguments[4] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - var _options = options, - mode = _options.mode, - opacitySource = _options.opacitySource, - opacityDest = _options.opacityDest; - - if (!mode) { - mode = constants.BLEND_SOURCE_OVER; - } - - if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) { - opacitySource = 1.0; - } - - if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) { - opacityDest = 1.0; - } - - var blendmode = compositeModes[mode]; // round input - - x = Math.round(x); - y = Math.round(y); - var baseImage = this; - - if (opacityDest !== 1.0) { - baseImage.opacity(opacityDest); - } - - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); - var blended = blendmode({ - r: this.bitmap.data[idx + 0] / 255, - g: this.bitmap.data[idx + 1] / 255, - b: this.bitmap.data[idx + 2] / 255, - a: this.bitmap.data[idx + 3] / 255 - }, { - r: baseImage.bitmap.data[dstIdx + 0] / 255, - g: baseImage.bitmap.data[dstIdx + 1] / 255, - b: baseImage.bitmap.data[dstIdx + 2] / 255, - a: baseImage.bitmap.data[dstIdx + 3] / 255 - }, opacitySource); - baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(blended.r * 255); - baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(blended.g * 255); - baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -module.exports = exports.default; - -},{"../constants":192,"./composite-modes":190,"@babel/runtime/helpers/interopRequireWildcard":12,"@jimp/utils":235}],192:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; -// used to auto resizing etc. -var AUTO = -1; // Align modes for cover, contain, bit masks - -exports.AUTO = AUTO; -var HORIZONTAL_ALIGN_LEFT = 1; -exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; -var HORIZONTAL_ALIGN_CENTER = 2; -exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; -var HORIZONTAL_ALIGN_RIGHT = 4; -exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; -var VERTICAL_ALIGN_TOP = 8; -exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; -var VERTICAL_ALIGN_MIDDLE = 16; -exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; -var VERTICAL_ALIGN_BOTTOM = 32; // blend modes - -exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; -var BLEND_SOURCE_OVER = 'srcOver'; -exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; -var BLEND_DESTINATION_OVER = 'dstOver'; -exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; -var BLEND_MULTIPLY = 'multiply'; -exports.BLEND_MULTIPLY = BLEND_MULTIPLY; -var BLEND_ADD = 'add'; -exports.BLEND_ADD = BLEND_ADD; -var BLEND_SCREEN = 'screen'; -exports.BLEND_SCREEN = BLEND_SCREEN; -var BLEND_OVERLAY = 'overlay'; -exports.BLEND_OVERLAY = BLEND_OVERLAY; -var BLEND_DARKEN = 'darken'; -exports.BLEND_DARKEN = BLEND_DARKEN; -var BLEND_LIGHTEN = 'lighten'; -exports.BLEND_LIGHTEN = BLEND_LIGHTEN; -var BLEND_HARDLIGHT = 'hardLight'; -exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; -var BLEND_DIFFERENCE = 'difference'; -exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; -var BLEND_EXCLUSION = 'exclusion'; // Edge Handling - -exports.BLEND_EXCLUSION = BLEND_EXCLUSION; -var EDGE_EXTEND = 1; -exports.EDGE_EXTEND = EDGE_EXTEND; -var EDGE_WRAP = 2; -exports.EDGE_WRAP = EDGE_WRAP; -var EDGE_CROP = 3; -exports.EDGE_CROP = EDGE_CROP; - -},{}],193:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addConstants = addConstants; -exports.addJimpMethods = addJimpMethods; -exports.jimpEvMethod = jimpEvMethod; -exports.jimpEvChange = jimpEvChange; -Object.defineProperty(exports, "addType", { - enumerable: true, - get: function get() { - return MIME.addType; - } -}); -exports["default"] = void 0; - -var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); - -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); - -var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); - -var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); - -var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); - -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _fs = _interopRequireDefault(require("fs")); - -var _path = _interopRequireDefault(require("path")); - -var _events = _interopRequireDefault(require("events")); - -var _utils = require("@jimp/utils"); - -var _anyBase = _interopRequireDefault(require("any-base")); - -var _mkdirp = _interopRequireDefault(require("mkdirp")); - -var _pixelmatch = _interopRequireDefault(require("pixelmatch")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _phash = _interopRequireDefault(require("./modules/phash")); - -var _request = _interopRequireDefault(require("./request")); - -var _composite = _interopRequireDefault(require("./composite")); - -var _promisify = _interopRequireDefault(require("./utils/promisify")); - -var MIME = _interopRequireWildcard(require("./utils/mime")); - -var _imageBitmap = require("./utils/image-bitmap"); - -var constants = _interopRequireWildcard(require("./constants")); - -var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases -// 0 and 1 do not exist as possible hash lengths - -var maxHashLength = [NaN, NaN]; - -for (var i = 2; i < 65; i++) { - var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1')); - maxHashLength.push(maxHash.length); -} // no operation - - -function noop() {} // error checking methods - - -function isArrayBuffer(test) { - return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1; -} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, -// But this function is not useful when running in node directly - - -function bufferFromArrayBuffer(arrayBuffer) { - var buffer = Buffer.alloc(arrayBuffer.byteLength); - var view = new Uint8Array(arrayBuffer); - - for (var _i = 0; _i < buffer.length; ++_i) { - buffer[_i] = view[_i]; - } - - return buffer; -} - -function loadFromURL(options, cb) { - (0, _request["default"])(options, function (err, response, data) { - if (err) { - return cb(err); - } - - if ('headers' in response && 'location' in response.headers) { - options.url = response.headers.location; - return loadFromURL(options, cb); - } - - if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) { - return cb(null, data); - } - - var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')'; - return new Error(msg); - }); -} - -function loadBufferFromPath(src, cb) { - if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) { - _fs["default"].readFile(src, cb); - } else { - loadFromURL({ - url: src - }, cb); - } -} - -function isRawRGBAData(obj) { - return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); -} - -function makeRGBABufferFromRGB(buffer) { - if (buffer.length % 3 !== 0) { - throw new Error('Buffer length is incorrect'); - } - - var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); - var j = 0; - - for (var _i2 = 0; _i2 < buffer.length; _i2++) { - rgbaBuffer[j] = buffer[_i2]; - - if ((_i2 + 1) % 3 === 0) { - rgbaBuffer[++j] = 255; - } - - j++; - } - - return rgbaBuffer; -} - -var emptyBitmap = { - data: null, - width: null, - height: null -}; -/** - * Jimp constructor (from a file) - * @param path a path to the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a url with options) - * @param options { url, otherOptions} - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from another Jimp image or raw image data) - * @param image a Jimp image to clone - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a Buffer) - * @param data a Buffer containing the image data - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param background color to fill the image with - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -var Jimp = -/*#__PURE__*/ -function (_EventEmitter) { - (0, _inherits2["default"])(Jimp, _EventEmitter); - - // An object representing a bitmap in memory, comprising: - // - data: a buffer of the bitmap data - // - width: the width of the image in pixels - // - height: the height of the image in pixels - // Default colour to use for new pixels - // Default MIME is PNG - // Exif data for the image - // Whether Transparency supporting formats will be exported as RGB or RGBA - function Jimp() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - (0, _classCallCheck2["default"])(this, Jimp); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { - return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { - return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); - var jimpInstance = (0, _assertThisInitialized2["default"])(_this); - var cb = noop; - - if (isArrayBuffer(args[0])) { - args[0] = bufferFromArrayBuffer(args[0]); - } - - function finish() { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - var err = args[0]; - var evData = err || {}; - evData.methodName = 'constructor'; - setTimeout(function () { - var _cb; - - // run on next tick. - if (err && cb === noop) { - jimpInstance.emitError('constructor', err); - } else if (!err) { - jimpInstance.emitMulti('constructor', 'initialized'); - } - - (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); - }, 1); - } - - if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) { - // create a new image - var w = parseInt(args[0], 10); - var h = parseInt(args[1], 10); - cb = args[2]; // with a hex color - - if (typeof args[2] === 'number') { - _this._background = args[2]; - cb = args[3]; - } // with a css color - - - if (typeof args[2] === 'string') { - _this._background = Jimp.cssColorToHex(args[2]); - cb = args[3]; - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { - _this.bitmap.data.writeUInt32BE(_this._background, _i3); - } - - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) { - cb = args[1] || noop; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadFromURL(args[0], function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, args[0].url, finish); - }); - } else if (args[0] instanceof Jimp) { - // clone an existing Jimp - var original = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.from(original.bitmap.data), - width: original.bitmap.width, - height: original.bitmap.height - }; - _this._quality = original._quality; - _this._deflateLevel = original._deflateLevel; - _this._deflateStrategy = original._deflateStrategy; - _this._filterType = original._filterType; - _this._rgba = original._rgba; - _this._background = original._background; - _this._originalMime = original._originalMime; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (isRawRGBAData(args[0])) { - var imageData = args[0]; - cb = args[1] || noop; - var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; - var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); - _this.bitmap = { - data: buffer, - width: imageData.width, - height: imageData.height - }; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (typeof args[0] === 'string') { - // read from a path - var path = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadBufferFromPath(path, function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, path, finish); - }); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) { - // read from a buffer - var data = args[0]; - cb = args[1]; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.parseBitmap(data, null, finish); - } else { - // Allow client libs to add new ways to build a Jimp object. - // Extra constructors must be added by `Jimp.appendConstructorOption()` - cb = args[args.length - 1]; - - if (typeof cb !== 'function') { - // TODO: try to solve the args after cb problem. - cb = args[args.length - 2]; - - if (typeof cb !== 'function') { - cb = noop; - } - } - - var extraConstructor = Jimp.__extraConstructors.find(function (c) { - return c.test.apply(c, args); - }); - - if (extraConstructor) { - new Promise(function (resolve, reject) { - var _extraConstructor$run; - - return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); - }).then(function () { - return finish(null, (0, _assertThisInitialized2["default"])(_this)); - })["catch"](finish); - } else { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish)); - } - } - - return _this; - } - /** - * Parse a bitmap with the loaded image types. - * - * @param {Buffer} data raw image data - * @param {string} path optional path to file - * @param {function(Error, Jimp)} finish (optional) a callback for when complete - * @memberof Jimp - */ - - - (0, _createClass2["default"])(Jimp, [{ - key: "parseBitmap", - value: function parseBitmap(data, path, finish) { - _imageBitmap.parseBitmap.call(this, data, null, finish); - } - /** - * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) - * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "rgba", - value: function rgba(bool, cb) { - if (typeof bool !== 'boolean') { - return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb); - } - - this._rgba = bool; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - /** - * Emit for multiple listeners - * @param {string} methodName name of the method to emit an error for - * @param {string} eventName name of the eventName to emit an error for - * @param {object} data to emit - */ - - }, { - key: "emitMulti", - value: function emitMulti(methodName, eventName) { - var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - data = Object.assign(data, { - methodName: methodName, - eventName: eventName - }); - this.emit('any', data); - - if (methodName) { - this.emit(methodName, data); - } - - this.emit(eventName, data); - } - }, { - key: "emitError", - value: function emitError(methodName, err) { - this.emitMulti(methodName, 'error', err); - } - /** - * Get the current height of the image - * @return {number} height of the image - */ - - }, { - key: "getHeight", - value: function getHeight() { - return this.bitmap.height; - } - /** - * Get the current width of the image - * @return {number} width of the image - */ - - }, { - key: "getWidth", - value: function getWidth() { - return this.bitmap.width; - } - /** - * Nicely format Jimp object when sent to the console e.g. console.log(image) - * @returns {string} pretty printed - */ - - }, { - key: "inspect", - value: function inspect() { - return ''; - } - /** - * Nicely format Jimp object when converted to a string - * @returns {string} pretty printed - */ - - }, { - key: "toString", - value: function toString() { - return '[object Jimp]'; - } - /** - * Returns the original MIME of the image (default: "image/png") - * @returns {string} the MIME - */ - - }, { - key: "getMIME", - value: function getMIME() { - var mime = this._originalMime || Jimp.MIME_PNG; - return mime; - } - /** - * Returns the appropriate file extension for the original MIME of the image (default: "png") - * @returns {string} the file extension - */ - - }, { - key: "getExtension", - value: function getExtension() { - var mime = this.getMIME(); - return MIME.getExtension(mime); - } - /** - * Writes the image to a file - * @param {string} path a path to the destination file - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "write", - value: function write(path, cb) { - var _this2 = this; - - if (!_fs["default"] || !_fs["default"].createWriteStream) { - throw new Error('Cant access the filesystem. You can use the getBase64 method.'); - } - - if (typeof path !== 'string') { - return _utils.throwError.call(this, 'path must be a string', cb); - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - var mime = MIME.getType(path) || this.getMIME(); - - var pathObj = _path["default"].parse(path); - - if (pathObj.dir) { - _mkdirp["default"].sync(pathObj.dir); - } - - this.getBuffer(mime, function (err, buffer) { - if (err) { - return _utils.throwError.call(_this2, err, cb); - } - - var stream = _fs["default"].createWriteStream(path); - - stream.on('open', function () { - stream.write(buffer); - stream.end(); - }).on('error', function (err) { - return _utils.throwError.call(_this2, err, cb); - }); - stream.on('finish', function () { - cb.call(_this2, null, _this2); - }); - }); - return this; - } - }, { - key: "getBase64", - - /** - * Converts the image to a base 64 string - * @param {string} mime the mime type of the image data to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - value: function getBase64(mime, cb) { - if (mime === Jimp.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - this.getBuffer(mime, function (err, data) { - if (err) { - return _utils.throwError.call(this, err, cb); - } - - var src = 'data:' + mime + ';base64,' + data.toString('base64'); - cb.call(this, null, src); - }); - return this; - } - }, { - key: "hash", - - /** - * Generates a perceptual hash of the image . And pads the string. Can configure base. - * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {string} a string representing the hash - */ - value: function hash(base, cb) { - base = base || 64; - - if (typeof base === 'function') { - cb = base; - base = 64; - } - - if (typeof base !== 'number') { - return _utils.throwError.call(this, 'base must be a number', cb); - } - - if (base < 2 || base > 64) { - return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb); - } - - var hash = this.pHash(); - hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); - - while (hash.length < maxHashLength[base]) { - hash = '0' + hash; // pad out with leading zeros - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hash); - } - - return hash; - } - /** - * Calculates the perceptual hash - * @returns {number} the perceptual hash - */ - - }, { - key: "pHash", - value: function pHash() { - var pHash = new _phash["default"](); - return pHash.getHash(this); - } - /** - * Calculates the hamming distance of the current image and a hash based on their perceptual hash - * @param {hash} compareHash hash to compare to - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - }, { - key: "distanceFromHash", - value: function distanceFromHash(compareHash) { - var pHash = new _phash["default"](); - var currentHash = pHash.getHash(this); - return pHash.distance(currentHash, compareHash); - } - /** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "getPixelIndex", - - /** - * Returns the offset of a pixel in the bitmap buffer - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {number} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function getPixelIndex(x, y, edgeHandling, cb) { - var xi; - var yi; - - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = Jimp.EDGE_EXTEND; - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - xi = x; - yi = y; - - if (edgeHandling === Jimp.EDGE_EXTEND) { - if (x < 0) xi = 0; - if (x >= this.bitmap.width) xi = this.bitmap.width - 1; - if (y < 0) yi = 0; - if (y >= this.bitmap.height) yi = this.bitmap.height - 1; - } - - if (edgeHandling === Jimp.EDGE_WRAP) { - if (x < 0) { - xi = this.bitmap.width + x; - } - - if (x >= this.bitmap.width) { - xi = x % this.bitmap.width; - } - - if (y < 0) { - xi = this.bitmap.height + y; - } - - if (y >= this.bitmap.height) { - yi = y % this.bitmap.height; - } - } - - var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 - - if (xi < 0 || xi >= this.bitmap.width) { - i = -1; - } - - if (yi < 0 || yi >= this.bitmap.height) { - i = -1; - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; - } - /** - * Returns the hex colour value of a pixel - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the color of the pixel - */ - - }, { - key: "getPixelColor", - value: function getPixelColor(x, y, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - var hex = this.bitmap.data.readUInt32BE(idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hex); - } - - return hex; - } - }, { - key: "setPixelColor", - - /** - * Returns the hex colour value of a pixel - * @param {number} hex color to set - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function setPixelColor(hex, x, y, cb) { - if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - this.bitmap.data.writeUInt32BE(hex, idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }, { - key: "hasAlpha", - - /** - * Determine if the image contains opaque pixels. - * @return {boolean} hasAlpha whether the image contains opaque pixels - */ - value: function hasAlpha() { - for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { - for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { - var idx = this.bitmap.width * yIndex + xIndex << 2; - var alpha = this.bitmap.data[idx + 3]; - - if (alpha !== 0xff) { - return true; - } - } - } - - return false; - } - /** - * Iterate scan through a region of the bitmap - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} - */ - - }, { - key: "scanIterator", - value: function scanIterator(x, y, w, h) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers'); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers'); - } - - return (0, _utils.scanIterator)(this, x, y, w, h); - } - }]); - return Jimp; -}(_events["default"]); - -function addConstants(constants) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(constants).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - value = _ref2[1]; - - jimpInstance[name] = value; - }); -} - -function addJimpMethods(methods) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(methods).forEach(function (_ref3) { - var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), - name = _ref4[0], - value = _ref4[1]; - - jimpInstance.prototype[name] = value; - }); -} - -addConstants(constants); -addJimpMethods({ - composite: _composite["default"] -}); -Jimp.__extraConstructors = []; -/** - * Allow client libs to add new ways to build a Jimp object. - * @param {string} name identify the extra constructor. - * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. - * @param {function} run where the magic happens. - */ - -Jimp.appendConstructorOption = function (name, test, run) { - Jimp.__extraConstructors.push({ - name: name, - test: test, - run: run - }); -}; -/** - * Read an image from a file or a Buffer. Takes the same args as the constructor - * @returns {Promise} a promise - */ - - -Jimp.read = function () { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - return new Promise(function (resolve, reject) { - (0, _construct2["default"])(Jimp, args.concat([function (err, image) { - if (err) reject(err);else resolve(image); - }])); - }); -}; - -Jimp.create = Jimp.read; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} r the red value (0-255) - * @param {number} g the green value (0-255) - * @param {number} b the blue value (0-255) - * @param {number} a the alpha value (0-255) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {number} an single integer colour value - */ - -Jimp.rgbaToInt = function (r, g, b, a, cb) { - if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') { - return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb); - } - - if (r < 0 || r > 255) { - return _utils.throwError.call(this, 'r must be between 0 and 255', cb); - } - - if (g < 0 || g > 255) { - _utils.throwError.call(this, 'g must be between 0 and 255', cb); - } - - if (b < 0 || b > 255) { - return _utils.throwError.call(this, 'b must be between 0 and 255', cb); - } - - if (a < 0 || a > 255) { - return _utils.throwError.call(this, 'a must be between 0 and 255', cb); - } - - r = Math.round(r); - b = Math.round(b); - g = Math.round(g); - a = Math.round(a); - var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; -}; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {object} an object with the properties r, g, b and a representing RGBA values - */ - - -Jimp.intToRGBA = function (i, cb) { - if (typeof i !== 'number') { - return _utils.throwError.call(this, 'i must be a number', cb); - } - - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, rgba); - } - - return rgba; -}; -/** - * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number - * @param {string} cssColor a number - * @returns {number} a hex number representing a color - */ - - -Jimp.cssColorToHex = function (cssColor) { - cssColor = cssColor || 0; // 0, null, undefined, NaN - - if (typeof cssColor === 'number') return Number(cssColor); - return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); -}; -/** - * Limits a number to between 0 or 255 - * @param {number} n a number - * @returns {number} the number limited to between 0 or 255 - */ - - -Jimp.limit255 = function (n) { - n = Math.max(n, 0); - n = Math.min(n, 255); - return n; -}; -/** - * Diffs two images and returns - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) - * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } - */ - - -Jimp.diff = function (img1, img2) { - var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; - if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images'); - var bmp1 = img1.bitmap; - var bmp2 = img2.bitmap; - - if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { - if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { - // img1 is bigger - img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height); - } else { - // img2 is bigger (or they are the same in area) - img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); - } - } - - if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) { - return _utils.throwError.call(this, 'threshold must be a number between 0 and 1'); - } - - var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); - var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { - threshold: threshold - }); - return { - percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), - image: diff - }; -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.distance = function (img1, img2) { - var phash = new _phash["default"](); - var hash1 = phash.getHash(img1); - var hash2 = phash.getHash(img2); - return phash.distance(hash1, hash2); -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {hash} hash1 a pHash - * @param {hash} hash2 a pHash - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.compareHashes = function (hash1, hash2) { - var phash = new _phash["default"](); - return phash.distance(hash1, hash2); -}; -/** - * Compute color difference - * 0 means no difference, 1 means maximum difference. - * @param {number} rgba1: first color to compare. - * @param {number} rgba2: second color to compare. - * Both parameters must be an color object {r:val, g:val, b:val, a:val} - * Where `a` is optional and `val` is an integer between 0 and 255. - * @returns {number} float between 0 and 1. - */ - - -Jimp.colorDiff = function (rgba1, rgba2) { - var pow = function pow(n) { - return Math.pow(n, 2); - }; - - var max = Math.max; - var maxVal = 255 * 255 * 3; - - if (rgba1.a !== 0 && !rgba1.a) { - rgba1.a = 255; - } - - if (rgba2.a !== 0 && !rgba2.a) { - rgba2.a = 255; - } - - return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; -}; -/** - * Helper to create Jimp methods that emit events before and after its execution. - * @param {string} methodName The name to be appended to Jimp prototype. - * @param {string} evName The event name to be called. - * It will be prefixed by `before-` and emitted when on method call. - * It will be appended by `ed` and emitted after the method run. - * @param {function} method A function implementing the method itself. - * It will also create a quiet version that will not emit events, to not - * mess the user code with many `changed` event calls. You can call with - * `methodName + "Quiet"`. - * - * The emitted event comes with a object parameter to the listener with the - * `methodName` as one attribute. - */ - - -function jimpEvMethod(methodName, evName, method) { - var evNameBefore = 'before-' + evName; - var evNameAfter = evName.replace(/e$/, '') + 'ed'; - - Jimp.prototype[methodName] = function () { - var wrappedCb; - - for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; - } - - var cb = args[method.length - 1]; - var jimpInstance = this; - - if (typeof cb === 'function') { - wrappedCb = function wrappedCb() { - for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - args[_key5] = arguments[_key5]; - } - - var err = args[0], - data = args[1]; - - if (err) { - jimpInstance.emitError(methodName, err); - } else { - jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); - } - - cb.apply(this, args); - }; - - args[args.length - 1] = wrappedCb; - } else { - wrappedCb = false; - } - - this.emitMulti(methodName, evNameBefore); - var result; - - try { - result = method.apply(this, args); - - if (!wrappedCb) { - this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); - } - } catch (error) { - error.methodName = methodName; - this.emitError(methodName, error); - } - - return result; - }; - - Jimp.prototype[methodName + 'Quiet'] = method; -} -/** - * Creates a new image that is a clone of this one. - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns the new image - */ - - -jimpEvMethod('clone', 'clone', function (cb) { - var clone = new Jimp(this); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(clone, null, clone); - } - - return clone; -}); -/** - * Simplify jimpEvMethod call for the common `change` evName. - * @param {string} methodName name of the method - * @param {function} method to watch changes for - */ - -function jimpEvChange(methodName, method) { - jimpEvMethod(methodName, 'change', method); -} -/** - * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) - * @param b A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -jimpEvChange('background', function (hex, cb) { - if (typeof hex !== 'number') { - return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb); - } - - this._background = hex; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -}); -/** - * Scans through a region of the bitmap, calling a function for each pixel. - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @param f a function to call on even pixel; the (x, y) position of the pixel - * and the index of the pixel in the bitmap buffer are passed to the function - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - -jimpEvChange('scan', function (x, y, w, h, f, cb) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof f !== 'function') { - return _utils.throwError.call(this, 'f must be a function', cb); - } - - var result = (0, _utils.scan)(this, x, y, w, h, f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, result); - } - - return result; -}); - -if ("BROWSER" === 'BROWSER') { - // For use in a web browser or web worker - - /* global self */ - var gl; - - if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') { - gl = window; - } - - if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') { - gl = self; - } - - gl.Jimp = Jimp; - gl.Buffer = Buffer; -} - -var _default = Jimp; -exports["default"] = _default; - -}).call(this,require("buffer").Buffer) -},{"./composite":191,"./constants":192,"./modules/phash":194,"./request":195,"./utils/image-bitmap":196,"./utils/mime":197,"./utils/promisify":198,"@babel/runtime/helpers/assertThisInitialized":3,"@babel/runtime/helpers/classCallCheck":4,"@babel/runtime/helpers/construct":5,"@babel/runtime/helpers/createClass":6,"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/possibleConstructorReturn":17,"@babel/runtime/helpers/slicedToArray":19,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"any-base":23,"buffer":48,"events":52,"fs":47,"mkdirp":83,"path":107,"pixelmatch":109,"tinycolor2":178}],194:[function(require,module,exports){ -"use strict"; - -/* -Copyright (c) 2011 Elliot Shepherd - -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. -*/ -// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java - -/* - * pHash-like image hash. - * Author: Elliot Shepherd (elliot@jarofworms.com - * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html - */ -function ImagePHash(size, smallerSize) { - this.size = this.size || size; - this.smallerSize = this.smallerSize || smallerSize; - initCoefficients(this.size); -} - -ImagePHash.prototype.size = 32; -ImagePHash.prototype.smallerSize = 8; - -ImagePHash.prototype.distance = function (s1, s2) { - var counter = 0; - - for (var k = 0; k < s1.length; k++) { - if (s1[k] !== s2[k]) { - counter++; - } - } - - return counter / s1.length; -}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. - - -ImagePHash.prototype.getHash = function (img) { - /* 1. Reduce size. - * Like Average Hash, pHash starts with a small image. - * However, the image is larger than 8x8; 32x32 is a good size. - * This is really done to simplify the DCT computation and not - * because it is needed to reduce the high frequencies. - */ - img = img.clone().resize(this.size, this.size); - /* 2. Reduce color. - * The image is reduced to a grayscale just to further simplify - * the number of computations. - */ - - img.grayscale(); - var vals = []; - - for (var x = 0; x < img.bitmap.width; x++) { - vals[x] = []; - - for (var y = 0; y < img.bitmap.height; y++) { - vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; - } - } - /* 3. Compute the DCT. - * The DCT separates the image into a collection of frequencies - * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses - * a 32x32 DCT. - */ - - - var dctVals = applyDCT(vals, this.size); - /* 4. Reduce the DCT. - * This is the magic step. While the DCT is 32x32, just keep the - * top-left 8x8. Those represent the lowest frequencies in the - * picture. - */ - - /* 5. Compute the average value. - * Like the Average Hash, compute the mean DCT value (using only - * the 8x8 DCT low-frequency values and excluding the first term - * since the DC coefficient can be significantly different from - * the other values and will throw off the average). - */ - - var total = 0; - - for (var _x = 0; _x < this.smallerSize; _x++) { - for (var _y = 0; _y < this.smallerSize; _y++) { - total += dctVals[_x][_y]; - } - } - - var avg = total / (this.smallerSize * this.smallerSize); - /* 6. Further reduce the DCT. - * This is the magic step. Set the 64 hash bits to 0 or 1 - * depending on whether each of the 64 DCT values is above or - * below the average value. The result doesn't tell us the - * actual low frequencies; it just tells us the very-rough - * relative scale of the frequencies to the mean. The result - * will not vary as long as the overall structure of the image - * remains the same; this can survive gamma and color histogram - * adjustments without a problem. - */ - - var hash = ''; - - for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { - for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { - hash += dctVals[_x2][_y2] > avg ? '1' : '0'; - } - } - - return hash; -}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java - - -function intToRGBA(i) { - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - return rgba; -} - -var c = []; - -function initCoefficients(size) { - for (var i = 1; i < size; i++) { - c[i] = 1; - } - - c[0] = 1 / Math.sqrt(2.0); -} - -function applyDCT(f, size) { - var N = size; - var F = []; - - for (var u = 0; u < N; u++) { - F[u] = []; - - for (var v = 0; v < N; v++) { - var sum = 0; - - for (var i = 0; i < N; i++) { - for (var j = 0; j < N; j++) { - sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; - } - } - - sum *= c[u] * c[v] / 4; - F[u][v] = sum; - } - } - - return F; -} - -module.exports = ImagePHash; - -},{}],195:[function(require,module,exports){ -(function (process,Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/* global XMLHttpRequest */ -if (process.browser || "BROWSER" === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') { - // If we run into a browser or the electron renderer process, - // use XHR method instead of Request node module. - module.exports = function (options, cb) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', options.url, true); - xhr.responseType = 'arraybuffer'; - xhr.addEventListener('load', function () { - if (xhr.status < 400) { - try { - var data = Buffer.from(this.response); - cb(null, xhr, data); - } catch (error) { - return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message)); - } - } else { - cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url)); - } - }); - xhr.addEventListener('error', function (e) { - cb(e); - }); - xhr.send(); - }; -} else { - module.exports = function (_ref, cb) { - var options = (0, _extends2["default"])({}, _ref); - - var p = require('phin'); - - p(_objectSpread({ - compression: true - }, options), function (err, res) { - if (err === null) { - cb(null, res, res.body); - } else { - cb(err); - } - }); - }; -} - -}).call(this,require('_process'),require("buffer").Buffer) -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/extends":8,"@babel/runtime/helpers/interopRequireDefault":11,"_process":133,"buffer":48,"phin":108}],196:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseBitmap = parseBitmap; -exports.getBuffer = getBuffer; -exports.getBufferAsync = getBufferAsync; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _fileType = _interopRequireDefault(require("file-type")); - -var _exifParser = _interopRequireDefault(require("exif-parser")); - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var MIME = _interopRequireWildcard(require("./mime")); - -var _promisify = _interopRequireDefault(require("./promisify")); - -function getMIMEFromBuffer(buffer, path) { - var fileTypeFromBuffer = (0, _fileType["default"])(buffer); - - if (fileTypeFromBuffer) { - // If fileType returns something for buffer, then return the mime given - return fileTypeFromBuffer.mime; - } - - if (path) { - // If a path is supplied, and fileType yields no results, then retry with MIME - // Path can be either a file path or a url - return MIME.getType(path); - } - - return null; -} -/* - * Obtains image orientation from EXIF metadata. - * - * @param img {Jimp} a Jimp image object - * @returns {number} a number 1-8 representing EXIF orientation, - * in particular 1 if orientation tag is missing - */ - - -function getExifOrientation(img) { - return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; -} -/** - * Returns a function which translates EXIF-rotated coordinates into - * non-rotated ones. - * - * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. - * - * @param img {Jimp} a Jimp image object - * @returns {function} transformation function for transformBitmap(). - */ - - -function getExifOrientationTransformation(img) { - var w = img.getWidth(); - var h = img.getHeight(); - - switch (getExifOrientation(img)) { - case 1: - // Horizontal (normal) - // does not need to be supported here - return null; - - case 2: - // Mirror horizontal - return function (x, y) { - return [w - x - 1, y]; - }; - - case 3: - // Rotate 180 - return function (x, y) { - return [w - x - 1, h - y - 1]; - }; - - case 4: - // Mirror vertical - return function (x, y) { - return [x, h - y - 1]; - }; - - case 5: - // Mirror horizontal and rotate 270 CW - return function (x, y) { - return [y, x]; - }; - - case 6: - // Rotate 90 CW - return function (x, y) { - return [y, h - x - 1]; - }; - - case 7: - // Mirror horizontal and rotate 90 CW - return function (x, y) { - return [w - y - 1, h - x - 1]; - }; - - case 8: - // Rotate 270 CW - return function (x, y) { - return [w - y - 1, x]; - }; - - default: - return null; - } -} -/* - * Transforms bitmap in place (moves pixels around) according to given - * transformation function. - * - * @param img {Jimp} a Jimp image object, which bitmap is supposed to - * be transformed - * @param width {number} bitmap width after the transformation - * @param height {number} bitmap height after the transformation - * @param transformation {function} transformation function which defines pixel - * mapping between new and source bitmap. It takes a pair of coordinates - * in the target, and returns a respective pair of coordinates in - * the source bitmap, i.e. has following form: - * `function(new_x, new_y) { return [src_x, src_y] }`. - */ - - -function transformBitmap(img, width, height, transformation) { - // Underscore-prefixed values are related to the source bitmap - // Their counterparts with no prefix are related to the target bitmap - var _data = img.bitmap.data; - var _width = img.bitmap.width; - var data = Buffer.alloc(_data.length); - - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var _transformation = transformation(x, y), - _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), - _x = _transformation2[0], - _y = _transformation2[1]; - - var idx = width * y + x << 2; - - var _idx = _width * _y + _x << 2; - - var pixel = _data.readUInt32BE(_idx); - - data.writeUInt32BE(pixel, idx); - } - } - - img.bitmap.data = data; - img.bitmap.width = width; - img.bitmap.height = height; -} -/* - * Automagically rotates an image based on its EXIF data (if present). - * @param img {Jimp} a Jimp image object - */ - - -function exifRotate(img) { - if (getExifOrientation(img) < 2) return; - var transformation = getExifOrientationTransformation(img); - var swapDimensions = getExifOrientation(img) > 4; - var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; - var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; - transformBitmap(img, newWidth, newHeight, transformation); -} // parses a bitmap from the constructor to the JIMP bitmap property - - -function parseBitmap(data, path, cb) { - var mime = getMIMEFromBuffer(data, path); - - if (typeof mime !== 'string') { - return cb(new Error('Could not find MIME for Buffer <' + path + '>')); - } - - this._originalMime = mime.toLowerCase(); - - try { - var _mime = this.getMIME(); - - if (this.constructor.decoders[_mime]) { - this.bitmap = this.constructor.decoders[_mime](data); - } else { - return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb); - } - } catch (error) { - return cb.call(this, error, this); - } - - try { - this._exif = _exifParser["default"].create(data).parse(); - exifRotate(this); // EXIF data - } catch (error) { - /* meh */ - } - - cb.call(this, null, this); - return this; -} - -function compositeBitmapOverBackground(Jimp, image) { - return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; -} -/** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - -function getBuffer(mime, cb) { - if (mime === constants.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - mime = mime.toLowerCase(); - - if (this._rgba && this.constructor.hasAlpha[mime]) { - this.bitmap.data = Buffer.from(this.bitmap.data); - } else { - // when format doesn't support alpha - // composite onto a new image so that the background shows through alpha channels - this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; - } - - if (this.constructor.encoders[mime]) { - var buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); - } else { - cb.call(this, 'Unsupported MIME type: ' + mime); - } - - return this; -} - -function getBufferAsync(mime) { - return (0, _promisify["default"])(getBuffer, this, mime); -} - -}).call(this,require("buffer").Buffer) -},{"../constants":192,"./mime":197,"./promisify":198,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/slicedToArray":19,"@jimp/utils":235,"buffer":48,"exif-parser":53,"file-type":62}],197:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getExtension = exports.getType = exports.addType = void 0; -var mimeTypes = {}; - -var findType = function findType(extension) { - return Object.entries(mimeTypes).find(function (type) { - return type[1].includes(extension); - }) || []; -}; - -var addType = function addType(mime, extensions) { - mimeTypes[mime] = extensions; -}; -/** - * Lookup a mime type based on extension - * @param {string} path path to find extension for - * @returns {string} mime found mime type - */ - - -exports.addType = addType; - -var getType = function getType(path) { - var pathParts = path.split('/').slice(-1); - var extension = pathParts[pathParts.length - 1].split('.').pop(); - var type = findType(extension); - return type[0]; -}; -/** - * Return file extension associated with a mime type - * @param {string} type mime type to look up - * @returns {string} extension file extension - */ - - -exports.getType = getType; - -var getExtension = function getExtension(type) { - return (mimeTypes[type.toLowerCase()] || [])[0]; -}; - -exports.getExtension = getExtension; - -},{}],198:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var promisify = function promisify(fun, ctx) { - for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - - return new Promise(function (resolve, reject) { - args.push(function (err, data) { - if (err) { - reject(err); - } - - resolve(data); - }); - fun.bind(ctx).apply(void 0, args); - }); -}; - -var _default = promisify; -exports["default"] = _default; -module.exports = exports.default; - -},{}],199:[function(require,module,exports){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = configure; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _core = _interopRequireWildcard(require("@jimp/core")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function configure(configuration) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"]; - var jimpConfig = { - hasAlpha: {}, - encoders: {}, - decoders: {}, - "class": {}, - constants: {} - }; - - function addToConfig(newConfig) { - Object.entries(newConfig).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value); - }); - } - - function addImageType(typeModule) { - var type = typeModule(); - - if (Array.isArray(type.mime)) { - _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime)); - } else { - Object.entries(type.mime).forEach(function (mimeType) { - return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType)); - }); - } - - delete type.mime; - addToConfig(type); - } - - function addPlugin(pluginModule) { - var plugin = pluginModule(_core.jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { - // Default to class function - addToConfig({ - "class": plugin - }); - } else { - addToConfig(plugin); - } - } - - if (configuration.types) { - configuration.types.forEach(addImageType); - jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders); - jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders); - jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha); - } - - if (configuration.plugins) { - configuration.plugins.forEach(addPlugin); - } - - (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance); - (0, _core.addConstants)(jimpConfig.constants, jimpInstance); - return _core["default"]; -} - -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/slicedToArray":19,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/core":193}],200:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _custom = _interopRequireDefault(require("@jimp/custom")); - -var _types = _interopRequireDefault(require("@jimp/types")); - -var _plugins = _interopRequireDefault(require("@jimp/plugins")); - -var _default = (0, _custom["default"])({ - types: [_types["default"]], - plugins: [_plugins["default"]] -}); - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/custom":199,"@jimp/plugins":228,"@jimp/types":234}],201:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); // round input - - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - var maxWidth = this.bitmap.width; - var maxHeight = this.bitmap.height; - var baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { - var xOffset = x + sx - srcx; - var yOffset = y + sy - srcy; - - if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { - var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - var _src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - var dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],202:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shgTable = exports.mulTable = void 0; -var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; -exports.mulTable = mulTable; -var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; -exports.shgTable = shgTable; - -},{}],203:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _blurTables = require("./blur-tables"); - -/* - Superfast Blur (0.5) - http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js - - Copyright (c) 2011 Mario Klingemann - - 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 _default = function _default() { - return { - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur: function blur(r, cb) { - if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb); - if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb); - var rsum; - var gsum; - var bsum; - var asum; - var x; - var y; - var i; - var p; - var p1; - var p2; - var yp; - var yi; - var yw; - var pa; - var wm = this.bitmap.width - 1; - var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; - - var rad1 = r + 1; - var mulSum = _blurTables.mulTable[r]; - var shgSum = _blurTables.shgTable[r]; - var red = []; - var green = []; - var blue = []; - var alpha = []; - var vmin = []; - var vmax = []; - var iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - yi++; - } - - yw += this.bitmap.width << 2; - } - - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = asum * mulSum >>> shgSum; - this.bitmap.data[yi + 3] = pa; // normalize alpha - - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - yi += this.bitmap.width << 2; - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"./blur-tables":202,"@jimp/utils":235}],204:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) radius, x, y - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - circle: function circle() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; - var center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],205:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _utils = require("@jimp/utils"); - -function applyKernel(im, kernel, x, y) { - var value = [0, 0, 0]; - var size = (kernel.length - 1) / 2; - - for (var kx = 0; kx < kernel.length; kx += 1) { - for (var ky = 0; ky < kernel[kx].length; ky += 1) { - var idx = im.getPixelIndex(x + kx - size, y + ky - size); - value[0] += im.bitmap.data[idx] * kernel[kx][ky]; - value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; - value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; - } - } - - return value; -} - -var isDef = function isDef(v) { - return typeof v !== 'undefined' && v !== null; -}; - -function greyscale(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -function mix(clr, clr2) { - var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; - return { - r: (clr2.r - clr.r) * (p / 100) + clr.r, - g: (clr2.g - clr.g) * (p / 100) + clr.g, - b: (clr2.b - clr.b) * (p / 100) + clr.b - }; -} - -function colorFn(actions, cb) { - var _this = this; - - if (!actions || !Array.isArray(actions)) { - return _utils.throwError.call(this, 'actions must be an array', cb); - } - - actions = actions.map(function (action) { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); - } - - return action; - }); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var clr = { - r: _this.bitmap.data[idx], - g: _this.bitmap.data[idx + 1], - b: _this.bitmap.data[idx + 2] - }; - - var colorModifier = function colorModifier(i, amount) { - return _this.constructor.limit255(clr[i] + amount); - }; - - actions.forEach(function (action) { - if (action.apply === 'mix') { - clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { - clr = mix(clr, { - r: 255, - g: 255, - b: 255 - }, action.params[0]); - } else if (action.apply === 'shade') { - clr = mix(clr, { - r: 0, - g: 0, - b: 0 - }, action.params[0]); - } else if (action.apply === 'xor') { - clr = { - r: clr.r ^ action.params[0].r, - g: clr.g ^ action.params[0].g, - b: clr.b ^ action.params[0].b - }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); - } else { - var _clr; - - if (action.apply === 'hue') { - action.apply = 'spin'; - } - - clr = (0, _tinycolor["default"])(clr); - - if (!clr[action.apply]) { - return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb); - } - - clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); - } - }); - _this.bitmap.data[idx] = clr.r; - _this.bitmap.data[idx + 1] = clr.g; - _this.bitmap.data[idx + 2] = clr.b; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness: function brightness(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast: function contrast(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - var factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - return value < 0 ? 0 : value > 255 ? 255 : value; - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize: function posterize(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be numbers', cb); - } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale: greyscale, - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity: function opacity(f, cb) { - if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia: function sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var red = this.bitmap.data[idx]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade: function fade(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0 || f > 1) { - return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - } // this method is an alternative to opacity (which may be deprecated) - - - this.opacity(1 - f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution: function convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; - } - - var newData = Buffer.from(this.bitmap.data); - var kRows = kernel.length; - var kCols = kernel[0].length; - var rowEnd = Math.floor(kRows / 2); - var colEnd = Math.floor(kCols / 2); - var rowIni = -rowEnd; - var colIni = -colEnd; - var weight; - var rSum; - var gSum; - var bSum; - var ri; - var gi; - var bi; - var xi; - var yi; - var idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (var row = rowIni; row <= rowEnd; row++) { - for (var col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - this.bitmap.data = newData; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque: function opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx + 3] = 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate: function pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return _utils.throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute: function convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var ksize = (kernel.length - 1) / 2; - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/utils":235,"buffer":48,"tinycolor2":178}],206:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - contain: function contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } // permit any sort of optional parameters combination - - - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { - return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - } - - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - var c = this.cloneQuiet().scale(f, mode); - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],207:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - cover: function cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; - this.scale(f, mode); - this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],208:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = pluginCrop; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/* eslint-disable no-labels */ -function pluginCrop(event) { - /** - * Crops the image at a given point to a give size - * @param {number} x the x coordinate to crop form - * @param {number} y the y coordinate to crop form - * @param w the width of the crop region - * @param h the height of the crop region - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - event('crop', function (x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - if (x === 0 && w === this.bitmap.width) { - // shortcut - var start = w * y + x << 2; - var end = start + h * w << 2; - this.bitmap.data = this.bitmap.data.slice(start, end); - } else { - var bitmap = Buffer.allocUnsafe(w * h * 4); - var offset = 0; - this.scanQuiet(x, y, w, h, function (x, y, idx) { - var data = this.bitmap.data.readUInt32BE(idx, true); - bitmap.writeUInt32BE(data, offset, true); - offset += 4; - }); - this.bitmap.data = bitmap; - } - - this.bitmap.width = w; - this.bitmap.height = h; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }); - return { - "class": { - /** - * Autocrop same color borders from this image - * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) - * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) - * @returns {Jimp} this for chaining of methods - */ - autocrop: function autocrop() { - var w = this.bitmap.width; - var h = this.bitmap.height; - var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - var cb; // callback - - var leaveBorder = 0; // Amount of pixels in border to leave - - var tolerance = 0.0002; // percent of color difference tolerance (default value) - - var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" - // i.e. all 4 sides have some border (default value) - - var cropSymmetric = false; // flag to force cropping top be symmetric. - // i.e. north and south / east and west are cropped by the same value - - var ignoreSides = { - north: false, - south: false, - east: false, - west: false - }; // parse arguments - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - for (var a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { - // tolerance value passed - tolerance = args[a]; - } - - if (typeof args[a] === 'boolean') { - // cropOnlyFrames value passed - cropOnlyFrames = args[a]; - } - - if (typeof args[a] === 'function') { - // callback value passed - cb = args[a]; - } - - if ((0, _typeof2["default"])(args[a]) === 'object') { - // config object passed - var config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - tolerance = config.tolerance; - } - - if (typeof config.cropOnlyFrames !== 'undefined') { - cropOnlyFrames = config.cropOnlyFrames; - } - - if (typeof config.cropSymmetric !== 'undefined') { - cropSymmetric = config.cropSymmetric; - } - - if (typeof config.leaveBorder !== 'undefined') { - leaveBorder = config.leaveBorder; - } - - if (typeof config.ignoreSides !== 'undefined') { - ignoreSides = config.ignoreSides; - } - } - } - /** - * All borders must be of the same color as the top left pixel, to be cropped. - * It should be possible to crop borders each with a different color, - * but since there are many ways for corners to intersect, it would - * introduce unnecessary complexity to the algorithm. - */ - // scan each side for same color borders - - - var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - - var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides - - var northPixelsToCrop = 0; - var eastPixelsToCrop = 0; - var southPixelsToCrop = 0; - var westPixelsToCrop = 0; // north side (scan rows from north to south) - - colorTarget = this.getPixelColor(0, 0); - - if (!ignoreSides.north) { - north: for (var y = 0; y < h - minPixelsPerSide; y++) { - for (var x = 0; x < w; x++) { - var colorXY = this.getPixelColor(x, y); - var rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break north; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - northPixelsToCrop++; - } - } // east side (scan columns from east to west) - - - colorTarget = this.getPixelColor(w, 0); - - if (!ignoreSides.east) { - east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { - for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { - var _colorXY = this.getPixelColor(_x, _y); - - var _rgba = this.constructor.intToRGBA(_colorXY); - - if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break east; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - eastPixelsToCrop++; - } - } // south side (scan rows from south to north) - - - colorTarget = this.getPixelColor(0, h); - - if (!ignoreSides.south) { - south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { - for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { - var _colorXY2 = this.getPixelColor(_x2, _y2); - - var _rgba2 = this.constructor.intToRGBA(_colorXY2); - - if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break south; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - southPixelsToCrop++; - } - } // west side (scan columns from west to east) - - - colorTarget = this.getPixelColor(w, h); - - if (!ignoreSides.west) { - west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { - for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { - var _colorXY3 = this.getPixelColor(_x3, _y3); - - var _rgba3 = this.constructor.intToRGBA(_colorXY3); - - if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break west; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - westPixelsToCrop++; - } - } // decide if a crop is needed - - - var doCrop = false; // apply leaveBorder - - westPixelsToCrop -= leaveBorder; - eastPixelsToCrop -= leaveBorder; - northPixelsToCrop -= leaveBorder; - southPixelsToCrop -= leaveBorder; - - if (cropSymmetric) { - var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); - westPixelsToCrop = horizontal; - eastPixelsToCrop = horizontal; - northPixelsToCrop = vertical; - southPixelsToCrop = vertical; - } // make sure that crops are >= 0 - - - westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; - eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; - northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks - - var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); - var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); - - if (cropOnlyFrames) { - // crop image if all sides should be cropped - doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; - } else { - // crop image if at least one side should be cropped - doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; - } - - if (doCrop) { - // do the real crop - this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -} - -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"buffer":48}],209:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/** - * Displaces the image based on the provided displacement map - * @param {object} map the source Jimp instance - * @param {number} offset the maximum displacement value - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - displace: function displace(map, offset, cb) { - if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return _utils.throwError.call(this, 'factor must be a number', cb); - } - - var source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var displacement = map.bitmap.data[idx] / 256 * offset; - displacement = Math.round(displacement); - var ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],210:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Apply a ordered dithering effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function dither(cb) { - var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var thresholdId = ((y & 3) << 2) + x % 4; - var dither = rgb565Matrix[thresholdId]; - this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); - this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff); - this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - dither565: dither, - dither16: dither - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],211:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {object} options (optional) r: radius of effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - fisheye: function fisheye() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - r: 2.5 - }; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = { - r: 2.5 - }; - } - - var source = this.cloneQuiet(); - var _source$bitmap = source.bitmap, - width = _source$bitmap.width, - height = _source$bitmap.height; - source.scanQuiet(0, 0, width, height, function (x, y) { - var hx = x / width; - var hy = y / height; - var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - var rn = 2 * Math.pow(r, options.r); - var cosA = (hx - 0.5) / r; - var sinA = (hy - 0.5) / r; - var newX = Math.round((rn * cosA + 0.5) * width); - var newY = Math.round((rn * sinA + 0.5) * height); - var color = source.getPixelColor(newX, newY); - - _this.setPixelColor(color, x, y); - }); - /* Set center pixel color, otherwise it will be transparent */ - - this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],212:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Flip the image horizontally - * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally - * @param {boolean} vertical a Boolean, if true the image will be flipped vertically - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb); - var bitmap = Buffer.alloc(this.bitmap.data.length); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var _x = horizontal ? this.bitmap.width - 1 - x : x; - - var _y = vertical ? this.bitmap.height - 1 - y : y; - - var _idx = this.bitmap.width * _y + _x << 2; - - var data = this.bitmap.data.readUInt32BE(idx); - bitmap.writeUInt32BE(data, _idx); - }); - this.bitmap.data = Buffer.from(bitmap); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - flip: flipFn, - mirror: flipFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@jimp/utils":235,"buffer":48}],213:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a true Gaussian blur to the image (warning: this is VERY slow) - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - gaussian: function gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return _utils.throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return _utils.throwError.call(this, 'r must be greater than 0', cb); - } - - var rs = Math.ceil(r * 2.57); // significant radius - - var range = rs * 2 + 1; - var rr2 = r * r * 2; - var rr2pi = rr2 * Math.PI; - var weights = []; - - for (var y = 0; y < range; y++) { - weights[y] = []; - - for (var x = 0; x < range; x++) { - var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } - } - - for (var _y = 0; _y < this.bitmap.height; _y++) { - for (var _x = 0; _x < this.bitmap.width; _x++) { - var red = 0; - var green = 0; - var blue = 0; - var alpha = 0; - var wsum = 0; - - for (var iy = 0; iy < range; iy++) { - for (var ix = 0; ix < range; ix++) { - var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); - var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); - var weight = weights[iy][ix]; - - var _idx = y1 * this.bitmap.width + x1 << 2; - - red += this.bitmap.data[_idx] * weight; - green += this.bitmap.data[_idx + 1] * weight; - blue += this.bitmap.data[_idx + 2] * weight; - alpha += this.bitmap.data[_idx + 3] * weight; - wsum += weight; - } - - var idx = _y * this.bitmap.width + _x << 2; - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],214:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Inverts the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - invert: function invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],215:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. - * @param {Jimp} src the source Jimp instance - * @param {number} x the horizontal position to blit the image - * @param {number} y the vertical position to blit the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - mask: function mask(src) { - var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cb = arguments.length > 3 ? arguments[3] : undefined; - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - var w = this.bitmap.width; - var h = this.bitmap.height; - var baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var destX = x + sx; - var destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - var dstIdx = baseImage.getPixelIndex(destX, destY); - var data = this.bitmap.data; - var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],216:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Get an image's histogram - * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) - */ -function histogram() { - var histogram = { - r: new Array(256).fill(0), - g: new Array(256).fill(0), - b: new Array(256).fill(0) - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, index) { - histogram.r[this.bitmap.data[index + 0]]++; - histogram.g[this.bitmap.data[index + 1]]++; - histogram.b[this.bitmap.data[index + 2]]++; - }); - return histogram; -} -/** - * Normalize values - * @param {integer} value Pixel channel value. - * @param {integer} min Minimum value for channel - * @param {integer} max Maximum value for channel - * @return {integer} normalized values - */ - - -var _normalize = function normalize(value, min, max) { - return (value - min) * 255 / (max - min); -}; - -var getBounds = function getBounds(histogramChannel) { - return [histogramChannel.findIndex(function (value) { - return value > 0; - }), 255 - histogramChannel.slice().reverse().findIndex(function (value) { - return value > 0; - })]; -}; -/** - * Normalizes the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -var _default = function _default() { - return { - normalize: function normalize(cb) { - var h = histogram.call(this); // store bounds (minimum and maximum values) - - var bounds = { - r: getBounds(h.r), - g: getBounds(h.g), - b: getBounds(h.b) - }; // apply value transformations - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var r = this.bitmap.data[idx + 0]; - var g = this.bitmap.data[idx + 1]; - var b = this.bitmap.data[idx + 2]; - this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],217:[function(require,module,exports){ -(function (__dirname){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _path = _interopRequireDefault(require("path")); - -var _loadBmfont = _interopRequireDefault(require("load-bmfont")); - -var _utils = require("@jimp/utils"); - -var _measureText = require("./measure-text"); - -function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { - if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { - return 0; - } - - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { - return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; - } - - return maxWidth - (0, _measureText.measureText)(font, line); -} - -function drawCharacter(image, font, x, y, _char) { - if (_char.width > 0 && _char.height > 0) { - var characterPage = font.pages[_char.page]; - image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); - } - - return image; -} - -function printText(font, x, y, text, defaultCharWidth) { - for (var i = 0; i < text.length; i++) { - var _char2 = void 0; - - if (font.chars[text[i]]) { - _char2 = text[i]; - } else if (/\s/.test(text[i])) { - _char2 = ''; - } else { - _char2 = '?'; - } - - var fontChar = font.chars[_char2] || {}; - var fontKerning = font.kernings[_char2]; - drawCharacter(this, font, x, y, fontChar || {}); - var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; - x += kerning + (fontChar.xadvance || defaultCharWidth); - } -} - -function splitLines(font, text, maxWidth) { - var words = text.split(' '); - var lines = []; - var currentLine = []; - var longestLine = 0; - words.forEach(function (word) { - var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' '); - var length = (0, _measureText.measureText)(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - lines.push(currentLine); - return { - lines: lines, - longestLine: longestLine - }; -} - -function loadPages(Jimp, dir, pages) { - var newPages = pages.map(function (page) { - return Jimp.read(dir + '/' + page); - }); - return Promise.all(newPages); -} - -var dir = "browser/lib/" || "".concat(__dirname, "/../"); - -var _default = function _default() { - return { - constants: { - measureText: _measureText.measureText, - measureTextHeight: _measureText.measureTextHeight, - FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'), - FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'), - FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'), - FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'), - FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'), - FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'), - FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'), - FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'), - FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'), - FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'), - FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'), - FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'), - FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont: function loadFont(file, cb) { - var _this = this; - - if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb); - return new Promise(function (resolve, reject) { - cb = cb || function (err, font) { - if (err) reject(err);else resolve(font); - }; - - (0, _loadBmfont["default"])(file, function (err, font) { - var chars = {}; - var kernings = {}; - - if (err) { - return _utils.throwError.call(_this, err, cb); - } - - for (var i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (var _i = 0; _i < font.kernings.length; _i++) { - var firstString = String.fromCharCode(font.kernings[_i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; - } - - loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { - cb(null, { - chars: chars, - kernings: kernings, - pages: pages, - common: font.common, - info: font.info - }); - }); - }); - }); - } - }, - "class": { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print: function print(font, x, y, text, maxWidth, maxHeight, cb) { - var _this2 = this; - - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if ((0, _typeof2["default"])(font) !== 'object') { - return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return _utils.throwError.call(this, 'maxHeight must be a number', cb); - } - - var alignmentX; - var alignmentY; - - if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - var _text = text; - text = _text.text; - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { - y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); - } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { - y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; - } - - var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - - var _splitLines = splitLines(font, text, maxWidth), - lines = _splitLines.lines, - longestLine = _splitLines.longestLine; - - lines.forEach(function (line) { - var lineString = line.join(' '); - var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); - printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); - y += font.common.lineHeight; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this, { - x: x + longestLine, - y: y - }); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,"/../../node_modules/@jimp/plugin-print/dist") -},{"./measure-text":218,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"load-bmfont":219,"path":107}],218:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.measureText = measureText; -exports.measureTextHeight = measureTextHeight; - -function measureText(font, text) { - var x = 0; - - for (var i = 0; i < text.length; i++) { - if (font.chars[text[i]]) { - var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; - x += (font.chars[text[i]].xadvance || 0) + kerning; - } - } - - return x; -} - -function measureTextHeight(font, text, maxWidth) { - var words = text.split(' '); - var line = ''; - var textTotalHeight = font.common.lineHeight; - - for (var n = 0; n < words.length; n++) { - var testLine = line + words[n] + ' '; - var testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; - } else { - line = testLine; - } - } - - return textTotalHeight; -} - -},{}],219:[function(require,module,exports){ -(function (Buffer){ -var xhr = require('xhr') -var noop = function(){} -var parseASCII = require('parse-bmfont-ascii') -var parseXML = require('parse-bmfont-xml') -var readBinary = require('parse-bmfont-binary') -var isBinaryFormat = require('./lib/is-binary') -var xtend = require('xtend') - -var xml2 = (function hasXML2() { - return self.XMLHttpRequest && "withCredentials" in new XMLHttpRequest -})() - -module.exports = function(opt, cb) { - cb = typeof cb === 'function' ? cb : noop - - if (typeof opt === 'string') - opt = { uri: opt } - else if (!opt) - opt = {} - - var expectBinary = opt.binary - if (expectBinary) - opt = getBinaryOpts(opt) - - xhr(opt, function(err, res, body) { - if (err) - return cb(err) - if (!/^2/.test(res.statusCode)) - return cb(new Error('http status code: '+res.statusCode)) - if (!body) - return cb(new Error('no body result')) - - var binary = false - - //if the response type is an array buffer, - //we need to convert it into a regular Buffer object - if (isArrayBuffer(body)) { - var array = new Uint8Array(body) - body = new Buffer(array, 'binary') - } - - //now check the string/Buffer response - //and see if it has a binary BMF header - if (isBinaryFormat(body)) { - binary = true - //if we have a string, turn it into a Buffer - if (typeof body === 'string') - body = new Buffer(body, 'binary') - } - - //we are not parsing a binary format, just ASCII/XML/etc - if (!binary) { - //might still be a buffer if responseType is 'arraybuffer' - if (Buffer.isBuffer(body)) - body = body.toString(opt.encoding) - body = body.trim() - } - - var result - try { - var type = res.headers['content-type'] - if (binary) - result = readBinary(body) - else if (/json/.test(type) || body.charAt(0) === '{') - result = JSON.parse(body) - else if (/xml/.test(type) || body.charAt(0) === '<') - result = parseXML(body) - else - result = parseASCII(body) - } catch (e) { - cb(new Error('error parsing font '+e.message)) - cb = noop - } - cb(null, result) - }) -} - -function isArrayBuffer(arr) { - var str = Object.prototype.toString - return str.call(arr) === '[object ArrayBuffer]' -} - -function getBinaryOpts(opt) { - //IE10+ and other modern browsers support array buffers - if (xml2) - return xtend(opt, { responseType: 'arraybuffer' }) - - if (typeof self.XMLHttpRequest === 'undefined') - throw new Error('your browser does not support XHR loading') - - //IE9 and XML1 browsers could still use an override - var req = new self.XMLHttpRequest() - req.overrideMimeType('text/plain; charset=x-user-defined') - return xtend({ - xhr: req - }, opt) -} - -}).call(this,require("buffer").Buffer) -},{"./lib/is-binary":220,"buffer":48,"parse-bmfont-ascii":102,"parse-bmfont-binary":103,"parse-bmfont-xml":104,"xhr":187,"xtend":189}],220:[function(require,module,exports){ -(function (Buffer){ -var equal = require('buffer-equal') -var HEADER = new Buffer([66, 77, 70, 3]) - -module.exports = function(buf) { - if (typeof buf === 'string') - return buf.substring(0, 3) === 'BMF' - return buf.length > 4 && equal(buf.slice(0, 4), HEADER) -} -}).call(this,require("buffer").Buffer) -},{"buffer":48,"buffer-equal":49}],221:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _resize = _interopRequireDefault(require("./modules/resize")); - -var _resize2 = _interopRequireDefault(require("./modules/resize2")); - -var _default = function _default() { - return { - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - "class": { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize: function resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return _utils.throwError.call(this, 'w and h must be positive numbers', cb); - } // round inputs - - - w = Math.round(w); - h = Math.round(h); - - if (typeof _resize2["default"][mode] === 'function') { - var dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - _resize2["default"][mode](this.bitmap, dst); - - this.bitmap = dst; - } else { - var image = this; - var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - }); - resize.resize(this.bitmap.data); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"./modules/resize":222,"./modules/resize2":223,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"buffer":48}],222:[function(require,module,exports){ -"use strict"; - -// JavaScript Image Resizer (c) 2012 - Grant Galitz -// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 -function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { - this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); - this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); - this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); - this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); - this.colorChannels = blendAlpha ? 4 : 3; - this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {}; - this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; - this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; - this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; - this.widthPassResultSize = this.targetWidthMultipliedByChannels * this.heightOriginal; - this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; - this.initialize(); -} - -Resize.prototype.initialize = function () { - // Perform some checks: - if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { - this.configurePasses(); - } else { - throw new Error('Invalid settings specified for the resizer.'); - } -}; - -Resize.prototype.configurePasses = function () { - if (this.widthOriginal === this.targetWidth) { - // Bypass the width resizer pass: - this.resizeWidth = this.bypassResizer; - } else { - // Setup the width resizer pass: - this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { - this.initializeFirstPassBuffers(true); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; - } else { - this.initializeFirstPassBuffers(false); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; - } - } - - if (this.heightOriginal === this.targetHeight) { - // Bypass the height resizer pass: - this.resizeHeight = this.bypassResizer; - } else { - // Setup the height resizer pass: - this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { - this.initializeSecondPassBuffers(true); - this.resizeHeight = this.resizeHeightInterpolated; - } else { - this.initializeSecondPassBuffers(false); - this.resizeHeight = this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; - } - } -}; - -Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var outputBuffer = this.widthBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var firstWeight = 0; - var secondWeight = 0; - var targetPosition; // Handle for only one interpolation input being valid for start calculation: - - for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { - for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - var interpolationWidthSourceReadStop; - - for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; - } - } // Handle for only one interpolation input being valid for end calculation: - - - for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { - for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } - - return outputBuffer; -}; - -Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var ratioWeightDivisor = 1 / ratioWeight; - var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; - var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; - var output = this.outputWidthWorkBench; - var outputBuffer = this.widthBuffer; - var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var line = 0; - var pixelOffset = 0; - var outputOffset = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (line = 0; line < this.originalHeightMultipliedByChannels;) { - output[line++] = 0; - output[line++] = 0; - output[line++] = 0; - - if (fourthChannel) { - output[line++] = 0; - trustworthyColorsCount[line / channelsNum - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - - for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { - r = buffer[pixelOffset]; - g = buffer[++pixelOffset]; - b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent - - output[line++] += (a ? r : 0) * multiplier; - output[line++] += (a ? g : 0) * multiplier; - output[line++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[line++] += a * multiplier; - trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition += channelsNum; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); - - for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { - weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; - } - - outputOffset += channelsNum; - } while (outputOffset < this.targetWidthMultipliedByChannels); - - return outputBuffer; -}; - -Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { - var ratioWeight = this.ratioWeightHeightPass; - var ratioWeightDivisor = 1 / ratioWeight; - var output = this.outputHeightWorkBench; - var outputBuffer = this.heightBuffer; - var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var pixelOffset = 0; - var outputOffset = 0; - var caret = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - - if (fourthChannel) { - output[pixelOffset++] = 0; - trustworthyColorsCount[pixelOffset / 4 - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - caret = actualPosition; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - r = buffer[caret++]; - g = buffer[caret++]; - b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent - - output[pixelOffset++] += (a ? r : 0) * multiplier; - output[pixelOffset++] += (a ? g : 0) * multiplier; - output[pixelOffset++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[pixelOffset++] += a * multiplier; - trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition = caret; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.widthPassResultSize); - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - - if (fourthChannel) { - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); - } - } - } while (outputOffset < this.finalResultSize); - - return outputBuffer; -}; - -Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, true); -}; - -Resize.prototype.resizeWidthRGB = function (buffer) { - return this._resizeWidthRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthRGBA = function (buffer) { - return this._resizeWidthRGBChannels(buffer, true); -}; - -Resize.prototype.resizeHeightInterpolated = function (buffer) { - var ratioWeight = this.ratioWeightHeightPass; - var outputBuffer = this.heightBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var pixelOffsetAccumulated = 0; - var pixelOffsetAccumulated2 = 0; - var firstWeight = 0; - var secondWeight = 0; - var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: - - for (; weight < 1 / 3; weight += ratioWeight) { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - - for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; - pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); - } - } // Handle for only one interpolation input being valid for end calculation: - - - while (finalOffset < this.finalResultSize) { - for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); - } - } - - return outputBuffer; -}; - -Resize.prototype.resizeHeightRGB = function (buffer) { - return this._resizeHeightRGBChannels(buffer, false); -}; - -Resize.prototype.resizeHeightRGBA = function (buffer) { - return this._resizeHeightRGBChannels(buffer, true); -}; - -Resize.prototype.resize = function (buffer) { - this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); -}; - -Resize.prototype.bypassResizer = function (buffer) { - // Just return the buffer passed: - return buffer; -}; - -Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { - // Initialize the internal width pass buffers: - this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - - if (!BILINEARAlgo) { - this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); - } - } -}; - -Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { - // Initialize the internal height pass buffers: - this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - - if (!BILINEARAlgo) { - this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); - } - } -}; - -Resize.prototype.generateFloatBuffer = function (bufferLength) { - // Generate a float32 typed array buffer: - try { - return new Float32Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateFloat64Buffer = function (bufferLength) { - // Generate a float64 typed array buffer: - try { - return new Float64Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateUint8Buffer = function (bufferLength) { - // Generate a uint8 typed array buffer: - try { - return new Uint8Array(bufferLength); - } catch (error) { - return []; - } -}; - -module.exports = Resize; - -},{}],223:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -/** - * Copyright (c) 2015 Guyon Roche - * - * 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 = { - nearestNeighbor: function nearestNeighbor(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; - var iSrc = Math.floor(i * hSrc / hDst); - var jSrc = Math.floor(j * wSrc / wDst); - var posSrc = (iSrc * wSrc + jSrc) * 4; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - } - } - }, - bilinearInterpolation: function bilinearInterpolation(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) { - // special case - k is integer - if (kMin === kMax) { - return vMin; - } - - return Math.round((k - kMin) * vMax + (kMax - k) * vMin); - }; - - var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) { - var posMin = (yMin * wSrc + xMin) * 4 + offset; - var posMax = (yMin * wSrc + xMax) * 4 + offset; - var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer - - if (yMax === yMin) { - bufDst[pos + offset] = vMin; - } else { - posMin = (yMax * wSrc + xMin) * 4 + offset; - posMax = (yMax * wSrc + xMax) * 4 + offset; - var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); - } - }; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; // x & y in src coordinates - - var x = j * wSrc / wDst; - var xMin = Math.floor(x); - var xMax = Math.min(Math.ceil(x), wSrc - 1); - var y = i * hSrc / hDst; - var yMin = Math.floor(y); - var yMax = Math.min(Math.ceil(y), hSrc - 1); - assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 3, x, xMin, xMax, y, yMin, yMax); - } - } - }, - _interpolate2D: function _interpolate2D(src, dst, options, interpolate) { - var bufSrc = src.data; - var bufDst = dst.data; - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares - - var wM = Math.max(1, Math.floor(wSrc / wDst)); - var wDst2 = wDst * wM; - var hM = Math.max(1, Math.floor(hSrc / hDst)); - var hDst2 = hDst * hM; // =========================================================== - // Pass 1 - interpolate rows - // buf1 has width of dst2 and height of src - - var buf1 = Buffer.alloc(wDst2 * hSrc * 4); - - for (var i = 0; i < hSrc; i++) { - for (var j = 0; j < wDst2; j++) { - // i in src coords, j in dst coords - // calculate x in src coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (wSrc-1)/wDst2 - var x = j * (wSrc - 1) / wDst2; - var xPos = Math.floor(x); - var t = x - xPos; - var srcPos = (i * wSrc + xPos) * 4; - var buf1Pos = (i * wDst2 + j) * 4; - - for (var k = 0; k < 4; k++) { - var kPos = srcPos + k; - var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; - var x1 = bufSrc[kPos]; - var x2 = bufSrc[kPos + 4]; - var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; - buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); - } - } - } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); - // =========================================================== - // Pass 2 - interpolate columns - // buf2 has width and height of dst2 - - - var buf2 = Buffer.alloc(wDst2 * hDst2 * 4); - - for (var _i = 0; _i < hDst2; _i++) { - for (var _j = 0; _j < wDst2; _j++) { - // i&j in dst2 coords - // calculate y in buf1 coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (hSrc-1)/hDst2 - var y = _i * (hSrc - 1) / hDst2; - var yPos = Math.floor(y); - - var _t = y - yPos; - - var _buf1Pos = (yPos * wDst2 + _j) * 4; - - var buf2Pos = (_i * wDst2 + _j) * 4; - - for (var _k = 0; _k < 4; _k++) { - var _kPos = _buf1Pos + _k; - - var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4]; - var y1 = buf1[_kPos]; - var y2 = buf1[_kPos + wDst2 * 4]; - var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos]; - buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t); - } - } - } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); - // =========================================================== - // Pass 3 - scale to dst - - - var m = wM * hM; - - if (m > 1) { - for (var _i2 = 0; _i2 < hDst; _i2++) { - for (var _j2 = 0; _j2 < wDst; _j2++) { - // i&j in dst bounded coords - var r = 0; - var g = 0; - var b = 0; - var a = 0; - var realColors = 0; - - for (var _y = 0; _y < hM; _y++) { - var _yPos = _i2 * hM + _y; - - for (var _x = 0; _x < wM; _x++) { - var _xPos = _j2 * wM + _x; - - var xyPos = (_yPos * wDst2 + _xPos) * 4; - var pixelAlpha = buf2[xyPos + 3]; - - if (pixelAlpha) { - r += buf2[xyPos]; - g += buf2[xyPos + 1]; - b += buf2[xyPos + 2]; - realColors++; - } - - a += pixelAlpha; - } - } - - var pos = (_i2 * wDst + _j2) * 4; - bufDst[pos] = realColors ? Math.round(r / realColors) : 0; - bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; - bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; - bufDst[pos + 3] = Math.round(a / m); - } - } - } else { - // replace dst buffer with buf2 - dst.data = buf2; - } - }, - bicubicInterpolation: function bicubicInterpolation(src, dst, options) { - var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) { - var a0 = x3 - x2 - x0 + x1; - var a1 = x0 - x1 - a0; - var a2 = x2 - x0; - var a3 = x1; - return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)); - }; - - return this._interpolate2D(src, dst, options, interpolateCubic); - }, - hermiteInterpolation: function hermiteInterpolation(src, dst, options) { - var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) { - var c0 = x1; - var c1 = 0.5 * (x2 - x0); - var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; - var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); - return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))); - }; - - return this._interpolate2D(src, dst, options, interpolateHermite); - }, - bezierInterpolation: function bezierInterpolation(src, dst, options) { - // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) - // to predict control points (a & b) to be placed at n+0.5 - // ya(n) = y(n) + (y(n+1)-y(n-1))/4 - // yb(n) = y(n+1) - (y(n+2)-y(n))/4 - // then use std bezier to interpolate [n,n+1) - // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3 - // note the 3* factor for the two control points - // for edge cases, can choose: - // y(-1) = y(0) - 2*(y(1)-y(0)) - // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) - // but can go with y(-1) = y(0) and y(w) = y(w-1) - var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) { - // x1, x2 are the knots, use x0 and x3 to calculate control points - var cp1 = x1 + (x2 - x0) / 4; - var cp2 = x2 - (x3 - x1) / 4; - var nt = 1 - t; - var c0 = x1 * nt * nt * nt; - var c1 = 3 * cp1 * nt * nt * t; - var c2 = 3 * cp2 * nt * t * t; - var c3 = x2 * t * t * t; - return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); - }; - - return this._interpolate2D(src, dst, options, interpolateBezier); - } -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],224:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - */ -function advancedRotate(deg, mode) { - deg %= 360; - var rad = deg * Math.PI / 180; - var cosine = Math.cos(rad); - var sine = Math.sin(rad); // the final width and height will change if resize == true - - var w = this.bitmap.width; - var h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { - // resize the image to it maximum dimension and blit the existing image - // onto the center so that when it is rotated the image is kept in bounds - // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle - // Plus 1 border pixel to ensure to show all rotated result for some cases. - w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; - h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. - - if (w % 2 !== 0) { - w++; - } - - if (h % 2 !== 0) { - h++; - } - - var c = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); - this.resize(max, max, mode); - this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); - } - - var bW = this.bitmap.width; - var bH = this.bitmap.height; - var dstBuffer = Buffer.alloc(this.bitmap.data.length); - - function createTranslationFunction(deltaX, deltaY) { - return function (x, y) { - return { - x: x + deltaX, - y: y + deltaY - }; - }; - } - - var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); - - for (var y = 1; y <= bH; y++) { - for (var x = 1; x <= bW; x++) { - var cartesian = translate2Cartesian(x, y); - var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); - var dstIdx = bW * (y - 1) + x - 1 << 2; - - if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; - var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); - dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); - } else { - // reset off-image pixels - dstBuffer.writeUInt32BE(this._background, dstIdx); - } - } - } - - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { - // now crop the image to the final size - var _x = bW / 2 - w / 2; - - var _y = bH / 2 - h / 2; - - this.crop(_x, _y, w, h); - } -} - -var _default = function _default() { - return { - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate: function rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return _utils.throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return _utils.throwError.call(this, 'mode must be a boolean or a string', cb); - } - - advancedRotate.call(this, deg, mode, cb); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@jimp/utils":235,"buffer":48}],225:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale: function scale(f, mode, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return _utils.throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var w = this.bitmap.width * f; - var h = this.bitmap.height * f; - this.resize(w, h, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit: function scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - this.scale(f, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],226:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) - * opacity - opacity of the shadow between 0 and 1 - * size,- of the shadow - * blur - how blurry the shadow is - * x- x position of shadow - * y - y position of shadow - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - shadow: function shadow() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var _options = options, - _options$opacity = _options.opacity, - opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, - _options$size = _options.size, - size = _options$size === void 0 ? 1.1 : _options$size, - _options$x = _options.x, - x = _options$x === void 0 ? -25 : _options$x, - _options$y = _options.y, - y = _options$y === void 0 ? 25 : _options$y, - _options$blur = _options.blur, - blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image - - var orig = this.clone(); - var shadow = this.clone(); // turn all it's pixels black - - shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, - - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); - _this.bitmap.data[idx] = 0x00; - _this.bitmap.data[idx + 1] = 0x00; - _this.bitmap.data[idx + 2] = 0x00; - _this.bitmap.data[idx + 3] = 0x00; - }); // enlarge it. This creates a "shadow". - - shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. - - this.composite(shadow, x, y); - this.composite(orig, 0, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],227:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default - * @param {number} options object - * max: A number auto limited between 0 - 255 - * replace: (optional) A number auto limited between 0 - 255 (default 255) - * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) - * @param {number} cb (optional) a callback for when complete - * @return {this} this for chaining of methods - */ -var _default = function _default() { - return { - threshold: function threshold(_ref, cb) { - var _this = this; - - var max = _ref.max, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? 255 : _ref$replace, - _ref$autoGreyscale = _ref.autoGreyscale, - autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; - - if (typeof max !== 'number') { - return _utils.throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return _utils.throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; - _this.bitmap.data[idx] = grey; - _this.bitmap.data[idx + 1] = grey; - _this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],228:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _timm = require("timm"); - -var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit")); - -var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur")); - -var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle")); - -var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color")); - -var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain")); - -var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover")); - -var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop")); - -var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace")); - -var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither")); - -var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye")); - -var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip")); - -var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian")); - -var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert")); - -var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask")); - -var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize")); - -var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print")); - -var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize")); - -var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate")); - -var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale")); - -var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow")); - -var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold")); - -var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]]; - -var _default = function _default(jimpEvChange) { - var initializedPlugins = plugins.map(function (pluginModule) { - var plugin = pluginModule(jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { - // Default to class function - plugin = { - "class": plugin - }; - } - - return plugin; - }); - return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins)); -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/plugin-blit":201,"@jimp/plugin-blur":203,"@jimp/plugin-circle":204,"@jimp/plugin-color":205,"@jimp/plugin-contain":206,"@jimp/plugin-cover":207,"@jimp/plugin-crop":208,"@jimp/plugin-displace":209,"@jimp/plugin-dither":210,"@jimp/plugin-fisheye":211,"@jimp/plugin-flip":212,"@jimp/plugin-gaussian":213,"@jimp/plugin-invert":214,"@jimp/plugin-mask":215,"@jimp/plugin-normalize":216,"@jimp/plugin-print":217,"@jimp/plugin-resize":221,"@jimp/plugin-rotate":224,"@jimp/plugin-scale":225,"@jimp/plugin-shadow":226,"@jimp/plugin-threshold":227,"timm":177}],229:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _bmpJs = _interopRequireDefault(require("bmp-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/bmp'; -var MIME_TYPE_SECOND = 'image/x-ms-bmp'; - -function toAGBR(image) { - return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { - var red = this.bitmap.data[index + 0]; - var green = this.bitmap.data[index + 1]; - var blue = this.bitmap.data[index + 2]; - var alpha = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = alpha; - this.bitmap.data[index + 1] = blue; - this.bitmap.data[index + 2] = green; - this.bitmap.data[index + 3] = red; - }).bitmap; -} - -function fromAGBR(bitmap) { - return (0, _utils.scan)({ - bitmap: bitmap - }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { - var alpha = this.bitmap.data[index + 0]; - var blue = this.bitmap.data[index + 1]; - var green = this.bitmap.data[index + 2]; - var red = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = red; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; - }).bitmap; -} - -var decode = function decode(data) { - return fromAGBR(_bmpJs["default"].decode(data)); -}; - -var encode = function encode(image) { - return _bmpJs["default"].encode(toAGBR(image)).data; -}; - -var _default = function _default() { - var _decoders, _encoders; - - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']), - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), - encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"bmp-js":30}],230:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _omggif = _interopRequireDefault(require("omggif")); - -var _gifwrap = require("gifwrap"); - -var MIME_TYPE = 'image/gif'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']), - constants: { - MIME_GIF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var gifObj = new _omggif["default"].GifReader(data); - var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); - gifObj.decodeAndBlitFrameRGBA(0, gifData); - return { - data: gifData, - width: gifObj.width, - height: gifObj.height - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var bitmap = new _gifwrap.BitmapImage(data.bitmap); - - _gifwrap.GifUtil.quantizeDekker(bitmap, 256); - - var newFrame = new _gifwrap.GifFrame(bitmap); - var gifCodec = new _gifwrap.GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { - return newGif.buffer; - }); - }) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"buffer":48,"gifwrap":70,"omggif":85}],231:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _jpegJs = _interopRequireDefault(require("jpeg-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/jpeg'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']), - constants: { - MIME_JPEG: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - return _jpegJs["default"].encode(image.bitmap, image._quality).data; - }), - "class": { - // The quality to be used when saving JPEG images - _quality: 100, - - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality: function quality(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return _utils.throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"jpeg-js":80}],232:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _pngjs = require("pngjs"); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/png'; // PNG filter types - -var PNG_FILTER_AUTO = -1; -var PNG_FILTER_NONE = 0; -var PNG_FILTER_SUB = 1; -var PNG_FILTER_UP = 2; -var PNG_FILTER_AVERAGE = 3; -var PNG_FILTER_PATH = 4; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']), - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO: PNG_FILTER_AUTO, - PNG_FILTER_NONE: PNG_FILTER_NONE, - PNG_FILTER_SUB: PNG_FILTER_SUB, - PNG_FILTER_UP: PNG_FILTER_UP, - PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, - PNG_FILTER_PATH: PNG_FILTER_PATH - }, - hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var png = new _pngjs.PNG({ - width: data.bitmap.width, - height: data.bitmap.height - }); - png.data = data.bitmap.data; - return _pngjs.PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, - deflateLevel: data._deflateLevel, - deflateStrategy: data._deflateStrategy, - filterType: data._filterType, - colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2, - inputHasAlpha: data._rgba - }); - }), - "class": { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel: function deflateLevel(l, cb) { - if (typeof l !== 'number') { - return _utils.throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return _utils.throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy: function deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return _utils.throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType: function filterType(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb); - } - - this._filterType = Math.round(f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - colorType: function colorType(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"pngjs":129}],233:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _utif = _interopRequireDefault(require("utif")); - -var MIME_TYPE = 'image/tiff'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']), - constants: { - MIME_TIFF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var ifds = _utif["default"].decode(data); - - var page = ifds[0]; - - _utif["default"].decodeImages(data, ifds); - - var rgba = _utif["default"].toRGBA8(page); - - return { - data: Buffer.from(rgba), - width: page.t256[0], - height: page.t257[0] - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); - - return Buffer.from(tiff); - }) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"buffer":48,"utif":182}],234:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _timm = require("timm"); - -var _jpeg = _interopRequireDefault(require("@jimp/jpeg")); - -var _png = _interopRequireDefault(require("@jimp/png")); - -var _bmp = _interopRequireDefault(require("@jimp/bmp")); - -var _tiff = _interopRequireDefault(require("@jimp/tiff")); - -var _gif = _interopRequireDefault(require("@jimp/gif")); - -var _default = function _default() { - return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])()); -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/bmp":229,"@jimp/gif":230,"@jimp/jpeg":231,"@jimp/png":232,"@jimp/tiff":233,"timm":177}],235:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNodePattern = isNodePattern; -exports.throwError = throwError; -exports.scan = scan; -exports.scanIterator = scanIterator; - -var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); - -var _marked = -/*#__PURE__*/ -_regenerator["default"].mark(scanIterator); - -function isNodePattern(cb) { - if (typeof cb === 'undefined') { - return false; - } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); - } - - return true; -} - -function throwError(error, cb) { - if (typeof error === 'string') { - error = new Error(error); - } - - if (typeof cb === 'function') { - return cb.call(this, error); - } - - throw error; -} - -function scan(image, x, y, w, h, f) { - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - for (var _y = y; _y < y + h; _y++) { - for (var _x = x; _x < x + w; _x++) { - var idx = image.bitmap.width * _y + _x << 2; - f.call(image, _x, _y, idx); - } - } - - return image; -} - -function scanIterator(image, x, y, w, h) { - var _y, _x, idx; - - return _regenerator["default"].wrap(function scanIterator$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - _y = y; - - case 5: - if (!(_y < y + h)) { - _context.next = 17; - break; - } - - _x = x; - - case 7: - if (!(_x < x + w)) { - _context.next = 14; - break; - } - - idx = image.bitmap.width * _y + _x << 2; - _context.next = 11; - return { - x: _x, - y: _y, - idx: idx, - image: image - }; - - case 11: - _x++; - _context.next = 7; - break; - - case 14: - _y++; - _context.next = 5; - break; - - case 17: - case "end": - return _context.stop(); - } - } - }, _marked); -} - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/regenerator":22}]},{},[200])(200) -}); diff --git a/project starter code/node_modules/jimp/browser/lib/jimp.min.js b/project starter code/node_modules/jimp/browser/lib/jimp.min.js deleted file mode 100644 index 4dfdd1e2..00000000 --- a/project starter code/node_modules/jimp/browser/lib/jimp.min.js +++ /dev/null @@ -1,27 +0,0 @@ -/* -Jimp v0.16.1 -https://github.com/oliver-moran/jimp -Ported for the Web by Phil Seaton -MIT License - -Copyright (c) 2018 Oliver Moran - -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. -*/ -undefined \ No newline at end of file diff --git a/project starter code/node_modules/jimp/dist/index.js.map b/project starter code/node_modules/jimp/dist/index.js.map deleted file mode 100644 index 4a23c7a9..00000000 --- a/project starter code/node_modules/jimp/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["types","plugins"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe,wBAAU;AACvBA,EAAAA,KAAK,EAAE,CAACA,iBAAD,CADgB;AAEvBC,EAAAA,OAAO,EAAE,CAACA,mBAAD;AAFc,CAAV,C","sourcesContent":["import configure from '@jimp/custom';\n\nimport types from '@jimp/types';\nimport plugins from '@jimp/plugins';\n\nexport default configure({\n types: [types],\n plugins: [plugins]\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/jimp/es/index.js b/project starter code/node_modules/jimp/es/index.js deleted file mode 100644 index 62e78be0..00000000 --- a/project starter code/node_modules/jimp/es/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _custom = _interopRequireDefault(require("@jimp/custom")); - -var _types = _interopRequireDefault(require("@jimp/types")); - -var _plugins = _interopRequireDefault(require("@jimp/plugins")); - -var _default = (0, _custom["default"])({ - types: [_types["default"]], - plugins: [_plugins["default"]] -}); - -exports["default"] = _default; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/jimp/es/index.js.map b/project starter code/node_modules/jimp/es/index.js.map deleted file mode 100644 index 4a23c7a9..00000000 --- a/project starter code/node_modules/jimp/es/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/index.js"],"names":["types","plugins"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe,wBAAU;AACvBA,EAAAA,KAAK,EAAE,CAACA,iBAAD,CADgB;AAEvBC,EAAAA,OAAO,EAAE,CAACA,mBAAD;AAFc,CAAV,C","sourcesContent":["import configure from '@jimp/custom';\n\nimport types from '@jimp/types';\nimport plugins from '@jimp/plugins';\n\nexport default configure({\n types: [types],\n plugins: [plugins]\n});\n"],"file":"index.js"} \ No newline at end of file diff --git a/project starter code/node_modules/jimp/package.json b/project starter code/node_modules/jimp/package.json deleted file mode 100644 index de08b048..00000000 --- a/project starter code/node_modules/jimp/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "jimp", - "version": "0.16.2", - "description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies)", - "main": "dist/index.js", - "module": "es/index.js", - "types": "types/index.d.ts", - "typesVersions": { - ">=3.1.0-0": { - "*": [ - "types/ts3.1/index.d.ts" - ] - } - }, - "tonicExampleFilename": "example.js", - "files": [ - "browser", - "dist", - "es", - "index.d.ts", - "fonts", - "types" - ], - "repository": { - "type": "git", - "url": "https://github.com/oliver-moran/jimp.git" - }, - "bugs": { - "url": "https://github.com/oliver-moran/jimp/issues" - }, - "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", - "test:watch": "npm run test -- --reporter min --watch", - "test:coverage": "nyc npm run test", - "browser-build": "node tools/browser-build.js test", - "build": "npm run build:browser && npm run build:node:production && npm run build:module", - "build:watch": "npm run build:node:debug -- -- --watch --verbose", - "build:debug": "npm run build:browser:debug && npm run build:node:debug", - "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", - "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", - "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", - "build:node:production": "cross-env BABEL_ENV=production npm run build:node", - "build:browser": "cross-env BABEL_ENV=production node tools/browser-build.js prepublish", - "build:browser:debug": "cross-env BABEL_ENV=development ENV=browser node tools/browser-build.js prepublish" - }, - "keywords": [ - "image", - "image processing", - "image manipulation", - "png", - "jpg", - "jpeg", - "bmp", - "resize", - "scale", - "crop" - ], - "author": "Oliver Moran ", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", - "regenerator-runtime": "^0.13.3" - }, - "devDependencies": { - "@babel/cli": "^7.7.0", - "@babel/core": "^7.7.2", - "@babel/plugin-proposal-class-properties": "^7.7.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/preset-env": "^7.7.1", - "@babel/register": "^7.7.0", - "@jimp/test-utils": "^0.16.2", - "babel-eslint": "^10.0.3", - "babel-plugin-add-module-exports": "^1.0.2", - "babel-plugin-istanbul": "^5.2.0", - "babel-plugin-source-map-support": "^2.1.1", - "babelify": "^10.0.0", - "browserify": "^16.5.0", - "cross-env": "^6.0.0", - "dtslint": "^0.9.8", - "envify": "^4.1.0", - "eslint": "^6.4.0", - "eslint-plugin-prettier": "^3.1.1", - "express": "^4.17.1", - "husky": "^3.0.5", - "karma": "^4.3.0", - "karma-browserify": "^6.1.0", - "karma-chrome-launcher": "^3.1.0", - "karma-firefox-launcher": "^1.2.0", - "lerna": "^3.16.4", - "lerna-changelog": "^0.8.2", - "lint-staged": "^9.2.5", - "mocha": "^6.2.0", - "nyc": "^14.1.1", - "prettier": "^1.18.2", - "source-map-support": "^0.5.13", - "tfilter": "^1.0.1", - "uglify-js": "^3.6.0", - "watchify": "^3.11.1", - "xo": "^0.24.0" - }, - "xo": false, - "nyc": { - "sourceMap": false, - "instrument": false, - "reporter": [ - "text", - "text-summary", - "lcov", - "html" - ], - "exclude": [ - "src/modules/*.js", - "test/*.js" - ] - }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" -} diff --git a/project starter code/node_modules/jimp/types/index.d.ts b/project starter code/node_modules/jimp/types/index.d.ts deleted file mode 100644 index 88687bdf..00000000 --- a/project starter code/node_modules/jimp/types/index.d.ts +++ /dev/null @@ -1,600 +0,0 @@ -// TypeScript Version: 2.8 - - -declare const DepreciatedJimp: DepreciatedJimp; - -export = DepreciatedJimp; - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface DepreciatedJimp { - // Constructors - new(path: string, cb?: ImageCallback): this; - new(urlOptions: URLOptions, cb?: ImageCallback): this; - new(image: DepreciatedJimp, cb?: ImageCallback): this; - new(data: Buffer | Bitmap, cb?: ImageCallback): this; - new(w: number, h: number, cb?: ImageCallback): this; - new( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): this; - // For custom constructors when using Jimp.appendConstructorOption - new(...args: any[]): this; - prototype: this; - - // Constants - AUTO: -1; - - // supported mime types - MIME_PNG: 'image/png'; - MIME_TIFF: 'image/tiff'; - MIME_JPEG: 'image/jpeg'; - MIME_JGD: 'image/jgd'; - MIME_BMP: 'image/bmp'; - MIME_X_MS_BMP: 'image/x-ms-bmp'; - MIME_GIF: 'image/gif'; - // PNG filter types - PNG_FILTER_AUTO: -1; - PNG_FILTER_NONE: 0; - PNG_FILTER_SUB: 1; - PNG_FILTER_UP: 2; - PNG_FILTER_AVERAGE: 3; - PNG_FILTER_PATH: 4; - - // resize methods - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor'; - RESIZE_BILINEAR: 'bilinearInterpolation'; - RESIZE_BICUBIC: 'bicubicInterpolation'; - RESIZE_HERMITE: 'hermiteInterpolation'; - RESIZE_BEZIER: 'bezierInterpolation'; - - // blend modes - BLEND_SOURCE_OVER: string; - BLEND_DESTINATION_OVER: string; - BLEND_MULTIPLY: string; - BLEND_SCREEN: string; - BLEND_OVERLAY: string; - BLEND_DARKEN: string; - BLEND_LIGHTEN: string; - BLEND_HARDLIGHT: string; - BLEND_DIFFERENCE: string; - BLEND_EXCLUSION: string; - - // Align modes for cover, contain, bit masks - HORIZONTAL_ALIGN_LEFT: 1; - HORIZONTAL_ALIGN_CENTER: 2; - HORIZONTAL_ALIGN_RIGHT: 4; - - VERTICAL_ALIGN_TOP: 8; - VERTICAL_ALIGN_MIDDLE: 16; - VERTICAL_ALIGN_BOTTOM: 32; - - // Font locations - FONT_SANS_8_BLACK: string; - FONT_SANS_10_BLACK: string; - FONT_SANS_12_BLACK: string; - FONT_SANS_14_BLACK: string; - FONT_SANS_16_BLACK: string; - FONT_SANS_32_BLACK: string; - FONT_SANS_64_BLACK: string; - FONT_SANS_128_BLACK: string; - - FONT_SANS_8_WHITE: string; - FONT_SANS_16_WHITE: string; - FONT_SANS_32_WHITE: string; - FONT_SANS_64_WHITE: string; - FONT_SANS_128_WHITE: string; - - // Edge Handling - EDGE_EXTEND: 1; - EDGE_WRAP: 2; - EDGE_CROP: 3; - - // Properties - bitmap: Bitmap; - - _quality: number; - _deflateLevel: number; - _deflateStrategy: number; - _filterType: number; - _rgba: boolean; - _background: number; - _originalMime: string; - - // Methods - on( - event: T, - cb: (data: ListenerData) => any - ): any; - parseBitmap( - data: Buffer, - path: string | null | undefined, - cb?: ImageCallback - ): void; - hasAlpha(): boolean; - getHeight(): number; - getWidth(): number; - inspect(): string; - toString(): string; - getMIME(): string; - getExtension(): string; - distanceFromHash(hash: string): number; - write(path: string, cb?: ImageCallback): this; - writeAsync(path: string): Promise; - deflateLevel(l: number, cb?: ImageCallback): this; - deflateStrategy(s: number, cb?: ImageCallback): this; - colorType(s: number, cb?: ImageCallback): this; - filterType(f: number, cb?: ImageCallback): this; - rgba(bool: boolean, cb?: ImageCallback): this; - quality(n: number, cb?: ImageCallback): this; - getBase64(mime: string, cb: GenericCallback): this; - getBase64Async(mime: string): Promise; - hash(cb?: GenericCallback): string; - hash( - base: number | null | undefined, - cb?: GenericCallback - ): string; - getBuffer(mime: string, cb: GenericCallback): this; - getBufferAsync(mime: string): Promise; - getPixelIndex( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelIndex( - x: number, - y: number, - edgeHandling: string, - cb?: GenericCallback - ): number; - getPixelColor( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelColour( - x: number, - y: number, - cb?: GenericCallback - ): number; - setPixelColor(hex: number, x: number, y: number, cb?: ImageCallback): this; - setPixelColour(hex: number, x: number, y: number, cb?: ImageCallback): this; - clone(cb?: ImageCallback): this; - cloneQuiet(cb?: ImageCallback): this; - background(hex: number, cb?: ImageCallback): this; - backgroundQuiet(hex: number, cb?: ImageCallback): this; - scan( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanQuiet( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanIterator( - x: number, - y: number, - w: number, - h: number - ): IterableIterator<{ x: number; y: number; idx: number; image: DepreciatedJimp }>; - crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this; - cropQuiet( - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - - // Color methods - brightness(val: number, cb?: ImageCallback): this; - contrast(val: number, cb?: ImageCallback): this; - posterize(n: number, cb?: ImageCallback): this; - greyscale(cb?: ImageCallback): this; - grayscale(cb?: ImageCallback): this; - opacity(f: number, cb?: ImageCallback): this; - sepia(cb?: ImageCallback): this; - fade(f: number, cb?: ImageCallback): this; - convolution(kernel: number[][], cb?: ImageCallback): this; - convolution( - kernel: number[][], - edgeHandling: string, - cb?: ImageCallback - ): this; - opaque(cb?: ImageCallback): this; - pixelate(size: number, cb?: ImageCallback): this; - pixelate( - size: number, - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - convolute(kernel: number[][], cb?: ImageCallback): this; - convolute( - kernel: number[][], - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - color(actions: ColorAction[], cb?: ImageCallback): this; - colour(actions: ColorAction[], cb?: ImageCallback): this; - - // Shape methods - rotate(deg: number, cb?: ImageCallback): this; - rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; - flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - resize(w: number, h: number, cb?: ImageCallback): this; - resize(w: number, h: number, mode?: string, cb?: ImageCallback): this; - cover(w: number, h: number, cb?: ImageCallback): this; - cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - cover( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; - contain(w: number, h: number, cb?: ImageCallback): this; - contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; - contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - contain( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; - scale(f: number, cb?: ImageCallback): this; - scale(f: number, mode?: string, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; - displace(map: DepreciatedJimp, offset: number, cb?: ImageCallback): this; - autocrop(tolerance?: number, cb?: ImageCallback): this; - autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): this; - autocrop( - tolerance?: number, - cropOnlyFrames?: boolean, - cb?: ImageCallback - ): this; - autocrop( - options: { - tolerance?: number; - cropOnlyFrames?: boolean; - cropSymmetric?: boolean; - leaveBorder?: number; - }, - cb?: ImageCallback - ): this; - - // Text methods - print( - font: Font, - x: number, - y: number, - text: PrintableText, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - maxHeight?: number, - cb?: ImageCallback - ): this; - - // Effect methods - blur(r: number, cb?: ImageCallback): this; - dither565(cb?: ImageCallback): this; - dither16(cb?: ImageCallback): this; - histogram(): { - r: number[]; - g: number[]; - b: number[]; - }; - normalize(cb?: ImageCallback): this; - invert(cb?: ImageCallback): this; - gaussian(r: number, cb?: ImageCallback): this; - composite( - src: DepreciatedJimp, - x: number, - y: number, - options?: BlendMode, - cb?: ImageCallback - ): this; - blit(src: DepreciatedJimp, x: number, y: number, cb?: ImageCallback): this; - blit( - src: DepreciatedJimp, - x: number, - y: number, - srcx: number, - srcy: number, - srcw: number, - srch: number, - cb?: ImageCallback - ): this; - mask(src: this, x: number, y: number, cb?: ImageCallback): this; - - // Functions - /** - * I'd like to make `Args` generic and used in `run` and `test` but alas, - * it's not possible RN: - * https://github.com/microsoft/TypeScript/issues/26113 - */ - appendConstructorOption( - name: string, - test: (...args: any[]) => boolean, - run: ( - this: this, - resolve: (jimp?: this) => any, - reject: (reason: Error) => any, - ...args: any[] - ) => any - ): void; - read(path: string, cb?: ImageCallback): Promise; - read(image: this, cb?: ImageCallback): Promise; - read(data: Buffer, cb?: ImageCallback): Promise; - read( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): Promise; create(path: string): Promise; - create(image: this): Promise; - create(data: Buffer): Promise; - create(w: number, h: number, background?: number | string): Promise; - rgbaToInt( - r: number, - g: number, - b: number, - a: number, - cb: GenericCallback - ): number; - intToRGBA(i: number, cb?: GenericCallback): RGBA; - cssColorToHex(cssColor: string): number; - limit255(n: number): number; - diff( - img1: this, - img2: this, - threshold?: number - ): { - percent: number; - image: DepreciatedJimp; - }; - distance(img1: this, img2: this): number; - compareHashes(hash1: string, hash2: string): number; - colorDiff(rgba1: RGB, rgba2: RGB): number; - colorDiff(rgba1: RGBA, rgba2: RGBA): number; - loadFont(file: string): Promise; - loadFont(file: string, cb: GenericCallback): Promise; - measureText(font: Font, text: PrintableText): number; - measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; - circle( - options?: { - radius: number; - x: number; - y: number; - }, - cb?: ImageCallback - ): this; - circle(cb?: ImageCallback): this; - fishEye(opts?: { r: number }, cb?: ImageCallback): this; - fishEye(cb?: ImageCallback): this; - shadow( - options?: { - size?: number; - opacity?: number; - x?: number; - y?: number; - }, - cb?: ImageCallback - ): this; - shadow(cb?: ImageCallback): this; - threshold( - opts: { - max: number; - replace?: number; - autoGreyscale?: boolean; - }, - cb?: ImageCallback - ): this; -} - -type GenericCallback = ( - this: TThis, - err: Error | null, - value: T -) => U; - -type ImageCallback = ( - this: DepreciatedJimp, - err: Error | null, - value: DepreciatedJimp, - coords: { - x: number; - y: number; - } -) => U; - -type ColorActionName = - | 'mix' - | 'tint' - | 'shade' - | 'xor' - | 'red' - | 'green' - | 'blue' - | 'hue'; - -type ColorAction = { - apply: ColorActionName; - params: any; -}; - -type BlendMode = { - mode: string; - opacitySource: number; - opacityDest: number; -}; - -type ChangeName = 'background' | 'scan' | 'crop'; - -type ListenableName = - | 'any' - | 'initialized' - | 'before-change' - | 'changed' - | 'before-clone' - | 'cloned' - | ChangeName; - -type ListenerData = T extends 'any' - ? any - : T extends ChangeName - ? { - eventName: 'before-change' | 'changed'; - methodName: T; - [key: string]: any; - } - : { - eventName: T; - methodName: T extends 'initialized' - ? 'constructor' - : T extends 'before-change' | 'changed' - ? ChangeName - : T extends 'before-clone' | 'cloned' ? 'clone' : any; - }; - -type PrintableText = - | any - | { - text: string; - alignmentX: number; - alignmentY: number; -}; - -type URLOptions = { - url: string; - compression?: boolean; - headers: { - [key: string]: any; - }; -}; - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface Bitmap { - data: Buffer; - width: number; - height: number; -} -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface RGB { - r: number; - g: number; - b: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface RGBA { - r: number; - g: number; - b: number; - a: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface FontChar { - id: number; - x: number; - y: number; - width: number; - height: number; - xoffset: number; - yoffset: number; - xadvance: number; - page: number; - chnl: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface FontInfo { - face: string; - size: number; - bold: number; - italic: number; - charset: string; - unicode: number; - stretchH: number; - smooth: number; - aa: number; - padding: [number, number, number, number]; - spacing: [number, number]; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface FontCommon { - lineHeight: number; - base: number; - scaleW: number; - scaleH: number; - pages: number; - packed: number; - alphaChnl: number; - redChnl: number; - greenChnl: number; - blueChnl: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface Font { - chars: { - [char: string]: FontChar; - }; - kernings: { - [firstString: string]: { - [secondString: string]: number; - }; - }; - pages: string[]; - common: FontCommon; - info: FontInfo; -} diff --git a/project starter code/node_modules/jimp/types/test.ts b/project starter code/node_modules/jimp/types/test.ts deleted file mode 100644 index 6287d9c0..00000000 --- a/project starter code/node_modules/jimp/types/test.ts +++ /dev/null @@ -1,102 +0,0 @@ -import * as Jimp from 'jimp'; - -const jimpInst: Jimp = new Jimp('test'); - -// Main Jimp export should already have all of these already applied -jimpInst.read('Test'); -jimpInst.displace(jimpInst, 2); -jimpInst.resize(40, 40); -// $ExpectType 0 -jimpInst.PNG_FILTER_NONE; - -// $ExpectError -jimpInst.test; - -// $ExpectError -jimpInst.func(); - -// Main Jimp export should already have all of these already applied -Jimp.read('Test'); -Jimp.displace(Jimp, 2); -Jimp.shadow((err, val, coords) => {}); -Jimp.resize(40, 40); -// $ExpectType 0 -Jimp.PNG_FILTER_NONE; - -// $ExpectError -Jimp.test; - -// $ExpectError -Jimp.func(); - -test('can clone properly', async () => { - const baseImage = await Jimp.read('filename'); - const cloneBaseImage = baseImage.clone(); - - // $ExpectType -1 - cloneBaseImage.PNG_FILTER_AUTO; - - test('can handle `this` returns on the core type properly', () => { - // $ExpectType -1 - cloneBaseImage.diff(jimpInst, jimpInst).image.PNG_FILTER_AUTO - }); - - test('can handle `this` returns properly', () => { - cloneBaseImage - .resize(1, 1) - .crop(0, 0, 0, 0) - .mask(cloneBaseImage, 2, 2) - .print('a' as any, 2, 2, 'a' as any) - .resize(1, 1) - .quality(1) - .deflateLevel(2) - .PNG_FILTER_AUTO; - }); - - test('can handle imageCallbacks `this` properly', () => { - cloneBaseImage.rgba(false, (_, jimpCBIn) => { - jimpCBIn.read('Test'); - jimpCBIn.displace(jimpInst, 2); - jimpCBIn.resize(40, 40); - // $ExpectType 0 - jimpCBIn.PNG_FILTER_NONE; - - // $ExpectError - jimpCBIn.test; - - // $ExpectError - jimpCBIn.func(); - }) - }) -}); - -test('Can handle callback with constructor', () => { - const myBmpBuffer: Buffer = {} as any; - - Jimp.read(myBmpBuffer, (err, cbJimpInst) => { - cbJimpInst.read('Test'); - cbJimpInst.displace(jimpInst, 2); - cbJimpInst.resize(40, 40); - // $ExpectType 0 - cbJimpInst.PNG_FILTER_NONE; - - // $ExpectError - cbJimpInst.test; - - // $ExpectError - cbJimpInst.func(); - }); -}) - -test('Can handle appendConstructorOption', () => { - Jimp.appendConstructorOption( - 'Name of Option', - args => args.hasSomeCustomThing, - function(resolve, reject, args) { - // $ExpectError - this.bitmap = 3; - Jimp.resize(2, 2); - resolve(); - } - ); -}); diff --git a/project starter code/node_modules/jimp/types/ts3.1/index.d.ts b/project starter code/node_modules/jimp/types/ts3.1/index.d.ts deleted file mode 100644 index 08877f8b..00000000 --- a/project starter code/node_modules/jimp/types/ts3.1/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * While there is nothing in these typings that prevent it from running in TS 2.8 even, - * due to the complexity of the typings anything lower than TS 3.1 will only see - * Jimp as `any`. In order to test the strict versions of these types in our typing - * test suite, the version has been bumped to 3.1 - */ - -import { - Jimp as JimpType, - Bitmap, - RGB, - RGBA, - UnionToIntersection, - GetPluginVal, - GetPluginConst, - GetPluginEncoders, - GetPluginDecoders, - JimpConstructors -} from '@jimp/core'; -import typeFn from '@jimp/types'; -import pluginFn from '@jimp/plugins'; - -type Types = ReturnType; -type Plugins = ReturnType; - -type IntersectedPluginTypes = UnionToIntersection< - GetPluginVal | GetPluginVal ->; - -type IntersectedPluginConsts = UnionToIntersection< - GetPluginConst | GetPluginConst ->; - -type IntersectedPluginEncoders = UnionToIntersection< - GetPluginEncoders | GetPluginEncoders ->; - -type IntersectedPluginDecoders = UnionToIntersection< - GetPluginDecoders | GetPluginDecoders ->; - -type Jimp = JimpType & IntersectedPluginTypes; - -declare const Jimp: JimpConstructors & IntersectedPluginConsts & { - prototype: Jimp; - encoders: IntersectedPluginEncoders; - decoders: IntersectedPluginDecoders; -}; - -export = Jimp; diff --git a/project starter code/node_modules/jimp/types/ts3.1/test.ts b/project starter code/node_modules/jimp/types/ts3.1/test.ts deleted file mode 100644 index ae64a487..00000000 --- a/project starter code/node_modules/jimp/types/ts3.1/test.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as Jimp from 'jimp'; - -const jimpInst: Jimp = new Jimp('test'); - -// Main Jimp export should already have all of these already applied -// $ExpectError -jimpInst.read('Test'); -jimpInst.displace(jimpInst, 2); -jimpInst.resize(40, 40); -jimpInst.displace(jimpInst, 2); -jimpInst.shadow((err, val, coords) => {}); -jimpInst.fishEye({r: 12}); -jimpInst.circle({radius: 12, x: 12, y: 12}); -// $ExpectError -jimpInst.PNG_FILTER_NONE; - -// $ExpectError -jimpInst.test; - -// $ExpectError -jimpInst.func(); - -// Main Jimp export should already have all of these already applied -Jimp.read('Test'); - -// $ExpectType 0 -Jimp.PNG_FILTER_NONE; - -// $ExpectError -Jimp.test; - -// $ExpectError -Jimp.func(); - -test('can clone properly', async () => { - const baseImage = await Jimp.read('filename'); - const cloneBaseImage = baseImage.clone(); - - // $ExpectType number - cloneBaseImage._deflateLevel; - - test('can handle `this` returns on the core type properly', () => { - // $ExpectType number - cloneBaseImage.posterize(3)._quality - }); - - test('can handle `this` returns properly', () => { - cloneBaseImage - .resize(1, 1) - .crop(0, 0, 0, 0) - .mask(cloneBaseImage, 2, 2) - .print('a' as any, 2, 2, 'a' as any) - .resize(1, 1) - .quality(1) - .deflateLevel(2) - ._filterType; - }); - - test('can handle imageCallbacks `this` properly', () => { - cloneBaseImage.rgba(false, (_, jimpCBIn) => { - // $ExpectError - jimpCBIn.read('Test'); - jimpCBIn.displace(jimpInst, 2); - jimpCBIn.resize(40, 40); - // $ExpectType number - jimpCBIn._filterType; - - // $ExpectError - jimpCBIn.test; - - // $ExpectError - jimpCBIn.func(); - }) - }) -}); - -test('Can handle callback with constructor', () => { - const myBmpBuffer: Buffer = {} as any; - - Jimp.read(myBmpBuffer, (err, cbJimpInst) => { - // $ExpectError - cbJimpInst.read('Test'); - cbJimpInst.displace(jimpInst, 2); - cbJimpInst.resize(40, 40); - // $ExpectType number - cbJimpInst._filterType; - - // $ExpectError - cbJimpInst.test; - - // $ExpectError - cbJimpInst.func(); - }); -}); diff --git a/project starter code/node_modules/minimist/.eslintrc b/project starter code/node_modules/minimist/.eslintrc deleted file mode 100644 index 137f67b4..00000000 --- a/project starter code/node_modules/minimist/.eslintrc +++ /dev/null @@ -1,54 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb/eslint-config/node/0.4", - - "rules": { - "array-bracket-spacing": 0, - "array-element-newline": 0, - "brace-style": 1, - "camelcase": 1, - "comma-dangle": 1, - "comma-spacing": 1, - "complexity": 0, - "curly": 1, - "dot-notation": 1, - "eol-last": 1, - "func-style": 1, - "function-paren-newline": 1, - "indent": [1, 4], - "key-spacing": 1, - "max-lines-per-function": 0, - "max-nested-callbacks": 1, - "max-statements": 0, - "multiline-comment-style": 1, - "no-array-constructor": 1, - "no-continue": 1, - "no-div-regex": 1, - "no-extra-parens": 1, - "no-mixed-operators": 1, - "no-multi-spaces": 1, - "no-multiple-empty-lines": 1, - "no-param-reassign": 1, - "no-plusplus": 1, - "no-proto": 1, - "no-redeclare": 1, - "no-restricted-syntax": 1, - "no-shadow": 1, - "no-trailing-spaces": 1, - "no-unused-vars": 1, - "no-use-before-define": 1, - "object-curly-newline": 1, - "object-curly-spacing": 1, - "operator-linebreak": 1, - "quote-props": 1, - "quotes": 1, - "semi-style": 1, - "semi": 1, - "space-before-blocks": 1, - "space-before-function-paren": 1, - "space-infix-ops": 1, - "strict": 1, - "wrap-regex": 1, - }, -} diff --git a/project starter code/node_modules/minimist/CHANGELOG.md b/project starter code/node_modules/minimist/CHANGELOG.md deleted file mode 100644 index e0e00bd0..00000000 --- a/project starter code/node_modules/minimist/CHANGELOG.md +++ /dev/null @@ -1,212 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10 - -### Commits - -- [meta] add `auto-changelog` [`0ebf4eb`](https://github.com/minimistjs/minimist/commit/0ebf4ebcd5f7787a5524d31a849ef41316b83c3c) -- [actions] add reusable workflows [`e115b63`](https://github.com/minimistjs/minimist/commit/e115b63fa9d3909f33b00a2db647ff79068388de) -- [eslint] add eslint; rules to enable later are warnings [`f58745b`](https://github.com/minimistjs/minimist/commit/f58745b9bb84348e1be72af7dbba5840c7c13013) -- [Dev Deps] switch from `covert` to `nyc` [`ab03356`](https://github.com/minimistjs/minimist/commit/ab033567b9c8b31117cb026dc7f1e592ce455c65) -- [readme] rename and add badges [`236f4a0`](https://github.com/minimistjs/minimist/commit/236f4a07e4ebe5ee44f1496ec6974991ab293ffd) -- [meta] create FUNDING.yml; add `funding` in package.json [`783a49b`](https://github.com/minimistjs/minimist/commit/783a49bfd47e8335d3098a8cac75662cf71eb32a) -- [meta] use `npmignore` to autogenerate an npmignore file [`f81ece6`](https://github.com/minimistjs/minimist/commit/f81ece6aaec2fa14e69ff4f1e0407a8c4e2635a2) -- Only apps should have lockfiles [`56cad44`](https://github.com/minimistjs/minimist/commit/56cad44c7f879b9bb5ec18fcc349308024a89bfc) -- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`49c5f9f`](https://github.com/minimistjs/minimist/commit/49c5f9fb7e6a92db9eb340cc679de92fb3aacded) -- [Tests] add `aud` in `posttest` [`228ae93`](https://github.com/minimistjs/minimist/commit/228ae938f3cd9db9dfd8bd7458b076a7b2aef280) -- [meta] add `safe-publish-latest` [`01fc23f`](https://github.com/minimistjs/minimist/commit/01fc23f5104f85c75059972e01dd33796ab529ff) -- [meta] update repo URLs [`6b164c7`](https://github.com/minimistjs/minimist/commit/6b164c7d68e0b6bf32f894699effdfb7c63041dd) - -## [v1.2.6](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6) - 2022-03-21 - -### Commits - -- test from prototype pollution PR [`bc8ecee`](https://github.com/minimistjs/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb) -- isConstructorOrProto adapted from PR [`c2b9819`](https://github.com/minimistjs/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d) -- security notice for additional prototype pollution issue [`ef88b93`](https://github.com/minimistjs/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2) - -## [v1.2.5](https://github.com/minimistjs/minimist/compare/v1.2.4...v1.2.5) - 2020-03-12 - -## [v1.2.4](https://github.com/minimistjs/minimist/compare/v1.2.3...v1.2.4) - 2020-03-11 - -### Commits - -- security notice [`4cf1354`](https://github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11f) -- additional test for constructor prototype pollution [`1043d21`](https://github.com/minimistjs/minimist/commit/1043d212c3caaf871966e710f52cfdf02f9eea4b) - -## [v1.2.3](https://github.com/minimistjs/minimist/compare/v1.2.2...v1.2.3) - 2020-03-10 - -### Commits - -- more failing proto pollution tests [`13c01a5`](https://github.com/minimistjs/minimist/commit/13c01a5327736903704984b7f65616b8476850cc) -- even more aggressive checks for protocol pollution [`38a4d1c`](https://github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9ab) - -## [v1.2.2](https://github.com/minimistjs/minimist/compare/v1.2.1...v1.2.2) - 2020-03-10 - -### Commits - -- failing test for protocol pollution [`0efed03`](https://github.com/minimistjs/minimist/commit/0efed0340ec8433638758f7ca0c77cb20a0bfbab) -- cleanup [`67d3722`](https://github.com/minimistjs/minimist/commit/67d3722413448d00a62963d2d30c34656a92d7e2) -- console.dir -> console.log [`47acf72`](https://github.com/minimistjs/minimist/commit/47acf72c715a630bf9ea013867f47f1dd69dfc54) -- don't assign onto __proto__ [`63e7ed0`](https://github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94) - -## [v1.2.1](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.1) - 2020-03-10 - -### Merged - -- move the `opts['--']` example back where it belongs [`#63`](https://github.com/minimistjs/minimist/pull/63) - -### Commits - -- add test [`6be5dae`](https://github.com/minimistjs/minimist/commit/6be5dae35a32a987bcf4137fcd6c19c5200ee909) -- fix bad boolean regexp [`ac3fc79`](https://github.com/minimistjs/minimist/commit/ac3fc796e63b95128fdbdf67ea7fad71bd59aa76) - -## [v1.2.0](https://github.com/minimistjs/minimist/compare/v1.1.3...v1.2.0) - 2015-08-24 - -### Commits - -- failing -k=v short test [`63416b8`](https://github.com/minimistjs/minimist/commit/63416b8cd1d0d70e4714564cce465a36e4dd26d7) -- kv short fix [`6bbe145`](https://github.com/minimistjs/minimist/commit/6bbe14529166245e86424f220a2321442fe88dc3) -- failing kv short test [`f72ab7f`](https://github.com/minimistjs/minimist/commit/f72ab7f4572adc52902c9b6873cc969192f01b10) -- fixed kv test [`f5a48c3`](https://github.com/minimistjs/minimist/commit/f5a48c3e50e40ca54f00c8e84de4b4d6e9897fa8) -- enforce space between arg key and value [`86b321a`](https://github.com/minimistjs/minimist/commit/86b321affe648a8e016c095a4f0efa9d9074f502) - -## [v1.1.3](https://github.com/minimistjs/minimist/compare/v1.1.2...v1.1.3) - 2015-08-06 - -### Commits - -- add failing test - boolean alias array [`0fa3c5b`](https://github.com/minimistjs/minimist/commit/0fa3c5b3dd98551ddecf5392831b4c21211743fc) -- fix boolean values with multiple aliases [`9c0a6e7`](https://github.com/minimistjs/minimist/commit/9c0a6e7de25a273b11bbf9a7464f0bd833779795) - -## [v1.1.2](https://github.com/minimistjs/minimist/compare/v1.1.1...v1.1.2) - 2015-07-22 - -### Commits - -- Convert boolean arguments to boolean values [`8f3dc27`](https://github.com/minimistjs/minimist/commit/8f3dc27cf833f1d54671b6d0bcb55c2fe19672a9) -- use non-ancient npm, node 0.12 and iojs [`61ed1d0`](https://github.com/minimistjs/minimist/commit/61ed1d034b9ec7282764ce76f3992b1a0b4906ae) -- an older npm for 0.8 [`25cf778`](https://github.com/minimistjs/minimist/commit/25cf778b1220e7838a526832ad6972f75244054f) - -## [v1.1.1](https://github.com/minimistjs/minimist/compare/v1.1.0...v1.1.1) - 2015-03-10 - -### Commits - -- check that they type of a value is a boolean, not just that it is currently set to a boolean [`6863198`](https://github.com/minimistjs/minimist/commit/6863198e36139830ff1f20ffdceaddd93f2c1db9) -- upgrade tape, fix type issues from old tape version [`806712d`](https://github.com/minimistjs/minimist/commit/806712df91604ed02b8e39aa372b84aea659ee34) -- test for setting a boolean to a null default [`8c444fe`](https://github.com/minimistjs/minimist/commit/8c444fe89384ded7d441c120915ea60620b01dd3) -- if the previous value was a boolean, without an default (or with an alias) don't make an array either [`e5f419a`](https://github.com/minimistjs/minimist/commit/e5f419a3b5b3bc3f9e5ac71b7040621af70ed2dd) - -## [v1.1.0](https://github.com/minimistjs/minimist/compare/v1.0.0...v1.1.0) - 2014-08-10 - -### Commits - -- add support for handling "unknown" options not registered with the parser. [`6f3cc5d`](https://github.com/minimistjs/minimist/commit/6f3cc5d4e84524932a6ef2ce3592acc67cdd4383) -- reformat package.json [`02ed371`](https://github.com/minimistjs/minimist/commit/02ed37115194d3697ff358e8e25e5e66bab1d9f8) -- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df) -- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498) - -## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.1...v1.0.0) - 2014-08-10 - -### Commits - -- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9) -- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e) - -## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12 - -## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19 - -### Commits - -- support all-boolean mode [`450a97f`](https://github.com/minimistjs/minimist/commit/450a97f6e2bc85c7a4a13185c19a818d9a5ebe69) - -## [v0.1.0](https://github.com/minimistjs/minimist/compare/v0.0.10...v0.1.0) - 2014-05-12 - -### Commits - -- Provide a mechanism to segregate -- arguments [`ce4a1e6`](https://github.com/minimistjs/minimist/commit/ce4a1e63a7e8d5ab88d2a3768adefa6af98a445a) -- documented argv['--'] [`14db0e6`](https://github.com/minimistjs/minimist/commit/14db0e6dbc6d2b9e472adaa54dad7004b364634f) -- Adding a test-case for notFlags segregation [`715c1e3`](https://github.com/minimistjs/minimist/commit/715c1e3714be223f998f6c537af6b505f0236c16) - -## [v0.0.10](https://github.com/minimistjs/minimist/compare/v0.0.9...v0.0.10) - 2014-05-11 - -### Commits - -- dedicated boolean test [`46e448f`](https://github.com/minimistjs/minimist/commit/46e448f9f513cfeb2bcc8b688b9b47ba1e515c2b) -- dedicated num test [`9bf2d36`](https://github.com/minimistjs/minimist/commit/9bf2d36f1d3b8795be90b8f7de0a937f098aa394) -- aliased values treated as strings [`1ab743b`](https://github.com/minimistjs/minimist/commit/1ab743bad4484d69f1259bed42f9531de01119de) -- cover the case of already numbers, at 100% coverage [`b2bb044`](https://github.com/minimistjs/minimist/commit/b2bb04436599d77a2ce029e8e555e25b3aa55d13) -- another test for higher coverage [`3662624`](https://github.com/minimistjs/minimist/commit/3662624be976d5489d486a856849c048d13be903) - -## [v0.0.9](https://github.com/minimistjs/minimist/compare/v0.0.8...v0.0.9) - 2014-05-08 - -### Commits - -- Eliminate `longest` fn. [`824f642`](https://github.com/minimistjs/minimist/commit/824f642038d1b02ede68b6261d1d65163390929a) - -## [v0.0.8](https://github.com/minimistjs/minimist/compare/v0.0.7...v0.0.8) - 2014-02-20 - -### Commits - -- return '' if flag is string and empty [`fa63ed4`](https://github.com/minimistjs/minimist/commit/fa63ed4651a4ef4eefddce34188e0d98d745a263) -- handle joined single letters [`66c248f`](https://github.com/minimistjs/minimist/commit/66c248f0241d4d421d193b022e9e365f11178534) - -## [v0.0.7](https://github.com/minimistjs/minimist/compare/v0.0.6...v0.0.7) - 2014-02-08 - -### Commits - -- another swap of .test for .match [`d1da408`](https://github.com/minimistjs/minimist/commit/d1da40819acbe846d89a5c02721211e3c1260dde) - -## [v0.0.6](https://github.com/minimistjs/minimist/compare/v0.0.5...v0.0.6) - 2014-02-08 - -### Commits - -- use .test() instead of .match() to not crash on non-string values in the arguments array [`7e0d1ad`](https://github.com/minimistjs/minimist/commit/7e0d1add8c9e5b9b20a4d3d0f9a94d824c578da1) - -## [v0.0.5](https://github.com/minimistjs/minimist/compare/v0.0.4...v0.0.5) - 2013-09-18 - -### Commits - -- Improve '--' handling. [`b11822c`](https://github.com/minimistjs/minimist/commit/b11822c09cc9d2460f30384d12afc0b953c037a4) - -## [v0.0.4](https://github.com/minimistjs/minimist/compare/v0.0.3...v0.0.4) - 2013-09-17 - -## [v0.0.3](https://github.com/minimistjs/minimist/compare/v0.0.2...v0.0.3) - 2013-09-12 - -### Commits - -- failing test for single dash preceeding a double dash [`b465514`](https://github.com/minimistjs/minimist/commit/b465514b82c9ae28972d714facd951deb2ad762b) -- fix for the dot test [`6a095f1`](https://github.com/minimistjs/minimist/commit/6a095f1d364c8fab2d6753d2291a0649315d297a) - -## [v0.0.2](https://github.com/minimistjs/minimist/compare/v0.0.1...v0.0.2) - 2013-08-28 - -### Commits - -- allow dotted aliases & defaults [`321c33e`](https://github.com/minimistjs/minimist/commit/321c33e755485faaeb44eeb1c05d33b2e0a5a7c4) -- use a better version of ff [`e40f611`](https://github.com/minimistjs/minimist/commit/e40f61114cf7be6f7947f7b3eed345853a67dbbb) - -## [v0.0.1](https://github.com/minimistjs/minimist/compare/v0.0.0...v0.0.1) - 2013-06-25 - -### Commits - -- remove trailing commas [`6ff0fa0`](https://github.com/minimistjs/minimist/commit/6ff0fa055064f15dbe06d50b89d5173a6796e1db) - -## v0.0.0 - 2013-06-25 - -### Commits - -- half of the parse test ported [`3079326`](https://github.com/minimistjs/minimist/commit/307932601325087de6cf94188eb798ffc4f3088a) -- stripped down code and a passing test from optimist [`7cced88`](https://github.com/minimistjs/minimist/commit/7cced88d82e399d1a03ed23eb667f04d3f320d10) -- ported parse tests completely over [`9448754`](https://github.com/minimistjs/minimist/commit/944875452e0820df6830b1408c26a0f7d3e1db04) -- docs, package.json [`a5bf46a`](https://github.com/minimistjs/minimist/commit/a5bf46ac9bb3bd114a9c340276c62c1091e538d5) -- move more short tests into short.js [`503edb5`](https://github.com/minimistjs/minimist/commit/503edb5c41d89c0d40831ee517154fc13b0f18b9) -- default bool test was wrong, not the code [`1b9f5db`](https://github.com/minimistjs/minimist/commit/1b9f5db4741b49962846081b68518de824992097) -- passing long tests ripped out of parse.js [`7972c4a`](https://github.com/minimistjs/minimist/commit/7972c4aff1f4803079e1668006658e2a761a0428) -- badges [`84c0370`](https://github.com/minimistjs/minimist/commit/84c037063664d42878aace715fe6572ce01b6f3b) -- all the tests now ported, some failures [`64239ed`](https://github.com/minimistjs/minimist/commit/64239edfe92c711c4eb0da254fcdfad2a5fdb605) -- failing short test [`f8a5341`](https://github.com/minimistjs/minimist/commit/f8a534112dd1138d2fad722def56a848480c446f) -- fixed the numeric test [`6b034f3`](https://github.com/minimistjs/minimist/commit/6b034f37c79342c60083ed97fd222e16928aac51) diff --git a/project starter code/node_modules/minimist/README.md b/project starter code/node_modules/minimist/README.md deleted file mode 100644 index 30ff92df..00000000 --- a/project starter code/node_modules/minimist/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# minimist [![Version Badge][npm-version-svg]][package-url] - -[![github actions][actions-image]][actions-url] -[![coverage][codecov-image]][codecov-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][npm-badge-png]][package-url] - -parse argument options - -This module is the guts of optimist's argument parser without all the -fanciful decoration. - -# example - -``` js -var argv = require('minimist')(process.argv.slice(2)); -console.log(argv); -``` - -``` -$ node example/parse.js -a beep -b boop -{ _: [], a: 'beep', b: 'boop' } -``` - -``` -$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz -{ _: [ 'foo', 'bar', 'baz' ], - x: 3, - y: 4, - n: 5, - a: true, - b: true, - c: true, - beep: 'boop' } -``` - -# security - -Previous versions had a prototype pollution bug that could cause privilege -escalation in some circumstances when handling untrusted user input. - -Please use version 1.2.6 or later: - -* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) -* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) - -# methods - -``` js -var parseArgs = require('minimist') -``` - -## var argv = parseArgs(args, opts={}) - -Return an argument object `argv` populated with the array arguments from `args`. - -`argv._` contains all the arguments that didn't have an option associated with -them. - -Numeric-looking arguments will be returned as numbers unless `opts.string` or -`opts.boolean` is set for that argument name. - -Any arguments after `'--'` will not be parsed and will end up in `argv._`. - -options can be: - -* `opts.string` - a string or array of strings argument names to always treat as -strings -* `opts.boolean` - a boolean, string or array of strings to always treat as -booleans. if `true` will treat all double hyphenated arguments without equal signs -as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) -* `opts.alias` - an object mapping string names to strings or arrays of string -argument names to use as aliases -* `opts.default` - an object mapping string argument names to default values -* `opts.stopEarly` - when true, populate `argv._` with everything after the -first non-option -* `opts['--']` - when true, populate `argv._` with everything before the `--` -and `argv['--']` with everything after the `--`. Here's an example: - - ``` - > require('./')('one two three -- four five --six'.split(' '), { '--': true }) - { _: [ 'one', 'two', 'three' ], - '--': [ 'four', 'five', '--six' ] } - ``` - - Note that with `opts['--']` set, parsing for arguments still stops after the - `--`. - -* `opts.unknown` - a function which is invoked with a command line parameter not -defined in the `opts` configuration object. If the function returns `false`, the -unknown option is not added to `argv`. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install minimist -``` - -# license - -MIT - -[package-url]: https://npmjs.org/package/minimist -[npm-version-svg]: https://versionbadg.es/minimistjs/minimist.svg -[npm-badge-png]: https://nodei.co/npm/minimist.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/minimist.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/minimist.svg -[downloads-url]: https://npm-stat.com/charts.html?package=minimist -[codecov-image]: https://codecov.io/gh/minimistjs/minimist/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/minimistjs/minimist/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/minimistjs/minimist -[actions-url]: https://github.com/minimistjs/minimist/actions diff --git a/project starter code/node_modules/minimist/example/parse.js b/project starter code/node_modules/minimist/example/parse.js deleted file mode 100644 index f7c8d498..00000000 --- a/project starter code/node_modules/minimist/example/parse.js +++ /dev/null @@ -1,2 +0,0 @@ -var argv = require('../')(process.argv.slice(2)); -console.log(argv); diff --git a/project starter code/node_modules/minimist/index.js b/project starter code/node_modules/minimist/index.js deleted file mode 100644 index d9c3eb79..00000000 --- a/project starter code/node_modules/minimist/index.js +++ /dev/null @@ -1,249 +0,0 @@ -module.exports = function (args, opts) { - if (!opts) opts = {}; - - var flags = { bools : {}, strings : {}, unknownFn: null }; - - if (typeof opts['unknown'] === 'function') { - flags.unknownFn = opts['unknown']; - } - - if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { - flags.allBools = true; - } else { - [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - }); - } - - var aliases = {}; - Object.keys(opts.alias || {}).forEach(function (key) { - aliases[key] = [].concat(opts.alias[key]); - aliases[key].forEach(function (x) { - aliases[x] = [key].concat(aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); - - [].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - if (aliases[key]) { - flags.strings[aliases[key]] = true; - } - }); - - var defaults = opts['default'] || {}; - - var argv = { _ : [] }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - }); - - var notFlags = []; - - if (args.indexOf('--') !== -1) { - notFlags = args.slice(args.indexOf('--')+1); - args = args.slice(0, args.indexOf('--')); - } - - function argDefined(key, arg) { - return (flags.allBools && /^--[^=]+$/.test(arg)) || - flags.strings[key] || flags.bools[key] || aliases[key]; - } - - function setArg (key, val, arg) { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg) === false) return; - } - - var value = !flags.strings[key] && isNumber(val) - ? Number(val) : val - ; - setKey(argv, key.split('.'), value); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), value); - }); - } - - function setKey (obj, keys, value) { - var o = obj; - for (var i = 0; i < keys.length-1; i++) { - var key = keys[i]; - if (isConstructorOrProto(o, key)) return; - if (o[key] === undefined) o[key] = {}; - if (o[key] === Object.prototype || o[key] === Number.prototype - || o[key] === String.prototype) o[key] = {}; - if (o[key] === Array.prototype) o[key] = []; - o = o[key]; - } - - var key = keys[keys.length - 1]; - if (isConstructorOrProto(o, key)) return; - if (o === Object.prototype || o === Number.prototype - || o === String.prototype) o = {}; - if (o === Array.prototype) o = []; - if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { - o[key] = value; - } - else if (Array.isArray(o[key])) { - o[key].push(value); - } - else { - o[key] = [ o[key], value ]; - } - } - - function aliasIsBoolean(key) { - return aliases[key].some(function (x) { - return flags.bools[x]; - }); - } - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - - if (/^--.+=/.test(arg)) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - var m = arg.match(/^--([^=]+)=([\s\S]*)$/); - var key = m[1]; - var value = m[2]; - if (flags.bools[key]) { - value = value !== 'false'; - } - setArg(key, value, arg); - } - else if (/^--no-.+/.test(arg)) { - var key = arg.match(/^--no-(.+)/)[1]; - setArg(key, false, arg); - } - else if (/^--.+/.test(arg)) { - var key = arg.match(/^--(.+)/)[1]; - var next = args[i + 1]; - if (next !== undefined && !/^-/.test(next) - && !flags.bools[key] - && !flags.allBools - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, next, arg); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - else if (/^-[^-]+/.test(arg)) { - var letters = arg.slice(1,-1).split(''); - - var broken = false; - for (var j = 0; j < letters.length; j++) { - var next = arg.slice(j+2); - - if (next === '-') { - setArg(letters[j], next, arg) - continue; - } - - if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { - setArg(letters[j], next.split('=')[1], arg); - broken = true; - break; - } - - if (/[A-Za-z]/.test(letters[j]) - && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next, arg); - broken = true; - break; - } - - if (letters[j+1] && letters[j+1].match(/\W/)) { - setArg(letters[j], arg.slice(j+2), arg); - broken = true; - break; - } - else { - setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); - } - } - - var key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) - && !flags.bools[key] - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, args[i+1], arg); - i++; - } - else if (args[i+1] && /^(true|false)$/.test(args[i+1])) { - setArg(key, args[i+1] === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - } - else { - if (!flags.unknownFn || flags.unknownFn(arg) !== false) { - argv._.push( - flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) - ); - } - if (opts.stopEarly) { - argv._.push.apply(argv._, args.slice(i + 1)); - break; - } - } - } - - Object.keys(defaults).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) { - setKey(argv, key.split('.'), defaults[key]); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), defaults[key]); - }); - } - }); - - if (opts['--']) { - argv['--'] = new Array(); - notFlags.forEach(function(key) { - argv['--'].push(key); - }); - } - else { - notFlags.forEach(function(key) { - argv._.push(key); - }); - } - - return argv; -}; - -function hasKey (obj, keys) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - o = (o[key] || {}); - }); - - var key = keys[keys.length - 1]; - return key in o; -} - -function isNumber (x) { - if (typeof x === 'number') return true; - if (/^0x[0-9a-f]+$/i.test(x)) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); -} - - -function isConstructorOrProto (obj, key) { - return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__'; -} diff --git a/project starter code/node_modules/minimist/package.json b/project starter code/node_modules/minimist/package.json deleted file mode 100644 index 89a639ed..00000000 --- a/project starter code/node_modules/minimist/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "minimist", - "version": "1.2.7", - "description": "parse argument options", - "main": "index.js", - "devDependencies": { - "@ljharb/eslint-config": "^21.0.0", - "aud": "^2.0.1", - "auto-changelog": "^2.4.0", - "eslint": "=8.8.0", - "in-publish": "^2.0.1", - "npmignore": "^0.3.0", - "nyc": "^10.3.2", - "safe-publish-latest": "^2.0.0", - "tape": "^5.6.1" - }, - "scripts": { - "prepack": "npmignore --auto --commentLines=auto", - "prepublishOnly": "safe-publish-latest", - "prepublish": "not-in-publish || npm run prepublishOnly", - "lint": "eslint --ext=js,mjs .", - "pretest": "npm run lint", - "tests-only": "nyc tape test/*.js", - "test": "npm run tests-only", - "posttest": "aud --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/6..latest", - "ff/5", - "firefox/latest", - "chrome/10", - "chrome/latest", - "safari/5.1", - "safari/latest", - "opera/12" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/minimistjs/minimist.git" - }, - "homepage": "https://github.com/minimistjs/minimist", - "keywords": [ - "argv", - "getopt", - "parser", - "optimist" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - } -} diff --git a/project starter code/node_modules/minimist/test/all_bool.js b/project starter code/node_modules/minimist/test/all_bool.js deleted file mode 100644 index ac835483..00000000 --- a/project starter code/node_modules/minimist/test/all_bool.js +++ /dev/null @@ -1,32 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean true (default all --args to boolean)', function (t) { - var argv = parse(['moo', '--honk', 'cow'], { - boolean: true - }); - - t.deepEqual(argv, { - honk: true, - _: ['moo', 'cow'] - }); - - t.deepEqual(typeof argv.honk, 'boolean'); - t.end(); -}); - -test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { - var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { - boolean: true - }); - - t.deepEqual(argv, { - honk: true, - tacos: 'good', - p: 55, - _: ['moo', 'cow'] - }); - - t.deepEqual(typeof argv.honk, 'boolean'); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/bool.js b/project starter code/node_modules/minimist/test/bool.js deleted file mode 100644 index 5f7dbde1..00000000 --- a/project starter code/node_modules/minimist/test/bool.js +++ /dev/null @@ -1,178 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean default false', function (t) { - var argv = parse(['moo'], { - boolean: ['t', 'verbose'], - default: { verbose: false, t: false } - }); - - t.deepEqual(argv, { - verbose: false, - t: false, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); - -}); - -test('boolean groups', function (t) { - var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { - boolean: ['x','y','z'] - }); - - t.deepEqual(argv, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ] - }); - - t.deepEqual(typeof argv.x, 'boolean'); - t.deepEqual(typeof argv.y, 'boolean'); - t.deepEqual(typeof argv.z, 'boolean'); - t.end(); -}); -test('boolean and alias with chainable api', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = parse(aliased, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var propertyArgv = parse(regular, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - alias: { 'h': 'herp' }, - boolean: 'herp' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias array with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var alt = [ '--harp', 'derp' ]; - var opts = { - alias: { 'h': ['herp', 'harp'] }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var altPropertyArgv = parse(alt, opts); - var expected = { - harp: true, - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.same(altPropertyArgv, expected); - t.end(); -}); - -test('boolean and alias using explicit true', function (t) { - var aliased = [ '-h', 'true' ]; - var regular = [ '--herp', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -test('boolean and --x=true', function(t) { - var parsed = parse(['--boool', '--other=true'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'true'); - - parsed = parse(['--boool', '--other=false'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'false'); - t.end(); -}); - -test('boolean --boool=true', function (t) { - var parsed = parse(['--boool=true'], { - default: { - boool: false - }, - boolean: ['boool'] - }); - - t.same(parsed.boool, true); - t.end(); -}); - -test('boolean --boool=false', function (t) { - var parsed = parse(['--boool=false'], { - default: { - boool: true - }, - boolean: ['boool'] - }); - - t.same(parsed.boool, false); - t.end(); -}); - -test('boolean using something similar to true', function (t) { - var opts = { boolean: 'h' }; - var result = parse(['-h', 'true.txt'], opts); - var expected = { - h: true, - '_': ['true.txt'] - }; - - t.same(result, expected); - t.end(); -}); \ No newline at end of file diff --git a/project starter code/node_modules/minimist/test/dash.js b/project starter code/node_modules/minimist/test/dash.js deleted file mode 100644 index 5a4fa5be..00000000 --- a/project starter code/node_modules/minimist/test/dash.js +++ /dev/null @@ -1,31 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('-', function (t) { - t.plan(5); - t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); - t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); - t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); - t.deepEqual( - parse([ '-b', '-' ], { boolean: 'b' }), - { b: true, _: [ '-' ] } - ); - t.deepEqual( - parse([ '-s', '-' ], { string: 's' }), - { s: '-', _: [] } - ); -}); - -test('-a -- b', function (t) { - t.plan(3); - t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); -}); - -test('move arguments after the -- into their own `--` array', function(t) { - t.plan(1); - t.deepEqual( - parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), - { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); -}); diff --git a/project starter code/node_modules/minimist/test/default_bool.js b/project starter code/node_modules/minimist/test/default_bool.js deleted file mode 100644 index 780a3112..00000000 --- a/project starter code/node_modules/minimist/test/default_bool.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('boolean default true', function (t) { - var argv = parse([], { - boolean: 'sometrue', - default: { sometrue: true } - }); - t.equal(argv.sometrue, true); - t.end(); -}); - -test('boolean default false', function (t) { - var argv = parse([], { - boolean: 'somefalse', - default: { somefalse: false } - }); - t.equal(argv.somefalse, false); - t.end(); -}); - -test('boolean default to null', function (t) { - var argv = parse([], { - boolean: 'maybe', - default: { maybe: null } - }); - t.equal(argv.maybe, null); - var argv = parse(['--maybe'], { - boolean: 'maybe', - default: { maybe: null } - }); - t.equal(argv.maybe, true); - t.end(); - -}) diff --git a/project starter code/node_modules/minimist/test/dotted.js b/project starter code/node_modules/minimist/test/dotted.js deleted file mode 100644 index d8b3e856..00000000 --- a/project starter code/node_modules/minimist/test/dotted.js +++ /dev/null @@ -1,22 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('dotted alias', function (t) { - var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 22); - t.equal(argv.aa.bb, 22); - t.end(); -}); - -test('dotted default', function (t) { - var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 11); - t.equal(argv.aa.bb, 11); - t.end(); -}); - -test('dotted default with no alias', function (t) { - var argv = parse('', {default: {'a.b': 11}}); - t.equal(argv.a.b, 11); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/kv_short.js b/project starter code/node_modules/minimist/test/kv_short.js deleted file mode 100644 index f813b305..00000000 --- a/project starter code/node_modules/minimist/test/kv_short.js +++ /dev/null @@ -1,16 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('short -k=v' , function (t) { - t.plan(1); - - var argv = parse([ '-b=123' ]); - t.deepEqual(argv, { b: 123, _: [] }); -}); - -test('multi short -k=v' , function (t) { - t.plan(1); - - var argv = parse([ '-a=whatever', '-b=robots' ]); - t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); -}); diff --git a/project starter code/node_modules/minimist/test/long.js b/project starter code/node_modules/minimist/test/long.js deleted file mode 100644 index 5d3a1e09..00000000 --- a/project starter code/node_modules/minimist/test/long.js +++ /dev/null @@ -1,31 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('long opts', function (t) { - t.deepEqual( - parse([ '--bool' ]), - { bool : true, _ : [] }, - 'long boolean' - ); - t.deepEqual( - parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture sp' - ); - t.deepEqual( - parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture eq' - ); - t.deepEqual( - parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures sp' - ); - t.deepEqual( - parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures eq' - ); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/num.js b/project starter code/node_modules/minimist/test/num.js deleted file mode 100644 index 2cc77f4d..00000000 --- a/project starter code/node_modules/minimist/test/num.js +++ /dev/null @@ -1,36 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('nums', function (t) { - var argv = parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789' - ]); - t.deepEqual(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ] - }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv.y, 'number'); - t.deepEqual(typeof argv.z, 'number'); - t.deepEqual(typeof argv.w, 'string'); - t.deepEqual(typeof argv.hex, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); - -test('already a number', function (t) { - var argv = parse([ '-x', 1234, 789 ]); - t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/parse.js b/project starter code/node_modules/minimist/test/parse.js deleted file mode 100644 index 7b4a2a17..00000000 --- a/project starter code/node_modules/minimist/test/parse.js +++ /dev/null @@ -1,197 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse args', function (t) { - t.deepEqual( - parse([ '--no-moo' ]), - { moo : false, _ : [] }, - 'no' - ); - t.deepEqual( - parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [] }, - 'multi' - ); - t.end(); -}); - -test('comprehensive', function (t) { - t.deepEqual( - parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ] - } - ); - t.end(); -}); - -test('flag boolean', function (t) { - var argv = parse([ '-t', 'moo' ], { boolean: 't' }); - t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('flag boolean value', function (t) { - var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { - boolean: [ 't', 'verbose' ], - default: { verbose: true } - }); - - t.deepEqual(argv, { - verbose: false, - t: true, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('newlines in params' , function (t) { - var args = parse([ '-s', "X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - - // reproduce in bash: - // VALUE="new - // line" - // node program.js --s="$VALUE" - args = parse([ "--s=X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - t.end(); -}); - -test('strings' , function (t) { - var s = parse([ '-s', '0001234' ], { string: 's' }).s; - t.equal(s, '0001234'); - t.equal(typeof s, 'string'); - - var x = parse([ '-x', '56' ], { string: 'x' }).x; - t.equal(x, '56'); - t.equal(typeof x, 'string'); - t.end(); -}); - -test('stringArgs', function (t) { - var s = parse([ ' ', ' ' ], { string: '_' })._; - t.same(s.length, 2); - t.same(typeof s[0], 'string'); - t.same(s[0], ' '); - t.same(typeof s[1], 'string'); - t.same(s[1], ' '); - t.end(); -}); - -test('empty strings', function(t) { - var s = parse([ '-s' ], { string: 's' }).s; - t.equal(s, ''); - t.equal(typeof s, 'string'); - - var str = parse([ '--str' ], { string: 'str' }).str; - t.equal(str, ''); - t.equal(typeof str, 'string'); - - var letters = parse([ '-art' ], { - string: [ 'a', 't' ] - }); - - t.equal(letters.a, ''); - t.equal(letters.r, true); - t.equal(letters.t, ''); - - t.end(); -}); - - -test('string and alias', function(t) { - var x = parse([ '--str', '000123' ], { - string: 's', - alias: { s: 'str' } - }); - - t.equal(x.str, '000123'); - t.equal(typeof x.str, 'string'); - t.equal(x.s, '000123'); - t.equal(typeof x.s, 'string'); - - var y = parse([ '-s', '000123' ], { - string: 'str', - alias: { str: 's' } - }); - - t.equal(y.str, '000123'); - t.equal(typeof y.str, 'string'); - t.equal(y.s, '000123'); - t.equal(typeof y.s, 'string'); - t.end(); -}); - -test('slashBreak', function (t) { - t.same( - parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [] } - ); - t.same( - parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [] } - ); - t.end(); -}); - -test('alias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: 'zoom' } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.f, 11); - t.end(); -}); - -test('multiAlias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: [ 'zm', 'zoom' ] } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.z, argv.zm); - t.equal(argv.f, 11); - t.end(); -}); - -test('nested dotted objects', function (t) { - var argv = parse([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]); - - t.same(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - } - }); - t.same(argv.beep, { boop : true }); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/parse_modified.js b/project starter code/node_modules/minimist/test/parse_modified.js deleted file mode 100644 index ab620dc5..00000000 --- a/project starter code/node_modules/minimist/test/parse_modified.js +++ /dev/null @@ -1,9 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse with modifier functions' , function (t) { - t.plan(1); - - var argv = parse([ '-b', '123' ], { boolean: 'b' }); - t.deepEqual(argv, { b: true, _: [123] }); -}); diff --git a/project starter code/node_modules/minimist/test/proto.js b/project starter code/node_modules/minimist/test/proto.js deleted file mode 100644 index 4ac62df2..00000000 --- a/project starter code/node_modules/minimist/test/proto.js +++ /dev/null @@ -1,60 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('proto pollution', function (t) { - var argv = parse(['--__proto__.x','123']); - t.equal({}.x, undefined); - t.equal(argv.__proto__.x, undefined); - t.equal(argv.x, undefined); - t.end(); -}); - -test('proto pollution (array)', function (t) { - var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']); - t.equal({}.z, undefined); - t.deepEqual(argv.x, [4,5]); - t.equal(argv.x.z, undefined); - t.equal(argv.x.__proto__.z, undefined); - t.end(); -}); - -test('proto pollution (number)', function (t) { - var argv = parse(['--x','5','--x.__proto__.z','100']); - t.equal({}.z, undefined); - t.equal((4).z, undefined); - t.equal(argv.x, 5); - t.equal(argv.x.z, undefined); - t.end(); -}); - -test('proto pollution (string)', function (t) { - var argv = parse(['--x','abc','--x.__proto__.z','def']); - t.equal({}.z, undefined); - t.equal('...'.z, undefined); - t.equal(argv.x, 'abc'); - t.equal(argv.x.z, undefined); - t.end(); -}); - -test('proto pollution (constructor)', function (t) { - var argv = parse(['--constructor.prototype.y','123']); - t.equal({}.y, undefined); - t.equal(argv.y, undefined); - t.end(); -}); - -test('proto pollution (constructor function)', function (t) { - var argv = parse(['--_.concat.constructor.prototype.y', '123']); - function fnToBeTested() {} - t.equal(fnToBeTested.y, undefined); - t.equal(argv.y, undefined); - t.end(); -}); - -// powered by snyk - https://github.com/backstage/backstage/issues/10343 -test('proto pollution (constructor function) snyk', function (t) { - var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); - t.equal((function(){}).foo, undefined); - t.equal(argv.y, undefined); - t.end(); -}) diff --git a/project starter code/node_modules/minimist/test/short.js b/project starter code/node_modules/minimist/test/short.js deleted file mode 100644 index d513a1c2..00000000 --- a/project starter code/node_modules/minimist/test/short.js +++ /dev/null @@ -1,67 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('numeric short args', function (t) { - t.plan(2); - t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); - t.deepEqual( - parse([ '-123', '456' ]), - { 1: true, 2: true, 3: 456, _: [] } - ); -}); - -test('short', function (t) { - t.deepEqual( - parse([ '-b' ]), - { b : true, _ : [] }, - 'short boolean' - ); - t.deepEqual( - parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ] }, - 'bare' - ); - t.deepEqual( - parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [] }, - 'group' - ); - t.deepEqual( - parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [] }, - 'short group next' - ); - t.deepEqual( - parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [] }, - 'short capture' - ); - t.deepEqual( - parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [] }, - 'short captures' - ); - t.end(); -}); - -test('mixed short bool and capture', function (t) { - t.same( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); - -test('short and long', function (t) { - t.deepEqual( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/stop_early.js b/project starter code/node_modules/minimist/test/stop_early.js deleted file mode 100644 index bdf9fbcb..00000000 --- a/project starter code/node_modules/minimist/test/stop_early.js +++ /dev/null @@ -1,15 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('stops parsing on the first non-option when stopEarly is set', function (t) { - var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { - stopEarly: true - }); - - t.deepEqual(argv, { - aaa: 'bbb', - _: ['ccc', '--ddd'] - }); - - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/unknown.js b/project starter code/node_modules/minimist/test/unknown.js deleted file mode 100644 index 462a36bd..00000000 --- a/project starter code/node_modules/minimist/test/unknown.js +++ /dev/null @@ -1,102 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('boolean and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'true', '--derp', 'true' ]; - var regular = [ '--herp', 'true', '-d', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h', - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, ['--derp', '-d']); - t.end(); -}); - -test('flag boolean true any double hyphen argument is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { - boolean: true, - unknown: unknownFn - }); - t.same(unknown, ['--tacos=good', 'cow', '-p']); - t.same(argv, { - honk: true, - _: [] - }); - t.end(); -}); - -test('string and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; - var regular = [ '--herp', 'hello', '-d', 'moon' ]; - var opts = { - alias: { h: 'herp' }, - string: 'h', - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, ['--derp', '-d']); - t.end(); -}); - -test('default and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'hello' ]; - var regular = [ '--herp', 'hello' ]; - var opts = { - default: { 'h': 'bar' }, - alias: { 'h': 'herp' }, - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, []); - t.end(); - unknownFn(); // exercise fn for 100% coverage -}); - -test('value following -- is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '--bad', '--', 'good', 'arg' ]; - var opts = { - '--': true, - unknown: unknownFn - }; - var argv = parse(aliased, opts); - - t.same(unknown, ['--bad']); - t.same(argv, { - '--': ['good', 'arg'], - '_': [] - }) - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/whitespace.js b/project starter code/node_modules/minimist/test/whitespace.js deleted file mode 100644 index 8a52a58c..00000000 --- a/project starter code/node_modules/minimist/test/whitespace.js +++ /dev/null @@ -1,8 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('whitespace should be whitespace' , function (t) { - t.plan(1); - var x = parse([ '-x', '\t' ]).x; - t.equal(x, '\t'); -}); diff --git a/project starter code/node_modules/parse-bmfont-xml/package.json b/project starter code/node_modules/parse-bmfont-xml/package.json deleted file mode 100644 index 98c05e66..00000000 --- a/project starter code/node_modules/parse-bmfont-xml/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "parse-bmfont-xml", - "version": "1.1.4", - "description": "parses XML BMFont files into a JavaScript object", - "main": "lib/index.js", - "browser": "lib/browser.js", - "license": "MIT", - "author": { - "name": "Matt DesLauriers", - "email": "dave.des@gmail.com", - "url": "https://github.com/mattdesl" - }, - "dependencies": { - "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" - }, - "devDependencies": { - "brfs": "^1.4.0", - "browserify": "^9.0.3", - "faucet": "0.0.1", - "tape": "^3.5.0", - "testling": "^1.7.1", - "xhr": "^2.0.1" - }, - "scripts": { - "test-browser": "browserify test/test-browser.js -t brfs | testling | faucet", - "test-node": "node test/test.js | faucet", - "test": "npm run test-node && npm run test-browser" - }, - "keywords": [ - "xml", - "parse", - "convert", - "bmfont", - "bm", - "bitmap", - "font", - "bitmaps", - "angel", - "angelcode", - "code", - "text", - "gl", - "sprite", - "sprites", - "stackgl" - ], - "repository": { - "type": "git", - "url": "git://github.com/mattdesl/parse-bmfont-xml.git" - }, - "homepage": "https://github.com/mattdesl/parse-bmfont-xml", - "bugs": { - "url": "https://github.com/mattdesl/parse-bmfont-xml/issues" - } -} diff --git a/project starter code/node_modules/raw-body/HISTORY.md b/project starter code/node_modules/raw-body/HISTORY.md deleted file mode 100644 index 0b6b8373..00000000 --- a/project starter code/node_modules/raw-body/HISTORY.md +++ /dev/null @@ -1,303 +0,0 @@ -2.5.1 / 2022-02-28 -================== - - * Fix error on early async hooks implementations - -2.5.0 / 2022-02-21 -================== - - * Prevent loss of async hooks context - * Prevent hanging when stream is not readable - * deps: http-errors@2.0.0 - - deps: depd@2.0.0 - - deps: statuses@2.0.1 - -2.4.3 / 2022-02-14 -================== - - * deps: bytes@3.1.2 - -2.4.2 / 2021-11-16 -================== - - * deps: bytes@3.1.1 - * deps: http-errors@1.8.1 - - deps: setprototypeof@1.2.0 - - deps: toidentifier@1.0.1 - -2.4.1 / 2019-06-25 -================== - - * deps: http-errors@1.7.3 - - deps: inherits@2.0.4 - -2.4.0 / 2019-04-17 -================== - - * deps: bytes@3.1.0 - - Add petabyte (`pb`) support - * deps: http-errors@1.7.2 - - Set constructor name when possible - - deps: setprototypeof@1.1.1 - - deps: statuses@'>= 1.5.0 < 2' - * deps: iconv-lite@0.4.24 - - Added encoding MIK - -2.3.3 / 2018-05-08 -================== - - * deps: http-errors@1.6.3 - - deps: depd@~1.1.2 - - deps: setprototypeof@1.1.0 - - deps: statuses@'>= 1.3.1 < 2' - * deps: iconv-lite@0.4.23 - - Fix loading encoding with year appended - - Fix deprecation warnings on Node.js 10+ - -2.3.2 / 2017-09-09 -================== - - * deps: iconv-lite@0.4.19 - - Fix ISO-8859-1 regression - - Update Windows-1255 - -2.3.1 / 2017-09-07 -================== - - * deps: bytes@3.0.0 - * deps: http-errors@1.6.2 - - deps: depd@1.1.1 - * perf: skip buffer decoding on overage chunk - -2.3.0 / 2017-08-04 -================== - - * Add TypeScript definitions - * Use `http-errors` for standard emitted errors - * deps: bytes@2.5.0 - * deps: iconv-lite@0.4.18 - - Add support for React Native - - Add a warning if not loaded as utf-8 - - Fix CESU-8 decoding in Node.js 8 - - Improve speed of ISO-8859-1 encoding - -2.2.0 / 2017-01-02 -================== - - * deps: iconv-lite@0.4.15 - - Added encoding MS-31J - - Added encoding MS-932 - - Added encoding MS-936 - - Added encoding MS-949 - - Added encoding MS-950 - - Fix GBK/GB18030 handling of Euro character - -2.1.7 / 2016-06-19 -================== - - * deps: bytes@2.4.0 - * perf: remove double-cleanup on happy path - -2.1.6 / 2016-03-07 -================== - - * deps: bytes@2.3.0 - - Drop partial bytes on all parsed units - - Fix parsing byte string that looks like hex - -2.1.5 / 2015-11-30 -================== - - * deps: bytes@2.2.0 - * deps: iconv-lite@0.4.13 - -2.1.4 / 2015-09-27 -================== - - * Fix masking critical errors from `iconv-lite` - * deps: iconv-lite@0.4.12 - - Fix CESU-8 decoding in Node.js 4.x - -2.1.3 / 2015-09-12 -================== - - * Fix sync callback when attaching data listener causes sync read - - Node.js 0.10 compatibility issue - -2.1.2 / 2015-07-05 -================== - - * Fix error stack traces to skip `makeError` - * deps: iconv-lite@0.4.11 - - Add encoding CESU-8 - -2.1.1 / 2015-06-14 -================== - - * Use `unpipe` module for unpiping requests - -2.1.0 / 2015-05-28 -================== - - * deps: iconv-lite@0.4.10 - - Improved UTF-16 endianness detection - - Leading BOM is now removed when decoding - - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails - -2.0.2 / 2015-05-21 -================== - - * deps: bytes@2.1.0 - - Slight optimizations - -2.0.1 / 2015-05-10 -================== - - * Fix a false-positive when unpiping in Node.js 0.8 - -2.0.0 / 2015-05-08 -================== - - * Return a promise without callback instead of thunk - * deps: bytes@2.0.1 - - units no longer case sensitive when parsing - -1.3.4 / 2015-04-15 -================== - - * Fix hanging callback if request aborts during read - * deps: iconv-lite@0.4.8 - - Add encoding alias UNICODE-1-1-UTF-7 - -1.3.3 / 2015-02-08 -================== - - * deps: iconv-lite@0.4.7 - - Gracefully support enumerables on `Object.prototype` - -1.3.2 / 2015-01-20 -================== - - * deps: iconv-lite@0.4.6 - - Fix rare aliases of single-byte encodings - -1.3.1 / 2014-11-21 -================== - - * deps: iconv-lite@0.4.5 - - Fix Windows-31J and X-SJIS encoding support - -1.3.0 / 2014-07-20 -================== - - * Fully unpipe the stream on error - - Fixes `Cannot switch to old mode now` error on Node.js 0.10+ - -1.2.3 / 2014-07-20 -================== - - * deps: iconv-lite@0.4.4 - - Added encoding UTF-7 - -1.2.2 / 2014-06-19 -================== - - * Send invalid encoding error to callback - -1.2.1 / 2014-06-15 -================== - - * deps: iconv-lite@0.4.3 - - Added encodings UTF-16BE and UTF-16 with BOM - -1.2.0 / 2014-06-13 -================== - - * Passing string as `options` interpreted as encoding - * Support all encodings from `iconv-lite` - -1.1.7 / 2014-06-12 -================== - - * use `string_decoder` module from npm - -1.1.6 / 2014-05-27 -================== - - * check encoding for old streams1 - * support node.js < 0.10.6 - -1.1.5 / 2014-05-14 -================== - - * bump bytes - -1.1.4 / 2014-04-19 -================== - - * allow true as an option - * bump bytes - -1.1.3 / 2014-03-02 -================== - - * fix case when length=null - -1.1.2 / 2013-12-01 -================== - - * be less strict on state.encoding check - -1.1.1 / 2013-11-27 -================== - - * add engines - -1.1.0 / 2013-11-27 -================== - - * add err.statusCode and err.type - * allow for encoding option to be true - * pause the stream instead of dumping on error - * throw if the stream's encoding is set - -1.0.1 / 2013-11-19 -================== - - * dont support streams1, throw if dev set encoding - -1.0.0 / 2013-11-17 -================== - - * rename `expected` option to `length` - -0.2.0 / 2013-11-15 -================== - - * republish - -0.1.1 / 2013-11-15 -================== - - * use bytes - -0.1.0 / 2013-11-11 -================== - - * generator support - -0.0.3 / 2013-10-10 -================== - - * update repo - -0.0.2 / 2013-09-14 -================== - - * dump stream on bad headers - * listen to events after defining received and buffers - -0.0.1 / 2013-09-14 -================== - - * Initial release diff --git a/project starter code/node_modules/raw-body/README.md b/project starter code/node_modules/raw-body/README.md deleted file mode 100644 index 695c6607..00000000 --- a/project starter code/node_modules/raw-body/README.md +++ /dev/null @@ -1,223 +0,0 @@ -# raw-body - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build status][github-actions-ci-image]][github-actions-ci-url] -[![Test coverage][coveralls-image]][coveralls-url] - -Gets the entire buffer of a stream either as a `Buffer` or a string. -Validates the stream's length against an expected length and maximum limit. -Ideal for parsing request bodies. - -## Install - -This is a [Node.js](https://nodejs.org/en/) module available through the -[npm registry](https://www.npmjs.com/). Installation is done using the -[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): - -```sh -$ npm install raw-body -``` - -### TypeScript - -This module includes a [TypeScript](https://www.typescriptlang.org/) -declaration file to enable auto complete in compatible editors and type -information for TypeScript projects. This module depends on the Node.js -types, so install `@types/node`: - -```sh -$ npm install @types/node -``` - -## API - -```js -var getRawBody = require('raw-body') -``` - -### getRawBody(stream, [options], [callback]) - -**Returns a promise if no callback specified and global `Promise` exists.** - -Options: - -- `length` - The length of the stream. - If the contents of the stream do not add up to this length, - an `400` error code is returned. -- `limit` - The byte limit of the body. - This is the number of bytes or any string format supported by - [bytes](https://www.npmjs.com/package/bytes), - for example `1000`, `'500kb'` or `'3mb'`. - If the body ends up being larger than this limit, - a `413` error code is returned. -- `encoding` - The encoding to use to decode the body into a string. - By default, a `Buffer` instance will be returned when no encoding is specified. - Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`. - You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme). - -You can also pass a string in place of options to just specify the encoding. - -If an error occurs, the stream will be paused, everything unpiped, -and you are responsible for correctly disposing the stream. -For HTTP requests, you may need to finish consuming the stream if -you want to keep the socket open for future requests. For streams -that use file descriptors, you should `stream.destroy()` or -`stream.close()` to prevent leaks. - -## Errors - -This module creates errors depending on the error condition during reading. -The error may be an error from the underlying Node.js implementation, but is -otherwise an error created by this module, which has the following attributes: - - * `limit` - the limit in bytes - * `length` and `expected` - the expected length of the stream - * `received` - the received bytes - * `encoding` - the invalid encoding - * `status` and `statusCode` - the corresponding status code for the error - * `type` - the error type - -### Types - -The errors from this module have a `type` property which allows for the programmatic -determination of the type of error returned. - -#### encoding.unsupported - -This error will occur when the `encoding` option is specified, but the value does -not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme) -module. - -#### entity.too.large - -This error will occur when the `limit` option is specified, but the stream has -an entity that is larger. - -#### request.aborted - -This error will occur when the request stream is aborted by the client before -reading the body has finished. - -#### request.size.invalid - -This error will occur when the `length` option is specified, but the stream has -emitted more bytes. - -#### stream.encoding.set - -This error will occur when the given stream has an encoding set on it, making it -a decoded stream. The stream should not have an encoding set and is expected to -emit `Buffer` objects. - -#### stream.not.readable - -This error will occur when the given stream is not readable. - -## Examples - -### Simple Express example - -```js -var contentType = require('content-type') -var express = require('express') -var getRawBody = require('raw-body') - -var app = express() - -app.use(function (req, res, next) { - getRawBody(req, { - length: req.headers['content-length'], - limit: '1mb', - encoding: contentType.parse(req).parameters.charset - }, function (err, string) { - if (err) return next(err) - req.text = string - next() - }) -}) - -// now access req.text -``` - -### Simple Koa example - -```js -var contentType = require('content-type') -var getRawBody = require('raw-body') -var koa = require('koa') - -var app = koa() - -app.use(function * (next) { - this.text = yield getRawBody(this.req, { - length: this.req.headers['content-length'], - limit: '1mb', - encoding: contentType.parse(this.req).parameters.charset - }) - yield next -}) - -// now access this.text -``` - -### Using as a promise - -To use this library as a promise, simply omit the `callback` and a promise is -returned, provided that a global `Promise` is defined. - -```js -var getRawBody = require('raw-body') -var http = require('http') - -var server = http.createServer(function (req, res) { - getRawBody(req) - .then(function (buf) { - res.statusCode = 200 - res.end(buf.length + ' bytes submitted') - }) - .catch(function (err) { - res.statusCode = 500 - res.end(err.message) - }) -}) - -server.listen(3000) -``` - -### Using with TypeScript - -```ts -import * as getRawBody from 'raw-body'; -import * as http from 'http'; - -const server = http.createServer((req, res) => { - getRawBody(req) - .then((buf) => { - res.statusCode = 200; - res.end(buf.length + ' bytes submitted'); - }) - .catch((err) => { - res.statusCode = err.statusCode; - res.end(err.message); - }); -}); - -server.listen(3000); -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/raw-body.svg -[npm-url]: https://npmjs.org/package/raw-body -[node-version-image]: https://img.shields.io/node/v/raw-body.svg -[node-version-url]: https://nodejs.org/en/download/ -[coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg -[coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master -[downloads-image]: https://img.shields.io/npm/dm/raw-body.svg -[downloads-url]: https://npmjs.org/package/raw-body -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/stream-utils/raw-body/ci/master?label=ci -[github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci diff --git a/project starter code/node_modules/raw-body/index.js b/project starter code/node_modules/raw-body/index.js deleted file mode 100644 index a8f537f3..00000000 --- a/project starter code/node_modules/raw-body/index.js +++ /dev/null @@ -1,329 +0,0 @@ -/*! - * raw-body - * Copyright(c) 2013-2014 Jonathan Ong - * Copyright(c) 2014-2022 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var asyncHooks = tryRequireAsyncHooks() -var bytes = require('bytes') -var createError = require('http-errors') -var iconv = require('iconv-lite') -var unpipe = require('unpipe') - -/** - * Module exports. - * @public - */ - -module.exports = getRawBody - -/** - * Module variables. - * @private - */ - -var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: / - -/** - * Get the decoder for a given encoding. - * - * @param {string} encoding - * @private - */ - -function getDecoder (encoding) { - if (!encoding) return null - - try { - return iconv.getDecoder(encoding) - } catch (e) { - // error getting decoder - if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e - - // the encoding was not found - throw createError(415, 'specified encoding unsupported', { - encoding: encoding, - type: 'encoding.unsupported' - }) - } -} - -/** - * Get the raw body of a stream (typically HTTP). - * - * @param {object} stream - * @param {object|string|function} [options] - * @param {function} [callback] - * @public - */ - -function getRawBody (stream, options, callback) { - var done = callback - var opts = options || {} - - if (options === true || typeof options === 'string') { - // short cut for encoding - opts = { - encoding: options - } - } - - if (typeof options === 'function') { - done = options - opts = {} - } - - // validate callback is a function, if provided - if (done !== undefined && typeof done !== 'function') { - throw new TypeError('argument callback must be a function') - } - - // require the callback without promises - if (!done && !global.Promise) { - throw new TypeError('argument callback is required') - } - - // get encoding - var encoding = opts.encoding !== true - ? opts.encoding - : 'utf-8' - - // convert the limit to an integer - var limit = bytes.parse(opts.limit) - - // convert the expected length to an integer - var length = opts.length != null && !isNaN(opts.length) - ? parseInt(opts.length, 10) - : null - - if (done) { - // classic callback style - return readStream(stream, encoding, length, limit, wrap(done)) - } - - return new Promise(function executor (resolve, reject) { - readStream(stream, encoding, length, limit, function onRead (err, buf) { - if (err) return reject(err) - resolve(buf) - }) - }) -} - -/** - * Halt a stream. - * - * @param {Object} stream - * @private - */ - -function halt (stream) { - // unpipe everything from the stream - unpipe(stream) - - // pause stream - if (typeof stream.pause === 'function') { - stream.pause() - } -} - -/** - * Read the data from the stream. - * - * @param {object} stream - * @param {string} encoding - * @param {number} length - * @param {number} limit - * @param {function} callback - * @public - */ - -function readStream (stream, encoding, length, limit, callback) { - var complete = false - var sync = true - - // check the length and limit options. - // note: we intentionally leave the stream paused, - // so users should handle the stream themselves. - if (limit !== null && length !== null && length > limit) { - return done(createError(413, 'request entity too large', { - expected: length, - length: length, - limit: limit, - type: 'entity.too.large' - })) - } - - // streams1: assert request encoding is buffer. - // streams2+: assert the stream encoding is buffer. - // stream._decoder: streams1 - // state.encoding: streams2 - // state.decoder: streams2, specifically < 0.10.6 - var state = stream._readableState - if (stream._decoder || (state && (state.encoding || state.decoder))) { - // developer error - return done(createError(500, 'stream encoding should not be set', { - type: 'stream.encoding.set' - })) - } - - if (typeof stream.readable !== 'undefined' && !stream.readable) { - return done(createError(500, 'stream is not readable', { - type: 'stream.not.readable' - })) - } - - var received = 0 - var decoder - - try { - decoder = getDecoder(encoding) - } catch (err) { - return done(err) - } - - var buffer = decoder - ? '' - : [] - - // attach listeners - stream.on('aborted', onAborted) - stream.on('close', cleanup) - stream.on('data', onData) - stream.on('end', onEnd) - stream.on('error', onEnd) - - // mark sync section complete - sync = false - - function done () { - var args = new Array(arguments.length) - - // copy arguments - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - - // mark complete - complete = true - - if (sync) { - process.nextTick(invokeCallback) - } else { - invokeCallback() - } - - function invokeCallback () { - cleanup() - - if (args[0]) { - // halt the stream on error - halt(stream) - } - - callback.apply(null, args) - } - } - - function onAborted () { - if (complete) return - - done(createError(400, 'request aborted', { - code: 'ECONNABORTED', - expected: length, - length: length, - received: received, - type: 'request.aborted' - })) - } - - function onData (chunk) { - if (complete) return - - received += chunk.length - - if (limit !== null && received > limit) { - done(createError(413, 'request entity too large', { - limit: limit, - received: received, - type: 'entity.too.large' - })) - } else if (decoder) { - buffer += decoder.write(chunk) - } else { - buffer.push(chunk) - } - } - - function onEnd (err) { - if (complete) return - if (err) return done(err) - - if (length !== null && received !== length) { - done(createError(400, 'request size did not match content length', { - expected: length, - length: length, - received: received, - type: 'request.size.invalid' - })) - } else { - var string = decoder - ? buffer + (decoder.end() || '') - : Buffer.concat(buffer) - done(null, string) - } - } - - function cleanup () { - buffer = null - - stream.removeListener('aborted', onAborted) - stream.removeListener('data', onData) - stream.removeListener('end', onEnd) - stream.removeListener('error', onEnd) - stream.removeListener('close', cleanup) - } -} - -/** - * Try to require async_hooks - * @private - */ - -function tryRequireAsyncHooks () { - try { - return require('async_hooks') - } catch (e) { - return {} - } -} - -/** - * Wrap function with async resource, if possible. - * AsyncResource.bind static method backported. - * @private - */ - -function wrap (fn) { - var res - - // create anonymous resource - if (asyncHooks.AsyncResource) { - res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn') - } - - // incompatible node.js - if (!res || !res.runInAsyncScope) { - return fn - } - - // return bound function - return res.runInAsyncScope.bind(res, fn, null) -} diff --git a/project starter code/node_modules/raw-body/package.json b/project starter code/node_modules/raw-body/package.json deleted file mode 100644 index 50fc90ad..00000000 --- a/project starter code/node_modules/raw-body/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "raw-body", - "description": "Get and validate the raw body of a readable stream.", - "version": "2.5.1", - "author": "Jonathan Ong (http://jongleberry.com)", - "contributors": [ - "Douglas Christopher Wilson ", - "Raynos " - ], - "license": "MIT", - "repository": "stream-utils/raw-body", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "devDependencies": { - "bluebird": "3.7.2", - "eslint": "7.32.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.25.4", - "eslint-plugin-markdown": "2.2.1", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "5.2.0", - "eslint-plugin-standard": "4.1.0", - "mocha": "9.2.1", - "nyc": "15.1.0", - "readable-stream": "2.3.7", - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.8" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "README.md", - "SECURITY.md", - "index.d.ts", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/", - "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", - "test-cov": "nyc --reporter=html --reporter=text npm test" - } -} diff --git a/project starter code/node_modules/sax/LICENSE b/project starter code/node_modules/sax/LICENSE deleted file mode 100644 index ccffa082..00000000 --- a/project starter code/node_modules/sax/LICENSE +++ /dev/null @@ -1,41 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -==== - -`String.fromCodePoint` by Mathias Bynens used according to terms of MIT -License, as follows: - - Copyright Mathias Bynens - - 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. diff --git a/project starter code/node_modules/sax/README.md b/project starter code/node_modules/sax/README.md deleted file mode 100644 index afcd3f3d..00000000 --- a/project starter code/node_modules/sax/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# sax js - -A sax-style parser for XML and HTML. - -Designed with [node](http://nodejs.org/) in mind, but should work fine in -the browser or other CommonJS implementations. - -## What This Is - -* A very simple tool to parse through an XML string. -* A stepping stone to a streaming HTML parser. -* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML - docs. - -## What This Is (probably) Not - -* An HTML Parser - That's a fine goal, but this isn't it. It's just - XML. -* A DOM Builder - You can use it to build an object model out of XML, - but it doesn't do that out of the box. -* XSLT - No DOM = no querying. -* 100% Compliant with (some other SAX implementation) - Most SAX - implementations are in Java and do a lot more than this does. -* An XML Validator - It does a little validation when in strict mode, but - not much. -* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic - masochism. -* A DTD-aware Thing - Fetching DTDs is a much bigger job. - -## Regarding `Hello, world!').close(); - -// stream usage -// takes the same options as the parser -var saxStream = require("sax").createStream(strict, options) -saxStream.on("error", function (e) { - // unhandled errors will throw, since this is a proper node - // event emitter. - console.error("error!", e) - // clear the error - this._parser.error = null - this._parser.resume() -}) -saxStream.on("opentag", function (node) { - // same object as above -}) -// pipe is supported, and it's readable/writable -// same chunks coming in also go out. -fs.createReadStream("file.xml") - .pipe(saxStream) - .pipe(fs.createWriteStream("file-copy.xml")) -``` - - -## Arguments - -Pass the following arguments to the parser function. All are optional. - -`strict` - Boolean. Whether or not to be a jerk. Default: `false`. - -`opt` - Object bag of settings regarding string formatting. All default to `false`. - -Settings supported: - -* `trim` - Boolean. Whether or not to trim text and comment nodes. -* `normalize` - Boolean. If true, then turn any whitespace into a single - space. -* `lowercase` - Boolean. If true, then lowercase tag names and attribute names - in loose mode, rather than uppercasing them. -* `xmlns` - Boolean. If true, then namespaces are supported. -* `position` - Boolean. If false, then don't track line/col/position. -* `strictEntities` - Boolean. If true, only parse [predefined XML - entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent) - (`&`, `'`, `>`, `<`, and `"`) - -## Methods - -`write` - Write bytes onto the stream. You don't have to do this all at -once. You can keep writing as much as you want. - -`close` - Close the stream. Once closed, no more data may be written until -it is done processing the buffer, which is signaled by the `end` event. - -`resume` - To gracefully handle errors, assign a listener to the `error` -event. Then, when the error is taken care of, you can call `resume` to -continue parsing. Otherwise, the parser will not continue while in an error -state. - -## Members - -At all times, the parser object will have the following members: - -`line`, `column`, `position` - Indications of the position in the XML -document where the parser currently is looking. - -`startTagPosition` - Indicates the position where the current tag starts. - -`closed` - Boolean indicating whether or not the parser can be written to. -If it's `true`, then wait for the `ready` event to write again. - -`strict` - Boolean indicating whether or not the parser is a jerk. - -`opt` - Any options passed into the constructor. - -`tag` - The current tag being dealt with. - -And a bunch of other stuff that you probably shouldn't touch. - -## Events - -All events emit with a single argument. To listen to an event, assign a -function to `on`. Functions get executed in the this-context of -the parser object. The list of supported events are also in the exported -`EVENTS` array. - -When using the stream interface, assign handlers using the EventEmitter -`on` function in the normal fashion. - -`error` - Indication that something bad happened. The error will be hanging -out on `parser.error`, and must be deleted before parsing can continue. By -listening to this event, you can keep an eye on that kind of stuff. Note: -this happens *much* more in strict mode. Argument: instance of `Error`. - -`text` - Text node. Argument: string of text. - -`doctype` - The ``. Argument: -object with `name` and `body` members. Attributes are not parsed, as -processing instructions have implementation dependent semantics. - -`sgmldeclaration` - Random SGML declarations. Stuff like `` -would trigger this kind of event. This is a weird thing to support, so it -might go away at some point. SAX isn't intended to be used to parse SGML, -after all. - -`opentagstart` - Emitted immediately when the tag name is available, -but before any attributes are encountered. Argument: object with a -`name` field and an empty `attributes` set. Note that this is the -same object that will later be emitted in the `opentag` event. - -`opentag` - An opening tag. Argument: object with `name` and `attributes`. -In non-strict mode, tag names are uppercased, unless the `lowercase` -option is set. If the `xmlns` option is set, then it will contain -namespace binding information on the `ns` member, and will have a -`local`, `prefix`, and `uri` member. - -`closetag` - A closing tag. In loose mode, tags are auto-closed if their -parent closes. In strict mode, well-formedness is enforced. Note that -self-closing tags will have `closeTag` emitted immediately after `openTag`. -Argument: tag name. - -`attribute` - An attribute node. Argument: object with `name` and `value`. -In non-strict mode, attribute names are uppercased, unless the `lowercase` -option is set. If the `xmlns` option is set, it will also contains namespace -information. - -`comment` - A comment node. Argument: the string of the comment. - -`opencdata` - The opening tag of a ``) of a `` tags trigger a `"script"` -event, and their contents are not checked for special xml characters. -If you pass `noscript: true`, then this behavior is suppressed. - -## Reporting Problems - -It's best to write a failing test if you find an issue. I will always -accept pull requests with failing tests if they demonstrate intended -behavior, but it is very hard to figure out what issue you're describing -without a test. Writing a test is also the best way for you yourself -to figure out if you really understand the issue you think you have with -sax-js. diff --git a/project starter code/node_modules/sax/package.json b/project starter code/node_modules/sax/package.json deleted file mode 100644 index d2039bf3..00000000 --- a/project starter code/node_modules/sax/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "sax", - "description": "An evented streaming XML parser in JavaScript", - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "version": "1.2.4", - "main": "lib/sax.js", - "license": "ISC", - "scripts": { - "test": "tap test/*.js --cov -j4", - "posttest": "standard -F test/*.js lib/*.js", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" - }, - "repository": "git://github.com/isaacs/sax-js.git", - "files": [ - "lib/sax.js", - "LICENSE", - "README.md" - ], - "devDependencies": { - "standard": "^8.6.0", - "tap": "^10.5.1" - } -} diff --git a/project starter code/node_modules/tinycolor2/.travis.yml b/project starter code/node_modules/tinycolor2/.travis.yml deleted file mode 100644 index 76709417..00000000 --- a/project starter code/node_modules/tinycolor2/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "12" -before_script: - - npm install -g grunt-cli -script: - - grunt default --verbose diff --git a/project starter code/node_modules/tinycolor2/Gruntfile.js b/project starter code/node_modules/tinycolor2/Gruntfile.js deleted file mode 100644 index fc137e4a..00000000 --- a/project starter code/node_modules/tinycolor2/Gruntfile.js +++ /dev/null @@ -1,56 +0,0 @@ - -module.exports = function(grunt) { - - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - meta: { - banner: '// TinyColor v<%= pkg.version %>\n' + - '// https://github.com/bgrins/TinyColor\n' + - '// <%= grunt.template.today("yyyy-mm-dd") %>, Brian Grinstead, MIT License\n' - }, - - uglify: { - options: { - mangle: true, - banner: '<%= meta.banner %>' - }, - dist: { - files: { - 'dist/tinycolor-min.js': ['tinycolor.js'] - } - } - }, - - qunit: { - all: ['test/index.html'] - }, - - - jshint: { - options: { - browser: true, - sub: true, - }, - all: ['tinycolor.js'] - }, - - docco: { - debug: { - src: ['tinycolor.js'], - options: { - output: 'docs/' - } - } - } - }); - - - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-qunit'); - grunt.loadNpmTasks('grunt-docco'); - - grunt.registerTask('default', ['jshint', 'qunit']); - grunt.registerTask('version-bump', ['jshint', 'qunit', 'uglify', 'docco']); - -}; diff --git a/project starter code/node_modules/tinycolor2/README.md b/project starter code/node_modules/tinycolor2/README.md deleted file mode 100644 index 7412a022..00000000 --- a/project starter code/node_modules/tinycolor2/README.md +++ /dev/null @@ -1,469 +0,0 @@ -# TinyColor - -## JavaScript color tooling - -TinyColor is a small, fast library for color manipulation and conversion in JavaScript. It allows many forms of input, while providing color conversions and other color utility functions. It has no dependencies. - -[![Build Status](https://travis-ci.org/bgrins/TinyColor.png?branch=master)](https://travis-ci.org/bgrins/TinyColor) - -## Including in a browser - -Download [tinycolor.js](https://raw.githubusercontent.com/bgrins/TinyColor/master/tinycolor.js) or install it with bower: - - bower install tinycolor - -Then just include it in the page in a `script` tag: -```html - - -``` -## Including in node - -`tinycolor` may also be included as a [node](http://nodejs.org/) module like so: - - npm install tinycolor2 - -Then it can be used in your script like so: -```js -var tinycolor = require("tinycolor2"); -var color = tinycolor("red"); -``` -## Usage - -Call `tinycolor(input)` or `new tinycolor(input)`, and you will have an object with the following properties. See Accepted String Input and Accepted Object Input below for more information about what is accepted. - -## Accepted String Input - -The string parsing is very permissive. It is meant to make typing a color as input as easy as possible. All commas, percentages, parenthesis are optional, and most input allow either 0-1, 0%-100%, or 0-n (where n is either 100, 255, or 360 depending on the value). - -HSL and HSV both require either 0%-100% or 0-1 for the `S`/`L`/`V` properties. The `H` (hue) can have values between 0%-100% or 0-360. - -RGB input requires either 0-255 or 0%-100%. - -If you call `tinycolor.fromRatio`, RGB and Hue input can also accept 0-1. - -Here are some examples of string input: - -### Hex, 8-digit (RGBA) Hex -```js -tinycolor("#000"); -tinycolor("000"); -tinycolor("#369C"); -tinycolor("369C"); -tinycolor("#f0f0f6"); -tinycolor("f0f0f6"); -tinycolor("#f0f0f688"); -tinycolor("f0f0f688"); -``` -### RGB, RGBA -```js -tinycolor("rgb (255, 0, 0)"); -tinycolor("rgb 255 0 0"); -tinycolor("rgba (255, 0, 0, .5)"); -tinycolor({ r: 255, g: 0, b: 0 }); -tinycolor.fromRatio({ r: 1, g: 0, b: 0 }); -tinycolor.fromRatio({ r: .5, g: .5, b: .5 }); -``` -### HSL, HSLA -```js -tinycolor("hsl(0, 100%, 50%)"); -tinycolor("hsla(0, 100%, 50%, .5)"); -tinycolor("hsl(0, 100%, 50%)"); -tinycolor("hsl 0 1.0 0.5"); -tinycolor({ h: 0, s: 1, l: .5 }); -tinycolor.fromRatio({ h: 1, s: 0, l: 0 }); -tinycolor.fromRatio({ h: .5, s: .5, l: .5 }); -``` -### HSV, HSVA -```js -tinycolor("hsv(0, 100%, 100%)"); -tinycolor("hsva(0, 100%, 100%, .5)"); -tinycolor("hsv (0 100% 100%)"); -tinycolor("hsv 0 1 1"); -tinycolor({ h: 0, s: 100, v: 100 }); -tinycolor.fromRatio({ h: 1, s: 0, v: 0 }); -tinycolor.fromRatio({ h: .5, s: .5, v: .5 }); -``` -### Named -```js -tinycolor("RED"); -tinycolor("blanchedalmond"); -tinycolor("darkblue"); -``` -### Accepted Object Input - -If you are calling this from code, you may want to use object input. Here are some examples of the different types of accepted object inputs: - - { r: 255, g: 0, b: 0 } - { r: 255, g: 0, b: 0, a: .5 } - { h: 0, s: 100, l: 50 } - { h: 0, s: 100, v: 100 } - -## Methods - -### getFormat - -Returns the format used to create the tinycolor instance -```js -var color = tinycolor("red"); -color.getFormat(); // "name" -color = tinycolor({r:255, g:255, b:255}); -color.getFormat(); // "rgb" -``` - -### getOriginalInput - -Returns the input passed into the constructor used to create the tinycolor instance -```js -var color = tinycolor("red"); -color.getOriginalInput(); // "red" -color = tinycolor({r:255, g:255, b:255}); -color.getOriginalInput(); // "{r: 255, g: 255, b: 255}" -``` - -### isValid - -Return a boolean indicating whether the color was successfully parsed. Note: if the color is not valid then it will act like `black` when being used with other methods. -```js -var color1 = tinycolor("red"); -color1.isValid(); // true -color1.toHexString(); // "#ff0000" - -var color2 = tinycolor("not a color"); -color2.isValid(); // false -color2.toString(); // "#000000" -``` -### getBrightness - -Returns the perceived brightness of a color, from `0-255`, as defined by [Web Content Accessibility Guidelines (Version 1.0)](http://www.w3.org/TR/AERT#color-contrast). -```js -var color1 = tinycolor("#fff"); -color1.getBrightness(); // 255 - -var color2 = tinycolor("#000"); -color2.getBrightness(); // 0 -``` -### isLight - -Return a boolean indicating whether the color's perceived brightness is light. -```js -var color1 = tinycolor("#fff"); -color1.isLight(); // true - -var color2 = tinycolor("#000"); -color2.isLight(); // false -``` -### isDark - -Return a boolean indicating whether the color's perceived brightness is dark. -```js -var color1 = tinycolor("#fff"); -color1.isDark(); // false - -var color2 = tinycolor("#000"); -color2.isDark(); // true -``` -### getLuminance - -Returns the perceived luminance of a color, from `0-1` as defined by [Web Content Accessibility Guidelines (Version 2.0).](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef) -```js -var color1 = tinycolor("#fff"); -color1.getLuminance(); // 1 - -var color2 = tinycolor("#000"); -color2.getLuminance(); // 0 -``` -### getAlpha - -Returns the alpha value of a color, from `0-1`. -```js -var color1 = tinycolor("rgba(255, 0, 0, .5)"); -color1.getAlpha(); // 0.5 - -var color2 = tinycolor("rgb(255, 0, 0)"); -color2.getAlpha(); // 1 - -var color3 = tinycolor("transparent"); -color3.getAlpha(); // 0 -``` -### setAlpha - -Sets the alpha value on a current color. Accepted range is in between `0-1`. -```js -var color = tinycolor("red"); -color.getAlpha(); // 1 -color.setAlpha(.5); -color.getAlpha(); // .5 -color.toRgbString(); // "rgba(255, 0, 0, .5)" -``` -### String Representations - -The following methods will return a property for the `alpha` value, which can be ignored: `toHsv`, `toHsl`, `toRgb` - -### toHsv -```js -var color = tinycolor("red"); -color.toHsv(); // { h: 0, s: 1, v: 1, a: 1 } -``` -### toHsvString -```js -var color = tinycolor("red"); -color.toHsvString(); // "hsv(0, 100%, 100%)" -color.setAlpha(0.5); -color.toHsvString(); // "hsva(0, 100%, 100%, 0.5)" -``` -### toHsl -```js -var color = tinycolor("red"); -color.toHsl(); // { h: 0, s: 1, l: 0.5, a: 1 } -``` -### toHslString -```js -var color = tinycolor("red"); -color.toHslString(); // "hsl(0, 100%, 50%)" -color.setAlpha(0.5); -color.toHslString(); // "hsla(0, 100%, 50%, 0.5)" -``` -### toHex -```js -var color = tinycolor("red"); -color.toHex(); // "ff0000" -``` -### toHexString -```js -var color = tinycolor("red"); -color.toHexString(); // "#ff0000" -``` -### toHex8 -```js -var color = tinycolor("red"); -color.toHex8(); // "ff0000ff" -``` -### toHex8String -```js -var color = tinycolor("red"); -color.toHex8String(); // "#ff0000ff" -``` -### toRgb -```js -var color = tinycolor("red"); -color.toRgb(); // { r: 255, g: 0, b: 0, a: 1 } -``` -### toRgbString -```js -var color = tinycolor("red"); -color.toRgbString(); // "rgb(255, 0, 0)" -color.setAlpha(0.5); -color.toRgbString(); // "rgba(255, 0, 0, 0.5)" -``` -### toPercentageRgb -```js -var color = tinycolor("red"); -color.toPercentageRgb() // { r: "100%", g: "0%", b: "0%", a: 1 } -``` -### toPercentageRgbString -```js -var color = tinycolor("red"); -color.toPercentageRgbString(); // "rgb(100%, 0%, 0%)" -color.setAlpha(0.5); -color.toPercentageRgbString(); // "rgba(100%, 0%, 0%, 0.5)" -``` -### toName -```js -var color = tinycolor("red"); -color.toName(); // "red" -``` -### toFilter -``` -var color = tinycolor("red"); -color.toFilter(); // "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)" -``` -### toString - -Print to a string, depending on the input format. You can also override this by passing one of `"rgb", "prgb", "hex6", "hex3", "hex8", "name", "hsl", "hsv"` into the function. -```js -var color1 = tinycolor("red"); -color1.toString(); // "red" -color1.toString("hsv"); // "hsv(0, 100%, 100%)" - -var color2 = tinycolor("rgb(255, 0, 0)"); -color2.toString(); // "rgb(255, 0, 0)" -color2.setAlpha(.5); -color2.toString(); // "rgba(255, 0, 0, 0.5)" -``` -### Color Modification - -These methods manipulate the current color, and return it for chaining. For instance: -```js -tinycolor("red").lighten().desaturate().toHexString() // "#f53d3d" -``` -### lighten - -`lighten: function(amount = 10) -> TinyColor`. Lighten the color a given amount, from 0 to 100. Providing 100 will always return white. -```js -tinycolor("#f00").lighten().toString(); // "#ff3333" -tinycolor("#f00").lighten(100).toString(); // "#ffffff" -``` -### brighten - -`brighten: function(amount = 10) -> TinyColor`. Brighten the color a given amount, from 0 to 100. -```js -tinycolor("#f00").brighten().toString(); // "#ff1919" -``` -### darken - -`darken: function(amount = 10) -> TinyColor`. Darken the color a given amount, from 0 to 100. Providing 100 will always return black. -```js -tinycolor("#f00").darken().toString(); // "#cc0000" -tinycolor("#f00").darken(100).toString(); // "#000000" -``` -### desaturate - -`desaturate: function(amount = 10) -> TinyColor`. Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling `greyscale`. -```js -tinycolor("#f00").desaturate().toString(); // "#f20d0d" -tinycolor("#f00").desaturate(100).toString(); // "#808080" -``` -### saturate - -`saturate: function(amount = 10) -> TinyColor`. Saturate the color a given amount, from 0 to 100. -```js -tinycolor("hsl(0, 10%, 50%)").saturate().toString(); // "hsl(0, 20%, 50%)" -``` -### greyscale - -`greyscale: function() -> TinyColor`. Completely desaturates a color into greyscale. Same as calling `desaturate(100)`. -```js -tinycolor("#f00").greyscale().toString(); // "#808080" -``` -### spin - -`spin: function(amount = 0) -> TinyColor`. Spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing (since it sets the hue back to what it was before). -```js -tinycolor("#f00").spin(180).toString(); // "#00ffff" -tinycolor("#f00").spin(-90).toString(); // "#7f00ff" -tinycolor("#f00").spin(90).toString(); // "#80ff00" - -// spin(0) and spin(360) do nothing -tinycolor("#f00").spin(0).toString(); // "#ff0000" -tinycolor("#f00").spin(360).toString(); // "#ff0000" -``` -### Color Combinations - -Combination functions return an array of TinyColor objects unless otherwise noted. - -### analogous - -`analogous: function(, results = 6, slices = 30) -> array`. -```js -var colors = tinycolor("#f00").analogous(); - -colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#ff0066", "#ff0033", "#ff0000", "#ff3300", "#ff6600" ] -``` -### monochromatic - -`monochromatic: function(, results = 6) -> array`. -```js -var colors = tinycolor("#f00").monochromatic(); - -colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#2a0000", "#550000", "#800000", "#aa0000", "#d40000" ] -``` -### splitcomplement - -`splitcomplement: function() -> array`. -```js -var colors = tinycolor("#f00").splitcomplement(); - -colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#ccff00", "#0066ff" ] -``` -### triad - -`triad: function() -> array`. -```js -var colors = tinycolor("#f00").triad(); - -colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#00ff00", "#0000ff" ] -``` -### tetrad - -`tetrad: function() -> array`. -```js -var colors = tinycolor("#f00").tetrad(); - -colors.map(function(t) { return t.toHexString(); }); // [ "#ff0000", "#80ff00", "#00ffff", "#7f00ff" ] - -``` -### complement - -`complement: function() -> TinyColor`. -```js -tinycolor("#f00").complement().toHexString(); // "#00ffff" -``` -## Color Utilities -```js -tinycolor.equals(color1, color2) -tinycolor.mix(color1, color2, amount = 50) -``` -### random - -Returns a random color. -```js -var color = tinycolor.random(); -color.toRgb(); // "{r: 145, g: 40, b: 198, a: 1}" -``` - -### Readability - -TinyColor assesses readability based on the [Web Content Accessibility Guidelines (Version 2.0)](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef). - -#### readability - -`readability: function(TinyColor, TinyColor) -> Object`. -Returns the contrast ratio between two colors. -```js -tinycolor.readability("#000", "#000"); // 1 -tinycolor.readability("#000", "#111"); // 1.1121078324840545 -tinycolor.readability("#000", "#fff"); // 21 -``` -Use the values in your own calculations, or use one of the convenience functions below. - -#### isReadable - -`isReadable: function(TinyColor, TinyColor, Object) -> Boolean`. Ensure that foreground and background color combinations meet WCAG guidelines. `Object` is optional, defaulting to `{level: "AA",size: "small"}`. `level` can be `"AA"` or "AAA" and `size` can be `"small"` or `"large"`. - -Here are links to read more about the [AA](http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html) and [AAA](http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast7.html) requirements. -```js -tinycolor.isReadable("#000", "#111", {}); // false -tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"small"}); //false -tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"large"}), //true -``` -#### mostReadable - -`mostReadable: function(TinyColor, [TinyColor, Tinycolor ...], Object) -> Boolean`. -Given a base color and a list of possible foreground or background colors for that base, returns the most readable color. -If none of the colors in the list is readable, `mostReadable` will return the better of black or white if `includeFallbackColors:true`. -```js -tinycolor.mostReadable("#000", ["#f00", "#0f0", "#00f"]).toHexString(); // "#00ff00" -tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString() // "#2e0c3a", -tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString() // "#000000", -``` -See [index.html](https://github.com/bgrins/TinyColor/blob/master/index.html) in the project for a demo. - -## Common operations - -### clone - -`clone: function() -> TinyColor`. -Instantiate a new TinyColor object with the same color. Any changes to the new one won't affect the old one. -```js -var color1 = tinycolor("#F00"); -var color2 = color1.clone(); -color2.setAlpha(.5); - -color1.toString(); // "#ff0000" -color2.toString(); // "rgba(255, 0, 0, 0.5)" -``` diff --git a/project starter code/node_modules/tinycolor2/bower.json b/project starter code/node_modules/tinycolor2/bower.json deleted file mode 100644 index 0837be3a..00000000 --- a/project starter code/node_modules/tinycolor2/bower.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "tinycolor", - "repository": "bgrins/TinyColor", - "version": "1.4.2", - "main": "tinycolor.js", - "scripts": ["tinycolor.js"], - "license": "MIT", - "ignore": ["test"] -} diff --git a/project starter code/node_modules/tinycolor2/demo/demo.css b/project starter code/node_modules/tinycolor2/demo/demo.css deleted file mode 100644 index 3565ad1b..00000000 --- a/project starter code/node_modules/tinycolor2/demo/demo.css +++ /dev/null @@ -1,23 +0,0 @@ - -html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } -body { font-size: 15px; line-height: 1.231; margin: 4px; background-color: #FCFFFD; } -body, button, input, select, textarea { font-family: Droid Sans, Verdana, sans-serif; color: #222; } -a { color: #33f; } -table th { width: 200px; text-align: right; padding-right:10px; font-family: Georgia serif;} -#container { width: 90%; margin:0 auto; } -#code-output { border: solid 5px #333; margin:15px; border-top-width: 40px; } -#color { width: 200px; height: 2em;} -#inputter a { padding:3px; } -.invisible { visibility: hidden; } -h1 { font-size: 3.8em; color: #293c11; font-family:Tahoma; margin: 3px 0; padding:0; } -h1 .small { font-size: 0.4em; } -h1 a { text-decoration: none } -h2 { font-size: 1.5em; color: #293c11; margin: 0;margin-left: 10px; } -h3 { color: #293c11; } -.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;} -.download { float: right; } -pre { background: #000; color: #fff; padding: 15px;} -hr { border: 0; width: 80%; border-bottom: 1px solid #aaa} -.footer { text-align:center; padding-top:30px; font-style: italic; } - -#filter-output div, #combine-output span { width: 40px; height: 40px; display:inline-block; margin: 10px; } \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js b/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js deleted file mode 100644 index 2f7d9859..00000000 --- a/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js +++ /dev/null @@ -1,4 +0,0 @@ -// TinyColor v1.4.2 -// https://github.com/bgrins/TinyColor -// 2020-09-25, Brian Grinstead, MIT License -!function(a){function b(a,d){if(a=a?a:"",d=d||{},a instanceof b)return a;if(!(this instanceof b))return new b(a,d);var e=c(a);this._originalInput=a,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=P(100*this._a)/100,this._format=d.format||e.format,this._gradientType=d.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=e.ok,this._tc_id=O++}function c(a){var b={r:0,g:0,b:0},c=1,e=null,g=null,i=null,j=!1,k=!1;return"string"==typeof a&&(a=K(a)),"object"==typeof a&&(J(a.r)&&J(a.g)&&J(a.b)?(b=d(a.r,a.g,a.b),j=!0,k="%"===String(a.r).substr(-1)?"prgb":"rgb"):J(a.h)&&J(a.s)&&J(a.v)?(e=G(a.s),g=G(a.v),b=h(a.h,e,g),j=!0,k="hsv"):J(a.h)&&J(a.s)&&J(a.l)&&(e=G(a.s),i=G(a.l),b=f(a.h,e,i),j=!0,k="hsl"),a.hasOwnProperty("a")&&(c=a.a)),c=z(c),{ok:j,format:a.format||k,r:Q(255,R(b.r,0)),g:Q(255,R(b.g,0)),b:Q(255,R(b.b,0)),a:c}}function d(a,b,c){return{r:255*A(a,255),g:255*A(b,255),b:255*A(c,255)}}function e(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,l:h}}function f(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(a=A(a,360),b=A(b,100),c=A(c,100),0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function g(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,v:h}}function h(b,c,d){b=6*A(b,360),c=A(c,100),d=A(d,100);var e=a.floor(b),f=b-e,g=d*(1-c),h=d*(1-f*c),i=d*(1-(1-f)*c),j=e%6,k=[d,h,g,g,i,d][j],l=[i,d,d,h,g,g][j],m=[g,g,i,d,d,h][j];return{r:255*k,g:255*l,b:255*m}}function i(a,b,c,d){var e=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return d&&e[0].charAt(0)==e[0].charAt(1)&&e[1].charAt(0)==e[1].charAt(1)&&e[2].charAt(0)==e[2].charAt(1)?e[0].charAt(0)+e[1].charAt(0)+e[2].charAt(0):e.join("")}function j(a,b,c,d,e){var f=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16)),F(H(d))];return e&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function k(a,b,c,d){var e=[F(H(d)),F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return e.join("")}function l(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s-=c/100,d.s=B(d.s),b(d)}function m(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s+=c/100,d.s=B(d.s),b(d)}function n(a){return b(a).desaturate(100)}function o(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l+=c/100,d.l=B(d.l),b(d)}function p(a,c){c=0===c?0:c||10;var d=b(a).toRgb();return d.r=R(0,Q(255,d.r-P(255*-(c/100)))),d.g=R(0,Q(255,d.g-P(255*-(c/100)))),d.b=R(0,Q(255,d.b-P(255*-(c/100)))),b(d)}function q(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l-=c/100,d.l=B(d.l),b(d)}function r(a,c){var d=b(a).toHsl(),e=(d.h+c)%360;return d.h=0>e?360+e:e,b(d)}function s(a){var c=b(a).toHsl();return c.h=(c.h+180)%360,b(c)}function t(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+120)%360,s:c.s,l:c.l}),b({h:(d+240)%360,s:c.s,l:c.l})]}function u(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+90)%360,s:c.s,l:c.l}),b({h:(d+180)%360,s:c.s,l:c.l}),b({h:(d+270)%360,s:c.s,l:c.l})]}function v(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+72)%360,s:c.s,l:c.l}),b({h:(d+216)%360,s:c.s,l:c.l})]}function w(a,c,d){c=c||6,d=d||30;var e=b(a).toHsl(),f=360/d,g=[b(a)];for(e.h=(e.h-(f*c>>1)+720)%360;--c;)e.h=(e.h+f)%360,g.push(b(e));return g}function x(a,c){c=c||6;for(var d=b(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/c;c--;)h.push(b({h:e,s:f,v:g})),g=(g+i)%1;return h}function y(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function z(a){return a=parseFloat(a),(isNaN(a)||0>a||a>1)&&(a=1),a}function A(b,c){D(b)&&(b="100%");var d=E(b);return b=Q(c,R(0,parseFloat(b))),d&&(b=parseInt(b*c,10)/100),a.abs(b-c)<1e-6?1:b%c/parseFloat(c)}function B(a){return Q(1,R(0,a))}function C(a){return parseInt(a,16)}function D(a){return"string"==typeof a&&-1!=a.indexOf(".")&&1===parseFloat(a)}function E(a){return"string"==typeof a&&-1!=a.indexOf("%")}function F(a){return 1==a.length?"0"+a:""+a}function G(a){return 1>=a&&(a=100*a+"%"),a}function H(b){return a.round(255*parseFloat(b)).toString(16)}function I(a){return C(a)/255}function J(a){return!!V.CSS_UNIT.exec(a)}function K(a){a=a.replace(M,"").replace(N,"").toLowerCase();var b=!1;if(T[a])a=T[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=V.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=V.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=V.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=V.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=V.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=V.hsva.exec(a))?{h:c[1],s:c[2],v:c[3],a:c[4]}:(c=V.hex8.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),a:I(c[4]),format:b?"name":"hex8"}:(c=V.hex6.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),format:b?"name":"hex"}:(c=V.hex4.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),a:I(c[4]+""+c[4]),format:b?"name":"hex8"}:(c=V.hex3.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),format:b?"name":"hex"}:!1}function L(a){var b,c;return a=a||{level:"AA",size:"small"},b=(a.level||"AA").toUpperCase(),c=(a.size||"small").toLowerCase(),"AA"!==b&&"AAA"!==b&&(b="AA"),"small"!==c&&"large"!==c&&(c="small"),{level:b,size:c}}var M=/^\s+/,N=/\s+$/,O=0,P=a.round,Q=a.min,R=a.max,S=a.random;b.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1e3},getLuminance:function(){var b,c,d,e,f,g,h=this.toRgb();return b=h.r/255,c=h.g/255,d=h.b/255,e=.03928>=b?b/12.92:a.pow((b+.055)/1.055,2.4),f=.03928>=c?c/12.92:a.pow((c+.055)/1.055,2.4),g=.03928>=d?d/12.92:a.pow((d+.055)/1.055,2.4),.2126*e+.7152*f+.0722*g},setAlpha:function(a){return this._a=z(a),this._roundA=P(100*this._a)/100,this},toHsv:function(){var a=g(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=g(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.v);return 1==this._a?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHsl:function(){var a=e(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=e(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.l);return 1==this._a?"hsl("+b+", "+c+"%, "+d+"%)":"hsla("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHex:function(a){return i(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(a){return j(this._r,this._g,this._b,this._a,a)},toHex8String:function(a){return"#"+this.toHex8(a)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(100*A(this._r,255))+"%",g:P(100*A(this._g,255))+"%",b:P(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%)":"rgba("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:U[i(this._r,this._g,this._b,!0)]||!1},toFilter:function(a){var c="#"+k(this._r,this._g,this._b,this._a),d=c,e=this._gradientType?"GradientType = 1, ":"";if(a){var f=b(a);d="#"+k(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+e+"startColorstr="+c+",endColorstr="+d+")"},toString:function(a){var b=!!a;a=a||this._format;var c=!1,d=this._a<1&&this._a>=0,e=!b&&d&&("hex"===a||"hex6"===a||"hex3"===a||"hex4"===a||"hex8"===a||"name"===a);return e?"name"===a&&0===this._a?this.toName():this.toRgbString():("rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),("hex"===a||"hex6"===a)&&(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex4"===a&&(c=this.toHex8String(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),c||this.toHexString())},clone:function(){return b(this.toString())},_applyModification:function(a,b){var c=a.apply(null,[this].concat([].slice.call(b)));return this._r=c._r,this._g=c._g,this._b=c._b,this.setAlpha(c._a),this},lighten:function(){return this._applyModification(o,arguments)},brighten:function(){return this._applyModification(p,arguments)},darken:function(){return this._applyModification(q,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(n,arguments)},spin:function(){return this._applyModification(r,arguments)},_applyCombination:function(a,b){return a.apply(null,[this].concat([].slice.call(b)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(s,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(t,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},b.fromRatio=function(a,c){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&("a"===e?d[e]=a[e]:d[e]=G(a[e]));a=d}return b(a,c)},b.equals=function(a,c){return a&&c?b(a).toRgbString()==b(c).toRgbString():!1},b.random=function(){return b.fromRatio({r:S(),g:S(),b:S()})},b.mix=function(a,c,d){d=0===d?0:d||50;var e=b(a).toRgb(),f=b(c).toRgb(),g=d/100,h={r:(f.r-e.r)*g+e.r,g:(f.g-e.g)*g+e.g,b:(f.b-e.b)*g+e.b,a:(f.a-e.a)*g+e.a};return b(h)},b.readability=function(c,d){var e=b(c),f=b(d);return(a.max(e.getLuminance(),f.getLuminance())+.05)/(a.min(e.getLuminance(),f.getLuminance())+.05)},b.isReadable=function(a,c,d){var e,f,g=b.readability(a,c);switch(f=!1,e=L(d),e.level+e.size){case"AAsmall":case"AAAlarge":f=g>=4.5;break;case"AAlarge":f=g>=3;break;case"AAAsmall":f=g>=7}return f},b.mostReadable=function(a,c,d){var e,f,g,h,i=null,j=0;d=d||{},f=d.includeFallbackColors,g=d.level,h=d.size;for(var k=0;kj&&(j=e,i=b(c[k]));return b.isReadable(a,i,{level:g,size:h})||!f?i:(d.includeFallbackColors=!1,b.mostReadable(a,["#fff","#000"],d))};var T=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=b.hexNames=y(T),V=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{CSS_UNIT:new RegExp(c),rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hsva:new RegExp("hsva"+e),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof module&&module.exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):window.tinycolor=b}(Math); \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/docs/docco.css b/project starter code/node_modules/tinycolor2/docs/docco.css deleted file mode 100644 index 04cc7ecb..00000000 --- a/project starter code/node_modules/tinycolor2/docs/docco.css +++ /dev/null @@ -1,192 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h1, h2, h3, h4, h5, h6 { - margin: 0px 0 15px 0; -} - h1 { - margin-top: 40px; - } -hr { - border: 0 none; - border-top: 1px solid #e5e5ee; - height: 1px; - margin: 20px 0; -} -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/docs/tinycolor.html b/project starter code/node_modules/tinycolor2/docs/tinycolor.html deleted file mode 100644 index 148068c1..00000000 --- a/project starter code/node_modules/tinycolor2/docs/tinycolor.html +++ /dev/null @@ -1,1023 +0,0 @@ - tinycolor.js

tinycolor.js

TinyColor v1.4.2 -https://github.com/bgrins/TinyColor -Brian Grinstead, MIT License

(function(Math) {
-
-var trimLeft = /^\s+/,
-    trimRight = /\s+$/,
-    tinyCounter = 0,
-    mathRound = Math.round,
-    mathMin = Math.min,
-    mathMax = Math.max,
-    mathRandom = Math.random;
-
-function tinycolor (color, opts) {
-
-    color = (color) ? color : '';
-    opts = opts || { };

If input is already a tinycolor, return itself

    if (color instanceof tinycolor) {
-       return color;
-    }

If we are called as a function, call using new instead

    if (!(this instanceof tinycolor)) {
-        return new tinycolor(color, opts);
-    }
-
-    var rgb = inputToRGB(color);
-    this._originalInput = color,
-    this._r = rgb.r,
-    this._g = rgb.g,
-    this._b = rgb.b,
-    this._a = rgb.a,
-    this._roundA = mathRound(100*this._a) / 100,
-    this._format = opts.format || rgb.format;
-    this._gradientType = opts.gradientType;

Don't let the range of [0,255] come back in [0,1]. -Potentially lose a little bit of precision here, but will fix issues where -.5 gets interpreted as half of the total, instead of half of 1 -If it was supposed to be 128, this was already taken care of by inputToRgb

    if (this._r < 1) { this._r = mathRound(this._r); }
-    if (this._g < 1) { this._g = mathRound(this._g); }
-    if (this._b < 1) { this._b = mathRound(this._b); }
-
-    this._ok = rgb.ok;
-    this._tc_id = tinyCounter++;
-}
-
-tinycolor.prototype = {
-    isDark: function() {
-        return this.getBrightness() < 128;
-    },
-    isLight: function() {
-        return !this.isDark();
-    },
-    isValid: function() {
-        return this._ok;
-    },
-    getOriginalInput: function() {
-      return this._originalInput;
-    },
-    getFormat: function() {
-        return this._format;
-    },
-    getAlpha: function() {
-        return this._a;
-    },
-    getBrightness: function() {

http://www.w3.org/TR/AERT#color-contrast

        var rgb = this.toRgb();
-        return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
-    },
-    getLuminance: function() {

http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

        var rgb = this.toRgb();
-        var RsRGB, GsRGB, BsRGB, R, G, B;
-        RsRGB = rgb.r/255;
-        GsRGB = rgb.g/255;
-        BsRGB = rgb.b/255;
-
-        if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
-        if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
-        if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
-        return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
-    },
-    setAlpha: function(value) {
-        this._a = boundAlpha(value);
-        this._roundA = mathRound(100*this._a) / 100;
-        return this;
-    },
-    toHsv: function() {
-        var hsv = rgbToHsv(this._r, this._g, this._b);
-        return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
-    },
-    toHsvString: function() {
-        var hsv = rgbToHsv(this._r, this._g, this._b);
-        var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
-        return (this._a == 1) ?
-          "hsv("  + h + ", " + s + "%, " + v + "%)" :
-          "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
-    },
-    toHsl: function() {
-        var hsl = rgbToHsl(this._r, this._g, this._b);
-        return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
-    },
-    toHslString: function() {
-        var hsl = rgbToHsl(this._r, this._g, this._b);
-        var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
-        return (this._a == 1) ?
-          "hsl("  + h + ", " + s + "%, " + l + "%)" :
-          "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
-    },
-    toHex: function(allow3Char) {
-        return rgbToHex(this._r, this._g, this._b, allow3Char);
-    },
-    toHexString: function(allow3Char) {
-        return '#' + this.toHex(allow3Char);
-    },
-    toHex8: function(allow4Char) {
-        return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
-    },
-    toHex8String: function(allow4Char) {
-        return '#' + this.toHex8(allow4Char);
-    },
-    toRgb: function() {
-        return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
-    },
-    toRgbString: function() {
-        return (this._a == 1) ?
-          "rgb("  + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
-          "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
-    },
-    toPercentageRgb: function() {
-        return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
-    },
-    toPercentageRgbString: function() {
-        return (this._a == 1) ?
-          "rgb("  + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
-          "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
-    },
-    toName: function() {
-        if (this._a === 0) {
-            return "transparent";
-        }
-
-        if (this._a < 1) {
-            return false;
-        }
-
-        return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
-    },
-    toFilter: function(secondColor) {
-        var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
-        var secondHex8String = hex8String;
-        var gradientType = this._gradientType ? "GradientType = 1, " : "";
-
-        if (secondColor) {
-            var s = tinycolor(secondColor);
-            secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
-        }
-
-        return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
-    },
-    toString: function(format) {
-        var formatSet = !!format;
-        format = format || this._format;
-
-        var formattedString = false;
-        var hasAlpha = this._a < 1 && this._a >= 0;
-        var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
-
-        if (needsAlphaFormat) {

Special case for "transparent", all other non-alpha formats -will return rgba when there is transparency.

            if (format === "name" && this._a === 0) {
-                return this.toName();
-            }
-            return this.toRgbString();
-        }
-        if (format === "rgb") {
-            formattedString = this.toRgbString();
-        }
-        if (format === "prgb") {
-            formattedString = this.toPercentageRgbString();
-        }
-        if (format === "hex" || format === "hex6") {
-            formattedString = this.toHexString();
-        }
-        if (format === "hex3") {
-            formattedString = this.toHexString(true);
-        }
-        if (format === "hex4") {
-            formattedString = this.toHex8String(true);
-        }
-        if (format === "hex8") {
-            formattedString = this.toHex8String();
-        }
-        if (format === "name") {
-            formattedString = this.toName();
-        }
-        if (format === "hsl") {
-            formattedString = this.toHslString();
-        }
-        if (format === "hsv") {
-            formattedString = this.toHsvString();
-        }
-
-        return formattedString || this.toHexString();
-    },
-    clone: function() {
-        return tinycolor(this.toString());
-    },
-
-    _applyModification: function(fn, args) {
-        var color = fn.apply(null, [this].concat([].slice.call(args)));
-        this._r = color._r;
-        this._g = color._g;
-        this._b = color._b;
-        this.setAlpha(color._a);
-        return this;
-    },
-    lighten: function() {
-        return this._applyModification(lighten, arguments);
-    },
-    brighten: function() {
-        return this._applyModification(brighten, arguments);
-    },
-    darken: function() {
-        return this._applyModification(darken, arguments);
-    },
-    desaturate: function() {
-        return this._applyModification(desaturate, arguments);
-    },
-    saturate: function() {
-        return this._applyModification(saturate, arguments);
-    },
-    greyscale: function() {
-        return this._applyModification(greyscale, arguments);
-    },
-    spin: function() {
-        return this._applyModification(spin, arguments);
-    },
-
-    _applyCombination: function(fn, args) {
-        return fn.apply(null, [this].concat([].slice.call(args)));
-    },
-    analogous: function() {
-        return this._applyCombination(analogous, arguments);
-    },
-    complement: function() {
-        return this._applyCombination(complement, arguments);
-    },
-    monochromatic: function() {
-        return this._applyCombination(monochromatic, arguments);
-    },
-    splitcomplement: function() {
-        return this._applyCombination(splitcomplement, arguments);
-    },
-    triad: function() {
-        return this._applyCombination(triad, arguments);
-    },
-    tetrad: function() {
-        return this._applyCombination(tetrad, arguments);
-    }
-};

If input is an object, force 1 into "1.0" to handle ratios properly -String input requires "1.0" as input, so 1 will be treated as 1

tinycolor.fromRatio = function(color, opts) {
-    if (typeof color == "object") {
-        var newColor = {};
-        for (var i in color) {
-            if (color.hasOwnProperty(i)) {
-                if (i === "a") {
-                    newColor[i] = color[i];
-                }
-                else {
-                    newColor[i] = convertToPercentage(color[i]);
-                }
-            }
-        }
-        color = newColor;
-    }
-
-    return tinycolor(color, opts);
-};

Given a string or object, convert that input to RGB -Possible string inputs:

- -
"red"
-"#f00" or "f00"
-"#ff0000" or "ff0000"
-"#ff000000" or "ff000000"
-"rgb 255 0 0" or "rgb (255, 0, 0)"
-"rgb 1.0 0 0" or "rgb (1, 0, 0)"
-"rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
-"rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
-"hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
-"hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
-"hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
-
function inputToRGB(color) {
-
-    var rgb = { r: 0, g: 0, b: 0 };
-    var a = 1;
-    var s = null;
-    var v = null;
-    var l = null;
-    var ok = false;
-    var format = false;
-
-    if (typeof color == "string") {
-        color = stringInputToObject(color);
-    }
-
-    if (typeof color == "object") {
-        if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
-            rgb = rgbToRgb(color.r, color.g, color.b);
-            ok = true;
-            format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
-        }
-        else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
-            s = convertToPercentage(color.s);
-            v = convertToPercentage(color.v);
-            rgb = hsvToRgb(color.h, s, v);
-            ok = true;
-            format = "hsv";
-        }
-        else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
-            s = convertToPercentage(color.s);
-            l = convertToPercentage(color.l);
-            rgb = hslToRgb(color.h, s, l);
-            ok = true;
-            format = "hsl";
-        }
-
-        if (color.hasOwnProperty("a")) {
-            a = color.a;
-        }
-    }
-
-    a = boundAlpha(a);
-
-    return {
-        ok: ok,
-        format: color.format || format,
-        r: mathMin(255, mathMax(rgb.r, 0)),
-        g: mathMin(255, mathMax(rgb.g, 0)),
-        b: mathMin(255, mathMax(rgb.b, 0)),
-        a: a
-    };
-}

Conversion Functions

rgbToHsl, rgbToHsv, hslToRgb, hsvToRgb modified from: -http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript

rgbToRgb -Handle bounds / percentage checking to conform to CSS color spec -http://www.w3.org/TR/css3-color/ -Assumes: r, g, b in [0, 255] or [0, 1] -Returns: { r, g, b } in [0, 255]

function rgbToRgb(r, g, b){
-    return {
-        r: bound01(r, 255) * 255,
-        g: bound01(g, 255) * 255,
-        b: bound01(b, 255) * 255
-    };
-}

rgbToHsl -Converts an RGB color value to HSL. -Assumes: r, g, and b are contained in [0, 255] or [0, 1] -Returns: { h, s, l } in [0,1]

function rgbToHsl(r, g, b) {
-
-    r = bound01(r, 255);
-    g = bound01(g, 255);
-    b = bound01(b, 255);
-
-    var max = mathMax(r, g, b), min = mathMin(r, g, b);
-    var h, s, l = (max + min) / 2;
-
-    if(max == min) {
-        h = s = 0; // achromatic
-    }
-    else {
-        var d = max - min;
-        s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
-        switch(max) {
-            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
-            case g: h = (b - r) / d + 2; break;
-            case b: h = (r - g) / d + 4; break;
-        }
-
-        h /= 6;
-    }
-
-    return { h: h, s: s, l: l };
-}

hslToRgb -Converts an HSL color value to RGB. -Assumes: h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -Returns: { r, g, b } in the set [0, 255]

function hslToRgb(h, s, l) {
-    var r, g, b;
-
-    h = bound01(h, 360);
-    s = bound01(s, 100);
-    l = bound01(l, 100);
-
-    function hue2rgb(p, q, t) {
-        if(t < 0) t += 1;
-        if(t > 1) t -= 1;
-        if(t < 1/6) return p + (q - p) * 6 * t;
-        if(t < 1/2) return q;
-        if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
-        return p;
-    }
-
-    if(s === 0) {
-        r = g = b = l; // achromatic
-    }
-    else {
-        var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
-        var p = 2 * l - q;
-        r = hue2rgb(p, q, h + 1/3);
-        g = hue2rgb(p, q, h);
-        b = hue2rgb(p, q, h - 1/3);
-    }
-
-    return { r: r * 255, g: g * 255, b: b * 255 };
-}

rgbToHsv -Converts an RGB color value to HSV -Assumes: r, g, and b are contained in the set [0, 255] or [0, 1] -Returns: { h, s, v } in [0,1]

function rgbToHsv(r, g, b) {
-
-    r = bound01(r, 255);
-    g = bound01(g, 255);
-    b = bound01(b, 255);
-
-    var max = mathMax(r, g, b), min = mathMin(r, g, b);
-    var h, s, v = max;
-
-    var d = max - min;
-    s = max === 0 ? 0 : d / max;
-
-    if(max == min) {
-        h = 0; // achromatic
-    }
-    else {
-        switch(max) {
-            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
-            case g: h = (b - r) / d + 2; break;
-            case b: h = (r - g) / d + 4; break;
-        }
-        h /= 6;
-    }
-    return { h: h, s: s, v: v };
-}

hsvToRgb -Converts an HSV color value to RGB. -Assumes: h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -Returns: { r, g, b } in the set [0, 255]

 function hsvToRgb(h, s, v) {
-
-    h = bound01(h, 360) * 6;
-    s = bound01(s, 100);
-    v = bound01(v, 100);
-
-    var i = Math.floor(h),
-        f = h - i,
-        p = v * (1 - s),
-        q = v * (1 - f * s),
-        t = v * (1 - (1 - f) * s),
-        mod = i % 6,
-        r = [v, q, p, p, t, v][mod],
-        g = [t, v, v, q, p, p][mod],
-        b = [p, p, t, v, v, q][mod];
-
-    return { r: r * 255, g: g * 255, b: b * 255 };
-}

rgbToHex -Converts an RGB color to hex -Assumes r, g, and b are contained in the set [0, 255] -Returns a 3 or 6 character hex

function rgbToHex(r, g, b, allow3Char) {
-
-    var hex = [
-        pad2(mathRound(r).toString(16)),
-        pad2(mathRound(g).toString(16)),
-        pad2(mathRound(b).toString(16))
-    ];

Return a 3 character hex if possible

    if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
-        return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
-    }
-
-    return hex.join("");
-}

rgbaToHex -Converts an RGBA color plus alpha transparency to hex -Assumes r, g, b are contained in the set [0, 255] and -a in [0, 1]. Returns a 4 or 8 character rgba hex

function rgbaToHex(r, g, b, a, allow4Char) {
-
-    var hex = [
-        pad2(mathRound(r).toString(16)),
-        pad2(mathRound(g).toString(16)),
-        pad2(mathRound(b).toString(16)),
-        pad2(convertDecimalToHex(a))
-    ];

Return a 4 character hex if possible

    if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
-        return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
-    }
-
-    return hex.join("");
-}

rgbaToArgbHex -Converts an RGBA color to an ARGB Hex8 string -Rarely used, but required for "toFilter()"

function rgbaToArgbHex(r, g, b, a) {
-
-    var hex = [
-        pad2(convertDecimalToHex(a)),
-        pad2(mathRound(r).toString(16)),
-        pad2(mathRound(g).toString(16)),
-        pad2(mathRound(b).toString(16))
-    ];
-
-    return hex.join("");
-}

equals -Can be called with any tinycolor input

tinycolor.equals = function (color1, color2) {
-    if (!color1 || !color2) { return false; }
-    return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
-};
-
-tinycolor.random = function() {
-    return tinycolor.fromRatio({
-        r: mathRandom(),
-        g: mathRandom(),
-        b: mathRandom()
-    });
-};

Modification Functions

- -

Thanks to less.js for some of the basics here -https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js

function desaturate(color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.s -= amount / 100;
-    hsl.s = clamp01(hsl.s);
-    return tinycolor(hsl);
-}
-
-function saturate(color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.s += amount / 100;
-    hsl.s = clamp01(hsl.s);
-    return tinycolor(hsl);
-}
-
-function greyscale(color) {
-    return tinycolor(color).desaturate(100);
-}
-
-function lighten (color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.l += amount / 100;
-    hsl.l = clamp01(hsl.l);
-    return tinycolor(hsl);
-}
-
-function brighten(color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var rgb = tinycolor(color).toRgb();
-    rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
-    rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
-    rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
-    return tinycolor(rgb);
-}
-
-function darken (color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.l -= amount / 100;
-    hsl.l = clamp01(hsl.l);
-    return tinycolor(hsl);
-}

Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -Values outside of this range will be wrapped into this range.

function spin(color, amount) {
-    var hsl = tinycolor(color).toHsl();
-    var hue = (hsl.h + amount) % 360;
-    hsl.h = hue < 0 ? 360 + hue : hue;
-    return tinycolor(hsl);
-}

Combination Functions

- -

Thanks to jQuery xColor for some of the ideas behind these -https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js

function complement(color) {
-    var hsl = tinycolor(color).toHsl();
-    hsl.h = (hsl.h + 180) % 360;
-    return tinycolor(hsl);
-}
-
-function triad(color) {
-    var hsl = tinycolor(color).toHsl();
-    var h = hsl.h;
-    return [
-        tinycolor(color),
-        tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
-        tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
-    ];
-}
-
-function tetrad(color) {
-    var hsl = tinycolor(color).toHsl();
-    var h = hsl.h;
-    return [
-        tinycolor(color),
-        tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
-        tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
-        tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
-    ];
-}
-
-function splitcomplement(color) {
-    var hsl = tinycolor(color).toHsl();
-    var h = hsl.h;
-    return [
-        tinycolor(color),
-        tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
-        tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
-    ];
-}
-
-function analogous(color, results, slices) {
-    results = results || 6;
-    slices = slices || 30;
-
-    var hsl = tinycolor(color).toHsl();
-    var part = 360 / slices;
-    var ret = [tinycolor(color)];
-
-    for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
-        hsl.h = (hsl.h + part) % 360;
-        ret.push(tinycolor(hsl));
-    }
-    return ret;
-}
-
-function monochromatic(color, results) {
-    results = results || 6;
-    var hsv = tinycolor(color).toHsv();
-    var h = hsv.h, s = hsv.s, v = hsv.v;
-    var ret = [];
-    var modification = 1 / results;
-
-    while (results--) {
-        ret.push(tinycolor({ h: h, s: s, v: v}));
-        v = (v + modification) % 1;
-    }
-
-    return ret;
-}

Utility Functions

tinycolor.mix = function(color1, color2, amount) {
-    amount = (amount === 0) ? 0 : (amount || 50);
-
-    var rgb1 = tinycolor(color1).toRgb();
-    var rgb2 = tinycolor(color2).toRgb();
-
-    var p = amount / 100;
-
-    var rgba = {
-        r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
-        g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
-        b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
-        a: ((rgb2.a - rgb1.a) * p) + rgb1.a
-    };
-
-    return tinycolor(rgba);
-};

Readability Functions

- -

contrast -Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)

tinycolor.readability = function(color1, color2) {
-    var c1 = tinycolor(color1);
-    var c2 = tinycolor(color2);
-    return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
-};

isReadable -Ensure that foreground and background color combinations meet WCAG2 guidelines. -The third argument is an optional Object. - the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; - the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. -If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.

Example - tinycolor.isReadable("#000", "#111") => false - tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false

tinycolor.isReadable = function(color1, color2, wcag2) {
-    var readability = tinycolor.readability(color1, color2);
-    var wcag2Parms, out;
-
-    out = false;
-
-    wcag2Parms = validateWCAG2Parms(wcag2);
-    switch (wcag2Parms.level + wcag2Parms.size) {
-        case "AAsmall":
-        case "AAAlarge":
-            out = readability >= 4.5;
-            break;
-        case "AAlarge":
-            out = readability >= 3;
-            break;
-        case "AAAsmall":
-            out = readability >= 7;
-            break;
-    }
-    return out;
-
-};

mostReadable -Given a base color and a list of possible foreground or background -colors for that base, returns the most readable color. -Optionally returns Black or White if the most readable color is unreadable. -Example - tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" - tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" - tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" - tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"

tinycolor.mostReadable = function(baseColor, colorList, args) {
-    var bestColor = null;
-    var bestScore = 0;
-    var readability;
-    var includeFallbackColors, level, size ;
-    args = args || {};
-    includeFallbackColors = args.includeFallbackColors ;
-    level = args.level;
-    size = args.size;
-
-    for (var i= 0; i < colorList.length ; i++) {
-        readability = tinycolor.readability(baseColor, colorList[i]);
-        if (readability > bestScore) {
-            bestScore = readability;
-            bestColor = tinycolor(colorList[i]);
-        }
-    }
-
-    if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
-        return bestColor;
-    }
-    else {
-        args.includeFallbackColors=false;
-        return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
-    }
-};

Big List of Colors

- -

http://www.w3.org/TR/css3-color/#svg-color

var names = tinycolor.names = {
-    aliceblue: "f0f8ff",
-    antiquewhite: "faebd7",
-    aqua: "0ff",
-    aquamarine: "7fffd4",
-    azure: "f0ffff",
-    beige: "f5f5dc",
-    bisque: "ffe4c4",
-    black: "000",
-    blanchedalmond: "ffebcd",
-    blue: "00f",
-    blueviolet: "8a2be2",
-    brown: "a52a2a",
-    burlywood: "deb887",
-    burntsienna: "ea7e5d",
-    cadetblue: "5f9ea0",
-    chartreuse: "7fff00",
-    chocolate: "d2691e",
-    coral: "ff7f50",
-    cornflowerblue: "6495ed",
-    cornsilk: "fff8dc",
-    crimson: "dc143c",
-    cyan: "0ff",
-    darkblue: "00008b",
-    darkcyan: "008b8b",
-    darkgoldenrod: "b8860b",
-    darkgray: "a9a9a9",
-    darkgreen: "006400",
-    darkgrey: "a9a9a9",
-    darkkhaki: "bdb76b",
-    darkmagenta: "8b008b",
-    darkolivegreen: "556b2f",
-    darkorange: "ff8c00",
-    darkorchid: "9932cc",
-    darkred: "8b0000",
-    darksalmon: "e9967a",
-    darkseagreen: "8fbc8f",
-    darkslateblue: "483d8b",
-    darkslategray: "2f4f4f",
-    darkslategrey: "2f4f4f",
-    darkturquoise: "00ced1",
-    darkviolet: "9400d3",
-    deeppink: "ff1493",
-    deepskyblue: "00bfff",
-    dimgray: "696969",
-    dimgrey: "696969",
-    dodgerblue: "1e90ff",
-    firebrick: "b22222",
-    floralwhite: "fffaf0",
-    forestgreen: "228b22",
-    fuchsia: "f0f",
-    gainsboro: "dcdcdc",
-    ghostwhite: "f8f8ff",
-    gold: "ffd700",
-    goldenrod: "daa520",
-    gray: "808080",
-    green: "008000",
-    greenyellow: "adff2f",
-    grey: "808080",
-    honeydew: "f0fff0",
-    hotpink: "ff69b4",
-    indianred: "cd5c5c",
-    indigo: "4b0082",
-    ivory: "fffff0",
-    khaki: "f0e68c",
-    lavender: "e6e6fa",
-    lavenderblush: "fff0f5",
-    lawngreen: "7cfc00",
-    lemonchiffon: "fffacd",
-    lightblue: "add8e6",
-    lightcoral: "f08080",
-    lightcyan: "e0ffff",
-    lightgoldenrodyellow: "fafad2",
-    lightgray: "d3d3d3",
-    lightgreen: "90ee90",
-    lightgrey: "d3d3d3",
-    lightpink: "ffb6c1",
-    lightsalmon: "ffa07a",
-    lightseagreen: "20b2aa",
-    lightskyblue: "87cefa",
-    lightslategray: "789",
-    lightslategrey: "789",
-    lightsteelblue: "b0c4de",
-    lightyellow: "ffffe0",
-    lime: "0f0",
-    limegreen: "32cd32",
-    linen: "faf0e6",
-    magenta: "f0f",
-    maroon: "800000",
-    mediumaquamarine: "66cdaa",
-    mediumblue: "0000cd",
-    mediumorchid: "ba55d3",
-    mediumpurple: "9370db",
-    mediumseagreen: "3cb371",
-    mediumslateblue: "7b68ee",
-    mediumspringgreen: "00fa9a",
-    mediumturquoise: "48d1cc",
-    mediumvioletred: "c71585",
-    midnightblue: "191970",
-    mintcream: "f5fffa",
-    mistyrose: "ffe4e1",
-    moccasin: "ffe4b5",
-    navajowhite: "ffdead",
-    navy: "000080",
-    oldlace: "fdf5e6",
-    olive: "808000",
-    olivedrab: "6b8e23",
-    orange: "ffa500",
-    orangered: "ff4500",
-    orchid: "da70d6",
-    palegoldenrod: "eee8aa",
-    palegreen: "98fb98",
-    paleturquoise: "afeeee",
-    palevioletred: "db7093",
-    papayawhip: "ffefd5",
-    peachpuff: "ffdab9",
-    peru: "cd853f",
-    pink: "ffc0cb",
-    plum: "dda0dd",
-    powderblue: "b0e0e6",
-    purple: "800080",
-    rebeccapurple: "663399",
-    red: "f00",
-    rosybrown: "bc8f8f",
-    royalblue: "4169e1",
-    saddlebrown: "8b4513",
-    salmon: "fa8072",
-    sandybrown: "f4a460",
-    seagreen: "2e8b57",
-    seashell: "fff5ee",
-    sienna: "a0522d",
-    silver: "c0c0c0",
-    skyblue: "87ceeb",
-    slateblue: "6a5acd",
-    slategray: "708090",
-    slategrey: "708090",
-    snow: "fffafa",
-    springgreen: "00ff7f",
-    steelblue: "4682b4",
-    tan: "d2b48c",
-    teal: "008080",
-    thistle: "d8bfd8",
-    tomato: "ff6347",
-    turquoise: "40e0d0",
-    violet: "ee82ee",
-    wheat: "f5deb3",
-    white: "fff",
-    whitesmoke: "f5f5f5",
-    yellow: "ff0",
-    yellowgreen: "9acd32"
-};

Make it easy to access colors via hexNames[hex]

var hexNames = tinycolor.hexNames = flip(names);

Utilities

{ 'name1': 'val1' } becomes { 'val1': 'name1' }

function flip(o) {
-    var flipped = { };
-    for (var i in o) {
-        if (o.hasOwnProperty(i)) {
-            flipped[o[i]] = i;
-        }
-    }
-    return flipped;
-}

Return a valid alpha value [0,1] with all invalid values being set to 1

function boundAlpha(a) {
-    a = parseFloat(a);
-
-    if (isNaN(a) || a < 0 || a > 1) {
-        a = 1;
-    }
-
-    return a;
-}

Take input from [0, n] and return it as [0, 1]

function bound01(n, max) {
-    if (isOnePointZero(n)) { n = "100%"; }
-
-    var processPercent = isPercentage(n);
-    n = mathMin(max, mathMax(0, parseFloat(n)));

Automatically convert percentage into number

    if (processPercent) {
-        n = parseInt(n * max, 10) / 100;
-    }

Handle floating point rounding errors

    if ((Math.abs(n - max) < 0.000001)) {
-        return 1;
-    }

Convert into [0, 1] range if it isn't already

    return (n % max) / parseFloat(max);
-}

Force a number between 0 and 1

function clamp01(val) {
-    return mathMin(1, mathMax(0, val));
-}

Parse a base-16 hex value into a base-10 integer

function parseIntFromHex(val) {
-    return parseInt(val, 16);
-}

Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0

function isOnePointZero(n) {
-    return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
-}

Check to see if string passed in is a percentage

function isPercentage(n) {
-    return typeof n === "string" && n.indexOf('%') != -1;
-}

Force a hex value to have 2 characters

function pad2(c) {
-    return c.length == 1 ? '0' + c : '' + c;
-}

Replace a decimal with it's percentage value

function convertToPercentage(n) {
-    if (n <= 1) {
-        n = (n * 100) + "%";
-    }
-
-    return n;
-}

Converts a decimal to a hex value

function convertDecimalToHex(d) {
-    return Math.round(parseFloat(d) * 255).toString(16);
-}

Converts a hex value to a decimal

function convertHexToDecimal(h) {
-    return (parseIntFromHex(h) / 255);
-}
-
-var matchers = (function() {

http://www.w3.org/TR/css3-values/#integers

    var CSS_INTEGER = "[-\\+]?\\d+%?";

http://www.w3.org/TR/css3-values/#number-value

    var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";

Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.

    var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";

Actual matching. -Parentheses and commas are optional, but not required. -Whitespace can take the place of commas or opening paren

    var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
-    var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
-
-    return {
-        CSS_UNIT: new RegExp(CSS_UNIT),
-        rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
-        rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
-        hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
-        hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
-        hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
-        hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
-        hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
-        hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
-        hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
-        hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
-    };
-})();

isValidCSSUnit -Take in a single string / number and check to see if it looks like a CSS unit -(see matchers above for definition).

function isValidCSSUnit(color) {
-    return !!matchers.CSS_UNIT.exec(color);
-}

stringInputToObject -Permissive string parsing. Take in a number of formats, and output an object -based on detected format. Returns { r, g, b } or { h, s, l } or { h, s, v}

function stringInputToObject(color) {
-
-    color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
-    var named = false;
-    if (names[color]) {
-        color = names[color];
-        named = true;
-    }
-    else if (color == 'transparent') {
-        return { r: 0, g: 0, b: 0, a: 0, format: "name" };
-    }

Try to match string input using regular expressions. -Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] -Just return an object and let the conversion functions handle that. -This way the result will be the same whether the tinycolor is initialized with string or object.

    var match;
-    if ((match = matchers.rgb.exec(color))) {
-        return { r: match[1], g: match[2], b: match[3] };
-    }
-    if ((match = matchers.rgba.exec(color))) {
-        return { r: match[1], g: match[2], b: match[3], a: match[4] };
-    }
-    if ((match = matchers.hsl.exec(color))) {
-        return { h: match[1], s: match[2], l: match[3] };
-    }
-    if ((match = matchers.hsla.exec(color))) {
-        return { h: match[1], s: match[2], l: match[3], a: match[4] };
-    }
-    if ((match = matchers.hsv.exec(color))) {
-        return { h: match[1], s: match[2], v: match[3] };
-    }
-    if ((match = matchers.hsva.exec(color))) {
-        return { h: match[1], s: match[2], v: match[3], a: match[4] };
-    }
-    if ((match = matchers.hex8.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1]),
-            g: parseIntFromHex(match[2]),
-            b: parseIntFromHex(match[3]),
-            a: convertHexToDecimal(match[4]),
-            format: named ? "name" : "hex8"
-        };
-    }
-    if ((match = matchers.hex6.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1]),
-            g: parseIntFromHex(match[2]),
-            b: parseIntFromHex(match[3]),
-            format: named ? "name" : "hex"
-        };
-    }
-    if ((match = matchers.hex4.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1] + '' + match[1]),
-            g: parseIntFromHex(match[2] + '' + match[2]),
-            b: parseIntFromHex(match[3] + '' + match[3]),
-            a: convertHexToDecimal(match[4] + '' + match[4]),
-            format: named ? "name" : "hex8"
-        };
-    }
-    if ((match = matchers.hex3.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1] + '' + match[1]),
-            g: parseIntFromHex(match[2] + '' + match[2]),
-            b: parseIntFromHex(match[3] + '' + match[3]),
-            format: named ? "name" : "hex"
-        };
-    }
-
-    return false;
-}
-
-function validateWCAG2Parms(parms) {

return valid WCAG2 parms for isReadable. -If input parms are invalid, return {"level":"AA", "size":"small"}

    var level, size;
-    parms = parms || {"level":"AA", "size":"small"};
-    level = (parms.level || "AA").toUpperCase();
-    size = (parms.size || "small").toLowerCase();
-    if (level !== "AA" && level !== "AAA") {
-        level = "AA";
-    }
-    if (size !== "small" && size !== "large") {
-        size = "small";
-    }
-    return {"level":level, "size":size};
-}

Node: Export function

if (typeof module !== "undefined" && module.exports) {
-    module.exports = tinycolor;
-}

AMD/requirejs: Define the module

else if (typeof define === 'function' && define.amd) {
-    define(function () {return tinycolor;});
-}

Browser: Expose to window

else {
-    window.tinycolor = tinycolor;
-}
-
-})(Math);
-
-
\ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/index.html b/project starter code/node_modules/tinycolor2/index.html deleted file mode 100644 index 776329bc..00000000 --- a/project starter code/node_modules/tinycolor2/index.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - TinyColor - Fast, small color manipulation in JavaScript - - - - - - - -
-

TinyColor

-

Fast, small color manipulation and conversion for JavaScript

- -

- TinyColor is a micro framework for inputting colors and - outputting colors as different formats. - Input is meant to be as permissive as possible. -

- -

Usage Documentation

-

Read all the documentation on the TinyColor project page on - github.

- -

Code

-

View the annotated source code or see the full source on github.

- -

Tests

-

View the QUnit Tests.

- -

Demo

-
-
-

- Enter a color: -

-

- Or try these: - red - 0f0 - rgb 255 128 128 - hsl(0, 100%, 50%) - hsv 0, 100%, 50% -

-

And I'll tell you what I know about it:

-
- -

-
-			
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lighten -
-
Darken -
-
Saturate -
-
Desaturate -
-
Greyscale -
-
Brighten -
-
Most Readable -
-
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Triad -
-
Tetrad -
-
Monochromatic -
-
Analogous -
-
Split Complements -
-
-
-
- - -

Credit

-

- Developed by Brian Grinstead. Big thanks to the following places: -

-
    -
  • less.js for some of the - modification functions
  • -
  • jQuery xColor for some of - the combination functions
  • -
  • w3.org for the color list and parsing rules
  • -
  • mjijackson.com - for the first stab at RGB / HSL / HSV converters
  • - -
- -
- - - \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/package.json b/project starter code/node_modules/tinycolor2/package.json deleted file mode 100644 index 7c42eef7..00000000 --- a/project starter code/node_modules/tinycolor2/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "version": "1.5.1", - "name": "tinycolor2", - "description": "Fast Color Parsing and Manipulation", - "url": "http://bgrins.github.com/TinyColor", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/bgrins/TinyColor.git" - }, - "keywords": [ - "color", - "parser", - "tinycolor" - ], - "author": "Brian Grinstead (http://briangrinstead.com)", - "main": "./tinycolor.js", - "engines": { - "node": "*" - }, - "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-concat": "~0.1.3", - "grunt-contrib-jshint": "~0.1.1", - "grunt-contrib-qunit": "^4.0.0", - "grunt-contrib-uglify": "~0.2.0", - "grunt-docco": "~0.2.0" - } -} diff --git a/project starter code/node_modules/tinycolor2/test/index.html b/project starter code/node_modules/tinycolor2/test/index.html deleted file mode 100644 index 757435ea..00000000 --- a/project starter code/node_modules/tinycolor2/test/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - -

TinyColor Tests

-

-
-

-
    -
    test markup, will be hidden
    - - - \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/test/qunit.css b/project starter code/node_modules/tinycolor2/test/qunit.css deleted file mode 100644 index cb4815b7..00000000 --- a/project starter code/node_modules/tinycolor2/test/qunit.css +++ /dev/null @@ -1,244 +0,0 @@ -/** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #0d3349; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-top-right-radius: 5px; - -webkit-border-top-left-radius: 5px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-testrunner-toolbar label { - display: inline-block; - padding: 0 .5em 0 .1em; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #eee; - overflow: hidden; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #2b81af; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - -#qunit-modulefilter-container { - float: right; -} - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #c2ccd1; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests li .runtime { - float: right; - font-size: smaller; -} - -.qunit-assert-list { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #fff; - - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -.qunit-collapsed { - display: none; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 .5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - padding: 5px; - background-color: #fff; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #3c510c; - background-color: #fff; - border-left: 10px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #fff; - border-left: 10px solid #EE5757; - white-space: pre; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 5px 5px; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-bottom-right-radius: 5px; - -webkit-border-bottom-left-radius: 5px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #2b81af; - background-color: #D2E0E6; - - border-bottom: 1px solid white; -} -#qunit-testresult .module-name { - font-weight: bold; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; - width: 1000px; - height: 1000px; -} \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/test/qunit.js b/project starter code/node_modules/tinycolor2/test/qunit.js deleted file mode 100644 index 97294187..00000000 --- a/project starter code/node_modules/tinycolor2/test/qunit.js +++ /dev/null @@ -1,2152 +0,0 @@ -/** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -(function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** - * Provides a normalized error string, correcting an issue - * with IE 7 (and prior) where Error.prototype.toString is - * not properly implemented - * - * Based on http://es5.github.com/#x15.11.4.4 - * - * @param {String|Error} error - * @return {String} error message - */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** - * Makes a clone of an object using only Array or Object as base, - * and copies over the own enumerable properties. - * - * @param {Object} obj - * @return {Object} New object with only the own properties (recursively). - */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( this.module !== config.previousModule ) { - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } else if ( config.autorun ) { - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
    " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// `assert` initialized at top of scope -// Asssert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -// We attach it to the QUnit object *after* we expose the public API, -// otherwise `assert` will become a global variable in browsers (#341). -assert = { - /** - * Asserts rough true-ish result. - * @name ok - * @function - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = escapeText( msg || (result ? "okay" : "failed" ) ); - msg = "" + msg + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
    Source:
    " + escapeText( source ) + "
    "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** - * Assert that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * @name equal - * @function - * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); - */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, - - /** - * @name notEqual - * @function - */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, - - /** - * @name propEqual - * @function - */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notPropEqual - * @function - */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name deepEqual - * @function - */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notDeepEqual - * @function - */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name strictEqual - * @function - */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, - - /** - * @name notStrictEqual - * @function - */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, 'No exception was thrown.' ); - } - } -}; - -/** - * @deprecate since 1.8.0 - * Kept assertion helpers in root for backwards compatibility. - */ -extend( QUnit, assert ); - -/** - * @deprecated since 1.9.0 - * Kept root "raises()" for backwards compatibility. - * (Note that we don't introduce assert.raises). - */ -QUnit.raises = assert[ "throws" ]; - -/** - * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 - * Kept to avoid TypeErrors for undefined methods. - */ -QUnit.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// We want access to the constructor's prototype -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** - * Config object: Maintain internal state - * Later exposed as QUnit.config - * `config` initialized at top of scope - */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Export global variables, unless an 'exports' object exists, -// in that case we assume we're in CommonJS (dealt with on the bottom of the script) -if ( typeof exports === "undefined" ) { - extend( window, QUnit ); - - // Expose QUnit object - window.QUnit = QUnit; -} - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -// Extend QUnit object, -// these after set here because they should not be exposed as global functions -extend( QUnit, { - assert: assert, - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

    " + escapeText( document.title ) + "

    " + - "

    " + - "
    " + - "

    " + - "
      "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
       "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Trigger an event on an element. - // @example triggerEvent( document.body, "click" ); - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent( "MouseEvents" ); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - - elem.dispatchEvent( event ); - } else if ( elem.fireEvent ) { - elem.fireEvent( "on" + type ); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - // consider: typeof null === object - } - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
      Expected:
      " + expected + "
      Result:
      " + actual + "
      Diff:
      " + QUnit.diff( expected, actual ) + "
      Source:
      " + escapeText( source ) + "
      "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
      Result:
      " + escapeText( actual ) + "
      Source:
      " + escapeText( source ) + "
      "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( !hasOwn.call( params, key ) ) { - continue; - } - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.protocol + "//" + window.location.host + - window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent - // load, equiv, jsDump, diff: Attached later -}); - -/** - * @deprecated: Created for backwards compatibility with test runner that set the hook function - * into QUnit.{hook}, instead of invoking it and passing the hook function. - * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. - * Doing this allows us to tell if the following methods have been overwritten on the actual - * QUnit object. - */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, duration } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, - urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, - numModules = 0, - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val, - tooltip: "[no tooltip available]" - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - urlConfigHtml += ""; - } - - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = document.getElementById( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = document.getElementById( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigCheckboxesContainer = document.createElement("span"); - urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; - urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" - // * Fallback from event.target to event.srcElement - addEvents( urlConfigCheckboxes, "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigCheckboxesContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( 'span' ); - moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -addEvent( window, "load", QUnit.load ); - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will surpress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not surpressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
      ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = (test.module + ": " + test.testName).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber ) { - return test.testNumber === config.testNumber; - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** - * Escape text for attribute or text content. - */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case '\'': - return '''; - case '"': - return '"'; - case '<': - return '<'; - case '>': - return '>'; - case '&': - return '&'; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - window.setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - - // Avoid "Member not found" error in IE8 caused by setting window.constructor - } else if ( prop !== "constructor" || a !== window ) { - a[ prop ] = b[ prop ]; - } - } - - return a; -} - -/** - * @param {HTMLElement} elem - * @param {string} type - * @param {Function} fn - */ -function addEvent( elem, type, fn ) { - // Standards-based browsers - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - // IE - } else { - elem.attachEvent( "on" + type, fn ); - } -} - -/** - * @param {Array|NodeList} elems - * @param {string} type - * @param {Function} fn - */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not neccecarily - elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); -} - -function id( name ) { - return !!( typeof document !== "undefined" && document && document.getElementById ) && - document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotaion VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && - // the regex itself - a.source === b.source && - // and its modifers - a.global === b.global && - // (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline && - a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - loop = true;// dont rewalk array - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - return false; - } - } - parents.pop(); - return true; - }, - - "object": function( b, a ) { - var i, j, loop, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || - ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - // track reference to avoid circular references - parents.push( a ); - - for ( i in a ) { // be strict: don't ensures hasOwnProperty - // and go deep - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - // don't go down the same path twice - loop = true; - } - } - aProperties.push(i); // collect a's properties - - if (!loop && !innerEquiv( a[i], b[i] ) ) { - eq = false; - break; - } - } - - callers.pop(); // unstack, we are done - parents.pop(); - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || - QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } - - // apply transition with (1..n) arguments - }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); - }; - - return innerEquiv; -}()); - -/** - * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | - * http://flesler.blogspot.com Licensed under BSD - * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 - * - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || - // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
      " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this._depth_ + (extra||0) ).join(chr); - }, - up: function( a ) { - this._depth_ += a || 1; - }, - down: function( a ) { - this._depth_ -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( !hasOwn.call( ns, i ) ) { - continue; - } - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// for CommonJS enviroments, export everything -if ( typeof exports !== "undefined" ) { - extend( exports, QUnit ); -} - -// get at whatever the global object is, like window in browsers -}( (function() {return this;}.call()) )); \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/test/test.js b/project starter code/node_modules/tinycolor2/test/test.js deleted file mode 100644 index d5bd7870..00000000 --- a/project starter code/node_modules/tinycolor2/test/test.js +++ /dev/null @@ -1,791 +0,0 @@ - -test("TinyColor initialization", function() { - ok(typeof tinycolor != "undefined", "tinycolor is initialized on the page"); - ok(typeof tinycolor("red") == "object", "tinycolor is able to be instantiated"); - - var r = tinycolor("red"); - ok(tinycolor(r) === r, "when given a tinycolor instance, tinycolor() returns it"); - ok(new tinycolor(r) === r, "when given a tinycolor instance, new tinycolor() returns it"); - equal(tinycolor("red", { format: "hex" }).toString(), "#ff0000", "tinycolor options are being parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), "#ff0000", "tinycolor options are being parsed"); - - var obj = {h: 180, s: 0.5, l: 0.5}; - var color = tinycolor(obj); - ok(obj.s === 0.5, "when given an object, the original object is not modified"); -}); - -test("Original input", function() { - var colorRgbUp = "RGB(39, 39, 39)"; - var colorRgbLow = "rgb(39, 39, 39)"; - var colorRgbMix = "RgB(39, 39, 39)"; - var tinycolorObj = tinycolor(colorRgbMix); - var inputObj = {r:100,g:100,b:100}; - var r = tinycolor("red"); - - ok(tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, "original lowercase input is returned"); - ok(tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, "original uppercase input is returned"); - ok(tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, "original mixed input is returned"); - ok(tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, "when given a tinycolor instance, the color string is returned"); - ok(tinycolor(inputObj).getOriginalInput() === inputObj, "when given an object, the object is returned"); - ok(new tinycolor("").getOriginalInput() === "", "when given an empty string, an empty string is returned"); - ok(new tinycolor(null).getOriginalInput() === "", "when given a null value, an empty string is returned"); -}); - -test("Cloning color", function() { - var originalColor = tinycolor("red"); - var originalColorRgbString = originalColor.toRgbString(); - - var clonedColor = originalColor.clone(); - ok(clonedColor.toRgbString() === originalColor.toRgbString(), "cloned color is identical"); - - clonedColor.setAlpha(0.5); - ok(clonedColor.toRgbString() !== originalColor.toRgbString(), "cloned color is changing independently from original color"); - ok(originalColorRgbString === originalColor.toRgbString(), "original color was not changed by cloned color change"); -}); - -// Taken from convertWikipediaColors.html -var conversions = [ - {"hex":"#FFFFFF","hex8":"#FFFFFFFF","rgb":{"r":"100.0%","g":"100.0%","b":"100.0%"},"hsv":{"h":"0","s":"0.000","v":"1.000"},"hsl":{"h":"0","s":"0.000","l":"1.000"}}, - {"hex":"#808080","hex8":"#808080FF","rgb":{"r":"050.0%","g":"050.0%","b":"050.0%"},"hsv":{"h":"0","s":"0.000","v":"0.500"},"hsl":{"h":"0","s":"0.000","l":"0.500"}}, - {"hex":"#000000","hex8":"#000000FF","rgb":{"r":"000.0%","g":"000.0%","b":"000.0%"},"hsv":{"h":"0","s":"0.000","v":"0.000"},"hsl":{"h":"0","s":"0.000","l":"0.000"}}, - {"hex":"#FF0000","hex8":"#FF0000FF","rgb":{"r":"100.0%","g":"000.0%","b":"000.0%"},"hsv":{"h":"0.0","s":"1.000","v":"1.000"},"hsl":{"h":"0.0","s":"1.000","l":"0.500"}}, - {"hex":"#BFBF00","hex8":"#BFBF00FF","rgb":{"r":"075.0%","g":"075.0%","b":"000.0%"},"hsv":{"h":"60.0","s":"1.000","v":"0.750"},"hsl":{"h":"60.0","s":"1.000","l":"0.375"}}, - {"hex":"#008000","hex8":"#008000FF","rgb":{"r":"000.0%","g":"050.0%","b":"000.0%"},"hsv":{"h":"120.0","s":"1.000","v":"0.500"},"hsl":{"h":"120.0","s":"1.000","l":"0.250"}}, - {"hex":"#80FFFF","hex8":"#80FFFFFF","rgb":{"r":"050.0%","g":"100.0%","b":"100.0%"},"hsv":{"h":"180.0","s":"0.500","v":"1.000"},"hsl":{"h":"180.0","s":"1.000","l":"0.750"}}, - {"hex":"#8080FF","hex8":"#8080FFFF","rgb":{"r":"050.0%","g":"050.0%","b":"100.0%"},"hsv":{"h":"240.0","s":"0.500","v":"1.000"},"hsl":{"h":"240.0","s":"1.000","l":"0.750"}}, - {"hex":"#BF40BF","hex8":"#BF40BFFF","rgb":{"r":"075.0%","g":"025.0%","b":"075.0%"},"hsv":{"h":"300.0","s":"0.667","v":"0.750"},"hsl":{"h":"300.0","s":"0.500","l":"0.500"}}, - {"hex":"#A0A424","hex8":"#A0A424FF","rgb":{"r":"062.8%","g":"064.3%","b":"014.2%"},"hsv":{"h":"61.8","s":"0.779","v":"0.643"},"hsl":{"h":"61.8","s":"0.638","l":"0.393"}}, - {"hex":"#1EAC41","hex8":"#1EAC41FF","rgb":{"r":"011.6%","g":"067.5%","b":"025.5%"},"hsv":{"h":"134.9","s":"0.828","v":"0.675"},"hsl":{"h":"134.9","s":"0.707","l":"0.396"}}, - {"hex":"#B430E5","hex8":"#B430E5FF","rgb":{"r":"070.4%","g":"018.7%","b":"089.7%"},"hsv":{"h":"283.7","s":"0.792","v":"0.897"},"hsl":{"h":"283.7","s":"0.775","l":"0.542"}}, - {"hex":"#FEF888","hex8":"#FEF888FF","rgb":{"r":"099.8%","g":"097.4%","b":"053.2%"},"hsv":{"h":"56.9","s":"0.467","v":"0.998"},"hsl":{"h":"56.9","s":"0.991","l":"0.765"}}, - {"hex":"#19CB97","hex8":"#19CB97FF","rgb":{"r":"009.9%","g":"079.5%","b":"059.1%"},"hsv":{"h":"162.4","s":"0.875","v":"0.795"},"hsl":{"h":"162.4","s":"0.779","l":"0.447"}}, - {"hex":"#362698","hex8":"#362698FF","rgb":{"r":"021.1%","g":"014.9%","b":"059.7%"},"hsv":{"h":"248.3","s":"0.750","v":"0.597"},"hsl":{"h":"248.3","s":"0.601","l":"0.373"}}, - {"hex":"#7E7EB8","hex8":"#7E7EB8FF","rgb":{"r":"049.5%","g":"049.3%","b":"072.1%"},"hsv":{"h":"240.5","s":"0.316","v":"0.721"},"hsl":{"h":"240.5","s":"0.290","l":"0.607"}} -]; - -module("Color translations"); - -test("Color Equality", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - - ok(true, tiny.isValid()); - ok(true, - "Testing " + c.hex + ": " + tiny.toRgbString() + " " + tiny.toPercentageRgbString() + " " + tiny.toHsvString() + " " + tiny.toHslString() + " " + tiny.toHexString() + - "Original: " + JSON.stringify(c.rgb) + " " + JSON.stringify(c.hsv) + " " + JSON.stringify(c.hsl) - ); - ok(tinycolor.equals(c.rgb, c.hex), "RGB equals hex " + c.hex); - ok(tinycolor.equals(c.rgb, c.hex8), "RGB equals hex " + c.hex); - ok(tinycolor.equals(c.rgb, c.hsl), "RGB equals HSL " + c.hex); - ok(tinycolor.equals(c.rgb, c.hsv), "RGB equals HSV " + c.hex); - ok(tinycolor.equals(c.rgb, c.rgb), "RGB equals RGB " + c.hex); - - ok(tinycolor.equals(c.hex, c.hex), "hex equals hex " + c.hex); - ok(tinycolor.equals(c.hex, c.hex8), "hex equals hex8 " + c.hex); - ok(tinycolor.equals(c.hex, c.hsl), "hex equals HSL " + c.hex); - ok(tinycolor.equals(c.hex, c.hsv), "hex equals HSV " + c.hex); - - ok(tinycolor.equals(c.hsl, c.hsv), "HSL equals HSV " + c.hex); - } -}); - -module("Ratio Parsing"); - -test("With Ratio", function() { - equal(tinycolor.fromRatio({r: 1, g: 1, b: 1}).toHexString(), "#ffffff", "white"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: .5 }).toRgbString(), "rgba(255, 0, 0, 0.5)", "alpha works when ratio is parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: 1 }).toRgbString(), "rgb(255, 0, 0)", "alpha = 1 works when ratio is parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: 10 }).toRgbString(), "rgb(255, 0, 0)", "alpha > 1 works when ratio is parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: -1 }).toRgbString(), "rgb(255, 0, 0)", "alpha < 1 works when ratio is parsed"); -}); - -test("Without Ratio", function() { - equal(tinycolor({r: 1, g: 1, b: 1}).toHexString(), "#010101", "010101"); - equal(tinycolor({r: .1, g: .1, b: .1}).toHexString(), "#000000", "000000"); - equal(tinycolor("rgb .1 .1 .1").toHexString(), "#000000", "000000"); -}); - -module("String Parsing"); - -test("RGB Text Parsing", function() { - equal(tinycolor("rgb 255 0 0").toHexString(), "#ff0000", "spaced input"); - equal(tinycolor("rgb(255, 0, 0)").toHexString(), "#ff0000", "parenthesized input"); - equal(tinycolor("rgb (255, 0, 0)").toHexString(), "#ff0000", "parenthesized spaced input"); - equal(tinycolor({ r: 255, g: 0, b: 0 }).toHexString(), "#ff0000", "object input"); - deepEqual (tinycolor({ r: 255, g: 0, b: 0 }).toRgb(), { r: 255, g: 0, b: 0, a: 1 }, "object input and compare"); - - - ok(tinycolor.equals({r:200, g: 100, b: 0 }, "rgb(200, 100, 0)")); - ok(tinycolor.equals({r:200, g: 100, b: 0 }, "rgb 200 100 0")); - ok(tinycolor.equals({r:200, g: 100, b: 0 }, "rgb 200 100 0")); - ok(tinycolor.equals({r:200, g: 100, b: 0, a: .4 }, "rgba 200 100 0 .4")); - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgba 200 100 0 1")); - - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgb(200, 100, 0)")); - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgb 200 100 0")); - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgb 200 100 0")); - - - ok(tinycolor.equals(tinycolor({r:200, g: 100, b: 0 }), "rgb(200, 100, 0)")); - ok(tinycolor.equals(tinycolor({r:200, g: 100, b: 0 }), "rgb 200 100 0")); - ok(tinycolor.equals(tinycolor({r:200, g: 100, b: 0 }), "rgb 200 100 0")); -}); - -test("Percentage RGB Text Parsing", function() { - equal(tinycolor("rgb 100% 0% 0%").toHexString(), "#ff0000", "spaced input"); - equal(tinycolor("rgb(100%, 0%, 0%)").toHexString(), "#ff0000", "parenthesized input"); - equal(tinycolor("rgb (100%, 0%, 0%)").toHexString(), "#ff0000", "parenthesized spaced input"); - equal(tinycolor({ r: "100%", g: "0%", b: "0%" }).toHexString(), "#ff0000", "object input"); - deepEqual (tinycolor({ r: "100%", g: "0%", b: "0%" }).toRgb(), { r: 255, g: 0, b: 0, a: 1 }, "object input and compare"); - - - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)")); - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%", a: .4 }, "rgba 90% 45% 0% .4")); - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgba 90% 45% 0% 1")); - - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)")); - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - - - ok(tinycolor.equals(tinycolor({r:"90%", g: "45%", b: "0%" }), "rgb(90%, 45%, 0%)")); - ok(tinycolor.equals(tinycolor({r:"90%", g: "45%", b: "0%" }), "rgb 90% 45% 0%")); - ok(tinycolor.equals(tinycolor({r:"90%", g: "45%", b: "0%" }), "rgb 90% 45% 0%")); -}); - -test("HSL parsing", function() { - equal(tinycolor({ h: 251, s: 100, l: .38 }).toHexString(), "#2400c2", "to hex"); - equal(tinycolor({ h: 251, s: 100, l: .38 }).toRgbString(), "rgb(36, 0, 194)", "to rgb"); - equal(tinycolor({ h: 251, s: 100, l: .38 }).toHslString(), "hsl(251, 100%, 38%)", "to hsl"); - equal(tinycolor("hsl(251, 100, 38)").toHexString(), "#2400c2", "to hex"); - equal(tinycolor("hsl(251, 100%, 38%)").toRgbString(), "rgb(36, 0, 194)", "to rgb"); - equal(tinycolor("hsl(251, 100%, 38%)").toHslString(), "hsl(251, 100%, 38%)", "to hsl"); - equal(tinycolor("hsl 100 20 10").toHslString(), "hsl(100, 20%, 10%)", "problematic hsl"); -}); - -test("Hex Parsing", function() { - equal(tinycolor("rgb 255 0 0").toHexString(), "#ff0000"); - equal(tinycolor("rgb 255 0 0").toHexString(true), "#f00"); - - equal(tinycolor("rgba 255 0 0 0.5").toHex8String(), "#ff000080"); - equal(tinycolor("rgba 255 0 0 0").toHex8String(), "#ff000000"); - equal(tinycolor("rgba 255 0 0 1").toHex8String(), "#ff0000ff"); - equal(tinycolor("rgba 255 0 0 1").toHex8String(true), "#f00f"); - - equal(tinycolor("rgb 255 0 0").toHex(), "ff0000"); - equal(tinycolor("rgb 255 0 0").toHex(true), "f00"); - equal(tinycolor("rgba 255 0 0 0.5").toHex8(), "ff000080"); -}); - -test("HSV Parsing", function() { - equal(tinycolor("hsv 251.1 0.887 .918").toHsvString(), "hsv(251, 89%, 92%)"); - equal(tinycolor("hsv 251.1 0.887 0.918").toHsvString(), "hsv(251, 89%, 92%)"); - equal(tinycolor("hsva 251.1 0.887 0.918 0.5").toHsvString(), "hsva(251, 89%, 92%, 0.5)"); -}); - -test("Invalid Parsing", function() { - var invalidColor = tinycolor("this is not a color"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor("#red"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor(" #red"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor("##123456"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor(" ##123456"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor({r: 'invalid', g: 'invalid', b: 'invalid' }); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor({h: 'invalid', s: 'invalid', l: 'invalid' }); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor({h: 'invalid', s: 'invalid', v: 'invalid' }); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); -}); - -test("Named colors", function() { - equal(tinycolor("aliceblue").toHex(), "f0f8ff"); - equal(tinycolor("antiquewhite").toHex(), "faebd7"); - equal(tinycolor("aqua").toHex(), "00ffff"); - equal(tinycolor("aquamarine").toHex(), "7fffd4"); - equal(tinycolor("azure").toHex(), "f0ffff"); - equal(tinycolor("beige").toHex(), "f5f5dc"); - equal(tinycolor("bisque").toHex(), "ffe4c4"); - equal(tinycolor("black").toHex(), "000000"); - equal(tinycolor("blanchedalmond").toHex(), "ffebcd"); - equal(tinycolor("blue").toHex(), "0000ff"); - equal(tinycolor("blueviolet").toHex(), "8a2be2"); - equal(tinycolor("brown").toHex(), "a52a2a"); - equal(tinycolor("burlywood").toHex(), "deb887"); - equal(tinycolor("cadetblue").toHex(), "5f9ea0"); - equal(tinycolor("chartreuse").toHex(), "7fff00"); - equal(tinycolor("chocolate").toHex(), "d2691e"); - equal(tinycolor("coral").toHex(), "ff7f50"); - equal(tinycolor("cornflowerblue").toHex(), "6495ed"); - equal(tinycolor("cornsilk").toHex(), "fff8dc"); - equal(tinycolor("crimson").toHex(), "dc143c"); - equal(tinycolor("cyan").toHex(), "00ffff"); - equal(tinycolor("darkblue").toHex(), "00008b"); - equal(tinycolor("darkcyan").toHex(), "008b8b"); - equal(tinycolor("darkgoldenrod").toHex(), "b8860b"); - equal(tinycolor("darkgray").toHex(), "a9a9a9"); - equal(tinycolor("darkgreen").toHex(), "006400"); - equal(tinycolor("darkkhaki").toHex(), "bdb76b"); - equal(tinycolor("darkmagenta").toHex(), "8b008b"); - equal(tinycolor("darkolivegreen").toHex(), "556b2f"); - equal(tinycolor("darkorange").toHex(), "ff8c00"); - equal(tinycolor("darkorchid").toHex(), "9932cc"); - equal(tinycolor("darkred").toHex(), "8b0000"); - equal(tinycolor("darksalmon").toHex(), "e9967a"); - equal(tinycolor("darkseagreen").toHex(), "8fbc8f"); - equal(tinycolor("darkslateblue").toHex(), "483d8b"); - equal(tinycolor("darkslategray").toHex(), "2f4f4f"); - equal(tinycolor("darkturquoise").toHex(), "00ced1"); - equal(tinycolor("darkviolet").toHex(), "9400d3"); - equal(tinycolor("deeppink").toHex(), "ff1493"); - equal(tinycolor("deepskyblue").toHex(), "00bfff"); - equal(tinycolor("dimgray").toHex(), "696969"); - equal(tinycolor("dodgerblue").toHex(), "1e90ff"); - equal(tinycolor("firebrick").toHex(), "b22222"); - equal(tinycolor("floralwhite").toHex(), "fffaf0"); - equal(tinycolor("forestgreen").toHex(), "228b22"); - equal(tinycolor("fuchsia").toHex(), "ff00ff"); - equal(tinycolor("gainsboro").toHex(), "dcdcdc"); - equal(tinycolor("ghostwhite").toHex(), "f8f8ff"); - equal(tinycolor("gold").toHex(), "ffd700"); - equal(tinycolor("goldenrod").toHex(), "daa520"); - equal(tinycolor("gray").toHex(), "808080"); - equal(tinycolor("grey").toHex(), "808080"); - equal(tinycolor("green").toHex(), "008000"); - equal(tinycolor("greenyellow").toHex(), "adff2f"); - equal(tinycolor("honeydew").toHex(), "f0fff0"); - equal(tinycolor("hotpink").toHex(), "ff69b4"); - equal(tinycolor("indianred ").toHex(), "cd5c5c"); - equal(tinycolor("indigo ").toHex(), "4b0082"); - equal(tinycolor("ivory").toHex(), "fffff0"); - equal(tinycolor("khaki").toHex(), "f0e68c"); - equal(tinycolor("lavender").toHex(), "e6e6fa"); - equal(tinycolor("lavenderblush").toHex(), "fff0f5"); - equal(tinycolor("lawngreen").toHex(), "7cfc00"); - equal(tinycolor("lemonchiffon").toHex(), "fffacd"); - equal(tinycolor("lightblue").toHex(), "add8e6"); - equal(tinycolor("lightcoral").toHex(), "f08080"); - equal(tinycolor("lightcyan").toHex(), "e0ffff"); - equal(tinycolor("lightgoldenrodyellow").toHex(), "fafad2"); - equal(tinycolor("lightgrey").toHex(), "d3d3d3"); - equal(tinycolor("lightgreen").toHex(), "90ee90"); - equal(tinycolor("lightpink").toHex(), "ffb6c1"); - equal(tinycolor("lightsalmon").toHex(), "ffa07a"); - equal(tinycolor("lightseagreen").toHex(), "20b2aa"); - equal(tinycolor("lightskyblue").toHex(), "87cefa"); - equal(tinycolor("lightslategray").toHex(), "778899"); - equal(tinycolor("lightsteelblue").toHex(), "b0c4de"); - equal(tinycolor("lightyellow").toHex(), "ffffe0"); - equal(tinycolor("lime").toHex(), "00ff00"); - equal(tinycolor("limegreen").toHex(), "32cd32"); - equal(tinycolor("linen").toHex(), "faf0e6"); - equal(tinycolor("magenta").toHex(), "ff00ff"); - equal(tinycolor("maroon").toHex(), "800000"); - equal(tinycolor("mediumaquamarine").toHex(), "66cdaa"); - equal(tinycolor("mediumblue").toHex(), "0000cd"); - equal(tinycolor("mediumorchid").toHex(), "ba55d3"); - equal(tinycolor("mediumpurple").toHex(), "9370db"); - equal(tinycolor("mediumseagreen").toHex(), "3cb371"); - equal(tinycolor("mediumslateblue").toHex(), "7b68ee"); - equal(tinycolor("mediumspringgreen").toHex(), "00fa9a"); - equal(tinycolor("mediumturquoise").toHex(), "48d1cc"); - equal(tinycolor("mediumvioletred").toHex(), "c71585"); - equal(tinycolor("midnightblue").toHex(), "191970"); - equal(tinycolor("mintcream").toHex(), "f5fffa"); - equal(tinycolor("mistyrose").toHex(), "ffe4e1"); - equal(tinycolor("moccasin").toHex(), "ffe4b5"); - equal(tinycolor("navajowhite").toHex(), "ffdead"); - equal(tinycolor("navy").toHex(), "000080"); - equal(tinycolor("oldlace").toHex(), "fdf5e6"); - equal(tinycolor("olive").toHex(), "808000"); - equal(tinycolor("olivedrab").toHex(), "6b8e23"); - equal(tinycolor("orange").toHex(), "ffa500"); - equal(tinycolor("orangered").toHex(), "ff4500"); - equal(tinycolor("orchid").toHex(), "da70d6"); - equal(tinycolor("palegoldenrod").toHex(), "eee8aa"); - equal(tinycolor("palegreen").toHex(), "98fb98"); - equal(tinycolor("paleturquoise").toHex(), "afeeee"); - equal(tinycolor("palevioletred").toHex(), "db7093"); - equal(tinycolor("papayawhip").toHex(), "ffefd5"); - equal(tinycolor("peachpuff").toHex(), "ffdab9"); - equal(tinycolor("peru").toHex(), "cd853f"); - equal(tinycolor("pink").toHex(), "ffc0cb"); - equal(tinycolor("plum").toHex(), "dda0dd"); - equal(tinycolor("powderblue").toHex(), "b0e0e6"); - equal(tinycolor("purple").toHex(), "800080"); - equal(tinycolor("rebeccapurple").toHex(), "663399"); - equal(tinycolor("red").toHex(), "ff0000"); - equal(tinycolor("rosybrown").toHex(), "bc8f8f"); - equal(tinycolor("royalblue").toHex(), "4169e1"); - equal(tinycolor("saddlebrown").toHex(), "8b4513"); - equal(tinycolor("salmon").toHex(), "fa8072"); - equal(tinycolor("sandybrown").toHex(), "f4a460"); - equal(tinycolor("seagreen").toHex(), "2e8b57"); - equal(tinycolor("seashell").toHex(), "fff5ee"); - equal(tinycolor("sienna").toHex(), "a0522d"); - equal(tinycolor("silver").toHex(), "c0c0c0"); - equal(tinycolor("skyblue").toHex(), "87ceeb"); - equal(tinycolor("slateblue").toHex(), "6a5acd"); - equal(tinycolor("slategray").toHex(), "708090"); - equal(tinycolor("snow").toHex(), "fffafa"); - equal(tinycolor("springgreen").toHex(), "00ff7f"); - equal(tinycolor("steelblue").toHex(), "4682b4"); - equal(tinycolor("tan").toHex(), "d2b48c"); - equal(tinycolor("teal").toHex(), "008080"); - equal(tinycolor("thistle").toHex(), "d8bfd8"); - equal(tinycolor("tomato").toHex(), "ff6347"); - equal(tinycolor("turquoise").toHex(), "40e0d0"); - equal(tinycolor("violet").toHex(), "ee82ee"); - equal(tinycolor("wheat").toHex(), "f5deb3"); - equal(tinycolor("white").toHex(), "ffffff"); - equal(tinycolor("whitesmoke").toHex(), "f5f5f5"); - equal(tinycolor("yellow").toHex(), "ffff00"); - equal(tinycolor("yellowgreen").toHex(), "9acd32"); - - equal(tinycolor("#f00").toName(), "red"); - equal(tinycolor("#fa0a0a").toName(), false); -}); - -module("Alpha handling"); - -test("Invalid alpha should normalize to 1", function() { - equal(tinycolor({r:255,g:20,b:10,a: -1}).toRgbString(), "rgb(255, 20, 10)", "Negative value"); - equal(tinycolor({r:255,g:20,b:10,a: -0}).toRgbString(), "rgba(255, 20, 10, 0)", "Negative 0"); - equal(tinycolor({r:255,g:20,b:10,a: 0}).toRgbString(), "rgba(255, 20, 10, 0)", "0"); - equal(tinycolor({r:255,g:20,b:10,a: .5}).toRgbString(), "rgba(255, 20, 10, 0.5)", ".5"); - equal(tinycolor({r:255,g:20,b:10,a: 1}).toRgbString(), "rgb(255, 20, 10)", "1"); - equal(tinycolor({r:255,g:20,b:10,a: 100}).toRgbString(), "rgb(255, 20, 10)", "Greater than 1"); - equal(tinycolor({r:255,g:20,b:10,a: "asdfasd"}).toRgbString(), "rgb(255, 20, 10)", "Non Numeric"); - - equal(tinycolor("#fff").toRgbString(), "rgb(255, 255, 255)", "Hex should be 1"); - equal(tinycolor("rgba 255 0 0 100").toRgbString(), "rgb(255, 0, 0)", "Greater than 1 in string parsing"); -}); - -test("toString() with alpha set", function() { - var redNamed = tinycolor.fromRatio({ r: 255, g: 0, b: 0, a: .6}, {format: "name"}); - var transparentNamed = tinycolor.fromRatio({ r: 255, g: 0, b: 0, a: 0 }, {format: "name"}); - var redHex = tinycolor.fromRatio({ r: 255, g: 0, b: 0, a: .4}, {format: "hex"}); - - equal(redNamed.getFormat(), "name", "getFormat() is correct"); - equal(redHex.getFormat(), "hex", "getFormat() is correct"); - - equal(redNamed.toString(), "rgba(255, 0, 0, 0.6)", "Names should default to rgba if alpha is < 1"); - equal(redHex.toString(), "rgba(255, 0, 0, 0.4)", "Hex should default to rgba if alpha is < 1"); - - equal(redNamed.toString("hex"), "#ff0000", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex6"), "#ff0000", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex3"), "#f00", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex8"), "#ff000099", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex4"), "#f009", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("name"), "#ff0000", "Semi transparent names should return hex in toString() if name format is specified"); - - equal(redNamed.toName(), false, "Semi transparent names should be false in toName()"); - - equal(redHex.toString(), "rgba(255, 0, 0, 0.4)", "Hex should default to rgba if alpha is < 1"); - equal(transparentNamed.toString(), "transparent", "Named color should equal transparent if alpha == 0"); - - redHex.setAlpha(0); - equal(redHex.toString(), "rgba(255, 0, 0, 0)", "Hex should default to rgba if alpha is = 0"); -}); - -test("setting alpha", function() { - var hexSetter = tinycolor("rgba(255, 0, 0, 1)"); - equal(hexSetter.getAlpha(), 1, "Alpha should start as 1"); - var returnedFromSetAlpha = hexSetter.setAlpha(.9); - equal(returnedFromSetAlpha, hexSetter, "setAlpha return value should be the color."); - equal(hexSetter.getAlpha(), .9, "setAlpha should change alpha value"); - hexSetter.setAlpha(.5); - equal(hexSetter.getAlpha(), .5, "setAlpha should change alpha value"); - hexSetter.setAlpha(0); - equal(hexSetter.getAlpha(), 0, "setAlpha should change alpha value"); - hexSetter.setAlpha(-1); - equal(hexSetter.getAlpha(), 1, "setAlpha with value < 0 should be bound to 1"); - hexSetter.setAlpha(2); - equal(hexSetter.getAlpha(), 1, "setAlpha with value > 1 should be bound to 1"); - hexSetter.setAlpha(); - equal(hexSetter.getAlpha(), 1, "setAlpha with invalid value should be bound to 1"); - hexSetter.setAlpha(null); - equal(hexSetter.getAlpha(), 1, "setAlpha with invalid value should be bound to 1"); - hexSetter.setAlpha("test"); - equal(hexSetter.getAlpha(), 1, "setAlpha with invalid value should be bound to 1"); -}); - -test("Alpha = 0 should act differently on toName()", function() { - equal(tinycolor({r:255,g:20,b:10,a: 0}).toName(), "transparent", "0"); - equal(tinycolor("transparent").toString(), "transparent", "toString when passed"); - equal(tinycolor("transparent").toHex(), "000000", "toHex"); -}); - - -module("Brightness handling"); - -test("getBrightness", function() { - equal(tinycolor('#000').getBrightness(), 0, 'returns 0 for #000'); - equal(tinycolor('#fff').getBrightness(), 255, 'returns 255 for #fff'); -}); - -test("getLuminance", function() { - equal(tinycolor('#000').getLuminance(), 0, 'returns 0 for #000'); - equal(tinycolor('#fff').getLuminance(), 1, 'returns 1 for #fff'); -}); - -test("isDark returns true/false for dark/light colors", function() { - equal(tinycolor('#000').isDark(), true, '#000 is dark'); - equal(tinycolor('#111').isDark(), true, '#111 is dark'); - equal(tinycolor('#222').isDark(), true, '#222 is dark'); - equal(tinycolor('#333').isDark(), true, '#333 is dark'); - equal(tinycolor('#444').isDark(), true, '#444 is dark'); - equal(tinycolor('#555').isDark(), true, '#555 is dark'); - equal(tinycolor('#666').isDark(), true, '#666 is dark'); - equal(tinycolor('#777').isDark(), true, '#777 is dark'); - equal(tinycolor('#888').isDark(), false, '#888 is not dark'); - equal(tinycolor('#999').isDark(), false, '#999 is not dark'); - equal(tinycolor('#aaa').isDark(), false, '#aaa is not dark'); - equal(tinycolor('#bbb').isDark(), false, '#bbb is not dark'); - equal(tinycolor('#ccc').isDark(), false, '#ccc is not dark'); - equal(tinycolor('#ddd').isDark(), false, '#ddd is not dark'); - equal(tinycolor('#eee').isDark(), false, '#eee is not dark'); - equal(tinycolor('#fff').isDark(), false, '#fff is not dark'); -}); - -test("isLight returns true/false for light/dark colors", function() { - equal(tinycolor('#000').isLight(), false, '#000 is not light'); - equal(tinycolor('#111').isLight(), false, '#111 is not light'); - equal(tinycolor('#222').isLight(), false, '#222 is not light'); - equal(tinycolor('#333').isLight(), false, '#333 is not light'); - equal(tinycolor('#444').isLight(), false, '#444 is not light'); - equal(tinycolor('#555').isLight(), false, '#555 is not light'); - equal(tinycolor('#666').isLight(), false, '#666 is not light'); - equal(tinycolor('#777').isLight(), false, '#777 is not light'); - equal(tinycolor('#888').isLight(), true, '#888 is light'); - equal(tinycolor('#999').isLight(), true, '#999 is light'); - equal(tinycolor('#aaa').isLight(), true, '#aaa is light'); - equal(tinycolor('#bbb').isLight(), true, '#bbb is light'); - equal(tinycolor('#ccc').isLight(), true, '#ccc is light'); - equal(tinycolor('#ddd').isLight(), true, '#ddd is light'); - equal(tinycolor('#eee').isLight(), true, '#eee is light'); - equal(tinycolor('#fff').isLight(), true, '#fff is light'); -}); - -module("Initialization from tinycolor output"); - -test("HSL Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toHsl()).toHexString(), "HSL Object"); - } -}); - -test("HSL String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toHslString()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "toHslString red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "toHslString green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "toHslString blue value difference <= " + maxDiff); - } -}); - -test("HSV String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toHsvString()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "toHsvString red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "toHsvString green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "toHsvString blue value difference <= " + maxDiff); - } -}); - -test("HSV Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toHsv()).toHexString(), "HSV Object"); - } -}); - -test("RGB Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toRgb()).toHexString(), "RGB Object"); - } -}); - -test("RGB String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toRgbString()).toHexString(), "RGB String"); - } -}); - -test("PRGB Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toPercentageRgb()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "Red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "Green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "Blue value difference <= " + maxDiff); - } -}); - -test("PRGB String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toPercentageRgbString()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "Red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "Green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "Blue value difference <= " + maxDiff); - } -}); - -test("Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny).toHexString(), "Object"); - } -}); - -module("Utilities"); - -test("Color equality", function() { - ok(tinycolor.equals("#ff0000", "#ff0000"), "Same hex"); - ok(tinycolor.equals("#ff0000", "rgb(255, 0, 0)"), "Same alphas"); - ok(!tinycolor.equals("#ff0000", "rgba(255, 0, 0, .1)"), "Different alphas"); - ok(tinycolor.equals("#ff000066", "rgba(255, 0, 0, .4)"), "Same alphas"); - ok(tinycolor.equals("#f009", "rgba(255, 0, 0, .6)"), "Same alphas"); - ok(tinycolor.equals("#336699CC", "369C"), "Same hex"); - ok(tinycolor.equals("ff0000", "#ff0000"), "Same hex"); - ok(tinycolor.equals("#f00", "#ff0000"), "Same hex"); - ok(tinycolor.equals("#f00", "#ff0000"), "Same hex"); - ok(tinycolor.equals("f00", "#ff0000"), "Same hex"); - equal(tinycolor("010101").toHexString(), "#010101"); - ok(!tinycolor.equals("#ff0000", "#00ff00"), "Different hex"); - ok(tinycolor.equals("#ff8000", "rgb(100%, 50%, 0%)"), "Percentage bounds checking"); -}); - -test("isReadable", function() { - // "#ff0088", "#8822aa" (values used in old WCAG1 tests) - ok(tinycolor.isReadable("#000000", "#ffffff",{level:"AA",size:"small"}), "white/black is readable"); - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{}), "not readable - empty wcag2 object"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AA",size:"small"}), "not readable - AA small"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AA",size:"large"}), "not readable - AA large"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AAA",size:"small"}), "not readable - AAA small"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AAA",size:"large"}), "not readable - AAA large"); - - // values derived from and validated using the calculators at http://www.dasplankton.de/ContrastA/ - // and http://webaim.org/resources/contrastchecker/ - - // "#ff0088", "#5c1a72": contrast ratio 3.04 - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"small"}), "not readable - AA small"); - ok(tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"large"}), "readable - AA large"); - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AAA",size:"small"}), "not readable - AAA small"); - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AAA",size:"large"}), "not readable - AAA large"); - - // "#ff0088", "#2e0c3a": contrast ratio 4.56 - ok(tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AA",size:"small"}), "readable - AA small"); - ok(tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AA",size:"large"}), "readable - AA large"); - ok(!tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AAA",size:"small"}), "not readable - AAA small"); - ok(tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AAA",size:"large"}), "readable - AAA large"); - - // "#db91b8", "#2e0c3a": contrast ratio 7.12 - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AA",size:"small"}), "readable - AA small"); - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AA",size:"large"}), "readable - AA large"); - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AAA",size:"small"}), "readable - AAA small"); - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AAA",size:"large"}), "readable - AAA large"); -}); - -test("readability", function() { - // check return values from readability function. See isReadable above for standards tests. - equal(tinycolor.readability("#000", "#000"), 1, "Readability function test 0"); - deepEqual(tinycolor.readability("#000", "#111"), 1.1121078324840545, "Readability function test 1"); - deepEqual(tinycolor.readability("#000", "#fff"), 21, "Readability function test 2"); -}); - -test("mostReadable", function () { - equal(tinycolor.mostReadable("#000", ["#111", "#222",{wcag2:{}}]).toHexString(), "#222222", "readable color present"); - equal(tinycolor.mostReadable("#f00", ["#d00", "#0d0"],{wcag2:{}}).toHexString(), "#00dd00", "readable color present"); - equal(tinycolor.mostReadable("#fff", ["#fff", "#fff"],{wcag2:{}}).toHexString(), "#ffffff", "no different color in list"); - //includeFallbackColors - equal(tinycolor.mostReadable("#fff", ["#fff", "#fff"],{includeFallbackColors:true}).toHexString(), "#000000", "no different color in list"); - equal(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(), "#112255", "no readable color in list"); - equal(tinycolor.mostReadable("#123", ["#000", "#fff"],{includeFallbackColors:false}).toHexString(), "#ffffff", "verify assumption"); - equal(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(), "#ffffff", "no readable color in list"); - - equal(tinycolor.mostReadable("#ff0088", ["#000", "#fff"],{includeFallbackColors:false}).toHexString(), "#000000", "verify assumption"); - equal(tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(), "#2e0c3a", "readable color present"); - equal(tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(), "#000000", "no readable color in list"); - - equal(tinycolor.mostReadable("#371b2c", ["#000", "#fff"],{includeFallbackColors:false}).toHexString(), "#ffffff", "verify assumption"); - equal(tinycolor.mostReadable("#371b2c", ["#a9acb6"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(), "#a9acb6", "readable color present"); - equal(tinycolor.mostReadable("#371b2c", ["#a9acb6"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(), "#ffffff", "no readable color in list"); -}); - - -test("Filters", function () { - equal(tinycolor("red").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)"); - equal(tinycolor("red").toFilter("blue"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ff0000ff)"); - - equal(tinycolor("transparent").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#00000000)"); - equal(tinycolor("transparent").toFilter("red"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ffff0000)"); - - equal(tinycolor("#f0f0f0dd").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ddf0f0f0,endColorstr=#ddf0f0f0)"); - equal(tinycolor("rgba(0, 0, 255, .5").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#800000ff,endColorstr=#800000ff)"); -}); - -module("Modifications"); - -/* Originally generated with: -var results = []; -for (var i = 0; i <= 100; i++) results.push( tinycolor.saturate("red", i).toHex() ) -console.log(JSON.stringify(results)) -*/ -var DESATURATIONS = ["ff0000","fe0101","fc0303","fb0404","fa0505","f90606","f70808","f60909","f50a0a","f40b0b","f20d0d","f10e0e","f00f0f","ee1111","ed1212","ec1313","eb1414","e91616","e81717","e71818","e61919","e41b1b","e31c1c","e21d1d","e01f1f","df2020","de2121","dd2222","db2424","da2525","d92626","d72828","d62929","d52a2a","d42b2b","d22d2d","d12e2e","d02f2f","cf3030","cd3232","cc3333","cb3434","c93636","c83737","c73838","c63939","c43b3b","c33c3c","c23d3d","c13e3e","bf4040","be4141","bd4242","bb4444","ba4545","b94646","b84747","b64949","b54a4a","b44b4b","b34d4d","b14e4e","b04f4f","af5050","ad5252","ac5353","ab5454","aa5555","a85757","a75858","a65959","a45b5b","a35c5c","a25d5d","a15e5e","9f6060","9e6161","9d6262","9c6363","9a6565","996666","986767","966969","956a6a","946b6b","936c6c","916e6e","906f6f","8f7070","8e7171","8c7373","8b7474","8a7575","887777","877878","867979","857a7a","837c7c","827d7d","817e7e","808080"]; -var SATURATIONS = ["ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000"]; -var LIGHTENS = ["ff0000","ff0505","ff0a0a","ff0f0f","ff1414","ff1a1a","ff1f1f","ff2424","ff2929","ff2e2e","ff3333","ff3838","ff3d3d","ff4242","ff4747","ff4d4d","ff5252","ff5757","ff5c5c","ff6161","ff6666","ff6b6b","ff7070","ff7575","ff7a7a","ff8080","ff8585","ff8a8a","ff8f8f","ff9494","ff9999","ff9e9e","ffa3a3","ffa8a8","ffadad","ffb3b3","ffb8b8","ffbdbd","ffc2c2","ffc7c7","ffcccc","ffd1d1","ffd6d6","ffdbdb","ffe0e0","ffe5e5","ffebeb","fff0f0","fff5f5","fffafa","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff"]; -var BRIGHTENS = ["ff0000","ff0303","ff0505","ff0808","ff0a0a","ff0d0d","ff0f0f","ff1212","ff1414","ff1717","ff1919","ff1c1c","ff1f1f","ff2121","ff2424","ff2626","ff2929","ff2b2b","ff2e2e","ff3030","ff3333","ff3636","ff3838","ff3b3b","ff3d3d","ff4040","ff4242","ff4545","ff4747","ff4a4a","ff4c4c","ff4f4f","ff5252","ff5454","ff5757","ff5959","ff5c5c","ff5e5e","ff6161","ff6363","ff6666","ff6969","ff6b6b","ff6e6e","ff7070","ff7373","ff7575","ff7878","ff7a7a","ff7d7d","ff7f7f","ff8282","ff8585","ff8787","ff8a8a","ff8c8c","ff8f8f","ff9191","ff9494","ff9696","ff9999","ff9c9c","ff9e9e","ffa1a1","ffa3a3","ffa6a6","ffa8a8","ffabab","ffadad","ffb0b0","ffb2b2","ffb5b5","ffb8b8","ffbaba","ffbdbd","ffbfbf","ffc2c2","ffc4c4","ffc7c7","ffc9c9","ffcccc","ffcfcf","ffd1d1","ffd4d4","ffd6d6","ffd9d9","ffdbdb","ffdede","ffe0e0","ffe3e3","ffe5e5","ffe8e8","ffebeb","ffeded","fff0f0","fff2f2","fff5f5","fff7f7","fffafa","fffcfc","ffffff"]; -var DARKENS = ["ff0000","fa0000","f50000","f00000","eb0000","e60000","e00000","db0000","d60000","d10000","cc0000","c70000","c20000","bd0000","b80000","b30000","ad0000","a80000","a30000","9e0000","990000","940000","8f0000","8a0000","850000","800000","7a0000","750000","700000","6b0000","660000","610000","5c0000","570000","520000","4d0000","470000","420000","3d0000","380000","330000","2e0000","290000","240000","1f0000","190000","140000","0f0000","0a0000","050000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000"]; - -test("Modifications", function () { - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").desaturate(i).toHex(), DESATURATIONS[i], "Desaturation " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").saturate(i).toHex(), SATURATIONS[i], "Saturation " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").lighten(i).toHex(), LIGHTENS[i], "Lighten " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").brighten(i).toHex(), BRIGHTENS[i], "Brighter " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").darken(i).toHex(), DARKENS[i], "Darken " + i + " works"); - } - - equal(tinycolor("red").greyscale().toHex(), "808080", "Greyscale works"); -}); - -test("Spin", function () { - equal(Math.round(tinycolor("#f00").spin(-1234).toHsl().h), 206, "Spinning -1234 works"); - equal(Math.round(tinycolor("#f00").spin(-360).toHsl().h), 0, "Spinning -360 works"); - equal(Math.round(tinycolor("#f00").spin(-120).toHsl().h), 240, "Spinning -120 works"); - equal(Math.round(tinycolor("#f00").spin(0).toHsl().h), 0, "Spinning 0 works"); - equal(Math.round(tinycolor("#f00").spin(10).toHsl().h), 10, "Spinning 10 works"); - equal(Math.round(tinycolor("#f00").spin(360).toHsl().h), 0, "Spinning 360 works"); - equal(Math.round(tinycolor("#f00").spin(2345).toHsl().h), 185, "Spinning 2345 works"); - - [-360, 0, 360].forEach(function (delta) { - Object.keys(tinycolor.names).forEach(function (name) { - equal(tinycolor(name).toHex(), tinycolor(name).spin(delta).toHex(), "Spinning " + delta.toString() + " has no effect") - }) - }) -}); - -test("Mix", function () { - // amount 0 or none - equal(tinycolor.mix('#000', '#fff').toHsl().l, 0.5, "Mixing without amount works"); - equal(tinycolor.mix('#f00', '#000', 0).toHex(), 'ff0000', "Mixing with 0 amount works"); - // This case checks the the problem with floating point numbers (eg 255/90) - equal(tinycolor.mix('#fff', '#000', 90).toHex(), '1a1a1a', "Mixing with 90 amount works correctly"); - - // black and white - for (var i = 0; i < 100; i++) { - equal(Math.round(tinycolor.mix('#000', '#fff', i).toHsl().l * 100) / 100, i / 100, "Mixing black and white with " + i + " amount works"); - } - - // with colors - for (var i = 0; i < 100; i++) { - var new_hex = Math.round((255 * (100 - i)) / 100).toString(16); - - if (new_hex.length === 1) { - new_hex = '0' + new_hex; - } - - equal(tinycolor.mix('#f00', '#000', i).toHex(), new_hex + '0000', "Mixing " + i + " (red channel)"); - equal(tinycolor.mix('#0f0', '#000', i).toHex(), '00' + new_hex + '00', "Mixing " + i + " (green channel)"); - equal(tinycolor.mix('#00f', '#000', i).toHex(), '0000' + new_hex, "Mixing " + i + " (blue channel)"); - equal(tinycolor.mix(tinycolor('transparent'), '#000', i).toRgb().a, i / 100, "Mixing " + i + " (alpha channel)"); - } -}); - -// The combination tests need to be expanded further -module("Combinations"); - -function colorsToHexString(colors) { - return colors.map(function(c) { - return c.toHex(); - }).join(","); -} - -test("complement", function() { - var complementDoesntModifyInstance = tinycolor("red"); - equal(complementDoesntModifyInstance.complement().toHex(), "00ffff", "Complement works"); - equal(complementDoesntModifyInstance.toHex(), "ff0000", "Complement did not modify this color"); -}); - -test("analogous", function() { - var combination = tinycolor("red").analogous(); - equal(colorsToHexString(combination), "ff0000,ff0066,ff0033,ff0000,ff3300,ff6600", "Correct Combination"); -}); - -test("monochromatic", function() { - var combination = tinycolor("red").monochromatic(); - equal(colorsToHexString(combination), "ff0000,2a0000,550000,800000,aa0000,d40000", "Correct Combination"); -}); - -test("splitcomplement", function() { - var combination = tinycolor("red").splitcomplement(); - equal(colorsToHexString(combination), "ff0000,ccff00,0066ff", "Correct Combination"); -}); - -test("triad", function() { - var combination = tinycolor("red").triad(); - equal(colorsToHexString(combination), "ff0000,00ff00,0000ff", "Correct Combination"); -}); - -test("tetrad", function() { - var combination = tinycolor("red").tetrad(); - equal(colorsToHexString(combination), "ff0000,80ff00,00ffff,7f00ff", "Correct Combination"); -}); diff --git a/project starter code/node_modules/tinycolor2/tinycolor.js b/project starter code/node_modules/tinycolor2/tinycolor.js deleted file mode 100644 index 9ce79d84..00000000 --- a/project starter code/node_modules/tinycolor2/tinycolor.js +++ /dev/null @@ -1,1195 +0,0 @@ -// TinyColor v1.4.2 -// https://github.com/bgrins/TinyColor -// Brian Grinstead, MIT License - -(function(Math) { - -var trimLeft = /^\s+/, - trimRight = /\s+$/, - tinyCounter = 0, - mathRound = Math.round, - mathMin = Math.min, - mathMax = Math.max, - mathRandom = Math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - opts = opts || { }; - - // If input is already a tinycolor, return itself - if (color instanceof tinycolor) { - return color; - } - // If we are called as a function, call using new instead - if (!(this instanceof tinycolor)) { - return new tinycolor(color, opts); - } - - var rgb = inputToRGB(color); - this._originalInput = color, - this._r = rgb.r, - this._g = rgb.g, - this._b = rgb.b, - this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, - this._format = opts.format || rgb.format; - this._gradientType = opts.gradientType; - - // Don't let the range of [0,255] come back in [0,1]. - // Potentially lose a little bit of precision here, but will fix issues where - // .5 gets interpreted as half of the total, instead of half of 1 - // If it was supposed to be 128, this was already taken care of by `inputToRgb` - if (this._r < 1) { this._r = mathRound(this._r); } - if (this._g < 1) { this._g = mathRound(this._g); } - if (this._b < 1) { this._b = mathRound(this._b); } - - this._ok = rgb.ok; - this._tc_id = tinyCounter++; -} - -tinycolor.prototype = { - isDark: function() { - return this.getBrightness() < 128; - }, - isLight: function() { - return !this.isDark(); - }, - isValid: function() { - return this._ok; - }, - getOriginalInput: function() { - return this._originalInput; - }, - getFormat: function() { - return this._format; - }, - getAlpha: function() { - return this._a; - }, - getBrightness: function() { - //http://www.w3.org/TR/AERT#color-contrast - var rgb = this.toRgb(); - return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; - }, - getLuminance: function() { - //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - var rgb = this.toRgb(); - var RsRGB, GsRGB, BsRGB, R, G, B; - RsRGB = rgb.r/255; - GsRGB = rgb.g/255; - BsRGB = rgb.b/255; - - if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} - if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} - if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} - return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); - }, - setAlpha: function(value) { - this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; - return this; - }, - toHsv: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; - }, - toHsvString: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (this._a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; - }, - toHsl: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; - }, - toHslString: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (this._a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; - }, - toHex: function(allow3Char) { - return rgbToHex(this._r, this._g, this._b, allow3Char); - }, - toHexString: function(allow3Char) { - return '#' + this.toHex(allow3Char); - }, - toHex8: function(allow4Char) { - return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); - }, - toHex8String: function(allow4Char) { - return '#' + this.toHex8(allow4Char); - }, - toRgb: function() { - return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; - }, - toRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : - "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; - }, - toPercentageRgb: function() { - return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; - }, - toPercentageRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; - }, - toName: function() { - if (this._a === 0) { - return "transparent"; - } - - if (this._a < 1) { - return false; - } - - return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; - }, - toFilter: function(secondColor) { - var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); - var secondHex8String = hex8String; - var gradientType = this._gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); - } - - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; - }, - toString: function(format) { - var formatSet = !!format; - format = format || this._format; - - var formattedString = false; - var hasAlpha = this._a < 1 && this._a >= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); - } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); - }, - clone: function() { - return tinycolor(this.toString()); - }, - - _applyModification: function(fn, args) { - var color = fn.apply(null, [this].concat([].slice.call(args))); - this._r = color._r; - this._g = color._g; - this._b = color._b; - this.setAlpha(color._a); - return this; - }, - lighten: function() { - return this._applyModification(lighten, arguments); - }, - brighten: function() { - return this._applyModification(brighten, arguments); - }, - darken: function() { - return this._applyModification(darken, arguments); - }, - desaturate: function() { - return this._applyModification(desaturate, arguments); - }, - saturate: function() { - return this._applyModification(saturate, arguments); - }, - greyscale: function() { - return this._applyModification(greyscale, arguments); - }, - spin: function() { - return this._applyModification(spin, arguments); - }, - - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); - }, - analogous: function() { - return this._applyCombination(analogous, arguments); - }, - complement: function() { - return this._applyCombination(complement, arguments); - }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); - }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); - }, - triad: function() { - return this._applyCombination(triad, arguments); - }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); - } -}; - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color, opts) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - if (color.hasOwnProperty(i)) { - if (i === "a") { - newColor[i] = color[i]; - } - else { - newColor[i] = convertToPercentage(color[i]); - } - } - } - color = newColor; - } - - return tinycolor(color, opts); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 0, g: 0, b: 0 }; - var a = 1; - var s = null; - var v = null; - var l = null; - var ok = false; - var format = false; - - if (typeof color == "string") { - color = stringInputToObject(color); - } - - if (typeof color == "object") { - if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s = convertToPercentage(color.s); - v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s, v); - ok = true; - format = "hsv"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s = convertToPercentage(color.s); - l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s, l); - ok = true; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } - } - - a = boundAlpha(a); - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - - -// Conversion Functions -// -------------------- - -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ - return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 - }; -} - -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - - if(max == min) { - h = s = 0; // achromatic - } - else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - - h /= 6; - } - - return { h: h, s: s, l: l }; -} - -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { - var r, g, b; - - h = bound01(h, 360); - s = bound01(s, 100); - l = bound01(l, 100); - - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - } - - if(s === 0) { - r = g = b = l; // achromatic - } - else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); - } - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; - - var d = max - min; - s = max === 0 ? 0 : d / max; - - if(max == min) { - h = 0; // achromatic - } - else { - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h, s: s, v: v }; -} - -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - function hsvToRgb(h, s, v) { - - h = bound01(h, 360) * 6; - s = bound01(s, 100); - v = bound01(v, 100); - - var i = Math.floor(h), - f = h - i, - p = v * (1 - s), - q = v * (1 - f * s), - t = v * (1 - (1 - f) * s), - mod = i % 6, - r = [v, q, p, p, t, v][mod], - g = [t, v, v, q, p, p][mod], - b = [p, p, t, v, v, q][mod]; - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b, allow3Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - // Return a 3 character hex if possible - if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); - } - - return hex.join(""); -} - -// `rgbaToHex` -// Converts an RGBA color plus alpha transparency to hex -// Assumes r, g, b are contained in the set [0, 255] and -// a in [0, 1]. Returns a 4 or 8 character rgba hex -function rgbaToHex(r, g, b, a, allow4Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)), - pad2(convertDecimalToHex(a)) - ]; - - // Return a 4 character hex if possible - if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); - } - - return hex.join(""); -} - -// `rgbaToArgbHex` -// Converts an RGBA color to an ARGB Hex8 string -// Rarely used, but required for "toFilter()" -function rgbaToArgbHex(r, g, b, a) { - - var hex = [ - pad2(convertDecimalToHex(a)), - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - return hex.join(""); -} - -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } - return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); -}; - -tinycolor.random = function() { - return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() - }); -}; - - -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// - -function desaturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s -= amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function saturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s += amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function greyscale(color) { - return tinycolor(color).desaturate(100); -} - -function lighten (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l += amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} - -function brighten(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var rgb = tinycolor(color).toRgb(); - rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); - rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); - rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); - return tinycolor(rgb); -} - -function darken (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l -= amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} - -// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -// Values outside of this range will be wrapped into this range. -function spin(color, amount) { - var hsl = tinycolor(color).toHsl(); - var hue = (hsl.h + amount) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return tinycolor(hsl); -} - -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// - -function complement(color) { - var hsl = tinycolor(color).toHsl(); - hsl.h = (hsl.h + 180) % 360; - return tinycolor(hsl); -} - -function triad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function tetrad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function splitcomplement(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), - tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) - ]; -} - -function analogous(color, results, slices) { - results = results || 6; - slices = slices || 30; - - var hsl = tinycolor(color).toHsl(); - var part = 360 / slices; - var ret = [tinycolor(color)]; - - for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { - hsl.h = (hsl.h + part) % 360; - ret.push(tinycolor(hsl)); - } - return ret; -} - -function monochromatic(color, results) { - results = results || 6; - var hsv = tinycolor(color).toHsv(); - var h = hsv.h, s = hsv.s, v = hsv.v; - var ret = []; - var modification = 1 / results; - - while (results--) { - ret.push(tinycolor({ h: h, s: s, v: v})); - v = (v + modification) % 1; - } - - return ret; -} - -// Utility Functions -// --------------------- - -tinycolor.mix = function(color1, color2, amount) { - amount = (amount === 0) ? 0 : (amount || 50); - - var rgb1 = tinycolor(color1).toRgb(); - var rgb2 = tinycolor(color2).toRgb(); - - var p = amount / 100; - - var rgba = { - r: ((rgb2.r - rgb1.r) * p) + rgb1.r, - g: ((rgb2.g - rgb1.g) * p) + rgb1.g, - b: ((rgb2.b - rgb1.b) * p) + rgb1.b, - a: ((rgb2.a - rgb1.a) * p) + rgb1.a - }; - - return tinycolor(rgba); -}; - - -// Readability Functions -// --------------------- -// false -// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false -tinycolor.isReadable = function(color1, color2, wcag2) { - var readability = tinycolor.readability(color1, color2); - var wcag2Parms, out; - - out = false; - - wcag2Parms = validateWCAG2Parms(wcag2); - switch (wcag2Parms.level + wcag2Parms.size) { - case "AAsmall": - case "AAAlarge": - out = readability >= 4.5; - break; - case "AAlarge": - out = readability >= 3; - break; - case "AAAsmall": - out = readability >= 7; - break; - } - return out; - -}; - -// `mostReadable` -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Optionally returns Black or White if the most readable color is unreadable. -// *Example* -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" -tinycolor.mostReadable = function(baseColor, colorList, args) { - var bestColor = null; - var bestScore = 0; - var readability; - var includeFallbackColors, level, size ; - args = args || {}; - includeFallbackColors = args.includeFallbackColors ; - level = args.level; - size = args.size; - - for (var i= 0; i < colorList.length ; i++) { - readability = tinycolor.readability(baseColor, colorList[i]); - if (readability > bestScore) { - bestScore = readability; - bestColor = tinycolor(colorList[i]); - } - } - - if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { - return bestColor; - } - else { - args.includeFallbackColors=false; - return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); - } -}; - - -// Big List of Colors -// ------------------ -// -var names = tinycolor.names = { - aliceblue: "f0f8ff", - antiquewhite: "faebd7", - aqua: "0ff", - aquamarine: "7fffd4", - azure: "f0ffff", - beige: "f5f5dc", - bisque: "ffe4c4", - black: "000", - blanchedalmond: "ffebcd", - blue: "00f", - blueviolet: "8a2be2", - brown: "a52a2a", - burlywood: "deb887", - burntsienna: "ea7e5d", - cadetblue: "5f9ea0", - chartreuse: "7fff00", - chocolate: "d2691e", - coral: "ff7f50", - cornflowerblue: "6495ed", - cornsilk: "fff8dc", - crimson: "dc143c", - cyan: "0ff", - darkblue: "00008b", - darkcyan: "008b8b", - darkgoldenrod: "b8860b", - darkgray: "a9a9a9", - darkgreen: "006400", - darkgrey: "a9a9a9", - darkkhaki: "bdb76b", - darkmagenta: "8b008b", - darkolivegreen: "556b2f", - darkorange: "ff8c00", - darkorchid: "9932cc", - darkred: "8b0000", - darksalmon: "e9967a", - darkseagreen: "8fbc8f", - darkslateblue: "483d8b", - darkslategray: "2f4f4f", - darkslategrey: "2f4f4f", - darkturquoise: "00ced1", - darkviolet: "9400d3", - deeppink: "ff1493", - deepskyblue: "00bfff", - dimgray: "696969", - dimgrey: "696969", - dodgerblue: "1e90ff", - firebrick: "b22222", - floralwhite: "fffaf0", - forestgreen: "228b22", - fuchsia: "f0f", - gainsboro: "dcdcdc", - ghostwhite: "f8f8ff", - gold: "ffd700", - goldenrod: "daa520", - gray: "808080", - green: "008000", - greenyellow: "adff2f", - grey: "808080", - honeydew: "f0fff0", - hotpink: "ff69b4", - indianred: "cd5c5c", - indigo: "4b0082", - ivory: "fffff0", - khaki: "f0e68c", - lavender: "e6e6fa", - lavenderblush: "fff0f5", - lawngreen: "7cfc00", - lemonchiffon: "fffacd", - lightblue: "add8e6", - lightcoral: "f08080", - lightcyan: "e0ffff", - lightgoldenrodyellow: "fafad2", - lightgray: "d3d3d3", - lightgreen: "90ee90", - lightgrey: "d3d3d3", - lightpink: "ffb6c1", - lightsalmon: "ffa07a", - lightseagreen: "20b2aa", - lightskyblue: "87cefa", - lightslategray: "789", - lightslategrey: "789", - lightsteelblue: "b0c4de", - lightyellow: "ffffe0", - lime: "0f0", - limegreen: "32cd32", - linen: "faf0e6", - magenta: "f0f", - maroon: "800000", - mediumaquamarine: "66cdaa", - mediumblue: "0000cd", - mediumorchid: "ba55d3", - mediumpurple: "9370db", - mediumseagreen: "3cb371", - mediumslateblue: "7b68ee", - mediumspringgreen: "00fa9a", - mediumturquoise: "48d1cc", - mediumvioletred: "c71585", - midnightblue: "191970", - mintcream: "f5fffa", - mistyrose: "ffe4e1", - moccasin: "ffe4b5", - navajowhite: "ffdead", - navy: "000080", - oldlace: "fdf5e6", - olive: "808000", - olivedrab: "6b8e23", - orange: "ffa500", - orangered: "ff4500", - orchid: "da70d6", - palegoldenrod: "eee8aa", - palegreen: "98fb98", - paleturquoise: "afeeee", - palevioletred: "db7093", - papayawhip: "ffefd5", - peachpuff: "ffdab9", - peru: "cd853f", - pink: "ffc0cb", - plum: "dda0dd", - powderblue: "b0e0e6", - purple: "800080", - rebeccapurple: "663399", - red: "f00", - rosybrown: "bc8f8f", - royalblue: "4169e1", - saddlebrown: "8b4513", - salmon: "fa8072", - sandybrown: "f4a460", - seagreen: "2e8b57", - seashell: "fff5ee", - sienna: "a0522d", - silver: "c0c0c0", - skyblue: "87ceeb", - slateblue: "6a5acd", - slategray: "708090", - slategrey: "708090", - snow: "fffafa", - springgreen: "00ff7f", - steelblue: "4682b4", - tan: "d2b48c", - teal: "008080", - thistle: "d8bfd8", - tomato: "ff6347", - turquoise: "40e0d0", - violet: "ee82ee", - wheat: "f5deb3", - white: "fff", - whitesmoke: "f5f5f5", - yellow: "ff0", - yellowgreen: "9acd32" -}; - -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); - - -// Utilities -// --------- - -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; - for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } - } - return flipped; -} - -// Return a valid alpha value [0,1] with all invalid values being set to 1 -function boundAlpha(a) { - a = parseFloat(a); - - if (isNaN(a) || a < 0 || a > 1) { - a = 1; - } - - return a; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } - - var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); - - // Automatically convert percentage into number - if (processPercent) { - n = parseInt(n * max, 10) / 100; - } - - // Handle floating point rounding errors - if ((Math.abs(n - max) < 0.000001)) { - return 1; - } - - // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} - -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} - -// Parse a base-16 hex value into a base-10 integer -function parseIntFromHex(val) { - return parseInt(val, 16); -} - -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} - -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} - -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} - -// Replace a decimal with it's percentage value -function convertToPercentage(n) { - if (n <= 1) { - n = (n * 100) + "%"; - } - - return n; -} - -// Converts a decimal to a hex value -function convertDecimalToHex(d) { - return Math.round(parseFloat(d) * 255).toString(16); -} -// Converts a hex value to a decimal -function convertHexToDecimal(h) { - return (parseIntFromHex(h) / 255); -} - -var matchers = (function() { - - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; - - // - var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; - - // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. - var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; - - // Actual matching. - // Parentheses and commas are optional, but not required. - // Whitespace can take the place of commas or opening paren - var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - - return { - CSS_UNIT: new RegExp(CSS_UNIT), - rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), - rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), - hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), - hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), - hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), - hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), - hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, - hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ - }; -})(); - -// `isValidCSSUnit` -// Take in a single string / number and check to see if it looks like a CSS unit -// (see `matchers` above for definition). -function isValidCSSUnit(color) { - return !!matchers.CSS_UNIT.exec(color); -} - -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -function stringInputToObject(color) { - - color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); - var named = false; - if (names[color]) { - color = names[color]; - named = true; - } - else if (color == 'transparent') { - return { r: 0, g: 0, b: 0, a: 0, format: "name" }; - } - - // Try to match string input using regular expressions. - // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] - // Just return an object and let the conversion functions handle that. - // This way the result will be the same whether the tinycolor is initialized with string or object. - var match; - if ((match = matchers.rgb.exec(color))) { - return { r: match[1], g: match[2], b: match[3] }; - } - if ((match = matchers.rgba.exec(color))) { - return { r: match[1], g: match[2], b: match[3], a: match[4] }; - } - if ((match = matchers.hsl.exec(color))) { - return { h: match[1], s: match[2], l: match[3] }; - } - if ((match = matchers.hsla.exec(color))) { - return { h: match[1], s: match[2], l: match[3], a: match[4] }; - } - if ((match = matchers.hsv.exec(color))) { - return { h: match[1], s: match[2], v: match[3] }; - } - if ((match = matchers.hsva.exec(color))) { - return { h: match[1], s: match[2], v: match[3], a: match[4] }; - } - if ((match = matchers.hex8.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - a: convertHexToDecimal(match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex6.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - format: named ? "name" : "hex" - }; - } - if ((match = matchers.hex4.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - a: convertHexToDecimal(match[4] + '' + match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex3.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - format: named ? "name" : "hex" - }; - } - - return false; -} - -function validateWCAG2Parms(parms) { - // return valid WCAG2 parms for isReadable. - // If input parms are invalid, return {"level":"AA", "size":"small"} - var level, size; - parms = parms || {"level":"AA", "size":"small"}; - level = (parms.level || "AA").toUpperCase(); - size = (parms.size || "small").toLowerCase(); - if (level !== "AA" && level !== "AAA") { - level = "AA"; - } - if (size !== "small" && size !== "large") { - size = "small"; - } - return {"level":level, "size":size}; -} - -// Node: Export function -if (typeof module !== "undefined" && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define === 'function' && define.amd) { - define(function () {return tinycolor;}); -} -// Browser: Expose to window -else { - window.tinycolor = tinycolor; -} - -})(Math); diff --git a/project starter code/node_modules/xml2js/README.md b/project starter code/node_modules/xml2js/README.md deleted file mode 100644 index 7534c893..00000000 --- a/project starter code/node_modules/xml2js/README.md +++ /dev/null @@ -1,488 +0,0 @@ -node-xml2js -=========== - -Ever had the urge to parse XML? And wanted to access the data in some sane, -easy way? Don't want to compile a C parser, for whatever reason? Then xml2js is -what you're looking for! - -Description -=========== - -Simple XML to JavaScript object converter. It supports bi-directional conversion. -Uses [sax-js](https://github.com/isaacs/sax-js/) and -[xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js/). - -Note: If you're looking for a full DOM parser, you probably want -[JSDom](https://github.com/tmpvar/jsdom). - -Installation -============ - -Simplest way to install `xml2js` is to use [npm](http://npmjs.org), just `npm -install xml2js` which will download xml2js and all dependencies. - -xml2js is also available via [Bower](http://bower.io/), just `bower install -xml2js` which will download xml2js and all dependencies. - -Usage -===== - -No extensive tutorials required because you are a smart developer! The task of -parsing XML should be an easy one, so let's make it so! Here's some examples. - -Shoot-and-forget usage ----------------------- - -You want to parse XML as simple and easy as possible? It's dangerous to go -alone, take this: - -```javascript -var parseString = require('xml2js').parseString; -var xml = "Hello xml2js!" -parseString(xml, function (err, result) { - console.dir(result); -}); -``` - -Can't get easier than this, right? This works starting with `xml2js` 0.2.3. -With CoffeeScript it looks like this: - -```coffeescript -{parseString} = require 'xml2js' -xml = "Hello xml2js!" -parseString xml, (err, result) -> - console.dir result -``` - -If you need some special options, fear not, `xml2js` supports a number of -options (see below), you can specify these as second argument: - -```javascript -parseString(xml, {trim: true}, function (err, result) { -}); -``` - -Simple as pie usage -------------------- - -That's right, if you have been using xml-simple or a home-grown -wrapper, this was added in 0.1.11 just for you: - -```javascript -var fs = require('fs'), - xml2js = require('xml2js'); - -var parser = new xml2js.Parser(); -fs.readFile(__dirname + '/foo.xml', function(err, data) { - parser.parseString(data, function (err, result) { - console.dir(result); - console.log('Done'); - }); -}); -``` - -Look ma, no event listeners! - -You can also use `xml2js` from -[CoffeeScript](https://github.com/jashkenas/coffeescript), further reducing -the clutter: - -```coffeescript -fs = require 'fs', -xml2js = require 'xml2js' - -parser = new xml2js.Parser() -fs.readFile __dirname + '/foo.xml', (err, data) -> - parser.parseString data, (err, result) -> - console.dir result - console.log 'Done.' -``` - -But what happens if you forget the `new` keyword to create a new `Parser`? In -the middle of a nightly coding session, it might get lost, after all. Worry -not, we got you covered! Starting with 0.2.8 you can also leave it out, in -which case `xml2js` will helpfully add it for you, no bad surprises and -inexplicable bugs! - -Promise usage -------------- - -```javascript -var xml2js = require('xml2js'); -var xml = ''; - -// With parser -var parser = new xml2js.Parser(/* options */); -parser.parseStringPromise(data).then(function (result) { - console.dir(result); - console.log('Done'); -}) -.catch(function (err) { - // Failed -}); - -// Without parser -xml2js.parseStringPromise(data /*, options */).then(function (result) { - console.dir(result); - console.log('Done'); -}) -.catch(function (err) { - // Failed -}); -``` - -Parsing multiple files ----------------------- - -If you want to parse multiple files, you have multiple possibilities: - - * You can create one `xml2js.Parser` per file. That's the recommended one - and is promised to always *just work*. - * You can call `reset()` on your parser object. - * You can hope everything goes well anyway. This behaviour is not - guaranteed work always, if ever. Use option #1 if possible. Thanks! - -So you wanna some JSON? ------------------------ - -Just wrap the `result` object in a call to `JSON.stringify` like this -`JSON.stringify(result)`. You get a string containing the JSON representation -of the parsed object that you can feed to JSON-hungry consumers. - -Displaying results ------------------- - -You might wonder why, using `console.dir` or `console.log` the output at some -level is only `[Object]`. Don't worry, this is not because `xml2js` got lazy. -That's because Node uses `util.inspect` to convert the object into strings and -that function stops after `depth=2` which is a bit low for most XML. - -To display the whole deal, you can use `console.log(util.inspect(result, false, -null))`, which displays the whole result. - -So much for that, but what if you use -[eyes](https://github.com/cloudhead/eyes.js) for nice colored output and it -truncates the output with `…`? Don't fear, there's also a solution for that, -you just need to increase the `maxLength` limit by creating a custom inspector -`var inspect = require('eyes').inspector({maxLength: false})` and then you can -easily `inspect(result)`. - -XML builder usage ------------------ - -Since 0.4.0, objects can be also be used to build XML: - -```javascript -var xml2js = require('xml2js'); - -var obj = {name: "Super", Surname: "Man", age: 23}; - -var builder = new xml2js.Builder(); -var xml = builder.buildObject(obj); -``` - -At the moment, a one to one bi-directional conversion is guaranteed only for -default configuration, except for `attrkey`, `charkey` and `explicitArray` options -you can redefine to your taste. Writing CDATA is supported via setting the `cdata` -option to `true`. - -To specify attributes: -```javascript -var xml2js = require('xml2js'); - -var obj = {root: {$: {id: "my id"}, _: "my inner text"}}; - -var builder = new xml2js.Builder(); -var xml = builder.buildObject(obj); -``` - -### Adding xmlns attributes - -You can generate XML that declares XML namespace prefix / URI pairs with xmlns attributes. - -Example declaring a default namespace on the root element: - -```javascript -let obj = { - Foo: { - $: { - "xmlns": "http://foo.com" - } - } -}; -``` -Result of `buildObject(obj)`: -```xml - -``` -Example declaring non-default namespaces on non-root elements: -```javascript -let obj = { - 'foo:Foo': { - $: { - 'xmlns:foo': 'http://foo.com' - }, - 'bar:Bar': { - $: { - 'xmlns:bar': 'http://bar.com' - } - } - } -} -``` -Result of `buildObject(obj)`: -```xml - - - -``` - - -Processing attribute, tag names and values ------------------------------------------- - -Since 0.4.1 you can optionally provide the parser with attribute name and tag name processors as well as element value processors (Since 0.4.14, you can also optionally provide the parser with attribute value processors): - -```javascript - -function nameToUpperCase(name){ - return name.toUpperCase(); -} - -//transform all attribute and tag names and values to uppercase -parseString(xml, { - tagNameProcessors: [nameToUpperCase], - attrNameProcessors: [nameToUpperCase], - valueProcessors: [nameToUpperCase], - attrValueProcessors: [nameToUpperCase]}, - function (err, result) { - // processed data -}); -``` - -The `tagNameProcessors` and `attrNameProcessors` options -accept an `Array` of functions with the following signature: - -```javascript -function (name){ - //do something with `name` - return name -} -``` - -The `attrValueProcessors` and `valueProcessors` options -accept an `Array` of functions with the following signature: - -```javascript -function (value, name) { - //`name` will be the node name or attribute name - //do something with `value`, (optionally) dependent on the node/attr name - return value -} -``` - -Some processors are provided out-of-the-box and can be found in `lib/processors.js`: - -- `normalize`: transforms the name to lowercase. -(Automatically used when `options.normalize` is set to `true`) - -- `firstCharLowerCase`: transforms the first character to lower case. -E.g. 'MyTagName' becomes 'myTagName' - -- `stripPrefix`: strips the xml namespace prefix. E.g `` will become 'Bar'. -(N.B.: the `xmlns` prefix is NOT stripped.) - -- `parseNumbers`: parses integer-like strings as integers and float-like strings as floats -E.g. "0" becomes 0 and "15.56" becomes 15.56 - -- `parseBooleans`: parses boolean-like strings to booleans -E.g. "true" becomes true and "False" becomes false - -Options -======= - -Apart from the default settings, there are a number of options that can be -specified for the parser. Options are specified by ``new Parser({optionName: -value})``. Possible options are: - - * `attrkey` (default: `$`): Prefix that is used to access the attributes. - Version 0.1 default was `@`. - * `charkey` (default: `_`): Prefix that is used to access the character - content. Version 0.1 default was `#`. - * `explicitCharkey` (default: `false`) - * `trim` (default: `false`): Trim the whitespace at the beginning and end of - text nodes. - * `normalizeTags` (default: `false`): Normalize all tag names to lowercase. - * `normalize` (default: `false`): Trim whitespaces inside text nodes. - * `explicitRoot` (default: `true`): Set this if you want to get the root - node in the resulting object. - * `emptyTag` (default: `''`): what will the value of empty nodes be. - * `explicitArray` (default: `true`): Always put child nodes in an array if - true; otherwise an array is created only if there is more than one. - * `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create - text nodes. - * `mergeAttrs` (default: `false`): Merge attributes and child elements as - properties of the parent, instead of keying attributes off a child - attribute object. This option is ignored if `ignoreAttrs` is `true`. - * `validator` (default `null`): You can specify a callable that validates - the resulting structure somehow, however you want. See unit tests - for an example. - * `xmlns` (default `false`): Give each element a field usually called '$ns' - (the first character is the same as attrkey) that contains its local name - and namespace URI. - * `explicitChildren` (default `false`): Put child elements to separate - property. Doesn't work with `mergeAttrs = true`. If element has no children - then "children" won't be created. Added in 0.2.5. - * `childkey` (default `$$`): Prefix that is used to access child elements if - `explicitChildren` is set to `true`. Added in 0.2.5. - * `preserveChildrenOrder` (default `false`): Modifies the behavior of - `explicitChildren` so that the value of the "children" property becomes an - ordered array. When this is `true`, every node will also get a `#name` field - whose value will correspond to the XML nodeName, so that you may iterate - the "children" array and still be able to determine node names. The named - (and potentially unordered) properties are also retained in this - configuration at the same level as the ordered "children" array. Added in - 0.4.9. - * `charsAsChildren` (default `false`): Determines whether chars should be - considered children if `explicitChildren` is on. Added in 0.2.5. - * `includeWhiteChars` (default `false`): Determines whether whitespace-only - text nodes should be included. Added in 0.4.17. - * `async` (default `false`): Should the callbacks be async? This *might* be - an incompatible change if your code depends on sync execution of callbacks. - Future versions of `xml2js` might change this default, so the recommendation - is to not depend on sync execution anyway. Added in 0.2.6. - * `strict` (default `true`): Set sax-js to strict or non-strict parsing mode. - Defaults to `true` which is *highly* recommended, since parsing HTML which - is not well-formed XML might yield just about anything. Added in 0.2.7. - * `attrNameProcessors` (default: `null`): Allows the addition of attribute - name processing functions. Accepts an `Array` of functions with following - signature: - ```javascript - function (name){ - //do something with `name` - return name - } - ``` - Added in 0.4.14 - * `attrValueProcessors` (default: `null`): Allows the addition of attribute - value processing functions. Accepts an `Array` of functions with following - signature: - ```javascript - function (value, name){ - //do something with `name` - return name - } - ``` - Added in 0.4.1 - * `tagNameProcessors` (default: `null`): Allows the addition of tag name - processing functions. Accepts an `Array` of functions with following - signature: - ```javascript - function (name){ - //do something with `name` - return name - } - ``` - Added in 0.4.1 - * `valueProcessors` (default: `null`): Allows the addition of element value - processing functions. Accepts an `Array` of functions with following - signature: - ```javascript - function (value, name){ - //do something with `name` - return name - } - ``` - Added in 0.4.6 - -Options for the `Builder` class -------------------------------- -These options are specified by ``new Builder({optionName: value})``. -Possible options are: - - * `attrkey` (default: `$`): Prefix that is used to access the attributes. - Version 0.1 default was `@`. - * `charkey` (default: `_`): Prefix that is used to access the character - content. Version 0.1 default was `#`. - * `rootName` (default `root` or the root key name): root element name to be used in case - `explicitRoot` is `false` or to override the root element name. - * `renderOpts` (default `{ 'pretty': true, 'indent': ' ', 'newline': '\n' }`): - Rendering options for xmlbuilder-js. - * pretty: prettify generated XML - * indent: whitespace for indentation (only when pretty) - * newline: newline char (only when pretty) - * `xmldec` (default `{ 'version': '1.0', 'encoding': 'UTF-8', 'standalone': true }`: - XML declaration attributes. - * `xmldec.version` A version number string, e.g. 1.0 - * `xmldec.encoding` Encoding declaration, e.g. UTF-8 - * `xmldec.standalone` standalone document declaration: true or false - * `doctype` (default `null`): optional DTD. Eg. `{'ext': 'hello.dtd'}` - * `headless` (default: `false`): omit the XML header. Added in 0.4.3. - * `allowSurrogateChars` (default: `false`): allows using characters from the Unicode - surrogate blocks. - * `cdata` (default: `false`): wrap text nodes in `` instead of - escaping when necessary. Does not add `` if it is not required. - Added in 0.4.5. - -`renderOpts`, `xmldec`,`doctype` and `headless` pass through to -[xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js). - -Updating to new version -======================= - -Version 0.2 changed the default parsing settings, but version 0.1.14 introduced -the default settings for version 0.2, so these settings can be tried before the -migration. - -```javascript -var xml2js = require('xml2js'); -var parser = new xml2js.Parser(xml2js.defaults["0.2"]); -``` - -To get the 0.1 defaults in version 0.2 you can just use -`xml2js.defaults["0.1"]` in the same place. This provides you with enough time -to migrate to the saner way of parsing in `xml2js` 0.2. We try to make the -migration as simple and gentle as possible, but some breakage cannot be -avoided. - -So, what exactly did change and why? In 0.2 we changed some defaults to parse -the XML in a more universal and sane way. So we disabled `normalize` and `trim` -so `xml2js` does not cut out any text content. You can reenable this at will of -course. A more important change is that we return the root tag in the resulting -JavaScript structure via the `explicitRoot` setting, so you need to access the -first element. This is useful for anybody who wants to know what the root node -is and preserves more information. The last major change was to enable -`explicitArray`, so everytime it is possible that one might embed more than one -sub-tag into a tag, xml2js >= 0.2 returns an array even if the array just -includes one element. This is useful when dealing with APIs that return -variable amounts of subtags. - -Running tests, development -========================== - -[![Build Status](https://travis-ci.org/Leonidas-from-XIV/node-xml2js.svg?branch=master)](https://travis-ci.org/Leonidas-from-XIV/node-xml2js) -[![Coverage Status](https://coveralls.io/repos/Leonidas-from-XIV/node-xml2js/badge.svg?branch=)](https://coveralls.io/r/Leonidas-from-XIV/node-xml2js?branch=master) -[![Dependency Status](https://david-dm.org/Leonidas-from-XIV/node-xml2js.svg)](https://david-dm.org/Leonidas-from-XIV/node-xml2js) - -The development requirements are handled by npm, you just need to install them. -We also have a number of unit tests, they can be run using `npm test` directly -from the project root. This runs zap to discover all the tests and execute -them. - -If you like to contribute, keep in mind that `xml2js` is written in -CoffeeScript, so don't develop on the JavaScript files that are checked into -the repository for convenience reasons. Also, please write some unit test to -check your behaviour and if it is some user-facing thing, add some -documentation to this README, so people will know it exists. Thanks in advance! - -Getting support -=============== - -Please, if you have a problem with the library, first make sure you read this -README. If you read this far, thanks, you're good. Then, please make sure your -problem really is with `xml2js`. It is? Okay, then I'll look at it. Send me a -mail and we can talk. Please don't open issues, as I don't think that is the -proper forum for support problems. Some problems might as well really be bugs -in `xml2js`, if so I'll let you know to open an issue instead :) - -But if you know you really found a bug, feel free to open an issue instead. diff --git a/project starter code/node_modules/xml2js/package.json b/project starter code/node_modules/xml2js/package.json deleted file mode 100644 index 0769b611..00000000 --- a/project starter code/node_modules/xml2js/package.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "xml2js", - "description": "Simple XML to JavaScript object converter.", - "keywords": [ - "xml", - "json" - ], - "homepage": "https://github.com/Leonidas-from-XIV/node-xml2js", - "version": "0.4.23", - "author": "Marek Kubica (https://xivilization.net)", - "contributors": [ - "maqr (https://github.com/maqr)", - "Ben Weaver (http://benweaver.com/)", - "Jae Kwon (https://github.com/jaekwon)", - "Jim Robert", - "Ștefan Rusu (http://www.saltwaterc.eu/)", - "Carter Cole (http://cartercole.com/)", - "Kurt Raschke (http://www.kurtraschke.com/)", - "Contra (https://github.com/Contra)", - "Marcelo Diniz (https://github.com/mdiniz)", - "Michael Hart (https://github.com/mhart)", - "Zachary Scott (http://zacharyscott.net/)", - "Raoul Millais (https://github.com/raoulmillais)", - "Salsita Software (http://www.salsitasoft.com/)", - "Mike Schilling (http://www.emotive.com/)", - "Jackson Tian (http://weibo.com/shyvo)", - "Mikhail Zyatin (https://github.com/Sitin)", - "Chris Tavares (https://github.com/christav)", - "Frank Xu (http://f2e.us/)", - "Guido D'Albore (http://www.bitstorm.it/)", - "Jack Senechal (http://jacksenechal.com/)", - "Matthias Hölzl (https://github.com/hoelzl)", - "Camille Reynders (http://www.creynders.be/)", - "Taylor Gautier (https://github.com/tsgautier)", - "Todd Bryan (https://github.com/toddrbryan)", - "Leore Avidar (http://leoreavidar.com/)", - "Dave Aitken (http://www.actionshrimp.com/)", - "Shaney Orrowe ", - "Candle ", - "Jess Telford (http://jes.st)", - "Tom Hughes < (http://compton.nu/)", - "Piotr Rochala (http://rocha.la/)", - "Michael Avila (https://github.com/michaelavila)", - "Ryan Gahl (https://github.com/ryedin)", - "Eric Laberge (https://github.com/elaberge)", - "Benjamin E. Coe (https://twitter.com/benjamincoe)", - "Stephen Cresswell (https://github.com/cressie176)", - "Pascal Ehlert (http://www.hacksrus.net/)", - "Tom Spencer (http://fiznool.com/)", - "Tristian Flanagan (https://github.com/tflanagan)", - "Tim Johns (https://github.com/TimJohns)", - "Bogdan Chadkin (https://github.com/TrySound)", - "David Wood (http://codesleuth.co.uk/)", - "Nicolas Maquet (https://github.com/nmaquet)", - "Lovell Fuller (http://lovell.info/)", - "d3adc0d3 (https://github.com/d3adc0d3)" - ], - "main": "./lib/xml2js", - "files": [ - "lib" - ], - "directories": { - "lib": "./lib" - }, - "scripts": { - "build": "cake build", - "test": "zap", - "coverage": "nyc npm test && nyc report", - "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", - "doc": "cake doc" - }, - "repository": { - "type": "git", - "url": "https://github.com/Leonidas-from-XIV/node-xml2js.git" - }, - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - }, - "devDependencies": { - "coffee-script": ">=1.10.0", - "coveralls": "^3.0.1", - "diff": ">=1.0.8", - "docco": ">=0.6.2", - "nyc": ">=2.2.1", - "zap": ">=0.2.9" - }, - "engines": { - "node": ">=4.0.0" - }, - "license": "MIT" -} diff --git a/project starter code/package-lock.json b/project starter code/package-lock.json deleted file mode 100644 index 5cebd566..00000000 --- a/project starter code/package-lock.json +++ /dev/null @@ -1,2372 +0,0 @@ -{ - "name": "api", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "api", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "body-parser": "^1.20.1", - "express": "^4.18.2", - "jimp": "^0.16.2" - } - }, - "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "dependencies": { - "regenerator-runtime": "^0.13.11" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@jimp/bmp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz", - "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "bmp-js": "^0.1.0" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/core": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz", - "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "any-base": "^1.1.0", - "buffer": "^5.2.0", - "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", - "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" - } - }, - "node_modules/@jimp/custom": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz", - "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" - } - }, - "node_modules/@jimp/gif": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz", - "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", - "omggif": "^1.0.9" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/jpeg": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz", - "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-blit": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz", - "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-blur": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz", - "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-circle": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz", - "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-color": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz", - "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-contain": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz", - "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5", - "@jimp/plugin-scale": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-cover": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz", - "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-crop": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5", - "@jimp/plugin-scale": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-crop": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz", - "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-displace": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz", - "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-dither": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz", - "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-fisheye": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz", - "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-flip": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz", - "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-rotate": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-gaussian": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz", - "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-invert": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz", - "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-mask": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz", - "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-normalize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz", - "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-print": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz", - "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-resize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz", - "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-rotate": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz", - "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blit": ">=0.3.5", - "@jimp/plugin-crop": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-scale": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz", - "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-shadow": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz", - "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-blur": ">=0.3.5", - "@jimp/plugin-resize": ">=0.3.5" - } - }, - "node_modules/@jimp/plugin-threshold": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz", - "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5", - "@jimp/plugin-color": ">=0.8.0", - "@jimp/plugin-resize": ">=0.8.0" - } - }, - "node_modules/@jimp/plugins": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz", - "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", - "timm": "^1.6.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/png": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz", - "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/tiff": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz", - "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/types": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz", - "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", - "timm": "^1.6.1" - }, - "peerDependencies": { - "@jimp/custom": ">=0.3.5" - } - }, - "node_modules/@jimp/utils": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz", - "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "regenerator-runtime": "^0.13.3" - } - }, - "node_modules/@types/node": { - "version": "16.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", - "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/any-base": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", - "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bmp-js": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", - "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" - }, - "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/buffer-equal": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", - "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/exif-parser": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", - "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" - }, - "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gifwrap": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", - "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", - "dependencies": { - "image-q": "^4.0.0", - "omggif": "^1.0.10" - } - }, - "node_modules/global": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "dependencies": { - "min-document": "^2.19.0", - "process": "^0.11.10" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/image-q": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", - "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", - "dependencies": { - "@types/node": "16.9.1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" - }, - "node_modules/jimp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz", - "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", - "regenerator-runtime": "^0.13.3" - } - }, - "node_modules/jpeg-js": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", - "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" - }, - "node_modules/load-bmfont": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", - "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", - "dependencies": { - "buffer-equal": "0.0.1", - "mime": "^1.3.4", - "parse-bmfont-ascii": "^1.0.3", - "parse-bmfont-binary": "^1.0.5", - "parse-bmfont-xml": "^1.1.4", - "phin": "^2.9.1", - "xhr": "^2.0.1", - "xtend": "^4.0.0" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", - "dependencies": { - "dom-walk": "^0.1.0" - } - }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/omggif": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", - "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" - }, - "node_modules/parse-bmfont-ascii": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", - "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==" - }, - "node_modules/parse-bmfont-binary": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", - "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" - }, - "node_modules/parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", - "dependencies": { - "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" - } - }, - "node_modules/parse-headers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", - "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "node_modules/phin": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", - "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" - }, - "node_modules/pixelmatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", - "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", - "dependencies": { - "pngjs": "^3.0.0" - }, - "bin": { - "pixelmatch": "bin/pixelmatch" - } - }, - "node_modules/pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/timm": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", - "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" - }, - "node_modules/tinycolor2": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz", - "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==", - "engines": { - "node": "*" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", - "dependencies": { - "pako": "^1.0.5" - } - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/xhr": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", - "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", - "dependencies": { - "global": "~4.4.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "node_modules/xml-parse-from-string": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", - "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" - }, - "node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - } - }, - "dependencies": { - "@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "requires": { - "regenerator-runtime": "^0.13.11" - } - }, - "@jimp/bmp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz", - "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "bmp-js": "^0.1.0" - } - }, - "@jimp/core": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz", - "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "any-base": "^1.1.0", - "buffer": "^5.2.0", - "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", - "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" - } - }, - "@jimp/custom": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz", - "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" - } - }, - "@jimp/gif": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz", - "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", - "omggif": "^1.0.9" - } - }, - "@jimp/jpeg": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz", - "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" - } - }, - "@jimp/plugin-blit": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz", - "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-blur": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz", - "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-circle": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz", - "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-color": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz", - "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" - } - }, - "@jimp/plugin-contain": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz", - "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-cover": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz", - "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-crop": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz", - "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-displace": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz", - "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-dither": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz", - "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-fisheye": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz", - "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-flip": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz", - "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-gaussian": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz", - "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-invert": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz", - "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-mask": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz", - "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-normalize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz", - "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-print": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz", - "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" - } - }, - "@jimp/plugin-resize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz", - "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-rotate": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz", - "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-scale": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz", - "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-shadow": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz", - "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugin-threshold": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz", - "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" - } - }, - "@jimp/plugins": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz", - "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", - "timm": "^1.6.1" - } - }, - "@jimp/png": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz", - "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" - } - }, - "@jimp/tiff": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz", - "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==", - "requires": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" - } - }, - "@jimp/types": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz", - "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", - "timm": "^1.6.1" - } - }, - "@jimp/utils": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz", - "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==", - "requires": { - "@babel/runtime": "^7.7.2", - "regenerator-runtime": "^0.13.3" - } - }, - "@types/node": { - "version": "16.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", - "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" - }, - "accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, - "any-base": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", - "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bmp-js": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", - "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" - }, - "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "buffer-equal": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", - "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==" - }, - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "requires": { - "safe-buffer": "5.2.1" - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - }, - "destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" - }, - "dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" - }, - "exif-parser": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", - "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" - }, - "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", - "requires": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - } - }, - "file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==" - }, - "finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - } - }, - "forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } - }, - "gifwrap": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", - "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", - "requires": { - "image-q": "^4.0.0", - "omggif": "^1.0.10" - } - }, - "global": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "requires": { - "min-document": "^2.19.0", - "process": "^0.11.10" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, - "http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "image-q": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", - "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", - "requires": { - "@types/node": "16.9.1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" - }, - "is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" - }, - "jimp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz", - "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", - "regenerator-runtime": "^0.13.3" - } - }, - "jpeg-js": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", - "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" - }, - "load-bmfont": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", - "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", - "requires": { - "buffer-equal": "0.0.1", - "mime": "^1.3.4", - "parse-bmfont-ascii": "^1.0.3", - "parse-bmfont-binary": "^1.0.5", - "parse-bmfont-xml": "^1.1.4", - "phin": "^2.9.1", - "xhr": "^2.0.1", - "xtend": "^4.0.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "requires": { - "mime-db": "1.52.0" - } - }, - "min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", - "requires": { - "dom-walk": "^0.1.0" - } - }, - "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" - }, - "mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "requires": { - "minimist": "^1.2.6" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" - }, - "object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" - }, - "omggif": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", - "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" - }, - "on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "requires": { - "ee-first": "1.1.1" - } - }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" - }, - "parse-bmfont-ascii": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", - "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==" - }, - "parse-bmfont-binary": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", - "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" - }, - "parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", - "requires": { - "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" - } - }, - "parse-headers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", - "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "phin": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", - "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" - }, - "pixelmatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", - "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", - "requires": { - "pngjs": "^3.0.0" - } - }, - "pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" - }, - "proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "requires": { - "side-channel": "^1.0.4" - } - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, - "send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "requires": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "dependencies": { - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } - }, - "serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - } - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" - }, - "timm": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", - "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" - }, - "tinycolor2": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz", - "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==" - }, - "toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" - }, - "utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", - "requires": { - "pako": "^1.0.5" - } - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" - }, - "xhr": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", - "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", - "requires": { - "global": "~4.4.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "xml-parse-from-string": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", - "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" - }, - "xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - } - }, - "xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - } - } -} diff --git a/project starter code/package.json b/project starter code/package.json deleted file mode 100644 index 00d2cf45..00000000 --- a/project starter code/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "api", - "version": "1.0.0", - "description": "", - "main": "server.js", - "type": "module", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js" - }, - "author": "", - "license": "ISC", - "dependencies": { - "body-parser": "^1.20.1", - "express": "^4.18.2", - "jimp": "^0.16.2" - } -} diff --git a/project starter code/server.js b/project starter code/server.js deleted file mode 100644 index 080f9cc4..00000000 --- a/project starter code/server.js +++ /dev/null @@ -1,45 +0,0 @@ -import express from 'express'; -import bodyParser from 'body-parser'; -import {filterImageFromURL, deleteLocalFiles} from './util/util.js'; - - - - // Init the Express application - const app = express(); - - // Set the network port - const port = process.env.PORT || 8082; - - // Use the body parser middleware for post requests - app.use(bodyParser.json()); - - // @TODO1 IMPLEMENT A RESTFUL ENDPOINT - // GET /filteredimage?image_url={{URL}} - // endpoint to filter an image from a public url. - // IT SHOULD - // 1 - // 1. validate the image_url query - // 2. call filterImageFromURL(image_url) to filter the image - // 3. send the resulting file in the response - // 4. deletes any files on the server on finish of the response - // QUERY PARAMATERS - // image_url: URL of a publicly accessible image - // RETURNS - // the filtered image file [!!TIP res.sendFile(filteredpath); might be useful] - - /**************************************************************************** */ - - //! END @TODO1 - - // Root Endpoint - // Displays a simple message to the user - app.get( "/", async (req, res) => { - res.send("try GET /filteredimage?image_url={{}}") - } ); - - - // Start the Server - app.listen( port, () => { - console.log( `server running http://localhost:${ port }` ); - console.log( `press CTRL+C to stop server` ); - } ); diff --git a/project starter code/util/util.js b/project starter code/util/util.js deleted file mode 100644 index a3aacf8c..00000000 --- a/project starter code/util/util.js +++ /dev/null @@ -1,40 +0,0 @@ -import fs from "fs"; -import Jimp from "jimp"; - - -// filterImageFromURL -// helper function to download, filter, and save the filtered image locally -// returns the absolute path to the local image -// INPUTS -// inputURL: string - a publicly accessible url to an image file -// RETURNS -// an absolute path to a filtered image locally saved file - export async function filterImageFromURL(inputURL) { - return new Promise(async (resolve, reject) => { - try { - const photo = await Jimp.read(inputURL); - const outpath = - "/tmp/filtered." + Math.floor(Math.random() * 2000) + ".jpg"; - await photo - .resize(256, 256) // resize - .quality(60) // set JPEG quality - .greyscale() // set greyscale - .write(outpath, (img) => { - resolve(outpath); - }); - } catch (error) { - reject(error); - } - }); -} - -// deleteLocalFiles -// helper function to delete files on the local disk -// useful to cleanup after tasks -// INPUTS -// files: Array an array of absolute paths to files - export async function deleteLocalFiles(files) { - for (let file of files) { - fs.unlinkSync(file); - } -} diff --git a/server.js b/server.js new file mode 100644 index 00000000..77e4265c --- /dev/null +++ b/server.js @@ -0,0 +1,51 @@ +import express from 'express'; +import bodyParser from 'body-parser'; +import { filterImageFromURL, deleteLocalFiles } from './util/util.js'; + +// Init the Express application +const app = express(); + +// Set the network port +const port = process.env.PORT || 8082; + +// Use the body parser middleware for post requests +app.use(bodyParser.json()); + +// Implement a RESTful endpoint +// GET /filteredimage?image_url={{URL}} +app.get('/filteredimage', async (req, res) => { + const { image_url } = req.query; + + // Validate the image_url query + if (!image_url) { + return res.status(400).send({ message: 'image_url query parameter is required' }); + } + + try { + // Call filterImageFromURL(image_url) to filter the image + const filteredImagePath = await filterImageFromURL(image_url); + + // Send the resulting file in the response + res.sendFile(filteredImagePath, async (err) => { + if (err) { + return res.status(500).send({ message: 'Failed to send the filtered image' }); + } + // Deletes any files on the server on finish of the response + await deleteLocalFiles([filteredImagePath]); + }); + } catch (error) { + return res.status(422).send({ message: 'Unable to process the image at the provided url', error: error.message }); + } +}); + +// Root Endpoint +// Displays a simple message to the user +app.get("/", async (req, res) => { + res.send("try GET /filteredimage?image_url={{}}"); +}); + +// Start the Server +app.listen(port, () => { + console.log(`server running http://localhost:${port}`); + console.log(`press CTRL+C to stop server`); +}); diff --git a/util/util.js b/util/util.js new file mode 100644 index 00000000..9671346f --- /dev/null +++ b/util/util.js @@ -0,0 +1,49 @@ +import fs from 'fs'; +import axios from 'axios'; +import Jimp from 'jimp'; + +// filterImageFromURL +// helper function to download, filter, and save the filtered image locally +// returns the absolute path to the local image +// INPUTS +// inputURL: string - a publicly accessible url to an image file +// RETURNS +// an absolute path to a filtered image locally saved file +export async function filterImageFromURL(inputURL) { + try { + const response = await axios({ + method: 'get', + url: inputURL, + responseType: 'arraybuffer' + }); + + // Check if the response contains valid image data + if (!response.data) { + throw new Error('No image data received'); + } + + const photo = await Jimp.read(response.data); + const outpath = '/tmp/filtered.' + Math.floor(Math.random() * 2000) + '.jpg'; + await photo + .resize(256, 256) // resize + .quality(60) // set JPEG quality + .greyscale() // set greyscale + .writeAsync(outpath); + + return outpath; + } catch (error) { + console.error('Error in filterImageFromURL:', error.message); + throw new Error('Error processing the image. ' + error.message); + } +} + +// deleteLocalFiles +// helper function to delete files on the local disk +// useful to cleanup after tasks +// INPUTS +// files: Array an array of absolute paths to files +export async function deleteLocalFiles(files) { + for (let file of files) { + fs.unlinkSync(file); + } +}