diff --git a/package-lock.json b/package-lock.json index f3ccb7cb..6ceaf90f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,24 +9,24 @@ "packages/*" ], "devDependencies": { - "@changesets/cli": "^2.27.7", - "@types/jest": "^29.5.2", - "@types/node": "^20.10.1", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", - "esbuild": "^0.23.0", - "eslint": "^8.54.0", - "jest": "^29.5.0", - "jest-config": "^29.5.0", - "lint-staged": "^15.1.0", - "lodash": "^4.17.15", - "prettier": "^3.1.0", - "ts-jest": "^29.1.0", - "tsup": "^8.2.2", - "turbo": "^2.0.0", - "typedoc": "^0.26.5", - "typedoc-plugin-markdown": "^4.2.2", - "typescript": "^5.5.4" + "@changesets/cli": "^2.27.11", + "@types/jest": "^29.5.14", + "@types/node": "^22.10.2", + "@typescript-eslint/eslint-plugin": "^8.18.1", + "@typescript-eslint/parser": "^8.18.1", + "esbuild": "^0.24.0", + "eslint": "^8", + "jest": "^29.7.0", + "jest-config": "^29.7.0", + "lint-staged": "^15.2.11", + "lodash": "^4.17.21", + "prettier": "^3.4.2", + "ts-jest": "^29.2.5", + "tsup": "^8.3.5", + "turbo": "^2.3.3", + "typedoc": "^0.27.5", + "typedoc-plugin-markdown": "^4.3.2", + "typescript": "^5.7.2" } }, "node_modules/@ampproject/remapping": { @@ -560,9 +560,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", - "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -633,14 +633,14 @@ "dev": true }, "node_modules/@changesets/apply-release-plan": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.5.tgz", - "integrity": "sha512-1cWCk+ZshEkSVEZrm2fSj1Gz8sYvxgUL4Q78+1ZZqeqfuevPTPk033/yUZ3df8BKMohkqqHfzj0HOOrG0KtXTw==", + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.7.tgz", + "integrity": "sha512-qnPOcmmmnD0MfMg9DjU1/onORFyRpDXkMMl2IJg9mECY6RnxL3wN0TCCc92b2sXt1jt8DgjAUUsZYGUGTdYIXA==", "dev": true, "dependencies": { - "@changesets/config": "^3.0.3", + "@changesets/config": "^3.0.5", "@changesets/get-version-range-type": "^0.4.0", - "@changesets/git": "^3.0.1", + "@changesets/git": "^3.0.2", "@changesets/should-skip-package": "^0.1.1", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", @@ -669,9 +669,9 @@ } }, "node_modules/@changesets/assemble-release-plan": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.4.tgz", - "integrity": "sha512-nqICnvmrwWj4w2x0fOhVj2QEGdlUuwVAwESrUo5HLzWMI1rE5SWfsr9ln+rDqWB6RQ2ZyaMZHUcU7/IRaUJS+Q==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.5.tgz", + "integrity": "sha512-IgvBWLNKZd6k4t72MBTBK3nkygi0j3t3zdC1zrfusYo0KpdsvnDjrMM9vPnTCLCMlfNs55jRL4gIMybxa64FCQ==", "dev": true, "dependencies": { "@changesets/errors": "^0.2.0", @@ -692,40 +692,38 @@ } }, "node_modules/@changesets/cli": { - "version": "2.27.8", - "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.8.tgz", - "integrity": "sha512-gZNyh+LdSsI82wBSHLQ3QN5J30P4uHKJ4fXgoGwQxfXwYFTJzDdvIJasZn8rYQtmKhyQuiBj4SSnLuKlxKWq4w==", + "version": "2.27.11", + "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.11.tgz", + "integrity": "sha512-1QislpE+nvJgSZZo9+Lj3Lno5pKBgN46dAV8IVxKJy9wX8AOrs9nn5pYVZuDpoxWJJCALmbfOsHkyxujgetQSg==", "dev": true, "dependencies": { - "@changesets/apply-release-plan": "^7.0.5", - "@changesets/assemble-release-plan": "^6.0.4", + "@changesets/apply-release-plan": "^7.0.7", + "@changesets/assemble-release-plan": "^6.0.5", "@changesets/changelog-git": "^0.2.0", - "@changesets/config": "^3.0.3", + "@changesets/config": "^3.0.5", "@changesets/errors": "^0.2.0", "@changesets/get-dependents-graph": "^2.1.2", - "@changesets/get-release-plan": "^4.0.4", - "@changesets/git": "^3.0.1", + "@changesets/get-release-plan": "^4.0.6", + "@changesets/git": "^3.0.2", "@changesets/logger": "^0.1.1", "@changesets/pre": "^2.0.1", - "@changesets/read": "^0.6.1", + "@changesets/read": "^0.6.2", "@changesets/should-skip-package": "^0.1.1", "@changesets/types": "^6.0.0", "@changesets/write": "^0.3.2", "@manypkg/get-packages": "^1.1.3", - "@types/semver": "^7.5.0", "ansi-colors": "^4.1.3", "ci-info": "^3.7.0", - "enquirer": "^2.3.0", + "enquirer": "^2.4.1", "external-editor": "^3.1.0", "fs-extra": "^7.0.1", "mri": "^1.2.0", - "outdent": "^0.5.0", "p-limit": "^2.2.0", "package-manager-detector": "^0.2.0", "picocolors": "^1.1.0", "resolve-from": "^5.0.0", "semver": "^7.5.3", - "spawndamnit": "^2.0.0", + "spawndamnit": "^3.0.1", "term-size": "^2.1.0" }, "bin": { @@ -733,9 +731,9 @@ } }, "node_modules/@changesets/config": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.3.tgz", - "integrity": "sha512-vqgQZMyIcuIpw9nqFIpTSNyc/wgm/Lu1zKN5vECy74u95Qx/Wa9g27HdgO4NkVAaq+BGA8wUc/qvbvVNs93n6A==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.5.tgz", + "integrity": "sha512-QyXLSSd10GquX7hY0Mt4yQFMEeqnO5z/XLpbIr4PAkNNoQNKwDyiSrx4yd749WddusH1v3OSiA0NRAYmH/APpQ==", "dev": true, "dependencies": { "@changesets/errors": "^0.2.0", @@ -744,7 +742,7 @@ "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", "fs-extra": "^7.0.1", - "micromatch": "^4.0.2" + "micromatch": "^4.0.8" } }, "node_modules/@changesets/errors": { @@ -769,15 +767,15 @@ } }, "node_modules/@changesets/get-release-plan": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.4.tgz", - "integrity": "sha512-SicG/S67JmPTrdcc9Vpu0wSQt7IiuN0dc8iR5VScnnTVPfIaLvKmEGRvIaF0kcn8u5ZqLbormZNTO77bCEvyWw==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.6.tgz", + "integrity": "sha512-FHRwBkY7Eili04Y5YMOZb0ezQzKikTka4wL753vfUA5COSebt7KThqiuCN9BewE4/qFGgF/5t3AuzXx1/UAY4w==", "dev": true, "dependencies": { - "@changesets/assemble-release-plan": "^6.0.4", - "@changesets/config": "^3.0.3", + "@changesets/assemble-release-plan": "^6.0.5", + "@changesets/config": "^3.0.5", "@changesets/pre": "^2.0.1", - "@changesets/read": "^0.6.1", + "@changesets/read": "^0.6.2", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3" } @@ -789,16 +787,16 @@ "dev": true }, "node_modules/@changesets/git": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@changesets/git/-/git-3.0.1.tgz", - "integrity": "sha512-pdgHcYBLCPcLd82aRcuO0kxCDbw/yISlOtkmwmE8Odo1L6hSiZrBOsRl84eYG7DRCab/iHnOkWqExqc4wxk2LQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@changesets/git/-/git-3.0.2.tgz", + "integrity": "sha512-r1/Kju9Y8OxRRdvna+nxpQIsMsRQn9dhhAZt94FLDeu0Hij2hnOozW8iqnHBgvu+KdnJppCveQwK4odwfw/aWQ==", "dev": true, "dependencies": { "@changesets/errors": "^0.2.0", "@manypkg/get-packages": "^1.1.3", "is-subdir": "^1.1.1", - "micromatch": "^4.0.2", - "spawndamnit": "^2.0.0" + "micromatch": "^4.0.8", + "spawndamnit": "^3.0.1" } }, "node_modules/@changesets/logger": { @@ -833,12 +831,12 @@ } }, "node_modules/@changesets/read": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@changesets/read/-/read-0.6.1.tgz", - "integrity": "sha512-jYMbyXQk3nwP25nRzQQGa1nKLY0KfoOV7VLgwucI0bUO8t8ZLCr6LZmgjXsiKuRDc+5A6doKPr9w2d+FEJ55zQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@changesets/read/-/read-0.6.2.tgz", + "integrity": "sha512-wjfQpJvryY3zD61p8jR87mJdyx2FIhEcdXhKUqkja87toMrP/3jtg/Yg29upN+N4Ckf525/uvV7a4tzBlpk6gg==", "dev": true, "dependencies": { - "@changesets/git": "^3.0.1", + "@changesets/git": "^3.0.2", "@changesets/logger": "^0.1.1", "@changesets/parse": "^0.4.0", "@changesets/types": "^6.0.0", @@ -891,9 +889,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", + "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", "cpu": [ "ppc64" ], @@ -907,9 +905,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", + "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", "cpu": [ "arm" ], @@ -923,9 +921,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", + "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", "cpu": [ "arm64" ], @@ -939,9 +937,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", + "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", "cpu": [ "x64" ], @@ -955,9 +953,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", - "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", + "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", "cpu": [ "arm64" ], @@ -971,9 +969,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", + "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", "cpu": [ "x64" ], @@ -987,9 +985,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", + "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", "cpu": [ "arm64" ], @@ -1003,9 +1001,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", + "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", "cpu": [ "x64" ], @@ -1019,9 +1017,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", + "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", "cpu": [ "arm" ], @@ -1035,9 +1033,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", + "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", "cpu": [ "arm64" ], @@ -1051,9 +1049,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", + "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", "cpu": [ "ia32" ], @@ -1067,9 +1065,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", + "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", "cpu": [ "loong64" ], @@ -1083,9 +1081,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", + "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", "cpu": [ "mips64el" ], @@ -1099,9 +1097,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", + "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", "cpu": [ "ppc64" ], @@ -1115,9 +1113,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", + "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", "cpu": [ "riscv64" ], @@ -1131,9 +1129,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", + "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", "cpu": [ "s390x" ], @@ -1147,9 +1145,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", - "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", + "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", "cpu": [ "x64" ], @@ -1163,9 +1161,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", + "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", "cpu": [ "x64" ], @@ -1179,9 +1177,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", + "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", "cpu": [ "arm64" ], @@ -1195,9 +1193,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", + "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", "cpu": [ "x64" ], @@ -1211,9 +1209,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", + "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", "cpu": [ "x64" ], @@ -1227,9 +1225,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", + "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", "cpu": [ "arm64" ], @@ -1243,9 +1241,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", + "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", "cpu": [ "ia32" ], @@ -1259,9 +1257,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", - "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", + "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", "cpu": [ "x64" ], @@ -1275,24 +1273,27 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", "dev": true, "dependencies": { - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.3" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, + "funding": { + "url": "https://opencollective.com/eslint" + }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "node_modules/@eslint-community/regexpp": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", - "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -1370,6 +1371,17 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@gerrit0/mini-shiki": { + "version": "1.24.4", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.4.tgz", + "integrity": "sha512-YEHW1QeAg6UmxEmswiQbOVEg1CW22b1XUD/lNTliOsu0LD0wqoyleFMnmbTp697QE0pcadQiR5cVtbbAPncvpw==", + "dev": true, + "dependencies": { + "@shikijs/engine-oniguruma": "^1.24.2", + "@shikijs/types": "^1.24.2", + "@shikijs/vscode-textmate": "^9.3.1" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -1986,9 +1998,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.3.tgz", - "integrity": "sha512-MmKSfaB9GX+zXl6E8z4koOr/xU63AMVleLEa64v7R0QF/ZloMs5vcD1sHgM64GXXS1csaJutG+ddtzcueI/BLg==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.28.1.tgz", + "integrity": "sha512-2aZp8AES04KI2dy3Ss6/MDjXbwBzj+i0GqKtWXgw2/Ma6E4jJvujryO6gJAghIRVz7Vwr9Gtl/8na3nDUKpraQ==", "cpu": [ "arm" ], @@ -1999,9 +2011,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.3.tgz", - "integrity": "sha512-zrt8ecH07PE3sB4jPOggweBjJMzI1JG5xI2DIsUbkA+7K+Gkjys6eV7i9pOenNSDJH3eOr/jLb/PzqtmdwDq5g==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.28.1.tgz", + "integrity": "sha512-EbkK285O+1YMrg57xVA+Dp0tDBRB93/BZKph9XhMjezf6F4TpYjaUSuPt5J0fZXlSag0LmZAsTmdGGqPp4pQFA==", "cpu": [ "arm64" ], @@ -2012,9 +2024,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.3.tgz", - "integrity": "sha512-P0UxIOrKNBFTQaXTxOH4RxuEBVCgEA5UTNV6Yz7z9QHnUJ7eLX9reOd/NYMO3+XZO2cco19mXTxDMXxit4R/eQ==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.28.1.tgz", + "integrity": "sha512-prduvrMKU6NzMq6nxzQw445zXgaDBbMQvmKSJaxpaZ5R1QDM8w+eGxo6Y/jhT/cLoCvnZI42oEqf9KQNYz1fqQ==", "cpu": [ "arm64" ], @@ -2025,9 +2037,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.3.tgz", - "integrity": "sha512-L1M0vKGO5ASKntqtsFEjTq/fD91vAqnzeaF6sfNAy55aD+Hi2pBI5DKwCO+UNDQHWsDViJLqshxOahXyLSh3EA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.28.1.tgz", + "integrity": "sha512-WsvbOunsUk0wccO/TV4o7IKgloJ942hVFK1CLatwv6TJspcCZb9umQkPdvB7FihmdxgaKR5JyxDjWpCOp4uZlQ==", "cpu": [ "x64" ], @@ -2037,10 +2049,36 @@ "darwin" ] }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.28.1.tgz", + "integrity": "sha512-HTDPdY1caUcU4qK23FeeGxCdJF64cKkqajU0iBnTVxS8F7H/7BewvYoG+va1KPSL63kQ1PGNyiwKOfReavzvNA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.28.1.tgz", + "integrity": "sha512-m/uYasxkUevcFTeRSM9TeLyPe2QDuqtjkeoTpP9SW0XxUWfcYrGDMkO/m2tTw+4NMAF9P2fU3Mw4ahNvo7QmsQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.3.tgz", - "integrity": "sha512-btVgIsCjuYFKUjopPoWiDqmoUXQDiW2A4C3Mtmp5vACm7/GnyuprqIDPNczeyR5W8rTXEbkmrJux7cJmD99D2g==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.28.1.tgz", + "integrity": "sha512-QAg11ZIt6mcmzpNE6JZBpKfJaKkqTm1A9+y9O+frdZJEuhQxiugM05gnCWiANHj4RmbgeVJpTdmKRmH/a+0QbA==", "cpu": [ "arm" ], @@ -2051,9 +2089,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.3.tgz", - "integrity": "sha512-zmjbSphplZlau6ZTkxd3+NMtE4UKVy7U4aVFMmHcgO5CUbw17ZP6QCgyxhzGaU/wFFdTfiojjbLG3/0p9HhAqA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.28.1.tgz", + "integrity": "sha512-dRP9PEBfolq1dmMcFqbEPSd9VlRuVWEGSmbxVEfiq2cs2jlZAl0YNxFzAQS2OrQmsLBLAATDMb3Z6MFv5vOcXg==", "cpu": [ "arm" ], @@ -2064,9 +2102,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.3.tgz", - "integrity": "sha512-nSZfcZtAnQPRZmUkUQwZq2OjQciR6tEoJaZVFvLHsj0MF6QhNMg0fQ6mUOsiCUpTqxTx0/O6gX0V/nYc7LrgPw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.28.1.tgz", + "integrity": "sha512-uGr8khxO+CKT4XU8ZUH1TTEUtlktK6Kgtv0+6bIFSeiSlnGJHG1tSFSjm41uQ9sAO/5ULx9mWOz70jYLyv1QkA==", "cpu": [ "arm64" ], @@ -2077,9 +2115,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.3.tgz", - "integrity": "sha512-MnvSPGO8KJXIMGlQDYfvYS3IosFN2rKsvxRpPO2l2cum+Z3exiExLwVU+GExL96pn8IP+GdH8Tz70EpBhO0sIQ==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.28.1.tgz", + "integrity": "sha512-QF54q8MYGAqMLrX2t7tNpi01nvq5RI59UBNx+3+37zoKX5KViPo/gk2QLhsuqok05sSCRluj0D00LzCwBikb0A==", "cpu": [ "arm64" ], @@ -2089,10 +2127,23 @@ "linux" ] }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.28.1.tgz", + "integrity": "sha512-vPul4uodvWvLhRco2w0GcyZcdyBfpfDRgNKU+p35AWEbJ/HPs1tOUrkSueVbBS0RQHAf/A+nNtDpvw95PeVKOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.3.tgz", - "integrity": "sha512-+W+p/9QNDr2vE2AXU0qIy0qQE75E8RTwTwgqS2G5CRQ11vzq0tbnfBd6brWhS9bCRjAjepJe2fvvkvS3dno+iw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.28.1.tgz", + "integrity": "sha512-pTnTdBuC2+pt1Rmm2SV7JWRqzhYpEILML4PKODqLz+C7Ou2apEV52h19CR7es+u04KlqplggmN9sqZlekg3R1A==", "cpu": [ "ppc64" ], @@ -2103,9 +2154,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.3.tgz", - "integrity": "sha512-yXH6K6KfqGXaxHrtr+Uoy+JpNlUlI46BKVyonGiaD74ravdnF9BUNC+vV+SIuB96hUMGShhKV693rF9QDfO6nQ==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.28.1.tgz", + "integrity": "sha512-vWXy1Nfg7TPBSuAncfInmAI/WZDd5vOklyLJDdIRKABcZWojNDY0NJwruY2AcnCLnRJKSaBgf/GiJfauu8cQZA==", "cpu": [ "riscv64" ], @@ -2116,9 +2167,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.3.tgz", - "integrity": "sha512-R8cwY9wcnApN/KDYWTH4gV/ypvy9yZUHlbJvfaiXSB48JO3KpwSpjOGqO4jnGkLDSk1hgjYkTbTt6Q7uvPf8eg==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.28.1.tgz", + "integrity": "sha512-/yqC2Y53oZjb0yz8PVuGOQQNOTwxcizudunl/tFs1aLvObTclTwZ0JhXF2XcPT/zuaymemCDSuuUPXJJyqeDOg==", "cpu": [ "s390x" ], @@ -2129,9 +2180,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.3.tgz", - "integrity": "sha512-kZPbX/NOPh0vhS5sI+dR8L1bU2cSO9FgxwM8r7wHzGydzfSjLRCFAT87GR5U9scj2rhzN3JPYVC7NoBbl4FZ0g==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.1.tgz", + "integrity": "sha512-fzgeABz7rrAlKYB0y2kSEiURrI0691CSL0+KXwKwhxvj92VULEDQLpBYLHpF49MSiPG4sq5CK3qHMnb9tlCjBw==", "cpu": [ "x64" ], @@ -2142,9 +2193,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.3.tgz", - "integrity": "sha512-S0Yq+xA1VEH66uiMNhijsWAafffydd2X5b77eLHfRmfLsRSpbiAWiRHV6DEpz6aOToPsgid7TI9rGd6zB1rhbg==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.28.1.tgz", + "integrity": "sha512-xQTDVzSGiMlSshpJCtudbWyRfLaNiVPXt1WgdWTwWz9n0U12cI2ZVtWe/Jgwyv/6wjL7b66uu61Vg0POWVfz4g==", "cpu": [ "x64" ], @@ -2155,9 +2206,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.3.tgz", - "integrity": "sha512-9isNzeL34yquCPyerog+IMCNxKR8XYmGd0tHSV+OVx0TmE0aJOo9uw4fZfUuk2qxobP5sug6vNdZR6u7Mw7Q+Q==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.28.1.tgz", + "integrity": "sha512-wSXmDRVupJstFP7elGMgv+2HqXelQhuNf+IS4V+nUpNVi/GUiBgDmfwD0UGN3pcAnWsgKG3I52wMOBnk1VHr/A==", "cpu": [ "arm64" ], @@ -2168,9 +2219,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.3.tgz", - "integrity": "sha512-nMIdKnfZfzn1Vsk+RuOvl43ONTZXoAPUUxgcU0tXooqg4YrAqzfKzVenqqk2g5efWh46/D28cKFrOzDSW28gTA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.28.1.tgz", + "integrity": "sha512-ZkyTJ/9vkgrE/Rk9vhMXhf8l9D+eAhbAVbsGsXKy2ohmJaWg0LPQLnIxRdRp/bKyr8tXuPlXhIoGlEB5XpJnGA==", "cpu": [ "ia32" ], @@ -2181,9 +2232,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.3.tgz", - "integrity": "sha512-fOvu7PCQjAj4eWDEuD8Xz5gpzFqXzGlxHZozHP4b9Jxv9APtdxL6STqztDzMLuRXEc4UpXGGhx029Xgm91QBeA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.28.1.tgz", + "integrity": "sha512-ZvK2jBafvttJjoIdKm/Q/Bh7IJ1Ose9IBOwpOXcOvW3ikGTQGmKDgxTC6oCAzW6PynbkKP8+um1du81XJHZ0JA==", "cpu": [ "x64" ], @@ -2193,55 +2244,30 @@ "win32" ] }, - "node_modules/@shikijs/core": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.17.7.tgz", - "integrity": "sha512-ZnIDxFu/yvje3Q8owSHaEHd+bu/jdWhHAaJ17ggjXofHx5rc4bhpCSW+OjC6smUBi5s5dd023jWtZ1gzMu/yrw==", - "dev": true, - "dependencies": { - "@shikijs/engine-javascript": "1.17.7", - "@shikijs/engine-oniguruma": "1.17.7", - "@shikijs/types": "1.17.7", - "@shikijs/vscode-textmate": "^9.2.2", - "@types/hast": "^3.0.4", - "hast-util-to-html": "^9.0.2" - } - }, - "node_modules/@shikijs/engine-javascript": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.17.7.tgz", - "integrity": "sha512-wwSf7lKPsm+hiYQdX+1WfOXujtnUG6fnN4rCmExxa4vo+OTmvZ9B1eKauilvol/LHUPrQgW12G3gzem7pY5ckw==", - "dev": true, - "dependencies": { - "@shikijs/types": "1.17.7", - "@shikijs/vscode-textmate": "^9.2.2", - "oniguruma-to-js": "0.4.3" - } - }, "node_modules/@shikijs/engine-oniguruma": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.17.7.tgz", - "integrity": "sha512-pvSYGnVeEIconU28NEzBXqSQC/GILbuNbAHwMoSfdTBrobKAsV1vq2K4cAgiaW1TJceLV9QMGGh18hi7cCzbVQ==", + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.2.tgz", + "integrity": "sha512-ZN6k//aDNWRJs1uKB12pturKHh7GejKugowOFGAuG7TxDRLod1Bd5JhpOikOiFqPmKjKEPtEA6mRCf7q3ulDyQ==", "dev": true, "dependencies": { - "@shikijs/types": "1.17.7", - "@shikijs/vscode-textmate": "^9.2.2" + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0" } }, "node_modules/@shikijs/types": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.17.7.tgz", - "integrity": "sha512-+qA4UyhWLH2q4EFd+0z4K7GpERDU+c+CN2XYD3sC+zjvAr5iuwD1nToXZMt1YODshjkEGEDV86G7j66bKjqDdg==", + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.2.tgz", + "integrity": "sha512-bdeWZiDtajGLG9BudI0AHet0b6e7FbR0EsE4jpGaI0YwHm/XJunI9+3uZnzFtX65gsyJ6ngCIWUfA4NWRPnBkQ==", "dev": true, "dependencies": { - "@shikijs/vscode-textmate": "^9.2.2", + "@shikijs/vscode-textmate": "^9.3.0", "@types/hast": "^3.0.4" } }, "node_modules/@shikijs/vscode-textmate": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.2.2.tgz", - "integrity": "sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==", + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.1.tgz", + "integrity": "sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==", "dev": true }, "node_modules/@sinclair/typebox": { @@ -2361,7 +2387,7 @@ "link": true }, "node_modules/@tonaljs/rhythm-pattern": { - "resolved": "packages/rhythm-patterm", + "resolved": "packages/rhythm-pattern", "link": true }, "node_modules/@tonaljs/roman-numeral": { @@ -2438,9 +2464,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, "node_modules/@types/graceful-fs": { @@ -2486,39 +2512,24 @@ } }, "node_modules/@types/jest": { - "version": "29.5.13", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.13.tgz", - "integrity": "sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==", + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", "dev": true, "dependencies": { "expect": "^29.0.0", "pretty-format": "^29.0.0" } }, - "node_modules/@types/mdast": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "dev": true, - "dependencies": { - "@types/unist": "*" - } - }, "node_modules/@types/node": { - "version": "20.16.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz", - "integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==", + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", "dev": true, "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.20.0" } }, - "node_modules/@types/semver": { - "version": "7.5.8", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", - "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", - "dev": true - }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -2547,77 +2558,69 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", - "integrity": "sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.1.tgz", + "integrity": "sha512-Ncvsq5CT3Gvh+uJG0Lwlho6suwDfUXH0HztslDf5I+F2wAFAZMRwYLEorumpKLzmO2suAXZ/td1tBg4NZIi9CQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/type-utils": "7.18.0", - "@typescript-eslint/utils": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", + "@typescript-eslint/scope-manager": "8.18.1", + "@typescript-eslint/type-utils": "8.18.1", + "@typescript-eslint/utils": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/parser": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz", - "integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.18.1.tgz", + "integrity": "sha512-rBnTWHCdbYM2lh7hjyXqxk70wvon3p2FyaniZuey5TrcGBpfhVp0OxOa6gxr9Q9YhZFKyfbEnxc24ZnVbbUkCA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", + "@typescript-eslint/scope-manager": "8.18.1", + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/typescript-estree": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1", "debug": "^4.3.4" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz", - "integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.1.tgz", + "integrity": "sha512-HxfHo2b090M5s2+/9Z3gkBhI6xBH8OJCFjH9MhQ+nnoZqxU3wNxkLT+VWXWSFWc3UF3Z+CfPAyqdCTdoXtDPCQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0" + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -2625,39 +2628,35 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz", - "integrity": "sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.18.1.tgz", + "integrity": "sha512-jAhTdK/Qx2NJPNOTxXpMwlOiSymtR2j283TtPqXkKBdH8OAMmhiUfP0kJjc/qSE51Xrq02Gj9NY7MwK+UxVwHQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/utils": "7.18.0", + "@typescript-eslint/typescript-estree": "8.18.1", + "@typescript-eslint/utils": "8.18.1", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/types": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz", - "integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.1.tgz", + "integrity": "sha512-7uoAUsCj66qdNQNpH2G8MyTFlgerum8ubf21s3TSM3XmKXuIn+H2Sifh/ES2nPOPiYSRJWAk0fDkW0APBWcpfw==", "dev": true, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", @@ -2665,82 +2664,93 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz", - "integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.1.tgz", + "integrity": "sha512-z8U21WI5txzl2XYOW7i9hJhxoKKNG1kcU4RzyNvKrdZDmbjkmLBo8bgeiOJmA06kizLI76/CCBAAGlTlEeUfyg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/visitor-keys": "8.18.1", "debug": "^4.3.4", - "globby": "^11.1.0", + "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/utils": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz", - "integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.1.tgz", + "integrity": "sha512-8vikiIj2ebrC4WRdcAdDcmnu9Q/MXXwg+STf40BVfT8exDqBCUPdypvzcUPxEqRGKg9ALagZ0UWcYCtn+4W2iQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.18.0", - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/typescript-estree": "7.18.0" + "@typescript-eslint/scope-manager": "8.18.1", + "@typescript-eslint/types": "8.18.1", + "@typescript-eslint/typescript-estree": "8.18.1" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^8.56.0" + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz", - "integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==", + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.1.tgz", + "integrity": "sha512-Vj0WLm5/ZsD013YeUKn+K0y8p1M0jPpxOkKdbD1wB0ns53a5piVY02zjf072TblEweAbcYiFiPoSMF3kp+VhhQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.18.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.18.1", + "eslint-visitor-keys": "^4.2.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz", + "integrity": "sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==", "dev": true }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -3014,18 +3024,6 @@ "node": ">=4" } }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -3168,16 +3166,6 @@ } ] }, - "node_modules/ccount": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", - "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3203,26 +3191,6 @@ "node": ">=10" } }, - "node_modules/character-entities-html4": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", - "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-legacy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", @@ -3230,39 +3198,18 @@ "dev": true }, "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.2.tgz", + "integrity": "sha512-/b57FK+bblSU+dfewfFe0rT1YjVDfOmeLQwCAuC+vwvgLkXboATqqmy+Ipux6JrF6L5joe5CBnFOw+gLWH6yKg==", "dev": true, "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 14.16.0" }, "funding": { "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" } }, "node_modules/ci-info": { @@ -3417,16 +3364,6 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, - "node_modules/comma-separated-tokens": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", - "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -3479,9 +3416,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", @@ -3493,9 +3430,9 @@ } }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, "dependencies": { "ms": "^2.1.3" @@ -3538,15 +3475,6 @@ "node": ">=0.10.0" } }, - "node_modules/dequal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", - "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/detect-indent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz", @@ -3565,19 +3493,6 @@ "node": ">=8" } }, - "node_modules/devlop": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", - "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", - "dev": true, - "dependencies": { - "dequal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -3703,9 +3618,9 @@ } }, "node_modules/esbuild": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", - "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", + "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -3715,30 +3630,30 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.23.1", - "@esbuild/android-arm": "0.23.1", - "@esbuild/android-arm64": "0.23.1", - "@esbuild/android-x64": "0.23.1", - "@esbuild/darwin-arm64": "0.23.1", - "@esbuild/darwin-x64": "0.23.1", - "@esbuild/freebsd-arm64": "0.23.1", - "@esbuild/freebsd-x64": "0.23.1", - "@esbuild/linux-arm": "0.23.1", - "@esbuild/linux-arm64": "0.23.1", - "@esbuild/linux-ia32": "0.23.1", - "@esbuild/linux-loong64": "0.23.1", - "@esbuild/linux-mips64el": "0.23.1", - "@esbuild/linux-ppc64": "0.23.1", - "@esbuild/linux-riscv64": "0.23.1", - "@esbuild/linux-s390x": "0.23.1", - "@esbuild/linux-x64": "0.23.1", - "@esbuild/netbsd-x64": "0.23.1", - "@esbuild/openbsd-arm64": "0.23.1", - "@esbuild/openbsd-x64": "0.23.1", - "@esbuild/sunos-x64": "0.23.1", - "@esbuild/win32-arm64": "0.23.1", - "@esbuild/win32-ia32": "0.23.1", - "@esbuild/win32-x64": "0.23.1" + "@esbuild/aix-ppc64": "0.24.0", + "@esbuild/android-arm": "0.24.0", + "@esbuild/android-arm64": "0.24.0", + "@esbuild/android-x64": "0.24.0", + "@esbuild/darwin-arm64": "0.24.0", + "@esbuild/darwin-x64": "0.24.0", + "@esbuild/freebsd-arm64": "0.24.0", + "@esbuild/freebsd-x64": "0.24.0", + "@esbuild/linux-arm": "0.24.0", + "@esbuild/linux-arm64": "0.24.0", + "@esbuild/linux-ia32": "0.24.0", + "@esbuild/linux-loong64": "0.24.0", + "@esbuild/linux-mips64el": "0.24.0", + "@esbuild/linux-ppc64": "0.24.0", + "@esbuild/linux-riscv64": "0.24.0", + "@esbuild/linux-s390x": "0.24.0", + "@esbuild/linux-x64": "0.24.0", + "@esbuild/netbsd-x64": "0.24.0", + "@esbuild/openbsd-arm64": "0.24.0", + "@esbuild/openbsd-x64": "0.24.0", + "@esbuild/sunos-x64": "0.24.0", + "@esbuild/win32-arm64": "0.24.0", + "@esbuild/win32-ia32": "0.24.0", + "@esbuild/win32-x64": "0.24.0" } }, "node_modules/escalade": { @@ -3766,6 +3681,7 @@ "version": "8.57.1", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -4229,9 +4145,9 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true }, "node_modules/foreground-child": { @@ -4324,9 +4240,9 @@ } }, "node_modules/get-east-asian-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", - "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", "dev": true, "engines": { "node": ">=18" @@ -4479,58 +4395,12 @@ "node": ">= 0.4" } }, - "node_modules/hast-util-to-html": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.3.tgz", - "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", - "dev": true, - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "ccount": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "hast-util-whitespace": "^3.0.0", - "html-void-elements": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "property-information": "^6.0.0", - "space-separated-tokens": "^2.0.0", - "stringify-entities": "^4.0.0", - "zwitch": "^2.0.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-whitespace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", - "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", - "dev": true, - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/html-void-elements": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", - "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/human-id": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/human-id/-/human-id-1.0.2.tgz", @@ -4643,18 +4513,6 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-core-module": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", @@ -5616,9 +5474,9 @@ } }, "node_modules/lilconfig": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", - "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", "dev": true, "engines": { "node": ">=14" @@ -5643,21 +5501,21 @@ } }, "node_modules/lint-staged": { - "version": "15.2.10", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.10.tgz", - "integrity": "sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==", + "version": "15.2.11", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.11.tgz", + "integrity": "sha512-Ev6ivCTYRTGs9ychvpVw35m/bcNDuBN+mnTeObCL5h+boS5WzBEC6LHI4I9F/++sZm1m+J2LEiy0gxL/R9TBqQ==", "dev": true, "dependencies": { "chalk": "~5.3.0", "commander": "~12.1.0", - "debug": "~4.3.6", + "debug": "~4.4.0", "execa": "~8.0.1", - "lilconfig": "~3.1.2", - "listr2": "~8.2.4", + "lilconfig": "~3.1.3", + "listr2": "~8.2.5", "micromatch": "~4.0.8", "pidtree": "~0.6.0", "string-argv": "~0.3.2", - "yaml": "~2.5.0" + "yaml": "~2.6.1" }, "bin": { "lint-staged": "bin/lint-staged.js" @@ -5816,9 +5674,9 @@ } }, "node_modules/listr2": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.4.tgz", - "integrity": "sha512-opevsywziHd3zHCVQGAj8zu+Z3yHNkkoYhWIGnq54RrCVwLz0MozotJEDnKsIBLvkfLGN6BLOyAeRrYI0pKA4g==", + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.5.tgz", + "integrity": "sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==", "dev": true, "dependencies": { "cli-truncate": "^4.0.0", @@ -6055,27 +5913,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/mdast-util-to-hast": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", - "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", - "dev": true, - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@ungap/structured-clone": "^1.0.0", - "devlop": "^1.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "trim-lines": "^3.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", @@ -6097,95 +5934,6 @@ "node": ">= 8" } }, - "node_modules/micromark-util-character": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz", - "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-encode": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", - "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/micromark-util-sanitize-uri": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", - "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-encode": "^2.0.0", - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-symbol": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", - "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/micromark-util-types": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", - "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", - "dev": true, - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -6342,18 +6090,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/oniguruma-to-js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/oniguruma-to-js/-/oniguruma-to-js-0.4.3.tgz", - "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", - "dev": true, - "dependencies": { - "regex": "^4.3.2" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -6550,9 +6286,9 @@ } }, "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true }, "node_modules/picomatch": { @@ -6661,9 +6397,9 @@ } }, "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -6714,22 +6450,6 @@ "node": ">= 6" } }, - "node_modules/property-information": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", - "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", - "dev": true - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -6815,15 +6535,16 @@ } }, "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", + "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, "engines": { - "node": ">=8.10.0" + "node": ">= 14.16.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, "node_modules/regenerator-runtime": { @@ -6832,12 +6553,6 @@ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "dev": true }, - "node_modules/regex": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/regex/-/regex-4.3.2.tgz", - "integrity": "sha512-kK/AA3A9K6q2js89+VMymcboLOlF5lZRCYJv3gzszXFHBr6kO6qLGzbm+UIugBEV8SMMKCTR59txoY6ctRHYVw==", - "dev": true - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -6970,12 +6685,12 @@ } }, "node_modules/rollup": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.3.tgz", - "integrity": "sha512-7sqRtBNnEbcBtMeRVc6VRsJMmpI+JU1z9VTvW8D4gXIYQFz0aLcsE6rRkyghZkLfEgUZgVvOG7A5CVz/VW5GIA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.28.1.tgz", + "integrity": "sha512-61fXYl/qNVinKmGSTHAZ6Yy8I3YIJC/r2m9feHo6SwVAVcLT5MPwOUFe7EuURA/4m0NR8lXG4BBXuo/IZEsjMg==", "dev": true, "dependencies": { - "@types/estree": "1.0.5" + "@types/estree": "1.0.6" }, "bin": { "rollup": "dist/bin/rollup" @@ -6985,22 +6700,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.21.3", - "@rollup/rollup-android-arm64": "4.21.3", - "@rollup/rollup-darwin-arm64": "4.21.3", - "@rollup/rollup-darwin-x64": "4.21.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.3", - "@rollup/rollup-linux-arm-musleabihf": "4.21.3", - "@rollup/rollup-linux-arm64-gnu": "4.21.3", - "@rollup/rollup-linux-arm64-musl": "4.21.3", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.3", - "@rollup/rollup-linux-riscv64-gnu": "4.21.3", - "@rollup/rollup-linux-s390x-gnu": "4.21.3", - "@rollup/rollup-linux-x64-gnu": "4.21.3", - "@rollup/rollup-linux-x64-musl": "4.21.3", - "@rollup/rollup-win32-arm64-msvc": "4.21.3", - "@rollup/rollup-win32-ia32-msvc": "4.21.3", - "@rollup/rollup-win32-x64-msvc": "4.21.3", + "@rollup/rollup-android-arm-eabi": "4.28.1", + "@rollup/rollup-android-arm64": "4.28.1", + "@rollup/rollup-darwin-arm64": "4.28.1", + "@rollup/rollup-darwin-x64": "4.28.1", + "@rollup/rollup-freebsd-arm64": "4.28.1", + "@rollup/rollup-freebsd-x64": "4.28.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.28.1", + "@rollup/rollup-linux-arm-musleabihf": "4.28.1", + "@rollup/rollup-linux-arm64-gnu": "4.28.1", + "@rollup/rollup-linux-arm64-musl": "4.28.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.28.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.28.1", + "@rollup/rollup-linux-riscv64-gnu": "4.28.1", + "@rollup/rollup-linux-s390x-gnu": "4.28.1", + "@rollup/rollup-linux-x64-gnu": "4.28.1", + "@rollup/rollup-linux-x64-musl": "4.28.1", + "@rollup/rollup-win32-arm64-msvc": "4.28.1", + "@rollup/rollup-win32-ia32-msvc": "4.28.1", + "@rollup/rollup-win32-x64-msvc": "4.28.1", "fsevents": "~2.3.2" } }, @@ -7066,20 +6784,6 @@ "node": ">=8" } }, - "node_modules/shiki": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.17.7.tgz", - "integrity": "sha512-Zf6hNtWhFyF4XP5OOsXkBTEx9JFPiN0TQx4wSe+Vqeuczewgk2vT4IZhF4gka55uelm052BD5BaHavNqUNZd+A==", - "dev": true, - "dependencies": { - "@shikijs/core": "1.17.7", - "@shikijs/engine-javascript": "1.17.7", - "@shikijs/engine-oniguruma": "1.17.7", - "@shikijs/types": "1.17.7", - "@shikijs/vscode-textmate": "^9.2.2", - "@types/hast": "^3.0.4" - } - }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -7148,86 +6852,28 @@ "source-map": "^0.6.0" } }, - "node_modules/space-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/spawndamnit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/spawndamnit/-/spawndamnit-2.0.0.tgz", - "integrity": "sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA==", - "dev": true, - "dependencies": { - "cross-spawn": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "node_modules/spawndamnit/node_modules/cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==", - "dev": true, - "dependencies": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "node_modules/spawndamnit/node_modules/lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "node_modules/spawndamnit/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spawndamnit/-/spawndamnit-3.0.1.tgz", + "integrity": "sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==", "dev": true, "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" + "cross-spawn": "^7.0.5", + "signal-exit": "^4.0.1" } }, - "node_modules/spawndamnit/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "node_modules/spawndamnit/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/spawndamnit/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" + "node": ">=14" }, - "bin": { - "which": "bin/which" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/spawndamnit/node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", - "dev": true - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -7351,20 +6997,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/stringify-entities": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", - "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", - "dev": true, - "dependencies": { - "character-entities-html4": "^2.0.0", - "character-entities-legacy": "^3.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -7570,13 +7202,19 @@ "node": ">=0.8" } }, + "node_modules/tinyexec": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.1.tgz", + "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==", + "dev": true + }, "node_modules/tinyglobby": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.6.tgz", - "integrity": "sha512-NbBoFBpqfcgd1tCiO8Lkfdk+xrA7mlLR9zgvZcZWQQwU63XAfUePyd6wZBaU93Hqw347lHnwFzttAkemHzzz4g==", + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.10.tgz", + "integrity": "sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==", "dev": true, "dependencies": { - "fdir": "^6.3.0", + "fdir": "^6.4.2", "picomatch": "^4.0.2" }, "engines": { @@ -7584,9 +7222,9 @@ } }, "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.3.0.tgz", - "integrity": "sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", "dev": true, "peerDependencies": { "picomatch": "^3 || ^4" @@ -7670,20 +7308,10 @@ "tree-kill": "cli.js" } }, - "node_modules/trim-lines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", - "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/ts-api-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", - "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", "dev": true, "engines": { "node": ">=16" @@ -7747,26 +7375,26 @@ } }, "node_modules/tsup": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.3.0.tgz", - "integrity": "sha512-ALscEeyS03IomcuNdFdc0YWGVIkwH1Ws7nfTbAPuoILvEV2hpGQAY72LIOjglGo4ShWpZfpBqP/jpQVCzqYQag==", + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.3.5.tgz", + "integrity": "sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==", "dev": true, "dependencies": { "bundle-require": "^5.0.0", "cac": "^6.7.14", - "chokidar": "^3.6.0", + "chokidar": "^4.0.1", "consola": "^3.2.3", - "debug": "^4.3.5", - "esbuild": "^0.23.0", - "execa": "^5.1.1", + "debug": "^4.3.7", + "esbuild": "^0.24.0", "joycon": "^3.1.1", - "picocolors": "^1.0.1", + "picocolors": "^1.1.1", "postcss-load-config": "^6.0.1", "resolve-from": "^5.0.0", - "rollup": "^4.19.0", + "rollup": "^4.24.0", "source-map": "0.8.0-beta.0", "sucrase": "^3.35.0", - "tinyglobby": "^0.2.1", + "tinyexec": "^0.3.1", + "tinyglobby": "^0.2.9", "tree-kill": "^1.2.2" }, "bin": { @@ -7810,26 +7438,26 @@ } }, "node_modules/turbo": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo/-/turbo-2.1.2.tgz", - "integrity": "sha512-Jb0rbU4iHEVQ18An/YfakdIv9rKnd3zUfSE117EngrfWXFHo3RndVH96US3GsT8VHpwTncPePDBT2t06PaFLrw==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo/-/turbo-2.3.3.tgz", + "integrity": "sha512-DUHWQAcC8BTiUZDRzAYGvpSpGLiaOQPfYXlCieQbwUvmml/LRGIe3raKdrOPOoiX0DYlzxs2nH6BoWJoZrj8hA==", "dev": true, "bin": { "turbo": "bin/turbo" }, "optionalDependencies": { - "turbo-darwin-64": "2.1.2", - "turbo-darwin-arm64": "2.1.2", - "turbo-linux-64": "2.1.2", - "turbo-linux-arm64": "2.1.2", - "turbo-windows-64": "2.1.2", - "turbo-windows-arm64": "2.1.2" + "turbo-darwin-64": "2.3.3", + "turbo-darwin-arm64": "2.3.3", + "turbo-linux-64": "2.3.3", + "turbo-linux-arm64": "2.3.3", + "turbo-windows-64": "2.3.3", + "turbo-windows-arm64": "2.3.3" } }, "node_modules/turbo-darwin-64": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-2.1.2.tgz", - "integrity": "sha512-3TEBxHWh99h2yIzkuIigMEOXt/ItYQp0aPiJjPd1xN4oDcsKK5AxiFKPH9pdtfIBzYsY59kQhZiFj0ELnSP7Bw==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-2.3.3.tgz", + "integrity": "sha512-bxX82xe6du/3rPmm4aCC5RdEilIN99VUld4HkFQuw+mvFg6darNBuQxyWSHZTtc25XgYjQrjsV05888w1grpaA==", "cpu": [ "x64" ], @@ -7840,9 +7468,9 @@ ] }, "node_modules/turbo-darwin-arm64": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-2.1.2.tgz", - "integrity": "sha512-he0miWNq2WxJzsH82jS2Z4MXpnkzn9SH8a79iPXiJkq25QREImucscM4RPasXm8wARp91pyysJMq6aasD45CeA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-2.3.3.tgz", + "integrity": "sha512-DYbQwa3NsAuWkCUYVzfOUBbSUBVQzH5HWUFy2Kgi3fGjIWVZOFk86ss+xsWu//rlEAfYwEmopigsPYSmW4X15A==", "cpu": [ "arm64" ], @@ -7853,9 +7481,9 @@ ] }, "node_modules/turbo-linux-64": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-2.1.2.tgz", - "integrity": "sha512-fKUBcc0rK8Vdqv5a/E3CSpMBLG1bzwv+Q0Q83F8fG2ZfNCNKGbcEYABdonNZkkx141Rj03cZQFCgxu3MVEGU+A==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-2.3.3.tgz", + "integrity": "sha512-eHj9OIB0dFaP6BxB88jSuaCLsOQSYWBgmhy2ErCu6D2GG6xW3b6e2UWHl/1Ho9FsTg4uVgo4DB9wGsKa5erjUA==", "cpu": [ "x64" ], @@ -7866,9 +7494,9 @@ ] }, "node_modules/turbo-linux-arm64": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-2.1.2.tgz", - "integrity": "sha512-sV8Bpmm0WiuxgbhxymcC7wSsuxfBBieI98GegSwbr/bs1ANAgzCg93urIrdKdQ3/b31zZxQwcaP4FBF1wx1Qdg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-2.3.3.tgz", + "integrity": "sha512-NmDE/NjZoDj1UWBhMtOPmqFLEBKhzGS61KObfrDEbXvU3lekwHeoPvAMfcovzswzch+kN2DrtbNIlz+/rp8OCg==", "cpu": [ "arm64" ], @@ -7879,9 +7507,9 @@ ] }, "node_modules/turbo-windows-64": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-2.1.2.tgz", - "integrity": "sha512-wcmIJZI9ORT9ykHGliFE6kWRQrlH930QGSjSgWC8uFChFFuOyUlvC7ttcxuSvU9VqC7NF4C+GVAcFJQ8lTjN7g==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-2.3.3.tgz", + "integrity": "sha512-O2+BS4QqjK3dOERscXqv7N2GXNcqHr9hXumkMxDj/oGx9oCatIwnnwx34UmzodloSnJpgSqjl8iRWiY65SmYoQ==", "cpu": [ "x64" ], @@ -7892,9 +7520,9 @@ ] }, "node_modules/turbo-windows-arm64": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-2.1.2.tgz", - "integrity": "sha512-zdnXjrhk7YO6CP+Q5wPueEvOCLH4lDa6C4rrwiakcWcPgcQGbVozJlo4uaQ6awo8HLWQEvOwu84RkWTdLAc/Hw==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-2.3.3.tgz", + "integrity": "sha512-dW4ZK1r6XLPNYLIKjC4o87HxYidtRRcBeo/hZ9Wng2XM/MqqYkAyzJXJGgRMsc0MMEN9z4+ZIfnSNBrA0b08ag==", "cpu": [ "arm64" ], @@ -7938,16 +7566,16 @@ } }, "node_modules/typedoc": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.7.tgz", - "integrity": "sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==", + "version": "0.27.5", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.5.tgz", + "integrity": "sha512-x+fhKJtTg4ozXwKayh/ek4wxZQI/+2hmZUdO2i2NGDBRUflDble70z+ewHod3d4gRpXSO6fnlnjbDTnJk7HlkQ==", "dev": true, "dependencies": { + "@gerrit0/mini-shiki": "^1.24.0", "lunr": "^2.3.9", "markdown-it": "^14.1.0", "minimatch": "^9.0.5", - "shiki": "^1.16.2", - "yaml": "^2.5.1" + "yaml": "^2.6.1" }, "bin": { "typedoc": "bin/typedoc" @@ -7956,25 +7584,25 @@ "node": ">= 18" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x" + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" } }, "node_modules/typedoc-plugin-markdown": { - "version": "4.2.7", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.2.7.tgz", - "integrity": "sha512-bLsQdweSm48P9j6kGqQ3/4GCH5zu2EnURSkkxqirNc+uVFE9YK825ogDw+WbNkRHIV6eZK/1U43gT7YfglyYOg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.3.2.tgz", + "integrity": "sha512-hCF3V0axzbzGDYFW21XigWIJQBOJ2ZRVWWs7X+e62ew/pXnvz7iKF/zVdkBm3w8Mk4bmXWp/FT0IF4Zn9uBRww==", "dev": true, "engines": { "node": ">= 18" }, "peerDependencies": { - "typedoc": "0.26.x" + "typedoc": "0.27.x" } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7991,79 +7619,11 @@ "dev": true }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true }, - "node_modules/unist-util-is": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", - "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-position": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-stringify-position": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", - "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit-parents": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", - "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -8126,34 +7686,6 @@ "node": ">=10.12.0" } }, - "node_modules/vfile": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", - "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-message": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", - "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", - "dev": true, - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-stringify-position": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -8342,9 +7874,9 @@ "dev": true }, "node_modules/yaml": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", - "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "dev": true, "bin": { "yaml": "bin.mjs" @@ -8421,17 +7953,8 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/zwitch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", - "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "packages/abc-notation": { + "name": "@tonaljs/abc-notation", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8440,6 +7963,7 @@ } }, "packages/array": { + "name": "@tonaljs/array", "version": "4.8.3", "license": "MIT", "dependencies": { @@ -8447,6 +7971,7 @@ } }, "packages/chord": { + "name": "@tonaljs/chord", "version": "6.1.0", "license": "MIT", "dependencies": { @@ -8461,6 +7986,7 @@ } }, "packages/chord-detect": { + "name": "@tonaljs/chord-detect", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8470,6 +7996,7 @@ } }, "packages/chord-dictionary": { + "name": "@tonaljs/chord-dictionary", "version": "4.8.5", "license": "MIT", "dependencies": { @@ -8477,6 +8004,7 @@ } }, "packages/chord-type": { + "name": "@tonaljs/chord-type", "version": "5.1.0", "license": "MIT", "dependencies": { @@ -8484,10 +8012,12 @@ } }, "packages/collection": { + "name": "@tonaljs/collection", "version": "4.9.0", "license": "MIT" }, "packages/core": { + "name": "@tonaljs/core", "version": "5.0.1", "license": "MIT", "dependencies": { @@ -8498,10 +8028,12 @@ } }, "packages/duration-value": { + "name": "@tonaljs/duration-value", "version": "4.9.0", "license": "MIT" }, "packages/interval": { + "name": "@tonaljs/interval", "version": "5.1.0", "license": "MIT", "dependencies": { @@ -8511,7 +8043,8 @@ } }, "packages/key": { - "version": "4.10.0", + "name": "@tonaljs/key", + "version": "4.11.0", "license": "MIT", "dependencies": { "@tonaljs/note": "4.11.0", @@ -8524,6 +8057,7 @@ } }, "packages/midi": { + "name": "@tonaljs/midi", "version": "4.10.0", "license": "MIT", "dependencies": { @@ -8531,6 +8065,7 @@ } }, "packages/mode": { + "name": "@tonaljs/mode", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8543,17 +8078,20 @@ } }, "packages/modules": { - "version": "4.8.7", + "name": "@tonaljs/modules", + "version": "4.8.8", "license": "MIT", "dependencies": { - "tonal": "6.2.0" + "tonal": "6.3.0" } }, "packages/notation-scientific": { + "name": "@tonaljs/notation-scientific", "version": "4.8.1", "license": "MIT" }, "packages/note": { + "name": "@tonaljs/note", "version": "4.11.0", "license": "MIT", "dependencies": { @@ -8565,6 +8103,7 @@ } }, "packages/pcset": { + "name": "@tonaljs/pcset", "version": "4.10.0", "license": "MIT", "dependencies": { @@ -8576,10 +8115,12 @@ } }, "packages/pitch": { + "name": "@tonaljs/pitch", "version": "5.0.2", "license": "MIT" }, "packages/pitch-distance": { + "name": "@tonaljs/pitch-distance", "version": "5.0.4", "license": "MIT", "dependencies": { @@ -8589,6 +8130,7 @@ } }, "packages/pitch-interval": { + "name": "@tonaljs/pitch-interval", "version": "6.0.0", "license": "MIT", "dependencies": { @@ -8596,6 +8138,7 @@ } }, "packages/pitch-note": { + "name": "@tonaljs/pitch-note", "version": "6.0.0", "license": "MIT", "dependencies": { @@ -8603,6 +8146,7 @@ } }, "packages/progression": { + "name": "@tonaljs/progression", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8614,6 +8158,7 @@ } }, "packages/range": { + "name": "@tonaljs/range", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8622,10 +8167,17 @@ } }, "packages/rhythm-patterm": { + "version": "1.0.0", + "extraneous": true, + "license": "MIT" + }, + "packages/rhythm-pattern": { + "name": "@tonaljs/rhythm-pattern", "version": "1.0.0", "license": "MIT" }, "packages/roman-numeral": { + "name": "@tonaljs/roman-numeral", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8635,6 +8187,7 @@ } }, "packages/scale": { + "name": "@tonaljs/scale", "version": "4.13.0", "license": "MIT", "dependencies": { @@ -8648,6 +8201,7 @@ } }, "packages/scale-dictionary": { + "name": "@tonaljs/scale-dictionary", "version": "4.8.4", "license": "MIT", "dependencies": { @@ -8655,6 +8209,7 @@ } }, "packages/scale-type": { + "name": "@tonaljs/scale-type", "version": "4.9.0", "license": "MIT", "dependencies": { @@ -8662,11 +8217,12 @@ } }, "packages/time-signature": { + "name": "@tonaljs/time-signature", "version": "4.9.0", "license": "MIT" }, "packages/tonal": { - "version": "6.2.0", + "version": "6.3.0", "license": "MIT", "dependencies": { "@tonaljs/abc-notation": "4.9.0", @@ -8677,7 +8233,7 @@ "@tonaljs/core": "5.0.1", "@tonaljs/duration-value": "4.9.0", "@tonaljs/interval": "5.1.0", - "@tonaljs/key": "4.10.0", + "@tonaljs/key": "4.11.0", "@tonaljs/midi": "4.10.0", "@tonaljs/mode": "4.9.0", "@tonaljs/note": "4.11.0", @@ -8695,6 +8251,7 @@ } }, "packages/voice-leading": { + "name": "@tonaljs/voice-leading", "version": "5.1.0", "license": "MIT", "dependencies": { @@ -8702,6 +8259,7 @@ } }, "packages/voicing": { + "name": "@tonaljs/voicing", "version": "5.1.0", "license": "MIT", "dependencies": { @@ -8714,6 +8272,7 @@ } }, "packages/voicing-dictionary": { + "name": "@tonaljs/voicing-dictionary", "version": "5.1.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 25525ee6..a0e06f86 100644 --- a/package.json +++ b/package.json @@ -47,24 +47,24 @@ "testEnvironment": "node" }, "devDependencies": { - "@changesets/cli": "^2.27.7", - "@types/jest": "^29.5.2", - "@types/node": "^20.10.1", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", - "esbuild": "^0.23.0", - "eslint": "^8.54.0", - "jest": "^29.5.0", - "jest-config": "^29.5.0", - "lint-staged": "^15.1.0", - "lodash": "^4.17.15", - "prettier": "^3.1.0", - "ts-jest": "^29.1.0", - "tsup": "^8.2.2", - "turbo": "^2.0.0", - "typedoc": "^0.26.5", - "typedoc-plugin-markdown": "^4.2.2", - "typescript": "^5.5.4" + "@changesets/cli": "^2.27.11", + "@types/jest": "^29.5.14", + "@types/node": "^22.10.2", + "@typescript-eslint/eslint-plugin": "^8.18.1", + "@typescript-eslint/parser": "^8.18.1", + "esbuild": "^0.24.0", + "eslint": "^8", + "jest": "^29.7.0", + "jest-config": "^29.7.0", + "lint-staged": "^15.2.11", + "lodash": "^4.17.21", + "prettier": "^3.4.2", + "ts-jest": "^29.2.5", + "tsup": "^8.3.5", + "turbo": "^2.3.3", + "typedoc": "^0.27.5", + "typedoc-plugin-markdown": "^4.3.2", + "typescript": "^5.7.2" }, - "packageManager": "npm@10.2.3" + "packageManager": "npm@11.0.0" } diff --git a/packages/chord/README.md b/packages/chord/README.md index daed4b3c..c3f53694 100644 --- a/packages/chord/README.md +++ b/packages/chord/README.md @@ -73,7 +73,7 @@ Chord.getChord("maj7", "C", "B") === Chord.get("Cmaj7/B"); Print the notes of the given chord at the given tonic: ```js -Chord.notes("maj4", "C4"); // => ["C4", "E4", "G4", "B4"] +Chord.notes("maj7", "C4"); // => ["C4", "E4", "G4", "B4"] ``` ### `Chord.degrees(chordType: string, tonic?: string) => (degree: number) => string` diff --git a/packages/rhythm-patterm/CHANGELOG.md b/packages/rhythm-pattern/CHANGELOG.md similarity index 100% rename from packages/rhythm-patterm/CHANGELOG.md rename to packages/rhythm-pattern/CHANGELOG.md diff --git a/packages/rhythm-patterm/README.md b/packages/rhythm-pattern/README.md similarity index 100% rename from packages/rhythm-patterm/README.md rename to packages/rhythm-pattern/README.md diff --git a/packages/rhythm-patterm/index.ts b/packages/rhythm-pattern/index.ts similarity index 100% rename from packages/rhythm-patterm/index.ts rename to packages/rhythm-pattern/index.ts diff --git a/packages/rhythm-patterm/package.json b/packages/rhythm-pattern/package.json similarity index 100% rename from packages/rhythm-patterm/package.json rename to packages/rhythm-pattern/package.json diff --git a/packages/rhythm-patterm/test.ts b/packages/rhythm-pattern/test.ts similarity index 100% rename from packages/rhythm-patterm/test.ts rename to packages/rhythm-pattern/test.ts diff --git a/packages/tonal/browser/tonal.min.js.map b/packages/tonal/browser/tonal.min.js.map index fcec45f8..06eabfab 100644 --- a/packages/tonal/browser/tonal.min.js.map +++ b/packages/tonal/browser/tonal.min.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../index.ts", "../../pitch/index.ts", "../../pitch-interval/index.ts", "../../pitch-note/index.ts", "../../pitch-distance/index.ts", "../../abc-notation/index.ts", "../../array/index.ts", "../../collection/index.ts", "../../pcset/index.ts", "../../chord-type/index.ts", "../../chord-type/data.ts", "../../chord-detect/index.ts", "../../interval/index.ts", "../../scale-type/index.ts", "../../scale-type/data.ts", "../../chord/index.ts", "../../duration-value/data.ts", "../../duration-value/index.ts", "../../midi/index.ts", "../../note/index.ts", "../../roman-numeral/index.ts", "../../key/index.ts", "../../mode/index.ts", "../../progression/index.ts", "../../range/index.ts", "../../rhythm-patterm/index.ts", "../../scale/index.ts", "../../time-signature/index.ts", "../../voice-leading/index.ts", "../../voicing-dictionary/index.ts", "../../voicing-dictionary/data.ts", "../../voicing/index.ts", "../../core/index.ts"], - "sourcesContent": ["import * as AbcNotation from \"@tonaljs/abc-notation\";\nimport * as Array from \"@tonaljs/array\";\nimport * as Chord from \"@tonaljs/chord\";\nimport * as ChordType from \"@tonaljs/chord-type\";\nimport * as Collection from \"@tonaljs/collection\";\nimport * as DurationValue from \"@tonaljs/duration-value\";\nimport * as Interval from \"@tonaljs/interval\";\nimport * as Key from \"@tonaljs/key\";\nimport * as Midi from \"@tonaljs/midi\";\nimport * as Mode from \"@tonaljs/mode\";\nimport * as Note from \"@tonaljs/note\";\nimport * as Pcset from \"@tonaljs/pcset\";\nimport * as Progression from \"@tonaljs/progression\";\nimport * as Range from \"@tonaljs/range\";\nimport * as RhythmPattern from \"@tonaljs/rhythm-pattern\";\nimport * as RomanNumeral from \"@tonaljs/roman-numeral\";\nimport * as Scale from \"@tonaljs/scale\";\nimport * as ScaleType from \"@tonaljs/scale-type\";\nimport * as TimeSignature from \"@tonaljs/time-signature\";\nimport * as VoiceLeading from \"@tonaljs/voice-leading\";\nimport * as Voicing from \"@tonaljs/voicing\";\nimport * as VoicingDictionary from \"@tonaljs/voicing-dictionary\";\n\nexport * from \"@tonaljs/core\";\n\n// deprecated (backwards compatibility)\nimport * as Core from \"@tonaljs/core\";\n/** @deprecated */\nconst Tonal = Core;\n/** @deprecated */\nconst PcSet = Pcset;\n/** @deprecated */\nconst ChordDictionary = ChordType;\n/** @deprecated */\nconst ScaleDictionary = ScaleType;\n\nexport {\n AbcNotation,\n Array,\n Chord,\n ChordDictionary,\n ChordType,\n Collection,\n Core,\n DurationValue,\n Interval,\n Key,\n Midi,\n Mode,\n Note,\n PcSet,\n Pcset,\n Progression,\n Range,\n RhythmPattern,\n RomanNumeral,\n Scale,\n ScaleDictionary,\n ScaleType,\n TimeSignature,\n Tonal,\n VoiceLeading,\n Voicing,\n VoicingDictionary,\n};\n", "export interface NamedPitch {\n readonly name: string;\n}\n\n/*** @deprecated use NamedPitch */\nexport interface Named {\n readonly name: string;\n}\n\nexport interface NotFound extends NamedPitch {\n readonly empty: true;\n readonly name: \"\";\n}\n\nexport function isNamedPitch(src: unknown): src is NamedPitch {\n return src !== null &&\n typeof src === \"object\" &&\n \"name\" in src &&\n typeof src.name === \"string\"\n ? true\n : false;\n}\n\ntype Fifths = number;\ntype Octaves = number;\nexport type Direction = 1 | -1;\n\nexport type PitchClassCoordinates = [Fifths];\nexport type NoteCoordinates = [Fifths, Octaves];\nexport type IntervalCoordinates = [Fifths, Octaves, Direction];\nexport type PitchCoordinates =\n | PitchClassCoordinates\n | NoteCoordinates\n | IntervalCoordinates;\n\n/**\n * Pitch properties\n *\n * - {number} step - The step number: 0 = C, 1 = D, ... 6 = B\n * - {number} alt - Number of alterations: -2 = 'bb', -1 = 'b', 0 = '', 1 = '#', ...\n * - {number} [oct] = The octave (undefined when is a coord class)\n * - {number} [dir] = Interval direction (undefined when is not an interval)\n */\nexport interface Pitch {\n readonly step: number;\n readonly alt: number;\n readonly oct?: number; // undefined for pitch classes\n readonly dir?: Direction; // undefined for notes\n}\n\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\nexport const chroma = ({ step, alt }: Pitch) => (SIZES[step] + alt + 120) % 12;\n\nexport const height = ({ step, alt, oct, dir = 1 }: Pitch) =>\n dir * (SIZES[step] + alt + 12 * (oct === undefined ? -100 : oct));\n\nexport const midi = (pitch: Pitch) => {\n const h = height(pitch);\n return pitch.oct !== undefined && h >= -12 && h <= 115 ? h + 12 : null;\n};\n\nexport function isPitch(pitch: unknown): pitch is Pitch {\n return pitch !== null &&\n typeof pitch === \"object\" &&\n \"step\" in pitch &&\n typeof pitch.step === \"number\" &&\n \"alt\" in pitch &&\n typeof pitch.alt === \"number\" &&\n !isNaN(pitch.step) &&\n !isNaN(pitch.alt)\n ? true\n : false;\n}\n\n// The number of fifths of [C, D, E, F, G, A, B]\nconst FIFTHS = [0, 2, 4, -1, 1, 3, 5];\n// The number of octaves it span each step\nconst STEPS_TO_OCTS = FIFTHS.map((fifths: number) =>\n Math.floor((fifths * 7) / 12),\n);\n\n/**\n * Get coordinates from pitch object\n */\nexport function coordinates(pitch: Pitch): PitchCoordinates {\n const { step, alt, oct, dir = 1 } = pitch;\n const f = FIFTHS[step] + 7 * alt;\n if (oct === undefined) {\n return [dir * f];\n }\n const o = oct - STEPS_TO_OCTS[step] - 4 * alt;\n return [dir * f, dir * o];\n}\n\n// We need to get the steps from fifths\n// Fifths for CDEFGAB are [ 0, 2, 4, -1, 1, 3, 5 ]\n// We add 1 to fifths to avoid negative numbers, so:\n// for [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"] we have:\nconst FIFTHS_TO_STEPS = [3, 0, 4, 1, 5, 2, 6];\n\n/**\n * Get pitch from coordinate objects\n */\nexport function pitch(coord: PitchCoordinates): Pitch {\n const [f, o, dir] = coord;\n const step = FIFTHS_TO_STEPS[unaltered(f)];\n const alt = Math.floor((f + 1) / 7);\n if (o === undefined) {\n return { step, alt, dir };\n }\n const oct = o + 4 * alt + STEPS_TO_OCTS[step];\n return { step, alt, oct, dir };\n}\n\n// Return the number of fifths as if it were unaltered\nfunction unaltered(f: number): number {\n const i = (f + 1) % 7;\n return i < 0 ? 7 + i : i;\n}\n", "import {\n coordinates,\n Direction,\n IntervalCoordinates,\n isNamedPitch,\n isPitch,\n NamedPitch,\n Pitch,\n pitch,\n PitchCoordinates,\n} from \"@tonaljs/pitch\";\n\nconst fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport type IntervalName = string;\nexport type IntervalLiteral = IntervalName | Pitch | NamedPitch;\n\ntype Quality =\n | \"dddd\"\n | \"ddd\"\n | \"dd\"\n | \"d\"\n | \"m\"\n | \"M\"\n | \"P\"\n | \"A\"\n | \"AA\"\n | \"AAA\"\n | \"AAAA\";\ntype Type = \"perfectable\" | \"majorable\";\n\nexport interface Interval extends Pitch, NamedPitch {\n readonly empty: boolean;\n readonly name: IntervalName;\n readonly num: number;\n readonly q: Quality;\n readonly type: Type;\n readonly step: number;\n readonly alt: number;\n readonly dir: Direction;\n readonly simple: number;\n readonly semitones: number;\n readonly chroma: number;\n readonly coord: IntervalCoordinates;\n readonly oct: number;\n}\n\nconst NoInterval: Interval = Object.freeze({\n empty: true,\n name: \"\",\n num: NaN,\n q: \"\" as Quality,\n type: \"\" as Type,\n step: NaN,\n alt: NaN,\n dir: NaN as Direction,\n simple: NaN,\n semitones: NaN,\n chroma: NaN,\n coord: [] as unknown as IntervalCoordinates,\n oct: NaN,\n});\n\n// shorthand tonal notation (with quality after number)\nconst INTERVAL_TONAL_REGEX = \"([-+]?\\\\d+)(d{1,4}|m|M|P|A{1,4})\";\n// standard shorthand notation (with quality before number)\nconst INTERVAL_SHORTHAND_REGEX = \"(AA|A|P|M|m|d|dd)([-+]?\\\\d+)\";\nconst REGEX = new RegExp(\n \"^\" + INTERVAL_TONAL_REGEX + \"|\" + INTERVAL_SHORTHAND_REGEX + \"$\",\n);\n\ntype IntervalTokens = [string, string];\n\n/**\n * @private\n */\nexport function tokenizeInterval(str?: IntervalName): IntervalTokens {\n const m = REGEX.exec(`${str}`);\n if (m === null) {\n return [\"\", \"\"];\n }\n return m[1] ? [m[1], m[2]] : [m[4], m[3]];\n}\n\nconst cache: { [key in string]: Interval } = {};\n\n/**\n * Get interval properties. It returns an object with:\n *\n * - name: the interval name\n * - num: the interval number\n * - type: 'perfectable' or 'majorable'\n * - q: the interval quality (d, m, M, A)\n * - dir: interval direction (1 ascending, -1 descending)\n * - simple: the simplified number\n * - semitones: the size in semitones\n * - chroma: the interval chroma\n *\n * @param {string} interval - the interval name\n * @return {Object} the interval properties\n *\n * @example\n * import { interval } from '@tonaljs/core'\n * interval('P5').semitones // => 7\n * interval('m3').type // => 'majorable'\n */\nexport function interval(src: IntervalLiteral): Interval {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : isPitch(src)\n ? interval(pitchName(src))\n : isNamedPitch(src)\n ? interval(src.name)\n : NoInterval;\n}\n\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\nconst TYPES = \"PMMPPMM\";\nfunction parse(str?: string): Interval {\n const tokens = tokenizeInterval(str);\n if (tokens[0] === \"\") {\n return NoInterval;\n }\n const num = +tokens[0];\n const q = tokens[1] as Quality;\n const step = (Math.abs(num) - 1) % 7;\n const t = TYPES[step];\n if (t === \"M\" && q === \"P\") {\n return NoInterval;\n }\n const type = t === \"M\" ? \"majorable\" : \"perfectable\";\n\n const name = \"\" + num + q;\n const dir = num < 0 ? -1 : 1;\n const simple = num === 8 || num === -8 ? num : dir * (step + 1);\n const alt = qToAlt(type, q);\n const oct = Math.floor((Math.abs(num) - 1) / 7);\n const semitones = dir * (SIZES[step] + alt + 12 * oct);\n const chroma = (((dir * (SIZES[step] + alt)) % 12) + 12) % 12;\n const coord = coordinates({ step, alt, oct, dir }) as IntervalCoordinates;\n return {\n empty: false,\n name,\n num,\n q,\n step,\n alt,\n dir,\n type,\n simple,\n semitones,\n chroma,\n coord,\n oct,\n };\n}\n\n/**\n * @private\n *\n * forceDescending is used in the case of unison (#243)\n */\nexport function coordToInterval(\n coord: PitchCoordinates,\n forceDescending?: boolean,\n): Interval {\n const [f, o = 0] = coord;\n const isDescending = f * 7 + o * 12 < 0;\n const ivl: IntervalCoordinates =\n forceDescending || isDescending ? [-f, -o, -1] : [f, o, 1];\n return interval(pitch(ivl)) as Interval;\n}\n\nfunction qToAlt(type: Type, q: string): number {\n return (q === \"M\" && type === \"majorable\") ||\n (q === \"P\" && type === \"perfectable\")\n ? 0\n : q === \"m\" && type === \"majorable\"\n ? -1\n : /^A+$/.test(q)\n ? q.length\n : /^d+$/.test(q)\n ? -1 * (type === \"perfectable\" ? q.length : q.length + 1)\n : 0;\n}\n\n// return the interval name of a pitch\nfunction pitchName(props: Pitch): string {\n const { step, alt, oct = 0, dir } = props;\n if (!dir) {\n return \"\";\n }\n const calcNum = step + 1 + 7 * oct;\n // this is an edge case: descending pitch class unison (see #243)\n const num = calcNum === 0 ? step + 1 : calcNum;\n const d = dir < 0 ? \"-\" : \"\";\n const type = TYPES[step] === \"M\" ? \"majorable\" : \"perfectable\";\n const name = d + num + altToQ(type, alt);\n return name;\n}\n\nfunction altToQ(type: Type, alt: number): Quality {\n if (alt === 0) {\n return type === \"majorable\" ? \"M\" : \"P\";\n } else if (alt === -1 && type === \"majorable\") {\n return \"m\";\n } else if (alt > 0) {\n return fillStr(\"A\", alt) as Quality;\n } else {\n return fillStr(\"d\", type === \"perfectable\" ? alt : alt + 1) as Quality;\n }\n}\n", "import {\n coordinates,\n isNamedPitch,\n isPitch,\n NamedPitch,\n Pitch,\n pitch,\n PitchCoordinates,\n} from \"@tonaljs/pitch\";\n\nconst fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport type NoteWithOctave = string;\nexport type PcName = string;\nexport type NoteName = NoteWithOctave | PcName;\nexport type NoteLiteral = NoteName | Pitch | NamedPitch;\n\nexport interface Note extends Pitch, NamedPitch {\n readonly empty: boolean;\n readonly name: NoteName;\n readonly letter: string;\n readonly acc: string;\n readonly pc: PcName;\n readonly chroma: number;\n readonly height: number;\n readonly coord: PitchCoordinates;\n readonly midi: number | null;\n readonly freq: number | null;\n}\n\nconst NoNote: Note = Object.freeze({\n empty: true,\n name: \"\",\n letter: \"\",\n acc: \"\",\n pc: \"\",\n step: NaN,\n alt: NaN,\n chroma: NaN,\n height: NaN,\n coord: [] as unknown as PitchCoordinates,\n midi: null,\n freq: null,\n});\n\nconst cache: Map = new Map();\n\nexport const stepToLetter = (step: number) => \"CDEFGAB\".charAt(step);\nexport const altToAcc = (alt: number): string =>\n alt < 0 ? fillStr(\"b\", -alt) : fillStr(\"#\", alt);\nexport const accToAlt = (acc: string): number =>\n acc[0] === \"b\" ? -acc.length : acc.length;\n\n/**\n * Given a note literal (a note name or a note object), returns the Note object\n * @example\n * note('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport function note(src: NoteLiteral): Note {\n const stringSrc = JSON.stringify(src);\n\n const cached = cache.get(stringSrc);\n if (cached) {\n return cached;\n }\n\n const value =\n typeof src === \"string\"\n ? parse(src)\n : isPitch(src)\n ? note(pitchName(src))\n : isNamedPitch(src)\n ? note(src.name)\n : NoNote;\n cache.set(stringSrc, value);\n return value;\n}\n\ntype NoteTokens = [string, string, string, string];\n\nconst REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\\d*)\\s*(.*)$/;\n\n/**\n * @private\n */\nexport function tokenizeNote(str: string): NoteTokens {\n const m = REGEX.exec(str) as string[];\n return m\n ? [m[1].toUpperCase(), m[2].replace(/x/g, \"##\"), m[3], m[4]]\n : [\"\", \"\", \"\", \"\"];\n}\n\n/**\n * @private\n */\nexport function coordToNote(noteCoord: PitchCoordinates): Note {\n return note(pitch(noteCoord)) as Note;\n}\n\nconst mod = (n: number, m: number) => ((n % m) + m) % m;\n\nconst SEMI = [0, 2, 4, 5, 7, 9, 11];\nfunction parse(noteName: NoteName): Note {\n const tokens = tokenizeNote(noteName);\n if (tokens[0] === \"\" || tokens[3] !== \"\") {\n return NoNote;\n }\n\n const letter = tokens[0];\n const acc = tokens[1];\n const octStr = tokens[2];\n\n const step = (letter.charCodeAt(0) + 3) % 7;\n const alt = accToAlt(acc);\n const oct = octStr.length ? +octStr : undefined;\n const coord = coordinates({ step, alt, oct });\n\n const name = letter + acc + octStr;\n const pc = letter + acc;\n const chroma = (SEMI[step] + alt + 120) % 12;\n const height =\n oct === undefined\n ? mod(SEMI[step] + alt, 12) - 12 * 99\n : SEMI[step] + alt + 12 * (oct + 1);\n const midi = height >= 0 && height <= 127 ? height : null;\n const freq = oct === undefined ? null : Math.pow(2, (height - 69) / 12) * 440;\n\n return {\n empty: false,\n acc,\n alt,\n chroma,\n coord,\n freq,\n height,\n letter,\n midi,\n name,\n oct,\n pc,\n step,\n };\n}\n\nfunction pitchName(props: Pitch): NoteName {\n const { step, alt, oct } = props;\n const letter = stepToLetter(step);\n if (!letter) {\n return \"\";\n }\n\n const pc = letter + altToAcc(alt);\n return oct || oct === 0 ? pc + oct : pc;\n}\n", "import { PitchCoordinates } from \"@tonaljs/pitch\";\nimport {\n IntervalLiteral,\n IntervalName,\n interval as asInterval,\n coordToInterval,\n} from \"@tonaljs/pitch-interval\";\nimport {\n NoteLiteral,\n NoteName,\n note as asNote,\n coordToNote,\n} from \"@tonaljs/pitch-note\";\n\n/**\n * Transpose a note by an interval.\n *\n * @param {string} note - the note or note name\n * @param {string} interval - the interval or interval name\n * @return {string} the transposed note name or empty string if not valid notes\n * @example\n * import { transpose } from \"@tonaljs/core\"\n * transpose(\"d3\", \"3M\") // => \"F#3\"\n * transpose(\"D\", \"3M\") // => \"F#\"\n * [\"C\", \"D\", \"E\", \"F\", \"G\"].map(pc => transpose(pc, \"M3)) // => [\"E\", \"F#\", \"G#\", \"A\", \"B\"]\n */\nexport function transpose(\n noteName: NoteLiteral,\n intervalName: IntervalLiteral | [number, number],\n): NoteName {\n const note = asNote(noteName);\n const intervalCoord = Array.isArray(intervalName)\n ? intervalName\n : asInterval(intervalName).coord;\n if (note.empty || !intervalCoord || intervalCoord.length < 2) {\n return \"\";\n }\n const noteCoord = note.coord;\n const tr: PitchCoordinates =\n noteCoord.length === 1\n ? [noteCoord[0] + intervalCoord[0]]\n : [noteCoord[0] + intervalCoord[0], noteCoord[1] + intervalCoord[1]];\n return coordToNote(tr).name;\n}\n\n// Private\nexport function tonicIntervalsTransposer(\n intervals: string[],\n tonic: string | undefined | null,\n) {\n const len = intervals.length;\n return (normalized: number) => {\n if (!tonic) return \"\";\n const index =\n normalized < 0 ? (len - (-normalized % len)) % len : normalized % len;\n const octaves = Math.floor(normalized / len);\n const root = transpose(tonic, [0, octaves]);\n return transpose(root, intervals[index]);\n };\n}\n\n/**\n * Find the interval distance between two notes or coord classes.\n *\n * To find distance between coord classes, both notes must be coord classes and\n * the interval is always ascending\n *\n * @param {Note|string} from - the note or note name to calculate distance from\n * @param {Note|string} to - the note or note name to calculate distance to\n * @return {string} the interval name or empty string if not valid notes\n *\n */\nexport function distance(\n fromNote: NoteLiteral,\n toNote: NoteLiteral,\n): IntervalName {\n const from = asNote(fromNote);\n const to = asNote(toNote);\n if (from.empty || to.empty) {\n return \"\";\n }\n\n const fcoord = from.coord;\n const tcoord = to.coord;\n const fifths = tcoord[0] - fcoord[0];\n const octs =\n fcoord.length === 2 && tcoord.length === 2\n ? tcoord[1] - fcoord[1]\n : -Math.floor((fifths * 7) / 12);\n\n // If it's unison, not pitch class, and in the same octave\n // it can be descending interval (see #243 & #428)\n const forceDescending =\n to.height === from.height &&\n to.midi !== null &&\n from.oct === to.oct &&\n from.step > to.step;\n return coordToInterval([fifths, octs], forceDescending).name;\n}\n", "import { distance as dist, transpose as tr } from \"@tonaljs/pitch-distance\";\nimport { note } from \"@tonaljs/pitch-note\";\n\nconst fillStr = (character: string, times: number) =>\n Array(times + 1).join(character);\n\nconst REGEX = /^(_{1,}|=|\\^{1,}|)([abcdefgABCDEFG])([,']*)$/;\n\ntype AbcTokens = [string, string, string];\n\nexport function tokenize(str: string): AbcTokens {\n const m = REGEX.exec(str);\n if (!m) {\n return [\"\", \"\", \"\"];\n }\n return [m[1], m[2], m[3]];\n}\n\n/**\n * Convert a (string) note in ABC notation into a (string) note in scientific notation\n *\n * @example\n * abcToScientificNotation(\"c\") // => \"C5\"\n */\nexport function abcToScientificNotation(str: string): string {\n const [acc, letter, oct] = tokenize(str);\n if (letter === \"\") {\n return \"\";\n }\n let o = 4;\n for (let i = 0; i < oct.length; i++) {\n o += oct.charAt(i) === \",\" ? -1 : 1;\n }\n const a =\n acc[0] === \"_\"\n ? acc.replace(/_/g, \"b\")\n : acc[0] === \"^\"\n ? acc.replace(/\\^/g, \"#\")\n : \"\";\n return letter.charCodeAt(0) > 96\n ? letter.toUpperCase() + a + (o + 1)\n : letter + a + o;\n}\n\n/**\n * Convert a (string) note in scientific notation into a (string) note in ABC notation\n *\n * @example\n * scientificToAbcNotation(\"C#4\") // => \"^C\"\n */\nexport function scientificToAbcNotation(str: string): string {\n const n = note(str);\n if (n.empty || (!n.oct && n.oct !== 0)) {\n return \"\";\n }\n const { letter, acc, oct } = n;\n const a = acc[0] === \"b\" ? acc.replace(/b/g, \"_\") : acc.replace(/#/g, \"^\");\n const l = oct > 4 ? letter.toLowerCase() : letter;\n const o =\n oct === 5 ? \"\" : oct > 4 ? fillStr(\"'\", oct - 5) : fillStr(\",\", 4 - oct);\n return a + l + o;\n}\n\nexport function transpose(note: string, interval: string): string {\n return scientificToAbcNotation(tr(abcToScientificNotation(note), interval));\n}\n\nexport function distance(from: string, to: string): string {\n return dist(abcToScientificNotation(from), abcToScientificNotation(to));\n}\n\n/** @deprecated */\nexport default {\n abcToScientificNotation,\n scientificToAbcNotation,\n tokenize,\n transpose,\n distance,\n};\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { note, Note } from \"@tonaljs/pitch-note\";\n\n// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It\"s completly agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} array\n * @return {Array} the rotated array\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the array with the null values removed\n * @function\n * @param {Array} array\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Sort an array of notes in ascending order. Pitch classes are listed\n * before notes. Any string that is not a note is removed.\n *\n * @param {string[]} notes\n * @return {string[]} sorted array of notes\n *\n * @example\n * sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])\n * // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']\n * sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])\n * // => ['C', 'F', 'G', 'A', 'B']\n */\nexport function sortedNoteNames(notes: string[]): string[] {\n const valid = notes.map((n) => note(n)).filter((n) => !n.empty) as Note[];\n return valid.sort((a, b) => a.height - b.height).map((n) => n.name);\n}\n\n/**\n * Get sorted notes with duplicates removed. Pitch classes are listed\n * before notes.\n *\n * @function\n * @param {string[]} array\n * @return {string[]} unique sorted notes\n *\n * @example\n * Array.sortedUniqNoteNames(['a', 'b', 'c2', '1p', 'p2', 'c2', 'b', 'c', 'c3' ])\n * // => [ 'C', 'A', 'B', 'C2', 'C3' ]\n */\nexport function sortedUniqNoteNames(arr: string[]): string[] {\n return sortedNoteNames(arr).filter((n, i, a) => i === 0 || n !== a[i - 1]);\n}\n\n/**\n * Randomizes the order of the specified array in-place, using the Fisher–Yates shuffle.\n *\n * @function\n * @param {Array} array\n * @return {Array} the array shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an array\n *\n * @param {Array} array - the array\n * @return {Array} an array with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n }),\n );\n }, []);\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It\"s completly agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} collection\n * @return {Array} the rotated collection\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the collection with the null values removed\n * @function\n * @param {Array} collection\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Randomizes the order of the specified collection in-place, using the Fisher–Yates shuffle.\n *\n * @function\n * @param {Array} collection\n * @return {Array} the collection shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an collection\n *\n * @param {Array} collection - the collection\n * @return {Array} an collection with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n }),\n );\n }, []);\n}\n\n/** @deprecated */\nexport default {\n compact,\n permutations,\n range,\n rotate,\n shuffle,\n};\n", "import { compact, range, rotate } from \"@tonaljs/collection\";\nimport { NotFound } from \"@tonaljs/pitch\";\nimport { transpose } from \"@tonaljs/pitch-distance\";\nimport { Interval, IntervalName, interval } from \"@tonaljs/pitch-interval\";\nimport { Note, NoteName, note } from \"@tonaljs/pitch-note\";\n\n/**\n * The properties of a pitch class set\n * @param {number} num - a number between 1 and 4095 (both included) that\n * uniquely identifies the set. It's the decimal number of the chrom.\n * @param {string} chroma - a string representation of the set: a 12-char string\n * with either \"1\" or \"0\" as characters, representing a pitch class or not\n * for the given position in the octave. For example, a \"1\" at index 0 means 'C',\n * a \"1\" at index 2 means 'D', and so on...\n * @param {string} normalized - the chroma but shifted to the first 1\n * @param {number} length - the number of notes of the pitch class set\n * @param {IntervalName[]} intervals - the intervals of the pitch class set\n * *starting from C*\n */\nexport interface Pcset {\n readonly name: string;\n readonly empty: boolean;\n readonly setNum: number;\n readonly chroma: PcsetChroma;\n readonly normalized: PcsetChroma;\n readonly intervals: IntervalName[];\n}\n\nexport const EmptyPcset: Pcset = {\n empty: true,\n name: \"\",\n setNum: 0,\n chroma: \"000000000000\",\n normalized: \"000000000000\",\n intervals: [],\n};\n\nexport type PcsetChroma = string;\nexport type PcsetNum = number;\n\n// UTILITIES\nconst setNumToChroma = (num: number): string =>\n Number(num).toString(2).padStart(12, \"0\");\nconst chromaToNumber = (chroma: string): number => parseInt(chroma, 2);\nconst REGEX = /^[01]{12}$/;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isChroma(set: any): set is PcsetChroma {\n return REGEX.test(set);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isPcsetNum = (set: any): set is PcsetNum =>\n typeof set === \"number\" && set >= 0 && set <= 4095;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isPcset = (set: any): set is Pcset => set && isChroma(set.chroma);\n\nconst cache: { [key in string]: Pcset } = { [EmptyPcset.chroma]: EmptyPcset };\n\n/**\n * A definition of a pitch class set. It could be:\n * - The pitch class set chroma (a 12-length string with only 1s or 0s)\n * - The pitch class set number (an integer between 1 and 4095)\n * - An array of note names\n * - An array of interval names\n */\nexport type Set =\n | Partial\n | PcsetChroma\n | PcsetNum\n | NoteName[]\n | IntervalName[];\n\n/**\n * Get the pitch class set of a collection of notes or set number or chroma\n */\nexport function get(src: Set): Pcset {\n const chroma: PcsetChroma = isChroma(src)\n ? src\n : isPcsetNum(src)\n ? setNumToChroma(src)\n : Array.isArray(src)\n ? listToChroma(src)\n : isPcset(src)\n ? src.chroma\n : EmptyPcset.chroma;\n\n return (cache[chroma] = cache[chroma] || chromaToPcset(chroma));\n}\n\n/**\n * @use Pcset.get\n * @deprecated\n */\nexport const pcset = get;\n\n/**\n * Get pitch class set chroma\n * @function\n * @example\n * Pcset.chroma([\"c\", \"d\", \"e\"]); //=> \"101010000000\"\n */\nexport const chroma = (set: Set) => get(set).chroma;\n\n/**\n * Get intervals (from C) of a set\n * @function\n * @example\n * Pcset.intervals([\"c\", \"d\", \"e\"]); //=>\n */\nexport const intervals = (set: Set) => get(set).intervals;\n\n/**\n * Get pitch class set number\n * @function\n * @example\n * Pcset.num([\"c\", \"d\", \"e\"]); //=> 2192\n */\nexport const num = (set: Set) => get(set).setNum;\n\nconst IVLS = [\n \"1P\",\n \"2m\",\n \"2M\",\n \"3m\",\n \"3M\",\n \"4P\",\n \"5d\",\n \"5P\",\n \"6m\",\n \"6M\",\n \"7m\",\n \"7M\",\n];\n\n/**\n * Get the intervals of a pcset *starting from C*\n * @private\n * @param {Set} set - the pitch class set\n * @return {IntervalName[]} an array of interval names or an empty array\n * if not a valid pitch class set\n */\nfunction chromaToIntervals(chroma: PcsetChroma): IntervalName[] {\n const intervals = [];\n for (let i = 0; i < 12; i++) {\n // tslint:disable-next-line:curly\n if (chroma.charAt(i) === \"1\") intervals.push(IVLS[i]);\n }\n return intervals;\n}\n\nexport function notes(set: Set): NoteName[] {\n return get(set).intervals.map((ivl) => transpose(\"C\", ivl));\n}\n\n/**\n * Get a list of all possible pitch class sets (all possible chromas) *having\n * C as root*. There are 2048 different chromas. If you want them with another\n * note you have to transpose it\n *\n * @see http://allthescales.org/\n * @return {Array} an array of possible chromas from '10000000000' to '11111111111'\n */\nexport function chromas(): PcsetChroma[] {\n return range(2048, 4095).map(setNumToChroma);\n}\n\n/**\n * Given a a list of notes or a pcset chroma, produce the rotations\n * of the chroma discarding the ones that starts with \"0\"\n *\n * This is used, for example, to get all the modes of a scale.\n *\n * @param {Array|string} set - the list of notes or pitchChr of the set\n * @param {boolean} normalize - (Optional, true by default) remove all\n * the rotations that starts with \"0\"\n * @return {Array} an array with all the modes of the chroma\n *\n * @example\n * Pcset.modes([\"C\", \"D\", \"E\"]).map(Pcset.intervals)\n */\nexport function modes(set: Set, normalize = true): PcsetChroma[] {\n const pcs = get(set);\n\n const binary = pcs.chroma.split(\"\");\n return compact(\n binary.map((_, i) => {\n const r = rotate(i, binary);\n return normalize && r[0] === \"0\" ? null : r.join(\"\");\n }),\n );\n}\n\n/**\n * Test if two pitch class sets are equal\n *\n * @param {Array|string} set1 - one of the pitch class sets\n * @param {Array|string} set2 - the other pitch class set\n * @return {boolean} true if they are equal\n * @example\n * Pcset.isEqual([\"c2\", \"d3\"], [\"c5\", \"d2\"]) // => true\n */\nexport function isEqual(s1: Set, s2: Set) {\n return get(s1).setNum === get(s2).setNum;\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * subset of a given set\n *\n * The function is curryfied.\n *\n * @param {PcsetChroma|NoteName[]} set - the superset to test against (chroma or\n * list of notes)\n * @return{function(PcsetChroma|NoteNames[]): boolean} a function accepting a set\n * to test against (chroma or list of notes)\n * @example\n * const inCMajor = Pcset.isSubsetOf([\"C\", \"E\", \"G\"])\n * inCMajor([\"e6\", \"c4\"]) // => true\n * inCMajor([\"e6\", \"c4\", \"d3\"]) // => false\n */\nexport function isSubsetOf(set: Set) {\n const s = get(set).setNum;\n\n return (notes: Set | Pcset) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o & s) === o;\n };\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * superset of a given set (it contains all notes and at least one more)\n *\n * @param {Set} set - an array of notes or a chroma set string to test against\n * @return {(subset: Set): boolean} a function that given a set\n * returns true if is a subset of the first one\n * @example\n * const extendsCMajor = Pcset.isSupersetOf([\"C\", \"E\", \"G\"])\n * extendsCMajor([\"e6\", \"a\", \"c4\", \"g2\"]) // => true\n * extendsCMajor([\"c6\", \"e4\", \"g3\"]) // => false\n */\nexport function isSupersetOf(set: Set) {\n const s = get(set).setNum;\n return (notes: Set) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o | s) === o;\n };\n}\n\n/**\n * Test if a given pitch class set includes a note\n *\n * @param {Array} set - the base set to test against\n * @param {string} note - the note to test\n * @return {boolean} true if the note is included in the pcset\n *\n * Can be partially applied\n *\n * @example\n * const isNoteInCMajor = isNoteIncludedIn(['C', 'E', 'G'])\n * isNoteInCMajor('C4') // => true\n * isNoteInCMajor('C#4') // => false\n */\nexport function isNoteIncludedIn(set: Set) {\n const s = get(set);\n\n return (noteName: NoteName): boolean => {\n const n = note(noteName);\n return s && !n.empty && s.chroma.charAt(n.chroma) === \"1\";\n };\n}\n\n/** @deprecated use: isNoteIncludedIn */\nexport const includes = isNoteIncludedIn;\n\n/**\n * Filter a list with a pitch class set\n *\n * @param {Array|string} set - the pitch class set notes\n * @param {Array|string} notes - the note list to be filtered\n * @return {Array} the filtered notes\n *\n * @example\n * Pcset.filter([\"C\", \"D\", \"E\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"d2\", \"c3\", \"d3\" ])\n * Pcset.filter([\"C2\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"c3\" ])\n */\nexport function filter(set: Set) {\n const isIncluded = isNoteIncludedIn(set);\n return (notes: NoteName[]) => {\n return notes.filter(isIncluded);\n };\n}\n\n/** @deprecated */\nexport default {\n get,\n chroma,\n num,\n intervals,\n chromas,\n isSupersetOf,\n isSubsetOf,\n isNoteIncludedIn,\n isEqual,\n filter,\n modes,\n notes,\n // deprecated\n pcset,\n};\n\n//// PRIVATE ////\n\nfunction chromaRotations(chroma: string): string[] {\n const binary = chroma.split(\"\");\n return binary.map((_, i) => rotate(i, binary).join(\"\"));\n}\n\nfunction chromaToPcset(chroma: PcsetChroma): Pcset {\n const setNum = chromaToNumber(chroma);\n const normalizedNum = chromaRotations(chroma)\n .map(chromaToNumber)\n .filter((n) => n >= 2048)\n .sort()[0];\n const normalized = setNumToChroma(normalizedNum);\n\n const intervals = chromaToIntervals(chroma);\n\n return {\n empty: false,\n name: \"\",\n setNum,\n chroma,\n normalized,\n intervals,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction listToChroma(set: any[]): PcsetChroma {\n if (set.length === 0) {\n return EmptyPcset.chroma;\n }\n\n let pitch: Note | Interval | NotFound;\n const binary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < set.length; i++) {\n pitch = note(set[i]);\n // tslint:disable-next-line: curly\n if (pitch.empty) pitch = interval(set[i]);\n // tslint:disable-next-line: curly\n if (!pitch.empty) binary[pitch.chroma] = 1;\n }\n return binary.join(\"\");\n}\n", "import {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\nexport type ChordQuality =\n | \"Major\"\n | \"Minor\"\n | \"Augmented\"\n | \"Diminished\"\n | \"Unknown\";\n\nexport interface ChordType extends Pcset {\n name: string;\n quality: ChordQuality;\n aliases: string[];\n}\nconst NoChordType: ChordType = {\n ...EmptyPcset,\n name: \"\",\n quality: \"Unknown\",\n intervals: [],\n aliases: [],\n};\n\ntype ChordTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ChordType[] = [];\nlet index: Record = {};\n\n/**\n * Given a chord name or chroma, return the chord properties\n * @param {string} source - chord name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/chord-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ChordTypeName): ChordType {\n return index[type] || NoChordType;\n}\n\n/** @deprecated */\nexport const chordType = get;\n\n/**\n * Get all chord (long) names\n */\nexport function names() {\n return dictionary.map((chord) => chord.name).filter((x) => x);\n}\n\n/**\n * Get all chord symbols\n */\nexport function symbols() {\n return dictionary.map((chord) => chord.aliases[0]).filter((x) => x);\n}\n\n/**\n * Keys used to reference chord types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Return a list of all chord types\n */\nexport function all(): ChordType[] {\n return dictionary.slice();\n}\n\n/** @deprecated */\nexport const entries = all;\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a chord to the dictionary.\n * @param intervals\n * @param aliases\n * @param [fullName]\n */\nexport function add(intervals: string[], aliases: string[], fullName?: string) {\n const quality = getQuality(intervals);\n const chord = {\n ...pcset(intervals),\n name: fullName || \"\",\n quality,\n intervals,\n aliases,\n };\n dictionary.push(chord);\n if (chord.name) {\n index[chord.name] = chord;\n }\n index[chord.setNum] = chord;\n index[chord.chroma] = chord;\n chord.aliases.forEach((alias) => addAlias(chord, alias));\n}\n\nexport function addAlias(chord: ChordType, alias: string) {\n index[alias] = chord;\n}\n\nfunction getQuality(intervals: string[]): ChordQuality {\n const has = (interval: string) => intervals.indexOf(interval) !== -1;\n return has(\"5A\")\n ? \"Augmented\"\n : has(\"3M\")\n ? \"Major\"\n : has(\"5d\")\n ? \"Diminished\"\n : has(\"3m\")\n ? \"Minor\"\n : \"Unknown\";\n}\n\ndata.forEach(([ivls, fullName, names]: string[]) =>\n add(ivls.split(\" \"), names.split(\" \"), fullName),\n);\ndictionary.sort((a, b) => a.setNum - b.setNum);\n\n/** @deprecated */\nexport default {\n names,\n symbols,\n get,\n all,\n add,\n removeAll,\n keys,\n // deprecated\n entries,\n chordType,\n};\n", "/**\n * @private\n * Chord List\n * Source: https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns\n * Format: [\"intervals\", \"full name\", \"abrv1 abrv2\"]\n */\nconst CHORDS: string[][] = [\n // ==Major==\n [\"1P 3M 5P\", \"major\", \"M ^ maj\"],\n [\"1P 3M 5P 7M\", \"major seventh\", \"maj7 Δ ma7 M7 Maj7 ^7\"],\n [\"1P 3M 5P 7M 9M\", \"major ninth\", \"maj9 Δ9 ^9\"],\n [\"1P 3M 5P 7M 9M 13M\", \"major thirteenth\", \"maj13 Maj13 ^13\"],\n [\"1P 3M 5P 6M\", \"sixth\", \"6 add6 add13 M6\"],\n [\"1P 3M 5P 6M 9M\", \"sixth added ninth\", \"6add9 6/9 69 M69\"],\n [\"1P 3M 6m 7M\", \"major seventh flat sixth\", \"M7b6 ^7b6\"],\n [\n \"1P 3M 5P 7M 11A\",\n \"major seventh sharp eleventh\",\n \"maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11\",\n ],\n // ==Minor==\n // '''Normal'''\n [\"1P 3m 5P\", \"minor\", \"m min -\"],\n [\"1P 3m 5P 7m\", \"minor seventh\", \"m7 min7 mi7 -7\"],\n [\n \"1P 3m 5P 7M\",\n \"minor/major seventh\",\n \"m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7 -maj7\",\n ],\n [\"1P 3m 5P 6M\", \"minor sixth\", \"m6 -6\"],\n [\"1P 3m 5P 7m 9M\", \"minor ninth\", \"m9 -9\"],\n [\"1P 3m 5P 7M 9M\", \"minor/major ninth\", \"mM9 mMaj9 -^9\"],\n [\"1P 3m 5P 7m 9M 11P\", \"minor eleventh\", \"m11 -11\"],\n [\"1P 3m 5P 7m 9M 13M\", \"minor thirteenth\", \"m13 -13\"],\n // '''Diminished'''\n [\"1P 3m 5d\", \"diminished\", \"dim ° o\"],\n [\"1P 3m 5d 7d\", \"diminished seventh\", \"dim7 °7 o7\"],\n [\"1P 3m 5d 7m\", \"half-diminished\", \"m7b5 ø -7b5 h7 h\"],\n // ==Dominant/Seventh==\n // '''Normal'''\n [\"1P 3M 5P 7m\", \"dominant seventh\", \"7 dom\"],\n [\"1P 3M 5P 7m 9M\", \"dominant ninth\", \"9\"],\n [\"1P 3M 5P 7m 9M 13M\", \"dominant thirteenth\", \"13\"],\n [\"1P 3M 5P 7m 11A\", \"lydian dominant seventh\", \"7#11 7#4\"],\n // '''Altered'''\n [\"1P 3M 5P 7m 9m\", \"dominant flat ninth\", \"7b9\"],\n [\"1P 3M 5P 7m 9A\", \"dominant sharp ninth\", \"7#9\"],\n [\"1P 3M 7m 9m\", \"altered\", \"alt7\"],\n // '''Suspended'''\n [\"1P 4P 5P\", \"suspended fourth\", \"sus4 sus\"],\n [\"1P 2M 5P\", \"suspended second\", \"sus2\"],\n [\"1P 4P 5P 7m\", \"suspended fourth seventh\", \"7sus4 7sus\"],\n [\"1P 5P 7m 9M 11P\", \"eleventh\", \"11\"],\n [\n \"1P 4P 5P 7m 9m\",\n \"suspended fourth flat ninth\",\n \"b9sus phryg 7b9sus 7b9sus4\",\n ],\n // ==Other==\n [\"1P 5P\", \"fifth\", \"5\"],\n [\"1P 3M 5A\", \"augmented\", \"aug + +5 ^#5\"],\n [\"1P 3m 5A\", \"minor augmented\", \"m#5 -#5 m+\"],\n [\"1P 3M 5A 7M\", \"augmented seventh\", \"maj7#5 maj7+5 +maj7 ^7#5\"],\n [\n \"1P 3M 5P 7M 9M 11A\",\n \"major sharp eleventh (lydian)\",\n \"maj9#11 Δ9#11 ^9#11\",\n ],\n // ==Legacy==\n [\"1P 2M 4P 5P\", \"\", \"sus24 sus4add9\"],\n [\"1P 3M 5A 7M 9M\", \"\", \"maj9#5 Maj9#5\"],\n [\"1P 3M 5A 7m\", \"\", \"7#5 +7 7+ 7aug aug7\"],\n [\"1P 3M 5A 7m 9A\", \"\", \"7#5#9 7#9#5 7alt\"],\n [\"1P 3M 5A 7m 9M\", \"\", \"9#5 9+\"],\n [\"1P 3M 5A 7m 9M 11A\", \"\", \"9#5#11\"],\n [\"1P 3M 5A 7m 9m\", \"\", \"7#5b9 7b9#5\"],\n [\"1P 3M 5A 7m 9m 11A\", \"\", \"7#5b9#11\"],\n [\"1P 3M 5A 9A\", \"\", \"+add#9\"],\n [\"1P 3M 5A 9M\", \"\", \"M#5add9 +add9\"],\n [\"1P 3M 5P 6M 11A\", \"\", \"M6#11 M6b5 6#11 6b5\"],\n [\"1P 3M 5P 6M 7M 9M\", \"\", \"M7add13\"],\n [\"1P 3M 5P 6M 9M 11A\", \"\", \"69#11\"],\n [\"1P 3m 5P 6M 9M\", \"\", \"m69 -69\"],\n [\"1P 3M 5P 6m 7m\", \"\", \"7b6\"],\n [\"1P 3M 5P 7M 9A 11A\", \"\", \"maj7#9#11\"],\n [\"1P 3M 5P 7M 9M 11A 13M\", \"\", \"M13#11 maj13#11 M13+4 M13#4\"],\n [\"1P 3M 5P 7M 9m\", \"\", \"M7b9\"],\n [\"1P 3M 5P 7m 11A 13m\", \"\", \"7#11b13 7b5b13\"],\n [\"1P 3M 5P 7m 13M\", \"\", \"7add6 67 7add13\"],\n [\"1P 3M 5P 7m 9A 11A\", \"\", \"7#9#11 7b5#9 7#9b5\"],\n [\"1P 3M 5P 7m 9A 11A 13M\", \"\", \"13#9#11\"],\n [\"1P 3M 5P 7m 9A 11A 13m\", \"\", \"7#9#11b13\"],\n [\"1P 3M 5P 7m 9A 13M\", \"\", \"13#9\"],\n [\"1P 3M 5P 7m 9A 13m\", \"\", \"7#9b13\"],\n [\"1P 3M 5P 7m 9M 11A\", \"\", \"9#11 9+4 9#4\"],\n [\"1P 3M 5P 7m 9M 11A 13M\", \"\", \"13#11 13+4 13#4\"],\n [\"1P 3M 5P 7m 9M 11A 13m\", \"\", \"9#11b13 9b5b13\"],\n [\"1P 3M 5P 7m 9m 11A\", \"\", \"7b9#11 7b5b9 7b9b5\"],\n [\"1P 3M 5P 7m 9m 11A 13M\", \"\", \"13b9#11\"],\n [\"1P 3M 5P 7m 9m 11A 13m\", \"\", \"7b9b13#11 7b9#11b13 7b5b9b13\"],\n [\"1P 3M 5P 7m 9m 13M\", \"\", \"13b9\"],\n [\"1P 3M 5P 7m 9m 13m\", \"\", \"7b9b13\"],\n [\"1P 3M 5P 7m 9m 9A\", \"\", \"7b9#9\"],\n [\"1P 3M 5P 9M\", \"\", \"Madd9 2 add9 add2\"],\n [\"1P 3M 5P 9m\", \"\", \"Maddb9\"],\n [\"1P 3M 5d\", \"\", \"Mb5\"],\n [\"1P 3M 5d 6M 7m 9M\", \"\", \"13b5\"],\n [\"1P 3M 5d 7M\", \"\", \"M7b5\"],\n [\"1P 3M 5d 7M 9M\", \"\", \"M9b5\"],\n [\"1P 3M 5d 7m\", \"\", \"7b5\"],\n [\"1P 3M 5d 7m 9M\", \"\", \"9b5\"],\n [\"1P 3M 7m\", \"\", \"7no5\"],\n [\"1P 3M 7m 13m\", \"\", \"7b13\"],\n [\"1P 3M 7m 9M\", \"\", \"9no5\"],\n [\"1P 3M 7m 9M 13M\", \"\", \"13no5\"],\n [\"1P 3M 7m 9M 13m\", \"\", \"9b13\"],\n [\"1P 3m 4P 5P\", \"\", \"madd4\"],\n [\"1P 3m 5P 6m 7M\", \"\", \"mMaj7b6\"],\n [\"1P 3m 5P 6m 7M 9M\", \"\", \"mMaj9b6\"],\n [\"1P 3m 5P 7m 11P\", \"\", \"m7add11 m7add4\"],\n [\"1P 3m 5P 9M\", \"\", \"madd9\"],\n [\"1P 3m 5d 6M 7M\", \"\", \"o7M7\"],\n [\"1P 3m 5d 7M\", \"\", \"oM7\"],\n [\"1P 3m 6m 7M\", \"\", \"mb6M7\"],\n [\"1P 3m 6m 7m\", \"\", \"m7#5\"],\n [\"1P 3m 6m 7m 9M\", \"\", \"m9#5\"],\n [\"1P 3m 5A 7m 9M 11P\", \"\", \"m11A\"],\n [\"1P 3m 6m 9m\", \"\", \"mb6b9\"],\n [\"1P 2M 3m 5d 7m\", \"\", \"m9b5\"],\n [\"1P 4P 5A 7M\", \"\", \"M7#5sus4\"],\n [\"1P 4P 5A 7M 9M\", \"\", \"M9#5sus4\"],\n [\"1P 4P 5A 7m\", \"\", \"7#5sus4\"],\n [\"1P 4P 5P 7M\", \"\", \"M7sus4\"],\n [\"1P 4P 5P 7M 9M\", \"\", \"M9sus4\"],\n [\"1P 4P 5P 7m 9M\", \"\", \"9sus4 9sus\"],\n [\"1P 4P 5P 7m 9M 13M\", \"\", \"13sus4 13sus\"],\n [\"1P 4P 5P 7m 9m 13m\", \"\", \"7sus4b9b13 7b9b13sus4\"],\n [\"1P 4P 7m 10m\", \"\", \"4 quartal\"],\n [\"1P 5P 7m 9m 11P\", \"\", \"11b9\"],\n];\n\nexport default CHORDS;\n", "import { all, ChordType } from \"@tonaljs/chord-type\";\nimport { modes } from \"@tonaljs/pcset\";\nimport { note } from \"@tonaljs/pitch-note\";\n\ninterface FoundChord {\n readonly weight: number;\n readonly name: string;\n}\n\nconst namedSet = (notes: string[]) => {\n const pcToName = notes.reduce>((record, n) => {\n const chroma = note(n).chroma;\n if (chroma !== undefined) {\n record[chroma] = record[chroma] || note(n).name;\n }\n return record;\n }, {});\n\n return (chroma: number) => pcToName[chroma];\n};\n\ntype DetectOptions = {\n assumePerfectFifth: boolean;\n};\nexport function detect(\n source: string[],\n options: Partial = {},\n): string[] {\n const notes = source.map((n) => note(n).pc).filter((x) => x);\n if (note.length === 0) {\n return [];\n }\n\n const found: FoundChord[] = findMatches(notes, 1, options);\n\n return found\n .filter((chord) => chord.weight)\n .sort((a, b) => b.weight - a.weight)\n .map((chord) => chord.name);\n}\n\n/* tslint:disable:no-bitwise */\nconst BITMASK = {\n // 3m 000100000000\n // 3M 000010000000\n anyThirds: 384,\n // 5P 000000010000\n perfectFifth: 16,\n // 5d 000000100000\n // 5A 000000001000\n nonPerfectFifths: 40,\n anySeventh: 3,\n};\n\nconst testChromaNumber = (bitmask: number) => (chromaNumber: number) =>\n Boolean(chromaNumber & bitmask);\nconst hasAnyThird = testChromaNumber(BITMASK.anyThirds);\nconst hasPerfectFifth = testChromaNumber(BITMASK.perfectFifth);\nconst hasAnySeventh = testChromaNumber(BITMASK.anySeventh);\nconst hasNonPerfectFifth = testChromaNumber(BITMASK.nonPerfectFifths);\n\nfunction hasAnyThirdAndPerfectFifthAndAnySeventh(chordType: ChordType) {\n const chromaNumber = parseInt(chordType.chroma, 2);\n return (\n hasAnyThird(chromaNumber) &&\n hasPerfectFifth(chromaNumber) &&\n hasAnySeventh(chromaNumber)\n );\n}\n\nfunction withPerfectFifth(chroma: string): string {\n const chromaNumber = parseInt(chroma, 2);\n return hasNonPerfectFifth(chromaNumber)\n ? chroma\n : (chromaNumber | 16).toString(2);\n}\n\n/* tslint:enable:no-bitwise */\n\ntype FindMatchesOptions = {\n assumePerfectFifth: boolean;\n};\nfunction findMatches(\n notes: string[],\n weight: number,\n options: Partial,\n): FoundChord[] {\n const tonic = notes[0];\n const tonicChroma = note(tonic).chroma;\n const noteName = namedSet(notes);\n // we need to test all chromas to get the correct baseNote\n const allModes = modes(notes, false);\n\n const found: FoundChord[] = [];\n allModes.forEach((mode, index) => {\n const modeWithPerfectFifth =\n options.assumePerfectFifth && withPerfectFifth(mode);\n // some chords could have the same chroma but different interval spelling\n const chordTypes = all().filter((chordType) => {\n if (\n options.assumePerfectFifth &&\n hasAnyThirdAndPerfectFifthAndAnySeventh(chordType)\n ) {\n return chordType.chroma === modeWithPerfectFifth;\n }\n return chordType.chroma === mode;\n });\n\n chordTypes.forEach((chordType) => {\n const chordName = chordType.aliases[0];\n const baseNote = noteName(index);\n const isInversion = index !== tonicChroma;\n if (isInversion) {\n found.push({\n weight: 0.5 * weight,\n name: `${baseNote}${chordName}/${tonic}`,\n });\n } else {\n found.push({ weight: 1 * weight, name: `${baseNote}${chordName}` });\n }\n });\n });\n\n return found;\n}\n\n/** @deprecated */\nexport default { detect };\n", "import { IntervalCoordinates, NoteCoordinates } from \"@tonaljs/pitch\";\nimport { distance as dist } from \"@tonaljs/pitch-distance\";\nimport {\n IntervalName,\n coordToInterval,\n interval as props,\n} from \"@tonaljs/pitch-interval\";\n\n/**\n * Get the natural list of names\n */\nexport function names(): IntervalName[] {\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\n}\n\n/**\n * Get properties of an interval\n *\n * @function\n * @example\n * Interval.get('P4') // => {\"alt\": 0, \"dir\": 1, \"name\": \"4P\", \"num\": 4, \"oct\": 0, \"q\": \"P\", \"semitones\": 5, \"simple\": 4, \"step\": 3, \"type\": \"perfectable\"}\n */\nexport const get = props;\n\n/**\n * Get name of an interval\n *\n * @function\n * @example\n * Interval.name('4P') // => \"4P\"\n * Interval.name('P4') // => \"4P\"\n * Interval.name('C4') // => \"\"\n */\nexport const name = (name: string) => props(name).name;\n\n/**\n * Get semitones of an interval\n * @function\n * @example\n * Interval.semitones('P4') // => 5\n */\nexport const semitones = (name: string) => props(name).semitones;\n\n/**\n * Get quality of an interval\n * @function\n * @example\n * Interval.quality('P4') // => \"P\"\n */\nexport const quality = (name: string) => props(name).q;\n\n/**\n * Get number of an interval\n * @function\n * @example\n * Interval.num('P4') // => 4\n */\nexport const num = (name: string) => props(name).num;\n\n/**\n * Get the simplified version of an interval.\n *\n * @function\n * @param {string} interval - the interval to simplify\n * @return {string} the simplified interval\n *\n * @example\n * Interval.simplify(\"9M\") // => \"2M\"\n * Interval.simplify(\"2M\") // => \"2M\"\n * Interval.simplify(\"-2M\") // => \"7m\"\n * [\"8P\", \"9M\", \"10M\", \"11P\", \"12P\", \"13M\", \"14M\", \"15P\"].map(Interval.simplify)\n * // => [ \"8P\", \"2M\", \"3M\", \"4P\", \"5P\", \"6M\", \"7M\", \"8P\" ]\n */\nexport function simplify(name: IntervalName): IntervalName {\n const i = props(name);\n return i.empty ? \"\" : i.simple + i.q;\n}\n\n/**\n * Get the inversion (https://en.wikipedia.org/wiki/Inversion_(music)#Intervals)\n * of an interval.\n *\n * @function\n * @param {string} interval - the interval to invert in interval shorthand\n * notation or interval array notation\n * @return {string} the inverted interval\n *\n * @example\n * Interval.invert(\"3m\") // => \"6M\"\n * Interval.invert(\"2M\") // => \"7m\"\n */\nexport function invert(name: IntervalName): IntervalName {\n const i = props(name);\n if (i.empty) {\n return \"\";\n }\n const step = (7 - i.step) % 7;\n const alt = i.type === \"perfectable\" ? -i.alt : -(i.alt + 1);\n return props({ step, alt, oct: i.oct, dir: i.dir }).name;\n}\n\n// interval numbers\nconst IN = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7];\n// interval qualities\nconst IQ = \"P m M m M P d P m M m M\".split(\" \");\n\n/**\n * Get interval name from semitones number. Since there are several interval\n * names for the same number, the name it's arbitrary, but deterministic.\n *\n * @param {Integer} num - the number of semitones (can be negative)\n * @return {string} the interval name\n * @example\n * Interval.fromSemitones(7) // => \"5P\"\n * Interval.fromSemitones(-7) // => \"-5P\"\n */\nexport function fromSemitones(semitones: number): IntervalName {\n const d = semitones < 0 ? -1 : 1;\n const n = Math.abs(semitones);\n const c = n % 12;\n const o = Math.floor(n / 12);\n return d * (IN[c] + 7 * o) + IQ[c];\n}\n\n/**\n * Find interval between two notes\n *\n * @example\n * Interval.distance(\"C4\", \"G4\"); // => \"5P\"\n */\nexport const distance = dist;\n\n/**\n * Adds two intervals\n *\n * @function\n * @param {string} interval1\n * @param {string} interval2\n * @return {string} the added interval name\n * @example\n * Interval.add(\"3m\", \"5P\") // => \"7m\"\n */\nexport const add = combinator((a, b) => [a[0] + b[0], a[1] + b[1]]);\n\n/**\n * Returns a function that adds an interval\n *\n * @function\n * @example\n * ['1P', '2M', '3M'].map(Interval.addTo('5P')) // => [\"5P\", \"6M\", \"7M\"]\n */\nexport const addTo = (interval: string) => (other: string) =>\n add(interval, other);\n\n/**\n * Subtracts two intervals\n *\n * @function\n * @param {string} minuendInterval\n * @param {string} subtrahendInterval\n * @return {string} the subtracted interval name\n * @example\n * Interval.subtract('5P', '3M') // => '3m'\n * Interval.subtract('3M', '5P') // => '-3m'\n */\nexport const subtract = combinator((a, b) => [a[0] - b[0], a[1] - b[1]]);\n\nexport function transposeFifths(\n interval: IntervalName,\n fifths: number,\n): IntervalName {\n const ivl = get(interval);\n if (ivl.empty) return \"\";\n\n const [nFifths, nOcts, dir] = ivl.coord;\n return coordToInterval([nFifths + fifths, nOcts, dir]).name;\n}\n\n/** @deprecated */\nexport default {\n names,\n get,\n name,\n num,\n semitones,\n quality,\n fromSemitones,\n distance,\n invert,\n simplify,\n add,\n addTo,\n subtract,\n transposeFifths,\n};\n\n//// PRIVATE ////\n\ntype Operation = (\n a: IntervalCoordinates,\n b: IntervalCoordinates,\n) => NoteCoordinates;\n\nfunction combinator(fn: Operation) {\n return (a: IntervalName, b: IntervalName): IntervalName | undefined => {\n const coordA = props(a).coord;\n const coordB = props(b).coord;\n if (coordA && coordB) {\n const coord = fn(coordA, coordB);\n return coordToInterval(coord).name;\n }\n };\n}\n", "import {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\n/**\n * Properties for a scale in the scale dictionary. It's a pitch class set\n * properties with the following additional information:\n * - name: the scale name\n * - aliases: alternative list of names\n * - intervals: an array of interval names\n */\nexport interface ScaleType extends Pcset {\n readonly name: string;\n readonly aliases: string[];\n}\n\nexport const NoScaleType: ScaleType = {\n ...EmptyPcset,\n intervals: [],\n aliases: [],\n};\n\ntype ScaleTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ScaleType[] = [];\nlet index: Record = {};\n\nexport function names() {\n return dictionary.map((scale) => scale.name);\n}\n\n/**\n * Given a scale name or chroma, return the scale properties\n *\n * @param {string} type - scale name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/scale-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ScaleTypeName): ScaleType {\n return index[type] || NoScaleType;\n}\n\n/**\n * @deprecated\n * @use ScaleType.get\n */\nexport const scaleType = get;\n\n/**\n * Return a list of all scale types\n */\nexport function all() {\n return dictionary.slice();\n}\n\n/**\n * @deprecated\n * @use ScaleType.all\n */\nexport const entries = all;\n\n/**\n * Keys used to reference scale types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a scale into dictionary\n * @param intervals\n * @param name\n * @param aliases\n */\nexport function add(\n intervals: string[],\n name: string,\n aliases: string[] = [],\n): ScaleType {\n const scale = { ...pcset(intervals), name, intervals, aliases };\n dictionary.push(scale);\n index[scale.name] = scale;\n index[scale.setNum] = scale;\n index[scale.chroma] = scale;\n scale.aliases.forEach((alias) => addAlias(scale, alias));\n return scale;\n}\n\nexport function addAlias(scale: ScaleType, alias: string) {\n index[alias] = scale;\n}\n\ndata.forEach(([ivls, name, ...aliases]: string[]) =>\n add(ivls.split(\" \"), name, aliases),\n);\n\n/** @deprecated */\nexport default {\n names,\n get,\n all,\n add,\n removeAll,\n keys,\n\n // deprecated\n entries,\n scaleType,\n};\n", "// SCALES\n// Format: [\"intervals\", \"name\", \"alias1\", \"alias2\", ...]\nconst SCALES: string[][] = [\n // Basic scales\n [\"1P 2M 3M 5P 6M\", \"major pentatonic\", \"pentatonic\"],\n [\"1P 2M 3M 4P 5P 6M 7M\", \"major\", \"ionian\"],\n [\"1P 2M 3m 4P 5P 6m 7m\", \"minor\", \"aeolian\"],\n\n // Jazz common scales\n [\"1P 2M 3m 3M 5P 6M\", \"major blues\"],\n [\"1P 3m 4P 5d 5P 7m\", \"minor blues\", \"blues\"],\n [\"1P 2M 3m 4P 5P 6M 7M\", \"melodic minor\"],\n [\"1P 2M 3m 4P 5P 6m 7M\", \"harmonic minor\"],\n [\"1P 2M 3M 4P 5P 6M 7m 7M\", \"bebop\"],\n [\"1P 2M 3m 4P 5d 6m 6M 7M\", \"diminished\", \"whole-half diminished\"],\n\n // Modes\n [\"1P 2M 3m 4P 5P 6M 7m\", \"dorian\"],\n [\"1P 2M 3M 4A 5P 6M 7M\", \"lydian\"],\n [\"1P 2M 3M 4P 5P 6M 7m\", \"mixolydian\", \"dominant\"],\n [\"1P 2m 3m 4P 5P 6m 7m\", \"phrygian\"],\n [\"1P 2m 3m 4P 5d 6m 7m\", \"locrian\"],\n\n // 5-note scales\n [\"1P 3M 4P 5P 7M\", \"ionian pentatonic\"],\n [\"1P 3M 4P 5P 7m\", \"mixolydian pentatonic\", \"indian\"],\n [\"1P 2M 4P 5P 6M\", \"ritusen\"],\n [\"1P 2M 4P 5P 7m\", \"egyptian\"],\n [\"1P 3M 4P 5d 7m\", \"neopolitan major pentatonic\"],\n [\"1P 3m 4P 5P 6m\", \"vietnamese 1\"],\n [\"1P 2m 3m 5P 6m\", \"pelog\"],\n [\"1P 2m 4P 5P 6m\", \"kumoijoshi\"],\n [\"1P 2M 3m 5P 6m\", \"hirajoshi\"],\n [\"1P 2m 4P 5d 7m\", \"iwato\"],\n [\"1P 2m 4P 5P 7m\", \"in-sen\"],\n [\"1P 3M 4A 5P 7M\", \"lydian pentatonic\", \"chinese\"],\n [\"1P 3m 4P 6m 7m\", \"malkos raga\"],\n [\"1P 3m 4P 5d 7m\", \"locrian pentatonic\", \"minor seven flat five pentatonic\"],\n [\"1P 3m 4P 5P 7m\", \"minor pentatonic\", \"vietnamese 2\"],\n [\"1P 3m 4P 5P 6M\", \"minor six pentatonic\"],\n [\"1P 2M 3m 5P 6M\", \"flat three pentatonic\", \"kumoi\"],\n [\"1P 2M 3M 5P 6m\", \"flat six pentatonic\"],\n [\"1P 2m 3M 5P 6M\", \"scriabin\"],\n [\"1P 3M 5d 6m 7m\", \"whole tone pentatonic\"],\n [\"1P 3M 4A 5A 7M\", \"lydian #5P pentatonic\"],\n [\"1P 3M 4A 5P 7m\", \"lydian dominant pentatonic\"],\n [\"1P 3m 4P 5P 7M\", \"minor #7M pentatonic\"],\n [\"1P 3m 4d 5d 7m\", \"super locrian pentatonic\"],\n\n // 6-note scales\n [\"1P 2M 3m 4P 5P 7M\", \"minor hexatonic\"],\n [\"1P 2A 3M 5P 5A 7M\", \"augmented\"],\n [\"1P 2M 4P 5P 6M 7m\", \"piongio\"],\n [\"1P 2m 3M 4A 6M 7m\", \"prometheus neopolitan\"],\n [\"1P 2M 3M 4A 6M 7m\", \"prometheus\"],\n [\"1P 2m 3M 5d 6m 7m\", \"mystery #1\"],\n [\"1P 2m 3M 4P 5A 6M\", \"six tone symmetric\"],\n [\"1P 2M 3M 4A 5A 6A\", \"whole tone\", \"messiaen's mode #1\"],\n [\"1P 2m 4P 4A 5P 7M\", \"messiaen's mode #5\"],\n\n // 7-note scales\n [\"1P 2M 3M 4P 5d 6m 7m\", \"locrian major\", \"arabian\"],\n [\"1P 2m 3M 4A 5P 6m 7M\", \"double harmonic lydian\"],\n [\n \"1P 2m 2A 3M 4A 6m 7m\",\n \"altered\",\n \"super locrian\",\n \"diminished whole tone\",\n \"pomeroy\",\n ],\n [\"1P 2M 3m 4P 5d 6m 7m\", \"locrian #2\", \"half-diminished\", \"aeolian b5\"],\n [\n \"1P 2M 3M 4P 5P 6m 7m\",\n \"mixolydian b6\",\n \"melodic minor fifth mode\",\n \"hindu\",\n ],\n [\"1P 2M 3M 4A 5P 6M 7m\", \"lydian dominant\", \"lydian b7\", \"overtone\"],\n [\"1P 2M 3M 4A 5A 6M 7M\", \"lydian augmented\"],\n [\n \"1P 2m 3m 4P 5P 6M 7m\",\n \"dorian b2\",\n \"phrygian #6\",\n \"melodic minor second mode\",\n ],\n [\n \"1P 2m 3m 4d 5d 6m 7d\",\n \"ultralocrian\",\n \"superlocrian bb7\",\n \"superlocrian diminished\",\n ],\n [\"1P 2m 3m 4P 5d 6M 7m\", \"locrian 6\", \"locrian natural 6\", \"locrian sharp 6\"],\n [\"1P 2A 3M 4P 5P 5A 7M\", \"augmented heptatonic\"],\n // Source https://en.wikipedia.org/wiki/Ukrainian_Dorian_scale\n [\n \"1P 2M 3m 4A 5P 6M 7m\",\n \"dorian #4\",\n \"ukrainian dorian\",\n \"romanian minor\",\n \"altered dorian\",\n ],\n [\"1P 2M 3m 4A 5P 6M 7M\", \"lydian diminished\"],\n [\"1P 2M 3M 4A 5A 7m 7M\", \"leading whole tone\"],\n [\"1P 2M 3M 4A 5P 6m 7m\", \"lydian minor\"],\n [\"1P 2m 3M 4P 5P 6m 7m\", \"phrygian dominant\", \"spanish\", \"phrygian major\"],\n [\"1P 2m 3m 4P 5P 6m 7M\", \"balinese\"],\n [\"1P 2m 3m 4P 5P 6M 7M\", \"neopolitan major\"],\n [\"1P 2M 3M 4P 5P 6m 7M\", \"harmonic major\"],\n [\"1P 2m 3M 4P 5P 6m 7M\", \"double harmonic major\", \"gypsy\"],\n [\"1P 2M 3m 4A 5P 6m 7M\", \"hungarian minor\"],\n [\"1P 2A 3M 4A 5P 6M 7m\", \"hungarian major\"],\n [\"1P 2m 3M 4P 5d 6M 7m\", \"oriental\"],\n [\"1P 2m 3m 3M 4A 5P 7m\", \"flamenco\"],\n [\"1P 2m 3m 4A 5P 6m 7M\", \"todi raga\"],\n [\"1P 2m 3M 4P 5d 6m 7M\", \"persian\"],\n [\"1P 2m 3M 5d 6m 7m 7M\", \"enigmatic\"],\n [\n \"1P 2M 3M 4P 5A 6M 7M\",\n \"major augmented\",\n \"major #5\",\n \"ionian augmented\",\n \"ionian #5\",\n ],\n [\"1P 2A 3M 4A 5P 6M 7M\", \"lydian #9\"],\n\n // 8-note scales\n [\"1P 2m 2M 4P 4A 5P 6m 7M\", \"messiaen's mode #4\"],\n [\"1P 2m 3M 4P 4A 5P 6m 7M\", \"purvi raga\"],\n [\"1P 2m 3m 3M 4P 5P 6m 7m\", \"spanish heptatonic\"],\n [\"1P 2M 3m 3M 4P 5P 6M 7m\", \"bebop minor\"],\n [\"1P 2M 3M 4P 5P 5A 6M 7M\", \"bebop major\"],\n [\"1P 2m 3m 4P 5d 5P 6m 7m\", \"bebop locrian\"],\n [\"1P 2M 3m 4P 5P 6m 7m 7M\", \"minor bebop\"],\n [\"1P 2M 3M 4P 5d 5P 6M 7M\", \"ichikosucho\"],\n [\"1P 2M 3m 4P 5P 6m 6M 7M\", \"minor six diminished\"],\n [\n \"1P 2m 3m 3M 4A 5P 6M 7m\",\n \"half-whole diminished\",\n \"dominant diminished\",\n \"messiaen's mode #2\",\n ],\n [\"1P 3m 3M 4P 5P 6M 7m 7M\", \"kafi raga\"],\n [\"1P 2M 3M 4P 4A 5A 6A 7M\", \"messiaen's mode #6\"],\n\n // 9-note scales\n [\"1P 2M 3m 3M 4P 5d 5P 6M 7m\", \"composite blues\"],\n [\"1P 2M 3m 3M 4A 5P 6m 7m 7M\", \"messiaen's mode #3\"],\n\n // 10-note scales\n [\"1P 2m 2M 3m 4P 4A 5P 6m 6M 7M\", \"messiaen's mode #7\"],\n\n // 12-note scales\n [\"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M\", \"chromatic\"],\n];\n\nexport default SCALES;\n", "import { detect } from \"@tonaljs/chord-detect\";\nimport {\n ChordType,\n all as chordTypes,\n get as getChordType,\n} from \"@tonaljs/chord-type\";\nimport { subtract } from \"@tonaljs/interval\";\nimport { isSubsetOf, isSupersetOf } from \"@tonaljs/pcset\";\nimport {\n distance,\n tonicIntervalsTransposer,\n transpose as transposeNote,\n} from \"@tonaljs/pitch-distance\";\nimport { NoteName, note, tokenizeNote } from \"@tonaljs/pitch-note\";\nimport { all as scaleTypes } from \"@tonaljs/scale-type\";\n\nexport { detect } from \"@tonaljs/chord-detect\";\n\ntype ChordNameOrTokens =\n | string // full name to be parsed\n | [string] // only the name\n | [string, string] // tonic, name\n | [string, string, string]; // tonic, name, bass\ntype ChordNameTokens = [string, string, string]; // [TONIC, SCALE TYPE, BASS]\n\nexport interface Chord extends ChordType {\n tonic: string | null;\n type: string;\n root: string;\n bass: string;\n rootDegree: number;\n symbol: string;\n notes: NoteName[];\n}\n\nconst NoChord: Chord = {\n empty: true,\n name: \"\",\n symbol: \"\",\n root: \"\",\n bass: \"\",\n rootDegree: 0,\n type: \"\",\n tonic: null,\n setNum: NaN,\n quality: \"Unknown\",\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n// 6, 64, 7, 9, 11 and 13 are consider part of the chord\n// (see https://github.com/danigb/tonal/issues/55)\n//const NUM_TYPES = /^(6|64|7|9|11|13)$/;\n/**\n * Tokenize a chord name. It returns an array with the tonic, chord type and bass\n * If not tonic is found, all the name is considered the chord name.\n *\n * This function does NOT check if the chord type exists or not. It only tries\n * to split the tonic and chord type.\n *\n * This function does NOT check if the bass is part of the chord or not but it\n * only accepts a pitch class as bass\n *\n * @function\n * @param {string} name - the chord name\n * @return {Array} an array with [tonic, type, bass]\n * @example\n * tokenize(\"Cmaj7\") // => [ \"C\", \"maj7\" ]\n * tokenize(\"C7\") // => [ \"C\", \"7\" ]\n * tokenize(\"mMaj7\") // => [ null, \"mMaj7\" ]\n * tokenize(\"Cnonsense\") // => [ null, \"nonsense\" ]\n */\nexport function tokenize(name: string): ChordNameTokens {\n const [letter, acc, oct, type] = tokenizeNote(name);\n if (letter === \"\") {\n return tokenizeBass(\"\", name);\n } else if (letter === \"A\" && type === \"ug\") {\n return tokenizeBass(\"\", \"aug\");\n } else {\n return tokenizeBass(letter + acc, oct + type);\n }\n}\n\nfunction tokenizeBass(note: string, chord: string): ChordNameTokens {\n const split = chord.split(\"/\");\n if (split.length === 1) {\n return [note, split[0], \"\"];\n }\n const [letter, acc, oct, type] = tokenizeNote(split[1]);\n // Only a pitch class is accepted as bass note\n if (letter !== \"\" && oct === \"\" && type === \"\") {\n return [note, split[0], letter + acc];\n } else {\n return [note, chord, \"\"];\n }\n}\n\n/**\n * Get a Chord from a chord name.\n */\nexport function get(src: ChordNameOrTokens): Chord {\n if (Array.isArray(src)) {\n return getChord(src[1] || \"\", src[0], src[2]);\n } else if (src === \"\") {\n return NoChord;\n } else {\n const [tonic, type, bass] = tokenize(src);\n const chord = getChord(type, tonic, bass);\n return chord.empty ? getChord(src) : chord;\n }\n}\n\n/**\n * Get chord properties\n *\n * @param typeName - the chord type name\n * @param [tonic] - Optional tonic\n * @param [root] - Optional root (requires a tonic)\n */\nexport function getChord(\n typeName: string,\n optionalTonic?: string,\n optionalBass?: string,\n): Chord {\n const type = getChordType(typeName);\n const tonic = note(optionalTonic || \"\");\n const bass = note(optionalBass || \"\");\n\n if (\n type.empty ||\n (optionalTonic && tonic.empty) ||\n (optionalBass && bass.empty)\n ) {\n return NoChord;\n }\n\n const bassInterval = distance(tonic.pc, bass.pc);\n const bassIndex = type.intervals.indexOf(bassInterval);\n const hasRoot = bassIndex >= 0;\n const root = hasRoot ? bass : note(\"\");\n const rootDegree = bassIndex === -1 ? NaN : bassIndex + 1;\n const hasBass = bass.pc && bass.pc !== tonic.pc;\n\n const intervals = Array.from(type.intervals);\n\n if (hasRoot) {\n for (let i = 1; i < rootDegree; i++) {\n const num = intervals[0][0];\n const quality = intervals[0][1];\n const newNum = parseInt(num, 10) + 7;\n intervals.push(`${newNum}${quality}`);\n intervals.shift();\n }\n } else if (hasBass) {\n const ivl = subtract(distance(tonic.pc, bass.pc), \"8P\");\n if (ivl) intervals.unshift(ivl);\n }\n\n const notes = tonic.empty\n ? []\n : intervals.map((i) => transposeNote(tonic.pc, i));\n\n typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];\n const symbol = `${tonic.empty ? \"\" : tonic.pc}${typeName}${\n hasRoot && rootDegree > 1 ? \"/\" + root.pc : hasBass ? \"/\" + bass.pc : \"\"\n }`;\n const name = `${optionalTonic ? tonic.pc + \" \" : \"\"}${type.name}${\n hasRoot && rootDegree > 1\n ? \" over \" + root.pc\n : hasBass\n ? \" over \" + bass.pc\n : \"\"\n }`;\n return {\n ...type,\n name,\n symbol,\n tonic: tonic.pc,\n type: type.name,\n root: root.pc,\n bass: hasBass ? bass.pc : \"\",\n intervals,\n rootDegree,\n notes,\n };\n}\n\nexport const chord = get;\n\n/**\n * Transpose a chord name\n *\n * @param {string} chordName - the chord name\n * @return {string} the transposed chord\n *\n * @example\n * transpose('Dm7', 'P4') // => 'Gm7\n */\nexport function transpose(chordName: string, interval: string): string {\n const [tonic, type, bass] = tokenize(chordName);\n if (!tonic) {\n return chordName;\n }\n const tr = transposeNote(bass, interval);\n const slash = tr ? \"/\" + tr : \"\";\n return transposeNote(tonic, interval) + type + slash;\n}\n\n/**\n * Get all scales where the given chord fits\n *\n * @example\n * chordScales('C7b9')\n * // => [\"phrygian dominant\", \"flamenco\", \"spanish heptatonic\", \"half-whole diminished\", \"chromatic\"]\n */\nexport function chordScales(name: string): string[] {\n const s = get(name);\n const isChordIncluded = isSupersetOf(s.chroma);\n return scaleTypes()\n .filter((scale) => isChordIncluded(scale.chroma))\n .map((scale) => scale.name);\n}\n/**\n * Get all chords names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @example\n * extended(\"CMaj7\")\n * // => [ 'Cmaj#4', 'Cmaj7#9#11', 'Cmaj9', 'CM7add13', 'Cmaj13', 'Cmaj9#11', 'CM13#11', 'CM7b9' ]\n */\nexport function extended(chordName: string): string[] {\n const s = get(chordName);\n const isSuperset = isSupersetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSuperset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\n/**\n * Find all chords names that are a subset of the given one\n * (has less notes but all from the given chord)\n *\n * @example\n */\nexport function reduced(chordName: string): string[] {\n const s = get(chordName);\n const isSubset = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSubset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\n/**\n * Return the chord notes\n */\nexport function notes(chordName: ChordNameOrTokens, tonic?: string): string[] {\n const chord = get(chordName);\n const note = tonic || chord.tonic;\n if (!note || chord.empty) return [];\n return chord.intervals.map((ivl) => transposeNote(note, ivl));\n}\n\n/**\n * Returns a function to get a note name from the scale degree.\n *\n * @example\n * [1, 2, 3, 4].map(Chord.degrees(\"C\")) => [\"C\", \"E\", \"G\", \"C\"]\n * [1, 2, 3, 4].map(Chord.degrees(\"C4\")) => [\"C4\", \"E4\", \"G4\", \"C5\"]\n */\nexport function degrees(chordName: ChordNameOrTokens, tonic?: string) {\n const chord = get(chordName);\n const note = tonic || chord.tonic;\n const transpose = tonicIntervalsTransposer(chord.intervals, note);\n return (degree: number) =>\n degree ? transpose(degree > 0 ? degree - 1 : degree) : \"\";\n}\n\n/**\n * Sames as `degree` but with 0-based index\n */\nexport function steps(chordName: ChordNameOrTokens, tonic?: string) {\n const chord = get(chordName);\n const note = tonic || chord.tonic;\n return tonicIntervalsTransposer(chord.intervals, note);\n}\n\n/** @deprecated */\nexport default {\n getChord,\n get,\n detect,\n chordScales,\n extended,\n reduced,\n tokenize,\n transpose,\n degrees,\n steps,\n notes,\n chord,\n};\n", "// source: https://en.wikipedia.org/wiki/Note_value\nconst DATA: [number, string, string[]][] = [\n [\n 0.125,\n \"dl\",\n [\"large\", \"duplex longa\", \"maxima\", \"octuple\", \"octuple whole\"],\n ],\n [0.25, \"l\", [\"long\", \"longa\"]],\n [0.5, \"d\", [\"double whole\", \"double\", \"breve\"]],\n [1, \"w\", [\"whole\", \"semibreve\"]],\n [2, \"h\", [\"half\", \"minim\"]],\n [4, \"q\", [\"quarter\", \"crotchet\"]],\n [8, \"e\", [\"eighth\", \"quaver\"]],\n [16, \"s\", [\"sixteenth\", \"semiquaver\"]],\n [32, \"t\", [\"thirty-second\", \"demisemiquaver\"]],\n [64, \"sf\", [\"sixty-fourth\", \"hemidemisemiquaver\"]],\n [128, \"h\", [\"hundred twenty-eighth\"]],\n [256, \"th\", [\"two hundred fifty-sixth\"]],\n];\n\nexport default DATA;\n", "import DATA from \"./data\";\n\ntype Fraction = [number, number];\n\nconst VALUES: DurationValue[] = [];\n\nDATA.forEach(([denominator, shorthand, names]) =>\n add(denominator, shorthand, names),\n);\n\nexport interface DurationValue {\n empty: boolean;\n value: number;\n name: string;\n fraction: Fraction;\n shorthand: string;\n dots: string;\n names: string[];\n}\n\nconst NoDuration: DurationValue = {\n empty: true,\n name: \"\",\n value: 0,\n fraction: [0, 0],\n shorthand: \"\",\n dots: \"\",\n names: [],\n};\n\nexport function names(): string[] {\n return VALUES.reduce((names, duration) => {\n duration.names.forEach((name) => names.push(name));\n return names;\n }, [] as string[]);\n}\n\nexport function shorthands(): string[] {\n return VALUES.map((dur) => dur.shorthand);\n}\n\nconst REGEX = /^([^.]+)(\\.*)$/;\n\nexport function get(name: string): DurationValue {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, simple, dots] = REGEX.exec(name) || [];\n const base = VALUES.find(\n (dur) => dur.shorthand === simple || dur.names.includes(simple),\n );\n if (!base) {\n return NoDuration;\n }\n\n const fraction = calcDots(base.fraction, dots.length);\n const value = fraction[0] / fraction[1];\n\n return { ...base, name, dots, value, fraction };\n}\n\nexport const value = (name: string) => get(name).value;\nexport const fraction = (name: string) => get(name).fraction;\n\n/** @deprecated */\nexport default { names, shorthands, get, value, fraction };\n\n//// PRIVATE ////\n\nfunction add(denominator: number, shorthand: string, names: string[]) {\n VALUES.push({\n empty: false,\n dots: \"\",\n name: \"\",\n value: 1 / denominator,\n fraction: denominator < 1 ? [1 / denominator, 1] : [1, denominator],\n shorthand,\n names,\n });\n}\n\nfunction calcDots(fraction: Fraction, dots: number): Fraction {\n const pow = Math.pow(2, dots);\n\n let numerator = fraction[0] * pow;\n let denominator = fraction[1] * pow;\n const base = numerator;\n\n // add fractions\n for (let i = 0; i < dots; i++) {\n numerator += base / Math.pow(2, i + 1);\n }\n\n // simplify\n while (numerator % 2 === 0 && denominator % 2 === 0) {\n numerator /= 2;\n denominator /= 2;\n }\n return [numerator, denominator];\n}\n", "import { NoteName, note as props } from \"@tonaljs/pitch-note\";\n\ntype Midi = number;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isMidi(arg: any): arg is Midi {\n return +arg >= 0 && +arg <= 127;\n}\n\n/**\n * Get the note midi number (a number between 0 and 127)\n *\n * It returns undefined if not valid note name\n *\n * @function\n * @param {string|number} note - the note name or midi number\n * @return {Integer} the midi number or undefined if not valid note\n * @example\n * import { toMidi } from '@tonaljs/midi'\n * toMidi(\"C4\") // => 60\n * toMidi(60) // => 60\n * toMidi('60') // => 60\n */\nexport function toMidi(note: NoteName | number): number | null {\n if (isMidi(note)) {\n return +note;\n }\n const n = props(note);\n return n.empty ? null : n.midi;\n}\n\n/**\n * Get the frequency in hertzs from midi number\n *\n * @param {number} midi - the note midi number\n * @param {number} [tuning = 440] - A4 tuning frequency in Hz (440 by default)\n * @return {number} the frequency or null if not valid note midi\n * @example\n * import { midiToFreq} from '@tonaljs/midi'\n * midiToFreq(69) // => 440\n */\nexport function midiToFreq(midi: number, tuning = 440): number {\n return Math.pow(2, (midi - 69) / 12) * tuning;\n}\n\nconst L2 = Math.log(2);\nconst L440 = Math.log(440);\n\n/**\n * Get the midi number from a frequency in hertz. The midi number can\n * contain decimals (with two digits precision)\n *\n * @param {number} frequency\n * @return {number}\n * @example\n * import { freqToMidi} from '@tonaljs/midi'\n * freqToMidi(220)); //=> 57\n * freqToMidi(261.62)); //=> 60\n * freqToMidi(261)); //=> 59.96\n */\nexport function freqToMidi(freq: number): number {\n const v = (12 * (Math.log(freq) - L440)) / L2 + 69;\n return Math.round(v * 100) / 100;\n}\n\nexport interface ToNoteNameOptions {\n pitchClass?: boolean;\n sharps?: boolean;\n}\n\nconst SHARPS = \"C C# D D# E F F# G G# A A# B\".split(\" \");\nconst FLATS = \"C Db D Eb E F Gb G Ab A Bb B\".split(\" \");\n/**\n * Given a midi number, returns a note name. The altered notes will have\n * flats unless explicitly set with the optional `useSharps` parameter.\n *\n * @function\n * @param {number} midi - the midi note number\n * @param {Object} options = default: `{ sharps: false, pitchClass: false }`\n * @param {boolean} useSharps - (Optional) set to true to use sharps instead of flats\n * @return {string} the note name\n * @example\n * import { midiToNoteName } from '@tonaljs/midi'\n * midiToNoteName(61) // => \"Db4\"\n * midiToNoteName(61, { pitchClass: true }) // => \"Db\"\n * midiToNoteName(61, { sharps: true }) // => \"C#4\"\n * midiToNoteName(61, { pitchClass: true, sharps: true }) // => \"C#\"\n * // it rounds to nearest note\n * midiToNoteName(61.7) // => \"D4\"\n */\nexport function midiToNoteName(midi: number, options: ToNoteNameOptions = {}) {\n if (isNaN(midi) || midi === -Infinity || midi === Infinity) return \"\";\n midi = Math.round(midi);\n const pcs = options.sharps === true ? SHARPS : FLATS;\n const pc = pcs[midi % 12];\n if (options.pitchClass) {\n return pc;\n }\n const o = Math.floor(midi / 12) - 1;\n return pc + o;\n}\n\nexport function chroma(midi: number): number {\n return midi % 12;\n}\n\nfunction pcsetFromChroma(chroma: string): number[] {\n return chroma.split(\"\").reduce((pcset, val, index) => {\n if (index < 12 && val === \"1\") pcset.push(index);\n return pcset;\n }, [] as number[]);\n}\n\nfunction pcsetFromMidi(midi: number[]): number[] {\n return midi\n .map(chroma)\n .sort((a, b) => a - b)\n .filter((n, i, a) => i === 0 || n !== a[i - 1]);\n}\n\n/**\n * Given a list of midi numbers, returns the pitch class set (unique chroma numbers)\n * @param midi\n * @example\n *\n */\nexport function pcset(notes: number[] | string): number[] {\n return Array.isArray(notes) ? pcsetFromMidi(notes) : pcsetFromChroma(notes);\n}\n\nexport function pcsetNearest(notes: number[] | string) {\n const set = pcset(notes);\n return (midi: number): number | undefined => {\n const ch = chroma(midi);\n for (let i = 0; i < 12; i++) {\n if (set.includes(ch + i)) return midi + i;\n if (set.includes(ch - i)) return midi - i;\n }\n return undefined;\n };\n}\n\nexport function pcsetSteps(notes: number[] | string, tonic: number) {\n const set = pcset(notes);\n const len = set.length;\n return (step: number): number => {\n const index = step < 0 ? (len - (-step % len)) % len : step % len;\n const octaves = Math.floor(step / len);\n return set[index] + octaves * 12 + tonic;\n };\n}\n\nexport function pcsetDegrees(notes: number[] | string, tonic: number) {\n const steps = pcsetSteps(notes, tonic);\n return (degree: number): number | undefined => {\n if (degree === 0) return undefined;\n return steps(degree > 0 ? degree - 1 : degree);\n };\n}\n\n/** @deprecated */\nexport default {\n chroma,\n freqToMidi,\n isMidi,\n midiToFreq,\n midiToNoteName,\n pcsetNearest,\n pcset,\n pcsetDegrees,\n pcsetSteps,\n toMidi,\n};\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { freqToMidi, midiToNoteName } from \"@tonaljs/midi\";\nimport { Pitch } from \"@tonaljs/pitch\";\nimport { distance as _dist, transpose as _tr } from \"@tonaljs/pitch-distance\";\nimport { IntervalName } from \"@tonaljs/pitch-interval\";\nimport {\n Note,\n NoteLiteral,\n NoteName,\n note as props,\n} from \"@tonaljs/pitch-note\";\n\nconst NAMES = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\n\nconst toName = (n: Note) => n.name;\nconst onlyNotes = (array: any[]) =>\n array.map(props).filter((n) => !n.empty) as Note[];\n\n/**\n * Return the natural note names without octave\n * @function\n * @example\n * Note.names(); // => [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"]\n */\nexport function names(array?: any[]): string[] {\n if (array === undefined) {\n return NAMES.slice();\n } else if (!Array.isArray(array)) {\n return [];\n } else {\n return onlyNotes(array).map(toName);\n }\n}\n\n/**\n * Get a note from a note name\n *\n * @function\n * @example\n * Note.get('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport const get = props;\n\n/**\n * Get the note name\n * @function\n */\nexport const name = (note: NoteLiteral) => get(note).name;\n\n/**\n * Get the note pitch class name\n * @function\n */\nexport const pitchClass = (note: NoteLiteral) => get(note).pc;\n\n/**\n * Get the note accidentals\n * @function\n */\nexport const accidentals = (note: NoteLiteral) => get(note).acc;\n\n/**\n * Get the note octave\n * @function\n */\nexport const octave = (note: NoteLiteral) => get(note).oct;\n\n/**\n * Get the note midi\n * @function\n */\nexport const midi = (note: NoteLiteral) => get(note).midi;\n\n/**\n * Get the note midi\n * @function\n */\nexport const freq = (note: NoteLiteral) => get(note).freq;\n\n/**\n * Get the note chroma\n * @function\n */\nexport const chroma = (note: NoteLiteral) => get(note).chroma;\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidi(61) // => \"Db4\"\n * Note.fromMidi(61.7) // => \"D4\"\n */\nexport function fromMidi(midi: number) {\n return midiToNoteName(midi);\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreq(freq: number) {\n return midiToNoteName(freqToMidi(freq));\n}\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreqSharps(freq: number) {\n return midiToNoteName(freqToMidi(freq), { sharps: true });\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidiSharps(61) // => \"C#4\"\n */\n\nexport function fromMidiSharps(midi: number) {\n return midiToNoteName(midi, { sharps: true });\n}\n\nexport const distance = _dist;\n\n/**\n * Transpose a note by an interval\n */\nexport const transpose = _tr;\nexport const tr = _tr;\n\n/**\n * Transpose by an interval.\n * @function\n * @param {string} interval\n * @return {function} a function that transposes by the given interval\n * @example\n * [\"C\", \"D\", \"E\"].map(Note.transposeBy(\"5P\"));\n * // => [\"G\", \"A\", \"B\"]\n */\nexport const transposeBy = (interval: IntervalName) => (note: NoteName) =>\n transpose(note, interval);\nexport const trBy = transposeBy;\n\n/**\n * Transpose from a note\n * @function\n * @param {string} note\n * @return {function} a function that transposes the the note by an interval\n * [\"1P\", \"3M\", \"5P\"].map(Note.transposeFrom(\"C\"));\n * // => [\"C\", \"E\", \"G\"]\n */\nexport const transposeFrom = (note: NoteName) => (interval: IntervalName) =>\n transpose(note, interval);\nexport const trFrom = transposeFrom;\n\n/**\n * Transpose a note by a number of perfect fifths.\n *\n * @function\n * @param {string} note - the note name\n * @param {number} fifhts - the number of fifths\n * @return {string} the transposed note name\n *\n * @example\n * import { transposeFifths } from \"@tonaljs/note\"\n * transposeFifths(\"G4\", 1) // => \"D\"\n * [0, 1, 2, 3, 4].map(fifths => transposeFifths(\"C\", fifths)) // => [\"C\", \"G\", \"D\", \"A\", \"E\"]\n */\nexport function transposeFifths(noteName: NoteName, fifths: number): NoteName {\n return transpose(noteName, [fifths, 0]);\n}\nexport const trFifths = transposeFifths;\n\n// TODO: documentation\nexport function transposeOctaves(\n noteName: NoteName,\n octaves: number,\n): NoteName {\n return transpose(noteName, [0, octaves]);\n}\n\nexport type NoteComparator = (a: Note, b: Note) => number;\n\nexport const ascending: NoteComparator = (a, b) => a.height - b.height;\nexport const descending: NoteComparator = (a, b) => b.height - a.height;\n\nexport function sortedNames(\n notes: any[],\n comparator?: NoteComparator,\n): string[] {\n comparator = comparator || ascending;\n return onlyNotes(notes).sort(comparator).map(toName);\n}\n\nexport function sortedUniqNames(notes: any[]): string[] {\n return sortedNames(notes, ascending).filter(\n (n, i, a) => i === 0 || n !== a[i - 1],\n );\n}\n\n/**\n * Simplify a note\n *\n * @function\n * @param {string} note - the note to be simplified\n * - sameAccType: default true. Use same kind of accidentals that source\n * @return {string} the simplified note or '' if not valid note\n * @example\n * simplify(\"C##\") // => \"D\"\n * simplify(\"C###\") // => \"D#\"\n * simplify(\"C###\")\n * simplify(\"B#4\") // => \"C5\"\n */\nexport const simplify = (noteName: NoteName | Pitch): string => {\n const note = get(noteName);\n if (note.empty) {\n return \"\";\n }\n return midiToNoteName(note.midi || note.chroma, {\n sharps: note.alt > 0,\n pitchClass: note.midi === null,\n });\n};\n/**\n * Get enharmonic of a note\n *\n * @function\n * @param {string} note\n * @param [string] - [optional] Destination pitch class\n * @return {string} the enharmonic note name or '' if not valid note\n * @example\n * Note.enharmonic(\"Db\") // => \"C#\"\n * Note.enharmonic(\"C\") // => \"C\"\n * Note.enharmonic(\"F2\",\"E#\") // => \"E#2\"\n * Note.eharmoinic(\"C##b\"); // => \"\"\n */\nexport function enharmonic(noteName: string, destName?: string) {\n const src = get(noteName);\n if (src.empty) {\n return \"\";\n }\n\n // destination: use given or generate one\n const dest = get(\n destName ||\n midiToNoteName(src.midi || src.chroma, {\n sharps: src.alt < 0,\n pitchClass: true,\n }),\n );\n\n // ensure destination is valid\n if (dest.empty || dest.chroma !== src.chroma) {\n return \"\";\n }\n\n // if src has no octave, no need to calculate anything else\n if (src.oct === undefined) {\n return dest.pc;\n }\n\n // detect any octave overflow\n const srcChroma = src.chroma - src.alt;\n const destChroma = dest.chroma - dest.alt;\n const destOctOffset =\n srcChroma > 11 || destChroma < 0\n ? -1\n : srcChroma < 0 || destChroma > 11\n ? +1\n : 0;\n // calculate the new octave\n const destOct = src.oct + destOctOffset;\n return dest.pc + destOct;\n}\n\n/** @deprecated */\nexport default {\n names,\n get,\n name,\n pitchClass,\n accidentals,\n octave,\n midi,\n ascending,\n descending,\n distance,\n sortedNames,\n sortedUniqNames,\n fromMidi,\n fromMidiSharps,\n freq,\n fromFreq,\n fromFreqSharps,\n chroma,\n transpose,\n tr,\n transposeBy,\n trBy,\n transposeFrom,\n trFrom,\n transposeFifths,\n transposeOctaves,\n trFifths,\n simplify,\n enharmonic,\n};\n", "import { isNamedPitch, isPitch, Pitch } from \"@tonaljs/pitch\";\nimport { interval } from \"@tonaljs/pitch-interval\";\nimport { accToAlt, altToAcc } from \"@tonaljs/pitch-note\";\n\nexport interface RomanNumeral extends Pitch {\n readonly name: string;\n readonly empty: boolean;\n readonly roman: string;\n readonly interval: string;\n readonly acc: string;\n readonly chordType: string;\n readonly major: boolean;\n readonly dir: 1;\n}\n\nexport interface NoRomanNumeral extends Partial {\n readonly empty: true;\n readonly name: \"\";\n readonly chordType: \"\";\n}\nconst NoRomanNumeral: NoRomanNumeral = { empty: true, name: \"\", chordType: \"\" };\n\nconst cache: Record = {};\n\n/**\n * Get properties of a roman numeral string\n *\n * @function\n * @param {string} - the roman numeral string (can have type, like: Imaj7)\n * @return {Object} - the roman numeral properties\n * @param {string} name - the roman numeral (tonic)\n * @param {string} type - the chord type\n * @param {string} num - the number (1 = I, 2 = II...)\n * @param {boolean} major - major or not\n *\n * @example\n * romanNumeral(\"VIIb5\") // => { name: \"VII\", type: \"b5\", num: 7, major: true }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function get(src: any): RomanNumeral | NoRomanNumeral {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : typeof src === \"number\"\n ? get(NAMES[src] || \"\")\n : isPitch(src)\n ? fromPitch(src)\n : isNamedPitch(src)\n ? get(src.name)\n : NoRomanNumeral;\n}\n\n/**\n * @deprecated\n * @use RomanNumeral.get\n */\nexport const romanNumeral = get;\n\n/**\n * Get roman numeral names\n *\n * @function\n * @param {boolean} [isMajor=true]\n * @return {Array}\n *\n * @example\n * names() // => [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\"]\n */\nexport function names(major = true) {\n return (major ? NAMES : NAMES_MINOR).slice();\n}\n\nfunction fromPitch(pitch: Pitch): RomanNumeral | NoRomanNumeral {\n return get(altToAcc(pitch.alt) + NAMES[pitch.step]);\n}\n\nconst REGEX =\n /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;\n\n// [name, accidentals, romanNumeral, chordType]\ntype RomanNumeralTokens = [string, string, string, string];\nexport function tokenize(str: string): RomanNumeralTokens {\n return (REGEX.exec(str) || [\"\", \"\", \"\", \"\"]) as RomanNumeralTokens;\n}\n\nconst ROMANS = \"I II III IV V VI VII\";\nconst NAMES = ROMANS.split(\" \");\nconst NAMES_MINOR = ROMANS.toLowerCase().split(\" \");\n\nfunction parse(src: string): RomanNumeral | NoRomanNumeral {\n const [name, acc, roman, chordType] = tokenize(src);\n if (!roman) {\n return NoRomanNumeral;\n }\n\n const upperRoman = roman.toUpperCase();\n const step = NAMES.indexOf(upperRoman);\n const alt = accToAlt(acc);\n const dir = 1;\n return {\n empty: false,\n name,\n roman,\n interval: interval({ step, alt, dir }).name,\n acc,\n chordType,\n alt,\n step,\n major: roman === upperRoman,\n oct: 0,\n dir,\n };\n}\n\n/** @deprecated */\nexport default {\n names,\n get,\n // deprecated\n romanNumeral,\n};\n", "import { transpose, transposeFifths } from \"@tonaljs/note\";\nimport { accToAlt, altToAcc, note } from \"@tonaljs/pitch-note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\n\nconst Empty: readonly string[] = Object.freeze([] as string[]);\n\nexport interface Key {\n readonly type: \"major\" | \"minor\";\n readonly tonic: string;\n readonly alteration: number;\n readonly keySignature: string;\n}\n\nconst NoKey: Key = {\n type: \"major\",\n tonic: \"\",\n alteration: 0,\n keySignature: \"\",\n};\n\nexport interface KeyScale {\n readonly tonic: string;\n readonly grades: readonly string[];\n readonly intervals: readonly string[];\n readonly scale: readonly string[];\n readonly triads: readonly string[];\n readonly chords: readonly string[];\n readonly chordsHarmonicFunction: readonly string[];\n readonly chordScales: readonly string[];\n readonly secondaryDominants: readonly string[];\n readonly secondaryDominantSupertonics: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly substituteDominantSupertonics: readonly string[];\n\n // @deprecated use secondaryDominantsSupertonic\n readonly secondaryDominantsMinorRelative: readonly string[];\n // @deprecated use substituteDominantSupertonics\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoKeyScale: KeyScale = {\n tonic: \"\",\n grades: Empty,\n intervals: Empty,\n scale: Empty,\n triads: Empty,\n chords: Empty,\n chordsHarmonicFunction: Empty,\n chordScales: Empty,\n secondaryDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n substituteDominants: Empty,\n substituteDominantSupertonics: Empty,\n secondaryDominantsMinorRelative: Empty,\n};\n\nexport interface MajorKey extends Key, KeyScale {\n readonly type: \"major\";\n readonly minorRelative: string;\n readonly scale: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly secondaryDominantSupertonics: readonly string[];\n // @deprecated use secondaryDominantsSupertonic\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoMajorKey: MajorKey = {\n ...NoKey,\n ...NoKeyScale,\n type: \"major\",\n minorRelative: \"\",\n scale: Empty,\n substituteDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n};\n\nexport interface MinorKey extends Key {\n readonly type: \"minor\";\n readonly relativeMajor: string;\n readonly natural: KeyScale;\n readonly harmonic: KeyScale;\n readonly melodic: KeyScale;\n}\n\nconst NoMinorKey: MinorKey = {\n ...NoKey,\n type: \"minor\",\n relativeMajor: \"\",\n natural: NoKeyScale,\n harmonic: NoKeyScale,\n melodic: NoKeyScale,\n};\n\nexport type KeyChord = {\n name: string;\n roles: string[];\n};\n\nconst mapScaleToType = (scale: string[], list: string[], sep = \"\") =>\n list.map((type, i) => `${scale[i]}${sep}${type}`);\n\nfunction keyScale(\n grades: string[],\n triads: string[],\n chordTypes: string[],\n harmonicFunctions: string[],\n chordScales: string[],\n) {\n return (tonic: string): KeyScale => {\n const intervals = grades.map((gr) => roman(gr).interval || \"\");\n const scale = intervals.map((interval) => transpose(tonic, interval));\n const chords = mapScaleToType(scale, chordTypes);\n const secondaryDominants = scale\n .map((note) => transpose(note, \"5P\"))\n .map((note) =>\n // A secondary dominant is a V chord which:\n // 1. is not diatonic to the key,\n // 2. it must have a diatonic root.\n scale.includes(note) && !chords.includes(note + \"7\") ? note + \"7\" : \"\",\n );\n\n const secondaryDominantSupertonics = supertonics(\n secondaryDominants,\n triads,\n );\n const substituteDominants = secondaryDominants.map((chord) => {\n if (!chord) return \"\";\n const domRoot = chord.slice(0, -1);\n const subRoot = transpose(domRoot, \"5d\");\n return subRoot + \"7\";\n });\n const substituteDominantSupertonics = supertonics(\n substituteDominants,\n triads,\n );\n\n return {\n tonic,\n grades,\n intervals,\n scale,\n triads: mapScaleToType(scale, triads),\n chords,\n chordsHarmonicFunction: harmonicFunctions.slice(),\n chordScales: mapScaleToType(scale, chordScales, \" \"),\n secondaryDominants,\n secondaryDominantSupertonics,\n substituteDominants,\n substituteDominantSupertonics,\n\n // @deprecated use secondaryDominantsSupertonic\n secondaryDominantsMinorRelative: secondaryDominantSupertonics,\n // @deprecated use secondaryDominantsSupertonic\n substituteDominantsMinorRelative: substituteDominantSupertonics,\n };\n };\n}\n\nconst supertonics = (dominants: string[], targetTriads: string[]) => {\n return dominants.map((chord, index) => {\n if (!chord) return \"\";\n const domRoot = chord.slice(0, -1);\n const minorRoot = transpose(domRoot, \"5P\");\n const target = targetTriads[index];\n const isMinor = target.endsWith(\"m\");\n return isMinor ? minorRoot + \"m7\" : minorRoot + \"m7b5\";\n });\n};\n\nconst distInFifths = (from: string, to: string) => {\n const f = note(from);\n const t = note(to);\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\n};\n\nconst MajorScale = keyScale(\n \"I II III IV V VI VII\".split(\" \"),\n \" m m m dim\".split(\" \"),\n \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"),\n \"T SD T SD D T D\".split(\" \"),\n \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\"),\n);\nconst NaturalScale = keyScale(\n \"I II bIII IV V bVI bVII\".split(\" \"),\n \"m dim m m \".split(\" \"),\n \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"),\n \"T SD T SD D SD SD\".split(\" \"),\n \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\"),\n);\nconst HarmonicScale = keyScale(\n \"I II bIII IV V bVI VII\".split(\" \"),\n \"m dim aug m dim\".split(\" \"),\n \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"),\n \"T SD T SD D SD D\".split(\" \"),\n \"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian\".split(\n \",\",\n ),\n);\nconst MelodicScale = keyScale(\n \"I II bIII IV V VI VII\".split(\" \"),\n \"m m aug dim dim\".split(\" \"),\n \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"),\n \"T SD T SD D \".split(\" \"),\n \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\n \",\",\n ),\n);\n\n/**\n * Get a major key properties in a given tonic\n * @param tonic\n */\nexport function majorKey(tonic: string): MajorKey {\n const pc = note(tonic).pc;\n if (!pc) return NoMajorKey;\n\n const keyScale = MajorScale(pc);\n const alteration = distInFifths(\"C\", pc);\n\n return {\n ...keyScale,\n type: \"major\",\n minorRelative: transpose(pc, \"-3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n };\n}\n\n/**\n * Get a list of available chords for a given major key\n * @param tonic\n * @returns array of { name: string, roles: string[] }\n */\nexport function majorKeyChords(tonic: string): KeyChord[] {\n const key = majorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key, chords);\n return chords;\n}\n\n/**\n * Get a list of available chords for a given major key\n * @param tonic\n * @returns array of { name: string, roles: string[] }\n */\nexport function minorKeyChords(tonic: string): KeyChord[] {\n const key = minorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key.natural, chords);\n keyChordsOf(key.harmonic, chords);\n keyChordsOf(key.melodic, chords);\n return chords;\n}\n\nfunction keyChordsOf(key: KeyScale, chords: KeyChord[]) {\n const updateChord = (name: string, newRole: string) => {\n if (!name) return;\n let keyChord = chords.find((chord) => chord.name === name);\n if (!keyChord) {\n keyChord = { name, roles: [] };\n chords.push(keyChord);\n }\n if (newRole && !keyChord.roles.includes(newRole)) {\n keyChord.roles.push(newRole);\n }\n };\n\n key.chords.forEach((chordName, index) =>\n updateChord(chordName, key.chordsHarmonicFunction[index]),\n );\n key.secondaryDominants.forEach((chordName, index) =>\n updateChord(chordName, `V/${key.grades[index]}`),\n );\n key.secondaryDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `ii/${key.grades[index]}`),\n );\n key.substituteDominants.forEach((chordName, index) =>\n updateChord(chordName, `subV/${key.grades[index]}`),\n );\n key.substituteDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `subii/${key.grades[index]}`),\n );\n}\n\n/**\n * Get minor key properties in a given tonic\n * @param tonic\n */\nexport function minorKey(tnc: string): MinorKey {\n const pc = note(tnc).pc;\n if (!pc) return NoMinorKey;\n\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: transpose(pc, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc),\n };\n}\n\n/**\n * Given a key signature, returns the tonic of the major key\n * @param sigature\n * @example\n * majorTonicFromKeySignature('###') // => 'A'\n */\nexport function majorTonicFromKeySignature(\n sig: string | number,\n): string | null {\n if (typeof sig === \"number\") {\n return transposeFifths(\"C\", sig);\n } else if (typeof sig === \"string\" && /^b+|#+$/.test(sig)) {\n return transposeFifths(\"C\", accToAlt(sig));\n }\n return null;\n}\n\n/** @deprecated */\nexport default { majorKey, majorTonicFromKeySignature, minorKey };\n", "import { rotate } from \"@tonaljs/collection\";\nimport { simplify, transposeFifths } from \"@tonaljs/interval\";\nimport { EmptyPcset, Pcset } from \"@tonaljs/pcset\";\nimport { transpose } from \"@tonaljs/pitch-distance\";\nimport { NoteName } from \"@tonaljs/pitch-note\";\nimport { get as getType } from \"@tonaljs/scale-type\";\n\nconst MODES = [\n [0, 2773, 0, \"ionian\", \"\", \"Maj7\", \"major\"],\n [1, 2902, 2, \"dorian\", \"m\", \"m7\"],\n [2, 3418, 4, \"phrygian\", \"m\", \"m7\"],\n [3, 2741, -1, \"lydian\", \"\", \"Maj7\"],\n [4, 2774, 1, \"mixolydian\", \"\", \"7\"],\n [5, 2906, 3, \"aeolian\", \"m\", \"m7\", \"minor\"],\n [6, 3434, 5, \"locrian\", \"dim\", \"m7b5\"],\n] as const;\n\ntype ModeDatum = (typeof MODES)[number];\n\nexport interface Mode extends Pcset {\n readonly name: string;\n readonly modeNum: number;\n readonly alt: number; // number of alterations === number of fiths\n readonly triad: string;\n readonly seventh: string;\n readonly aliases: string[];\n}\n\nconst NoMode: Mode = {\n ...EmptyPcset,\n name: \"\",\n alt: 0,\n modeNum: NaN,\n triad: \"\",\n seventh: \"\",\n aliases: [],\n};\n\nconst modes: Mode[] = MODES.map(toMode);\nconst index: Record = {};\nmodes.forEach((mode) => {\n index[mode.name] = mode;\n mode.aliases.forEach((alias) => {\n index[alias] = mode;\n });\n});\n\ntype ModeLiteral = string | { name: string };\n\n/**\n * Get a Mode by it's name\n *\n * @example\n * get('dorian')\n * // =>\n * // {\n * // intervals: [ '1P', '2M', '3m', '4P', '5P', '6M', '7m' ],\n * // modeNum: 1,\n * // chroma: '101101010110',\n * // normalized: '101101010110',\n * // name: 'dorian',\n * // setNum: 2902,\n * // alt: 2,\n * // triad: 'm',\n * // seventh: 'm7',\n * // aliases: []\n * // }\n */\nexport function get(name: ModeLiteral): Mode {\n return typeof name === \"string\"\n ? index[name.toLowerCase()] || NoMode\n : name && name.name\n ? get(name.name)\n : NoMode;\n}\n\n/** @deprecated */\nexport const mode = get;\n\n/**\n * Get a list of all modes\n */\nexport function all() {\n return modes.slice();\n}\n\n/** @deprecated */\nexport const entries = all;\n\n/**\n * Get a list of all mode names\n */\nexport function names() {\n return modes.map((mode) => mode.name);\n}\n\nfunction toMode(mode: ModeDatum): Mode {\n const [modeNum, setNum, alt, name, triad, seventh, alias] = mode;\n const aliases = alias ? [alias] : [];\n const chroma = Number(setNum).toString(2);\n const intervals = getType(name).intervals;\n return {\n empty: false,\n intervals,\n modeNum,\n chroma,\n normalized: chroma,\n name,\n setNum,\n alt,\n triad,\n seventh,\n aliases,\n };\n}\n\nexport function notes(modeName: ModeLiteral, tonic: NoteName) {\n return get(modeName).intervals.map((ivl) => transpose(tonic, ivl));\n}\n\nfunction chords(chords: string[]) {\n return (modeName: ModeLiteral, tonic: NoteName) => {\n const mode = get(modeName);\n if (mode.empty) return [];\n const triads = rotate(mode.modeNum, chords);\n const tonics = mode.intervals.map((i) => transpose(tonic, i));\n return triads.map((triad, i) => tonics[i] + triad);\n };\n}\n\nexport const triads = chords(MODES.map((x) => x[4]));\nexport const seventhChords = chords(MODES.map((x) => x[5]));\n\nexport function distance(destination: ModeLiteral, source: ModeLiteral) {\n const from = get(source);\n const to = get(destination);\n if (from.empty || to.empty) return \"\";\n return simplify(transposeFifths(\"1P\", to.alt - from.alt));\n}\n\nexport function relativeTonic(\n destination: ModeLiteral,\n source: ModeLiteral,\n tonic: NoteName,\n) {\n return transpose(tonic, distance(destination, source));\n}\n\n/** @deprecated */\nexport default {\n get,\n names,\n all,\n distance,\n relativeTonic,\n notes,\n triads,\n seventhChords,\n // deprecated\n entries,\n mode,\n};\n", "import { tokenize } from \"@tonaljs/chord\";\nimport { distance, transpose } from \"@tonaljs/pitch-distance\";\nimport { interval } from \"@tonaljs/pitch-interval\";\nimport { NoteLiteral } from \"@tonaljs/pitch-note\";\nimport { get as romanNumeral } from \"@tonaljs/roman-numeral\";\n\n/**\n * Given a tonic and a chord list expressed with roman numeral notation\n * returns the progression expressed with leadsheet chords symbols notation\n * @example\n * fromRomanNumerals(\"C\", [\"I\", \"IIm7\", \"V7\"]);\n * // => [\"C\", \"Dm7\", \"G7\"]\n */\nexport function fromRomanNumerals(\n tonic: NoteLiteral,\n chords: string[],\n): string[] {\n const romanNumerals = chords.map(romanNumeral);\n return romanNumerals.map(\n (rn) => transpose(tonic, interval(rn)) + rn.chordType,\n );\n}\n\n/**\n * Given a tonic and a chord list with leadsheet symbols notation,\n * return the chord list with roman numeral notation\n * @example\n * toRomanNumerals(\"C\", [\"CMaj7\", \"Dm7\", \"G7\"]);\n * // => [\"IMaj7\", \"IIm7\", \"V7\"]\n */\nexport function toRomanNumerals(\n tonic: NoteLiteral,\n chords: string[],\n): string[] {\n return chords.map((chord) => {\n const [note, chordType] = tokenize(chord);\n const intervalName = distance(tonic, note);\n const roman = romanNumeral(interval(intervalName));\n return roman.name + chordType;\n });\n}\n\n/** @deprecated */\nexport default { fromRomanNumerals, toRomanNumerals };\n", "import { compact, range } from \"@tonaljs/collection\";\nimport { midiToNoteName, toMidi, ToNoteNameOptions } from \"@tonaljs/midi\";\n\n/**\n * Create a numeric range. You supply a list of notes or numbers and it will\n * be connected to create complex ranges.\n *\n * @param {Array} notes - the list of notes or midi numbers used\n * @return {Array} an array of numbers or empty array if not valid parameters\n *\n * @example\n * numeric([\"C5\", \"C4\"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]\n * // it works midi notes\n * numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]\n * // complex range\n * numeric([\"C4\", \"E4\", \"Bb3\"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]\n */\nexport function numeric(notes: (string | number)[]): number[] {\n const midi: number[] = compact(\n notes.map((note) => (typeof note === \"number\" ? note : toMidi(note))),\n );\n if (!notes.length || midi.length !== notes.length) {\n // there is no valid notes\n return [];\n }\n\n return midi.reduce(\n (result, note) => {\n const last: number = result[result.length - 1];\n return result.concat(range(last, note).slice(1));\n },\n [midi[0]],\n );\n}\n\n/**\n * Create a range of chromatic notes. The altered notes will use flats.\n *\n * @function\n * @param {Array} notes - the list of notes or midi note numbers to create a range from\n * @param {Object} options - The same as `midiToNoteName` (`{ sharps: boolean, pitchClass: boolean }`)\n * @return {Array} an array of note names\n *\n * @example\n * Range.chromatic([\"C2, \"E2\", \"D2\"]) // => [\"C2\", \"Db2\", \"D2\", \"Eb2\", \"E2\", \"Eb2\", \"D2\"]\n * // with sharps\n * Range.chromatic([\"C2\", \"C3\"], { sharps: true }) // => [ \"C2\", \"C#2\", \"D2\", \"D#2\", \"E2\", \"F2\", \"F#2\", \"G2\", \"G#2\", \"A2\", \"A#2\", \"B2\", \"C3\" ]\n */\nexport function chromatic(\n notes: (string | number)[],\n options?: ToNoteNameOptions,\n): string[] {\n return numeric(notes).map((midi) => midiToNoteName(midi, options));\n}\n\n/** @deprecated */\nexport default { numeric, chromatic };\n", "type RhythmPatternValue = 0 | 1;\n\nexport type RhythmPattern = Array;\n\n/**\n * Create a rhythm pattern from a number or concatenation of numbers in binary form\n * @param numbers one or more number\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * binary(13) // => [1, 1, 0, 1]\n * binary(12, 13) // => [1, 1, 0, 0, 1, 1, 0, 1]\n */\nexport function binary(...numbers: number[]): RhythmPattern {\n return numbers.reduce((pattern, number) => {\n number\n .toString(2)\n .split(\"\")\n .forEach((digit: string) => {\n pattern.push(parseInt(digit) as RhythmPatternValue);\n });\n return pattern;\n }, [] as RhythmPattern);\n}\n\n/**\n * Create a rhythmic pattern using an hexadecimal numbers\n * @param hexNumber string with the hexadecimal number\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * R.hex(\"8f\"); // => [1, 0, 0, 0, 1, 1, 1, 1]\n */\nexport function hex(hexNumber: string): RhythmPattern {\n const pattern: RhythmPattern = [];\n for (let i = 0; i < hexNumber.length; i++) {\n const digit = parseInt(\"0x\" + hexNumber[i]);\n const binary = isNaN(digit) ? \"0000\" : digit.toString(2).padStart(4, \"0\");\n binary.split(\"\").forEach((digit: string) => {\n pattern.push(digit === \"1\" ? 1 : 0);\n });\n }\n return pattern;\n}\n\n/**\n * Create a rhythm pattern from the onsets\n * @param numbers the onsets sizes\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * onsets(1, 2, 2, 1) // => [1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n */\nexport function onsets(...numbers: number[]): RhythmPattern {\n return numbers.reduce((pattern, number) => {\n pattern.push(1);\n for (let i = 0; i < number; i++) {\n pattern.push(0);\n }\n return pattern;\n }, [] as RhythmPattern);\n}\n\n/**\n * Create a random rhythm pattern with a specified length\n * @param length length of the pattern\n * @param probability Threshold where random number is considered a beat (defaults to 0.5)\n * @param rnd A random function (Math.random by default)\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * random(4) // => [1, 0, 0, 1]\n */\nexport function random(\n length: number,\n probability = 0.5,\n rnd: () => number = Math.random,\n): RhythmPattern {\n const pattern: RhythmPattern = [];\n for (let i = 0; i < length; i++) {\n pattern.push(rnd() >= probability ? 1 : 0);\n }\n return pattern;\n}\n\n/**\n * Create a rhythm pattern based on the given probability thresholds\n * @param probabilities An array with the probability of each step to be a beat\n * @param rnd A random function (Math.random by default)\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * probability([0.6, 0, 0.2, 0.5]) // => [0, 0, 0, 1]\n */\nexport function probability(\n probabilities: number[],\n rnd: () => number = Math.random,\n): RhythmPattern {\n return probabilities.map((probability) => (rnd() <= probability ? 1 : 0));\n}\n\n/**\n * Rotate a pattern right\n * @param pattern the pattern to rotate\n * @param rotations the number of steps to rotate\n * @returns the rotated pattern (an array of 0s and 1s)\n * @example\n * rotate([1, 0, 0, 1], 2); // => [0, 1, 1, 0]\n *\n */\nexport function rotate(\n pattern: RhythmPattern,\n rotations: number,\n): RhythmPattern {\n const len = pattern.length;\n const rotated: RhythmPattern = [];\n for (let i = 0; i < len; i++) {\n const pos = (((i - rotations) % len) + len) % len;\n rotated[i] = pattern[pos];\n }\n return rotated;\n}\n\n/**\n * Generates an euclidean rhythm pattern\n * @param steps The length of the pattern\n * @param beats The number of beats\n * @returns an array with 0s and 1s representing the rhythmic pattern\n * @example\n * euclid(8, 3); // => [1, 0, 0, 1, 0, 0, 1, 0]\n */\nexport function euclid(steps: number, beats: number): RhythmPattern {\n const pattern: RhythmPattern = [];\n let d = -1;\n\n for (let i = 0; i < steps; i++) {\n const v = Math.floor(i * (beats / steps));\n pattern[i] = v !== d ? 1 : 0;\n d = v;\n }\n return pattern;\n}\n", "/**\n * References:\n * - https://www.researchgate.net/publication/327567188_An_Algorithm_for_Spelling_the_Pitches_of_Any_Musical_Scale\n * @module scale\n */\nimport { all as chordTypes } from \"@tonaljs/chord-type\";\nimport { range as nums, rotate } from \"@tonaljs/collection\";\nimport { enharmonic, fromMidi, sortedUniqNames } from \"@tonaljs/note\";\nimport {\n chroma,\n isChroma,\n isSubsetOf,\n isSupersetOf,\n modes,\n} from \"@tonaljs/pcset\";\nimport { tonicIntervalsTransposer, transpose } from \"@tonaljs/pitch-distance\";\nimport { note, NoteName } from \"@tonaljs/pitch-note\";\nimport {\n all,\n get as getScaleType,\n ScaleType,\n names as scaleTypeNames,\n all as scaleTypes,\n} from \"@tonaljs/scale-type\";\n\ntype ScaleName = string;\ntype ScaleNameTokens = [string, string]; // [TONIC, SCALE TYPE]\n\nexport interface Scale extends ScaleType {\n tonic: string | null;\n type: string;\n notes: NoteName[];\n}\n\nconst NoScale: Scale = {\n empty: true,\n name: \"\",\n type: \"\",\n tonic: null,\n setNum: NaN,\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n/**\n * Given a string with a scale name and (optionally) a tonic, split\n * that components.\n *\n * It retuns an array with the form [ name, tonic ] where tonic can be a\n * note name or null and name can be any arbitrary string\n * (this function doesn\"t check if that scale name exists)\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array} an array [tonic, name]\n * @example\n * tokenize(\"C mixolydean\") // => [\"C\", \"mixolydean\"]\n * tokenize(\"anything is valid\") // => [\"\", \"anything is valid\"]\n * tokenize() // => [\"\", \"\"]\n */\nexport function tokenize(name: ScaleName): ScaleNameTokens {\n if (typeof name !== \"string\") {\n return [\"\", \"\"];\n }\n const i = name.indexOf(\" \");\n const tonic = note(name.substring(0, i));\n if (tonic.empty) {\n const n = note(name);\n return n.empty ? [\"\", name] : [n.name, \"\"];\n }\n\n const type = name.substring(tonic.name.length + 1).toLowerCase();\n return [tonic.name, type.length ? type : \"\"];\n}\n\n/**\n * Get all scale names\n * @function\n */\nexport const names = scaleTypeNames;\n\n/**\n * Get a Scale from a scale name.\n */\nexport function get(src: ScaleName | ScaleNameTokens): Scale {\n const tokens = Array.isArray(src) ? src : tokenize(src);\n const tonic = note(tokens[0]).name;\n const st = getScaleType(tokens[1]);\n if (st.empty) {\n return NoScale;\n }\n\n const type = st.name;\n const notes: string[] = tonic\n ? st.intervals.map((i) => transpose(tonic, i))\n : [];\n\n const name = tonic ? tonic + \" \" + type : type;\n\n return { ...st, name, type, tonic, notes };\n}\n\n/**\n * @deprecated\n * @use Scale.get\n */\nexport const scale = get;\n\nexport function detect(\n notes: string[],\n options: { tonic?: string; match?: \"exact\" | \"fit\" } = {},\n): string[] {\n const notesChroma = chroma(notes);\n const tonic = note(options.tonic ?? notes[0] ?? \"\");\n const tonicChroma = tonic.chroma;\n if (tonicChroma === undefined) {\n return [];\n }\n\n const pitchClasses = notesChroma.split(\"\");\n pitchClasses[tonicChroma] = \"1\";\n const scaleChroma = rotate(tonicChroma, pitchClasses).join(\"\");\n const match = all().find((scaleType) => scaleType.chroma === scaleChroma);\n\n const results: string[] = [];\n if (match) {\n results.push(tonic.name + \" \" + match.name);\n }\n if (options.match === \"exact\") {\n return results;\n }\n\n extended(scaleChroma).forEach((scaleName) => {\n results.push(tonic.name + \" \" + scaleName);\n });\n\n return results;\n}\n\n/**\n * Get all chords that fits a given scale\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array} - the chord names\n *\n * @example\n * scaleChords(\"pentatonic\") // => [\"5\", \"64\", \"M\", \"M6\", \"Madd9\", \"Msus2\"]\n */\nexport function scaleChords(name: string): string[] {\n const s = get(name);\n const inScale = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => inScale(chord.chroma))\n .map((chord) => chord.aliases[0]);\n}\n/**\n * Get all scales names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n * @example\n * extended(\"major\") // => [\"bebop\", \"bebop dominant\", \"bebop major\", \"chromatic\", \"ichikosucho\"]\n */\nexport function extended(name: string): string[] {\n const chroma = isChroma(name) ? name : get(name).chroma;\n const isSuperset = isSupersetOf(chroma);\n return scaleTypes()\n .filter((scale) => isSuperset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Find all scales names that are a subset of the given one\n * (has less notes but all from the given scale)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n *\n * @example\n * reduced(\"major\") // => [\"ionian pentatonic\", \"major pentatonic\", \"ritusen\"]\n */\nexport function reduced(name: string): string[] {\n const isSubset = isSubsetOf(get(name).chroma);\n return scaleTypes()\n .filter((scale) => isSubset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Given an array of notes, return the scale: a pitch class set starting from\n * the first note of the array\n *\n * @function\n * @param {string[]} notes\n * @return {string[]} pitch classes with same tonic\n * @example\n * scaleNotes(['C4', 'c3', 'C5', 'C4', 'c4']) // => [\"C\"]\n * scaleNotes(['D4', 'c#5', 'A5', 'F#6']) // => [\"D\", \"F#\", \"A\", \"C#\"]\n */\nexport function scaleNotes(notes: NoteName[]) {\n const pcset: string[] = notes.map((n) => note(n).pc).filter((x) => x);\n const tonic = pcset[0];\n const scale = sortedUniqNames(pcset);\n return rotate(scale.indexOf(tonic), scale);\n}\n\ntype ScaleMode = [string, string];\n/**\n * Find mode names of a scale\n *\n * @function\n * @param {string} name - scale name\n * @example\n * modeNames(\"C pentatonic\") // => [\n * [\"C\", \"major pentatonic\"],\n * [\"D\", \"egyptian\"],\n * [\"E\", \"malkos raga\"],\n * [\"G\", \"ritusen\"],\n * [\"A\", \"minor pentatonic\"]\n * ]\n */\nexport function modeNames(name: string): ScaleMode[] {\n const s = get(name);\n if (s.empty) {\n return [];\n }\n\n const tonics = s.tonic ? s.notes : s.intervals;\n return modes(s.chroma)\n .map((chroma: string, i: number): ScaleMode => {\n const modeName = get(chroma).name;\n return modeName ? [tonics[i], modeName] : [\"\", \"\"];\n })\n .filter((x) => x[0]);\n}\n\nfunction getNoteNameOf(scale: string | string[]) {\n const names = Array.isArray(scale) ? scaleNotes(scale) : get(scale).notes;\n const chromas = names.map((name) => note(name).chroma);\n\n return (noteOrMidi: string | number): string | undefined => {\n const currNote =\n typeof noteOrMidi === \"number\"\n ? note(fromMidi(noteOrMidi))\n : note(noteOrMidi);\n const height = currNote.height;\n\n if (height === undefined) return undefined;\n const chroma = height % 12;\n const position = chromas.indexOf(chroma);\n if (position === -1) return undefined;\n return enharmonic(currNote.name, names[position]);\n };\n}\n\nexport function rangeOf(scale: string | string[]) {\n const getName = getNoteNameOf(scale);\n return (fromNote: string, toNote: string) => {\n const from = note(fromNote).height;\n const to = note(toNote).height;\n if (from === undefined || to === undefined) return [];\n\n return nums(from, to)\n .map(getName)\n .filter((x) => x);\n };\n}\n\n/**\n * Returns a function to get a note name from the scale degree.\n *\n * @example\n * [1, 2, 3].map(Scale.degrees(\"C major\")) => [\"C\", \"D\", \"E\"]\n * [1, 2, 3].map(Scale.degrees(\"C4 major\")) => [\"C4\", \"D4\", \"E4\"]\n */\nexport function degrees(scaleName: string | ScaleNameTokens) {\n const { intervals, tonic } = get(scaleName);\n const transpose = tonicIntervalsTransposer(intervals, tonic);\n return (degree: number) =>\n degree ? transpose(degree > 0 ? degree - 1 : degree) : \"\";\n}\n\n/**\n * Sames as `degree` but with 0-based index\n */\nexport function steps(scaleName: string | ScaleNameTokens) {\n const { intervals, tonic } = get(scaleName);\n return tonicIntervalsTransposer(intervals, tonic);\n}\n\n/** @deprecated */\nexport default {\n degrees,\n detect,\n extended,\n get,\n modeNames,\n names,\n rangeOf,\n reduced,\n scaleChords,\n scaleNotes,\n steps,\n tokenize,\n\n // deprecated\n scale,\n};\n", "// TYPES: PARSING\nexport type TimeSignatureLiteral = string | [number, number] | [string, string];\ntype ParsedTimeSignature = [number | number[], number];\n\n// TYPES: PROPERTIES\nexport type ValidTimeSignature = {\n readonly empty: false;\n readonly name: string;\n readonly upper: number | number[];\n readonly lower: number;\n readonly type: \"simple\" | \"compound\" | \"irregular\" | \"irrational\";\n readonly additive: number[];\n};\n\nexport type InvalidTimeSignature = {\n readonly empty: true;\n readonly name: \"\";\n readonly upper: undefined;\n readonly lower: undefined;\n readonly type: undefined;\n readonly additive: [];\n};\n\nexport type TimeSignature = ValidTimeSignature | InvalidTimeSignature;\n\n// CONSTANTS\nconst NONE: InvalidTimeSignature = {\n empty: true,\n name: \"\",\n upper: undefined,\n lower: undefined,\n type: undefined,\n additive: [],\n};\n\nconst NAMES = [\"4/4\", \"3/4\", \"2/4\", \"2/2\", \"12/8\", \"9/8\", \"6/8\", \"3/8\"];\n\n// PUBLIC API\n\nexport function names() {\n return NAMES.slice();\n}\n\nconst REGEX = /^(\\d*\\d(?:\\+\\d)*)\\/(\\d+)$/;\nconst CACHE = new Map();\n\nexport function get(literal: TimeSignatureLiteral): TimeSignature {\n const stringifiedLiteral = JSON.stringify(literal);\n const cached = CACHE.get(stringifiedLiteral);\n if (cached) {\n return cached;\n }\n\n const ts = build(parse(literal));\n CACHE.set(stringifiedLiteral, ts);\n return ts;\n}\n\nexport function parse(literal: TimeSignatureLiteral): ParsedTimeSignature {\n if (typeof literal === \"string\") {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, up, low] = REGEX.exec(literal) || [];\n return parse([up, low]);\n }\n\n const [up, down] = literal;\n const denominator = +down;\n if (typeof up === \"number\") {\n return [up, denominator];\n }\n\n const list = up.split(\"+\").map((n) => +n);\n return list.length === 1 ? [list[0], denominator] : [list, denominator];\n}\n\n/** @deprecated */\nexport default { names, parse, get };\n\n// PRIVATE\n\nconst isPowerOfTwo = (x: number) => (Math.log(x) / Math.log(2)) % 1 === 0;\n\nfunction build([up, down]: ParsedTimeSignature): TimeSignature {\n const upper = Array.isArray(up) ? up.reduce((a, b) => a + b, 0) : up;\n const lower = down;\n if (upper === 0 || lower === 0) {\n return NONE;\n }\n\n const name = Array.isArray(up) ? `${up.join(\"+\")}/${down}` : `${up}/${down}`;\n const additive = Array.isArray(up) ? up : [];\n const type =\n lower === 4 || lower === 2\n ? \"simple\"\n : lower === 8 && upper % 3 === 0\n ? \"compound\"\n : isPowerOfTwo(lower)\n ? \"irregular\"\n : \"irrational\";\n\n return {\n empty: false,\n name,\n type,\n upper,\n lower,\n additive,\n };\n}\n", "import Note from \"@tonaljs/note\";\n\n// A function that decides which of a set of voicings is picked as a follow up to lastVoicing.\nexport declare type VoiceLeadingFunction = (\n voicings: string[][],\n lastVoicing: string[],\n) => string[];\n\nexport const topNoteDiff: VoiceLeadingFunction = (voicings, lastVoicing) => {\n if (!lastVoicing || !lastVoicing.length) {\n return voicings[0];\n }\n const topNoteMidi = (voicing: string[]) =>\n Note.midi(voicing[voicing.length - 1]) || 0;\n const diff = (voicing: string[]) =>\n Math.abs(topNoteMidi(lastVoicing) - topNoteMidi(voicing));\n return voicings.sort((a, b) => diff(a) - diff(b))[0];\n};\n\n/** @deprecated */\nexport default {\n topNoteDiff,\n};\n", "import Chord from \"@tonaljs/chord\";\nimport { all, lefthand, triads, VoicingDictionary } from \"./data\";\nexport { all, lefthand, triads } from \"./data\";\n\nexport const defaultDictionary: VoicingDictionary = lefthand;\n\nexport function lookup(\n symbol: string,\n dictionary = defaultDictionary,\n): string[] | undefined {\n if (dictionary[symbol]) {\n return dictionary[symbol];\n }\n const { aliases } = Chord.get(\"C\" + symbol);\n // TODO: find other way to get aliases of symbol\n const match =\n Object.keys(dictionary).find((_symbol) => aliases.includes(_symbol)) || \"\";\n if (match !== undefined) {\n return dictionary[match];\n }\n return undefined;\n}\n\n/** @deprecated */\nexport default {\n lookup,\n lefthand,\n triads,\n all,\n defaultDictionary,\n};\n", "export type VoicingDictionary = { [symbol: string]: string[] };\n\nexport const triads: VoicingDictionary = {\n M: [\"1P 3M 5P\", \"3M 5P 8P\", \"5P 8P 10M\"],\n m: [\"1P 3m 5P\", \"3m 5P 8P\", \"5P 8P 10m\"],\n o: [\"1P 3m 5d\", \"3m 5d 8P\", \"5d 8P 10m\"],\n aug: [\"1P 3m 5A\", \"3m 5A 8P\", \"5A 8P 10m\"],\n};\nexport const lefthand: VoicingDictionary = {\n m7: [\"3m 5P 7m 9M\", \"7m 9M 10m 12P\"],\n \"7\": [\"3M 6M 7m 9M\", \"7m 9M 10M 13M\"],\n \"^7\": [\"3M 5P 7M 9M\", \"7M 9M 10M 12P\"],\n \"69\": [\"3M 5P 6A 9M\"],\n m7b5: [\"3m 5d 7m 8P\", \"7m 8P 10m 12d\"],\n \"7b9\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n \"7b13\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n o7: [\"1P 3m 5d 6M\", \"5d 6M 8P 10m\"],\n \"7#11\": [\"7m 9M 11A 13A\"],\n \"7#9\": [\"3M 7m 9A\"],\n mM7: [\"3m 5P 7M 9M\", \"7M 9M 10m 12P\"],\n m6: [\"3m 5P 6M 9M\", \"6M 9M 10m 12P\"],\n};\nexport const all: VoicingDictionary = {\n M: [\"1P 3M 5P\", \"3M 5P 8P\", \"5P 8P 10M\"],\n m: [\"1P 3m 5P\", \"3m 5P 8P\", \"5P 8P 10m\"],\n o: [\"1P 3m 5d\", \"3m 5d 8P\", \"5d 8P 10m\"],\n aug: [\"1P 3m 5A\", \"3m 5A 8P\", \"5A 8P 10m\"],\n m7: [\"3m 5P 7m 9M\", \"7m 9M 10m 12P\"],\n \"7\": [\"3M 6M 7m 9M\", \"7m 9M 10M 13M\"],\n \"^7\": [\"3M 5P 7M 9M\", \"7M 9M 10M 12P\"],\n \"69\": [\"3M 5P 6A 9M\"],\n m7b5: [\"3m 5d 7m 8P\", \"7m 8P 10m 12d\"],\n \"7b9\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n \"7b13\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n o7: [\"1P 3m 5d 6M\", \"5d 6M 8P 10m\"],\n \"7#11\": [\"7m 9M 11A 13A\"],\n \"7#9\": [\"3M 7m 9A\"],\n mM7: [\"3m 5P 7M 9M\", \"7M 9M 10m 12P\"],\n m6: [\"3m 5P 6M 9M\", \"6M 9M 10m 12P\"],\n};\n", "import Chord from \"@tonaljs/chord\";\nimport Interval from \"@tonaljs/interval\";\nimport Note from \"@tonaljs/note\";\nimport Range from \"@tonaljs/range\";\nimport VoiceLeading from \"@tonaljs/voice-leading\";\nimport VoicingDictionary from \"@tonaljs/voicing-dictionary\";\n\nconst defaultRange = [\"C3\", \"C5\"];\nconst defaultDictionary = VoicingDictionary.all;\nconst defaultVoiceLeading = VoiceLeading.topNoteDiff;\n\nexport function get(\n chord: string,\n range: string[] = defaultRange,\n dictionary = defaultDictionary,\n voiceLeading = defaultVoiceLeading,\n lastVoicing?: string[],\n) {\n const voicings = search(chord, range, dictionary);\n if (!lastVoicing || !lastVoicing.length) {\n // notes = voicings[Math.ceil(voicings.length / 2)]; // pick middle voicing..\n return voicings[0]; // pick lowest voicing..\n } else {\n // calculates the distance between the last note and the given voicings top note\n // sort voicings with differ\n return voiceLeading(voicings, lastVoicing);\n }\n}\n\nexport function search(\n chord: string,\n range = defaultRange,\n dictionary = VoicingDictionary.triads,\n): string[][] {\n const [tonic, symbol] = Chord.tokenize(chord);\n const sets = VoicingDictionary.lookup(symbol, dictionary);\n // find equivalent symbol that is used as a key in dictionary:\n if (!sets) {\n return [];\n }\n // resolve array of interval arrays for the wanted symbol\n const voicings = sets.map((intervals) => intervals.split(\" \"));\n const notesInRange = Range.chromatic(range); // gives array of notes inside range\n return voicings.reduce((voiced: string[][], voicing: string[]) => {\n // transpose intervals relative to first interval (e.g. 3m 5P > 1P 3M)\n const relativeIntervals = voicing.map(\n (interval) => Interval.subtract(interval, voicing[0]) || \"\",\n );\n // get enharmonic correct pitch class the bottom note\n const bottomPitchClass = Note.transpose(tonic, voicing[0]);\n // get all possible start notes for voicing\n const starts = notesInRange\n // only get the start notes:\n .filter((note) => Note.chroma(note) === Note.chroma(bottomPitchClass))\n // filter out start notes that will overshoot the top end of the range\n .filter(\n (note) =>\n (Note.midi(\n Note.transpose(\n note,\n relativeIntervals[relativeIntervals.length - 1],\n ),\n ) || 0) <= (Note.midi(range[1]) || 0),\n )\n // replace Range.chromatic notes with the correct enharmonic equivalents\n .map((note) => Note.enharmonic(note, bottomPitchClass));\n // render one voicing for each start note\n const notes = starts.map((start) =>\n relativeIntervals.map((interval) => Note.transpose(start, interval)),\n );\n return voiced.concat(notes);\n }, []);\n}\n\nexport function sequence(\n chords: string[],\n range = defaultRange,\n dictionary = defaultDictionary,\n voiceLeading = defaultVoiceLeading,\n lastVoicing?: string[],\n) {\n const { voicings } = chords.reduce<{\n voicings: string[][];\n lastVoicing: string[] | undefined;\n }>(\n ({ voicings, lastVoicing }, chord) => {\n const voicing = get(chord, range, dictionary, voiceLeading, lastVoicing);\n lastVoicing = voicing;\n voicings.push(voicing);\n return { voicings, lastVoicing };\n },\n { voicings: [], lastVoicing },\n );\n return voicings;\n}\n\n/** @deprecated */\nexport default {\n get,\n search,\n sequence,\n};\n", "import { isNamedPitch } from \"@tonaljs/pitch\";\n\nexport * from \"@tonaljs/pitch\";\nexport * from \"@tonaljs/pitch-distance\";\nexport * from \"@tonaljs/pitch-interval\";\nexport * from \"@tonaljs/pitch-note\";\n\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType,\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"], + "sources": ["../index.ts", "../../pitch/index.ts", "../../pitch-interval/index.ts", "../../pitch-note/index.ts", "../../pitch-distance/index.ts", "../../abc-notation/index.ts", "../../array/index.ts", "../../collection/index.ts", "../../pcset/index.ts", "../../chord-type/index.ts", "../../chord-type/data.ts", "../../chord-detect/index.ts", "../../interval/index.ts", "../../scale-type/index.ts", "../../scale-type/data.ts", "../../chord/index.ts", "../../duration-value/data.ts", "../../duration-value/index.ts", "../../midi/index.ts", "../../note/index.ts", "../../roman-numeral/index.ts", "../../key/index.ts", "../../mode/index.ts", "../../progression/index.ts", "../../range/index.ts", "../../rhythm-pattern/index.ts", "../../scale/index.ts", "../../time-signature/index.ts", "../../voice-leading/index.ts", "../../voicing-dictionary/index.ts", "../../voicing-dictionary/data.ts", "../../voicing/index.ts", "../../core/index.ts"], + "sourcesContent": ["import * as AbcNotation from \"@tonaljs/abc-notation\";\nimport * as Array from \"@tonaljs/array\";\nimport * as Chord from \"@tonaljs/chord\";\nimport * as ChordType from \"@tonaljs/chord-type\";\nimport * as Collection from \"@tonaljs/collection\";\nimport * as DurationValue from \"@tonaljs/duration-value\";\nimport * as Interval from \"@tonaljs/interval\";\nimport * as Key from \"@tonaljs/key\";\nimport * as Midi from \"@tonaljs/midi\";\nimport * as Mode from \"@tonaljs/mode\";\nimport * as Note from \"@tonaljs/note\";\nimport * as Pcset from \"@tonaljs/pcset\";\nimport * as Progression from \"@tonaljs/progression\";\nimport * as Range from \"@tonaljs/range\";\nimport * as RhythmPattern from \"@tonaljs/rhythm-pattern\";\nimport * as RomanNumeral from \"@tonaljs/roman-numeral\";\nimport * as Scale from \"@tonaljs/scale\";\nimport * as ScaleType from \"@tonaljs/scale-type\";\nimport * as TimeSignature from \"@tonaljs/time-signature\";\nimport * as VoiceLeading from \"@tonaljs/voice-leading\";\nimport * as Voicing from \"@tonaljs/voicing\";\nimport * as VoicingDictionary from \"@tonaljs/voicing-dictionary\";\n\nexport * from \"@tonaljs/core\";\n\n// deprecated (backwards compatibility)\nimport * as Core from \"@tonaljs/core\";\n/** @deprecated */\nconst Tonal = Core;\n/** @deprecated */\nconst PcSet = Pcset;\n/** @deprecated */\nconst ChordDictionary = ChordType;\n/** @deprecated */\nconst ScaleDictionary = ScaleType;\n\nexport {\n AbcNotation,\n Array,\n Chord,\n ChordDictionary,\n ChordType,\n Collection,\n Core,\n DurationValue,\n Interval,\n Key,\n Midi,\n Mode,\n Note,\n PcSet,\n Pcset,\n Progression,\n Range,\n RhythmPattern,\n RomanNumeral,\n Scale,\n ScaleDictionary,\n ScaleType,\n TimeSignature,\n Tonal,\n VoiceLeading,\n Voicing,\n VoicingDictionary,\n};\n", "export interface NamedPitch {\n readonly name: string;\n}\n\n/*** @deprecated use NamedPitch */\nexport interface Named {\n readonly name: string;\n}\n\nexport interface NotFound extends NamedPitch {\n readonly empty: true;\n readonly name: \"\";\n}\n\nexport function isNamedPitch(src: unknown): src is NamedPitch {\n return src !== null &&\n typeof src === \"object\" &&\n \"name\" in src &&\n typeof src.name === \"string\"\n ? true\n : false;\n}\n\ntype Fifths = number;\ntype Octaves = number;\nexport type Direction = 1 | -1;\n\nexport type PitchClassCoordinates = [Fifths];\nexport type NoteCoordinates = [Fifths, Octaves];\nexport type IntervalCoordinates = [Fifths, Octaves, Direction];\nexport type PitchCoordinates =\n | PitchClassCoordinates\n | NoteCoordinates\n | IntervalCoordinates;\n\n/**\n * Pitch properties\n *\n * - {number} step - The step number: 0 = C, 1 = D, ... 6 = B\n * - {number} alt - Number of alterations: -2 = 'bb', -1 = 'b', 0 = '', 1 = '#', ...\n * - {number} [oct] = The octave (undefined when is a coord class)\n * - {number} [dir] = Interval direction (undefined when is not an interval)\n */\nexport interface Pitch {\n readonly step: number;\n readonly alt: number;\n readonly oct?: number; // undefined for pitch classes\n readonly dir?: Direction; // undefined for notes\n}\n\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\nexport const chroma = ({ step, alt }: Pitch) => (SIZES[step] + alt + 120) % 12;\n\nexport const height = ({ step, alt, oct, dir = 1 }: Pitch) =>\n dir * (SIZES[step] + alt + 12 * (oct === undefined ? -100 : oct));\n\nexport const midi = (pitch: Pitch) => {\n const h = height(pitch);\n return pitch.oct !== undefined && h >= -12 && h <= 115 ? h + 12 : null;\n};\n\nexport function isPitch(pitch: unknown): pitch is Pitch {\n return pitch !== null &&\n typeof pitch === \"object\" &&\n \"step\" in pitch &&\n typeof pitch.step === \"number\" &&\n \"alt\" in pitch &&\n typeof pitch.alt === \"number\" &&\n !isNaN(pitch.step) &&\n !isNaN(pitch.alt)\n ? true\n : false;\n}\n\n// The number of fifths of [C, D, E, F, G, A, B]\nconst FIFTHS = [0, 2, 4, -1, 1, 3, 5];\n// The number of octaves it span each step\nconst STEPS_TO_OCTS = FIFTHS.map((fifths: number) =>\n Math.floor((fifths * 7) / 12),\n);\n\n/**\n * Get coordinates from pitch object\n */\nexport function coordinates(pitch: Pitch): PitchCoordinates {\n const { step, alt, oct, dir = 1 } = pitch;\n const f = FIFTHS[step] + 7 * alt;\n if (oct === undefined) {\n return [dir * f];\n }\n const o = oct - STEPS_TO_OCTS[step] - 4 * alt;\n return [dir * f, dir * o];\n}\n\n// We need to get the steps from fifths\n// Fifths for CDEFGAB are [ 0, 2, 4, -1, 1, 3, 5 ]\n// We add 1 to fifths to avoid negative numbers, so:\n// for [\"F\", \"C\", \"G\", \"D\", \"A\", \"E\", \"B\"] we have:\nconst FIFTHS_TO_STEPS = [3, 0, 4, 1, 5, 2, 6];\n\n/**\n * Get pitch from coordinate objects\n */\nexport function pitch(coord: PitchCoordinates): Pitch {\n const [f, o, dir] = coord;\n const step = FIFTHS_TO_STEPS[unaltered(f)];\n const alt = Math.floor((f + 1) / 7);\n if (o === undefined) {\n return { step, alt, dir };\n }\n const oct = o + 4 * alt + STEPS_TO_OCTS[step];\n return { step, alt, oct, dir };\n}\n\n// Return the number of fifths as if it were unaltered\nfunction unaltered(f: number): number {\n const i = (f + 1) % 7;\n return i < 0 ? 7 + i : i;\n}\n", "import {\n coordinates,\n Direction,\n IntervalCoordinates,\n isNamedPitch,\n isPitch,\n NamedPitch,\n Pitch,\n pitch,\n PitchCoordinates,\n} from \"@tonaljs/pitch\";\n\nconst fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport type IntervalName = string;\nexport type IntervalLiteral = IntervalName | Pitch | NamedPitch;\n\ntype Quality =\n | \"dddd\"\n | \"ddd\"\n | \"dd\"\n | \"d\"\n | \"m\"\n | \"M\"\n | \"P\"\n | \"A\"\n | \"AA\"\n | \"AAA\"\n | \"AAAA\";\ntype Type = \"perfectable\" | \"majorable\";\n\nexport interface Interval extends Pitch, NamedPitch {\n readonly empty: boolean;\n readonly name: IntervalName;\n readonly num: number;\n readonly q: Quality;\n readonly type: Type;\n readonly step: number;\n readonly alt: number;\n readonly dir: Direction;\n readonly simple: number;\n readonly semitones: number;\n readonly chroma: number;\n readonly coord: IntervalCoordinates;\n readonly oct: number;\n}\n\nconst NoInterval: Interval = Object.freeze({\n empty: true,\n name: \"\",\n num: NaN,\n q: \"\" as Quality,\n type: \"\" as Type,\n step: NaN,\n alt: NaN,\n dir: NaN as Direction,\n simple: NaN,\n semitones: NaN,\n chroma: NaN,\n coord: [] as unknown as IntervalCoordinates,\n oct: NaN,\n});\n\n// shorthand tonal notation (with quality after number)\nconst INTERVAL_TONAL_REGEX = \"([-+]?\\\\d+)(d{1,4}|m|M|P|A{1,4})\";\n// standard shorthand notation (with quality before number)\nconst INTERVAL_SHORTHAND_REGEX = \"(AA|A|P|M|m|d|dd)([-+]?\\\\d+)\";\nconst REGEX = new RegExp(\n \"^\" + INTERVAL_TONAL_REGEX + \"|\" + INTERVAL_SHORTHAND_REGEX + \"$\",\n);\n\ntype IntervalTokens = [string, string];\n\n/**\n * @private\n */\nexport function tokenizeInterval(str?: IntervalName): IntervalTokens {\n const m = REGEX.exec(`${str}`);\n if (m === null) {\n return [\"\", \"\"];\n }\n return m[1] ? [m[1], m[2]] : [m[4], m[3]];\n}\n\nconst cache: { [key in string]: Interval } = {};\n\n/**\n * Get interval properties. It returns an object with:\n *\n * - name: the interval name\n * - num: the interval number\n * - type: 'perfectable' or 'majorable'\n * - q: the interval quality (d, m, M, A)\n * - dir: interval direction (1 ascending, -1 descending)\n * - simple: the simplified number\n * - semitones: the size in semitones\n * - chroma: the interval chroma\n *\n * @param {string} interval - the interval name\n * @return {Object} the interval properties\n *\n * @example\n * import { interval } from '@tonaljs/core'\n * interval('P5').semitones // => 7\n * interval('m3').type // => 'majorable'\n */\nexport function interval(src: IntervalLiteral): Interval {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : isPitch(src)\n ? interval(pitchName(src))\n : isNamedPitch(src)\n ? interval(src.name)\n : NoInterval;\n}\n\nconst SIZES = [0, 2, 4, 5, 7, 9, 11];\nconst TYPES = \"PMMPPMM\";\nfunction parse(str?: string): Interval {\n const tokens = tokenizeInterval(str);\n if (tokens[0] === \"\") {\n return NoInterval;\n }\n const num = +tokens[0];\n const q = tokens[1] as Quality;\n const step = (Math.abs(num) - 1) % 7;\n const t = TYPES[step];\n if (t === \"M\" && q === \"P\") {\n return NoInterval;\n }\n const type = t === \"M\" ? \"majorable\" : \"perfectable\";\n\n const name = \"\" + num + q;\n const dir = num < 0 ? -1 : 1;\n const simple = num === 8 || num === -8 ? num : dir * (step + 1);\n const alt = qToAlt(type, q);\n const oct = Math.floor((Math.abs(num) - 1) / 7);\n const semitones = dir * (SIZES[step] + alt + 12 * oct);\n const chroma = (((dir * (SIZES[step] + alt)) % 12) + 12) % 12;\n const coord = coordinates({ step, alt, oct, dir }) as IntervalCoordinates;\n return {\n empty: false,\n name,\n num,\n q,\n step,\n alt,\n dir,\n type,\n simple,\n semitones,\n chroma,\n coord,\n oct,\n };\n}\n\n/**\n * @private\n *\n * forceDescending is used in the case of unison (#243)\n */\nexport function coordToInterval(\n coord: PitchCoordinates,\n forceDescending?: boolean,\n): Interval {\n const [f, o = 0] = coord;\n const isDescending = f * 7 + o * 12 < 0;\n const ivl: IntervalCoordinates =\n forceDescending || isDescending ? [-f, -o, -1] : [f, o, 1];\n return interval(pitch(ivl)) as Interval;\n}\n\nfunction qToAlt(type: Type, q: string): number {\n return (q === \"M\" && type === \"majorable\") ||\n (q === \"P\" && type === \"perfectable\")\n ? 0\n : q === \"m\" && type === \"majorable\"\n ? -1\n : /^A+$/.test(q)\n ? q.length\n : /^d+$/.test(q)\n ? -1 * (type === \"perfectable\" ? q.length : q.length + 1)\n : 0;\n}\n\n// return the interval name of a pitch\nfunction pitchName(props: Pitch): string {\n const { step, alt, oct = 0, dir } = props;\n if (!dir) {\n return \"\";\n }\n const calcNum = step + 1 + 7 * oct;\n // this is an edge case: descending pitch class unison (see #243)\n const num = calcNum === 0 ? step + 1 : calcNum;\n const d = dir < 0 ? \"-\" : \"\";\n const type = TYPES[step] === \"M\" ? \"majorable\" : \"perfectable\";\n const name = d + num + altToQ(type, alt);\n return name;\n}\n\nfunction altToQ(type: Type, alt: number): Quality {\n if (alt === 0) {\n return type === \"majorable\" ? \"M\" : \"P\";\n } else if (alt === -1 && type === \"majorable\") {\n return \"m\";\n } else if (alt > 0) {\n return fillStr(\"A\", alt) as Quality;\n } else {\n return fillStr(\"d\", type === \"perfectable\" ? alt : alt + 1) as Quality;\n }\n}\n", "import {\n coordinates,\n isNamedPitch,\n isPitch,\n NamedPitch,\n Pitch,\n pitch,\n PitchCoordinates,\n} from \"@tonaljs/pitch\";\n\nconst fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport type NoteWithOctave = string;\nexport type PcName = string;\nexport type NoteName = NoteWithOctave | PcName;\nexport type NoteLiteral = NoteName | Pitch | NamedPitch;\n\nexport interface Note extends Pitch, NamedPitch {\n readonly empty: boolean;\n readonly name: NoteName;\n readonly letter: string;\n readonly acc: string;\n readonly pc: PcName;\n readonly chroma: number;\n readonly height: number;\n readonly coord: PitchCoordinates;\n readonly midi: number | null;\n readonly freq: number | null;\n}\n\nconst NoNote: Note = Object.freeze({\n empty: true,\n name: \"\",\n letter: \"\",\n acc: \"\",\n pc: \"\",\n step: NaN,\n alt: NaN,\n chroma: NaN,\n height: NaN,\n coord: [] as unknown as PitchCoordinates,\n midi: null,\n freq: null,\n});\n\nconst cache: Map = new Map();\n\nexport const stepToLetter = (step: number) => \"CDEFGAB\".charAt(step);\nexport const altToAcc = (alt: number): string =>\n alt < 0 ? fillStr(\"b\", -alt) : fillStr(\"#\", alt);\nexport const accToAlt = (acc: string): number =>\n acc[0] === \"b\" ? -acc.length : acc.length;\n\n/**\n * Given a note literal (a note name or a note object), returns the Note object\n * @example\n * note('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport function note(src: NoteLiteral): Note {\n const stringSrc = JSON.stringify(src);\n\n const cached = cache.get(stringSrc);\n if (cached) {\n return cached;\n }\n\n const value =\n typeof src === \"string\"\n ? parse(src)\n : isPitch(src)\n ? note(pitchName(src))\n : isNamedPitch(src)\n ? note(src.name)\n : NoNote;\n cache.set(stringSrc, value);\n return value;\n}\n\ntype NoteTokens = [string, string, string, string];\n\nconst REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\\d*)\\s*(.*)$/;\n\n/**\n * @private\n */\nexport function tokenizeNote(str: string): NoteTokens {\n const m = REGEX.exec(str) as string[];\n return m\n ? [m[1].toUpperCase(), m[2].replace(/x/g, \"##\"), m[3], m[4]]\n : [\"\", \"\", \"\", \"\"];\n}\n\n/**\n * @private\n */\nexport function coordToNote(noteCoord: PitchCoordinates): Note {\n return note(pitch(noteCoord)) as Note;\n}\n\nconst mod = (n: number, m: number) => ((n % m) + m) % m;\n\nconst SEMI = [0, 2, 4, 5, 7, 9, 11];\nfunction parse(noteName: NoteName): Note {\n const tokens = tokenizeNote(noteName);\n if (tokens[0] === \"\" || tokens[3] !== \"\") {\n return NoNote;\n }\n\n const letter = tokens[0];\n const acc = tokens[1];\n const octStr = tokens[2];\n\n const step = (letter.charCodeAt(0) + 3) % 7;\n const alt = accToAlt(acc);\n const oct = octStr.length ? +octStr : undefined;\n const coord = coordinates({ step, alt, oct });\n\n const name = letter + acc + octStr;\n const pc = letter + acc;\n const chroma = (SEMI[step] + alt + 120) % 12;\n const height =\n oct === undefined\n ? mod(SEMI[step] + alt, 12) - 12 * 99\n : SEMI[step] + alt + 12 * (oct + 1);\n const midi = height >= 0 && height <= 127 ? height : null;\n const freq = oct === undefined ? null : Math.pow(2, (height - 69) / 12) * 440;\n\n return {\n empty: false,\n acc,\n alt,\n chroma,\n coord,\n freq,\n height,\n letter,\n midi,\n name,\n oct,\n pc,\n step,\n };\n}\n\nfunction pitchName(props: Pitch): NoteName {\n const { step, alt, oct } = props;\n const letter = stepToLetter(step);\n if (!letter) {\n return \"\";\n }\n\n const pc = letter + altToAcc(alt);\n return oct || oct === 0 ? pc + oct : pc;\n}\n", "import { PitchCoordinates } from \"@tonaljs/pitch\";\nimport {\n IntervalLiteral,\n IntervalName,\n interval as asInterval,\n coordToInterval,\n} from \"@tonaljs/pitch-interval\";\nimport {\n NoteLiteral,\n NoteName,\n note as asNote,\n coordToNote,\n} from \"@tonaljs/pitch-note\";\n\n/**\n * Transpose a note by an interval.\n *\n * @param {string} note - the note or note name\n * @param {string} interval - the interval or interval name\n * @return {string} the transposed note name or empty string if not valid notes\n * @example\n * import { transpose } from \"@tonaljs/core\"\n * transpose(\"d3\", \"3M\") // => \"F#3\"\n * transpose(\"D\", \"3M\") // => \"F#\"\n * [\"C\", \"D\", \"E\", \"F\", \"G\"].map(pc => transpose(pc, \"M3)) // => [\"E\", \"F#\", \"G#\", \"A\", \"B\"]\n */\nexport function transpose(\n noteName: NoteLiteral,\n intervalName: IntervalLiteral | [number, number],\n): NoteName {\n const note = asNote(noteName);\n const intervalCoord = Array.isArray(intervalName)\n ? intervalName\n : asInterval(intervalName).coord;\n if (note.empty || !intervalCoord || intervalCoord.length < 2) {\n return \"\";\n }\n const noteCoord = note.coord;\n const tr: PitchCoordinates =\n noteCoord.length === 1\n ? [noteCoord[0] + intervalCoord[0]]\n : [noteCoord[0] + intervalCoord[0], noteCoord[1] + intervalCoord[1]];\n return coordToNote(tr).name;\n}\n\n// Private\nexport function tonicIntervalsTransposer(\n intervals: string[],\n tonic: string | undefined | null,\n) {\n const len = intervals.length;\n return (normalized: number) => {\n if (!tonic) return \"\";\n const index =\n normalized < 0 ? (len - (-normalized % len)) % len : normalized % len;\n const octaves = Math.floor(normalized / len);\n const root = transpose(tonic, [0, octaves]);\n return transpose(root, intervals[index]);\n };\n}\n\n/**\n * Find the interval distance between two notes or coord classes.\n *\n * To find distance between coord classes, both notes must be coord classes and\n * the interval is always ascending\n *\n * @param {Note|string} from - the note or note name to calculate distance from\n * @param {Note|string} to - the note or note name to calculate distance to\n * @return {string} the interval name or empty string if not valid notes\n *\n */\nexport function distance(\n fromNote: NoteLiteral,\n toNote: NoteLiteral,\n): IntervalName {\n const from = asNote(fromNote);\n const to = asNote(toNote);\n if (from.empty || to.empty) {\n return \"\";\n }\n\n const fcoord = from.coord;\n const tcoord = to.coord;\n const fifths = tcoord[0] - fcoord[0];\n const octs =\n fcoord.length === 2 && tcoord.length === 2\n ? tcoord[1] - fcoord[1]\n : -Math.floor((fifths * 7) / 12);\n\n // If it's unison, not pitch class, and in the same octave\n // it can be descending interval (see #243 & #428)\n const forceDescending =\n to.height === from.height &&\n to.midi !== null &&\n from.oct === to.oct &&\n from.step > to.step;\n return coordToInterval([fifths, octs], forceDescending).name;\n}\n", "import { distance as dist, transpose as tr } from \"@tonaljs/pitch-distance\";\nimport { note } from \"@tonaljs/pitch-note\";\n\nconst fillStr = (character: string, times: number) =>\n Array(times + 1).join(character);\n\nconst REGEX = /^(_{1,}|=|\\^{1,}|)([abcdefgABCDEFG])([,']*)$/;\n\ntype AbcTokens = [string, string, string];\n\nexport function tokenize(str: string): AbcTokens {\n const m = REGEX.exec(str);\n if (!m) {\n return [\"\", \"\", \"\"];\n }\n return [m[1], m[2], m[3]];\n}\n\n/**\n * Convert a (string) note in ABC notation into a (string) note in scientific notation\n *\n * @example\n * abcToScientificNotation(\"c\") // => \"C5\"\n */\nexport function abcToScientificNotation(str: string): string {\n const [acc, letter, oct] = tokenize(str);\n if (letter === \"\") {\n return \"\";\n }\n let o = 4;\n for (let i = 0; i < oct.length; i++) {\n o += oct.charAt(i) === \",\" ? -1 : 1;\n }\n const a =\n acc[0] === \"_\"\n ? acc.replace(/_/g, \"b\")\n : acc[0] === \"^\"\n ? acc.replace(/\\^/g, \"#\")\n : \"\";\n return letter.charCodeAt(0) > 96\n ? letter.toUpperCase() + a + (o + 1)\n : letter + a + o;\n}\n\n/**\n * Convert a (string) note in scientific notation into a (string) note in ABC notation\n *\n * @example\n * scientificToAbcNotation(\"C#4\") // => \"^C\"\n */\nexport function scientificToAbcNotation(str: string): string {\n const n = note(str);\n if (n.empty || (!n.oct && n.oct !== 0)) {\n return \"\";\n }\n const { letter, acc, oct } = n;\n const a = acc[0] === \"b\" ? acc.replace(/b/g, \"_\") : acc.replace(/#/g, \"^\");\n const l = oct > 4 ? letter.toLowerCase() : letter;\n const o =\n oct === 5 ? \"\" : oct > 4 ? fillStr(\"'\", oct - 5) : fillStr(\",\", 4 - oct);\n return a + l + o;\n}\n\nexport function transpose(note: string, interval: string): string {\n return scientificToAbcNotation(tr(abcToScientificNotation(note), interval));\n}\n\nexport function distance(from: string, to: string): string {\n return dist(abcToScientificNotation(from), abcToScientificNotation(to));\n}\n\n/** @deprecated */\nexport default {\n abcToScientificNotation,\n scientificToAbcNotation,\n tokenize,\n transpose,\n distance,\n};\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { note, Note } from \"@tonaljs/pitch-note\";\n\n// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It's completely agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} array\n * @return {Array} the rotated array\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the array with the null values removed\n * @function\n * @param {Array} array\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Sort an array of notes in ascending order. Pitch classes are listed\n * before notes. Any string that is not a note is removed.\n *\n * @param {string[]} notes\n * @return {string[]} sorted array of notes\n *\n * @example\n * sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])\n * // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']\n * sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])\n * // => ['C', 'F', 'G', 'A', 'B']\n */\nexport function sortedNoteNames(notes: string[]): string[] {\n const valid = notes.map((n) => note(n)).filter((n) => !n.empty) as Note[];\n return valid.sort((a, b) => a.height - b.height).map((n) => n.name);\n}\n\n/**\n * Get sorted notes with duplicates removed. Pitch classes are listed\n * before notes.\n *\n * @function\n * @param {string[]} array\n * @return {string[]} unique sorted notes\n *\n * @example\n * Array.sortedUniqNoteNames(['a', 'b', 'c2', '1p', 'p2', 'c2', 'b', 'c', 'c3' ])\n * // => [ 'C', 'A', 'B', 'C2', 'C3' ]\n */\nexport function sortedUniqNoteNames(arr: string[]): string[] {\n return sortedNoteNames(arr).filter((n, i, a) => i === 0 || n !== a[i - 1]);\n}\n\n/**\n * Randomizes the order of the specified array in-place, using the Fisher–Yates shuffle.\n *\n * @function\n * @param {Array} array\n * @return {Array} the array shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an array\n *\n * @param {Array} array - the array\n * @return {Array} an array with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n }),\n );\n }, []);\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n// ascending range\nfunction ascR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = n + b);\n return a;\n}\n// descending range\nfunction descR(b: number, n: number) {\n const a = [];\n // tslint:disable-next-line:curly\n for (; n--; a[n] = b - n);\n return a;\n}\n\n/**\n * Creates a numeric range\n *\n * @param {number} from\n * @param {number} to\n * @return {Array}\n *\n * @example\n * range(-2, 2) // => [-2, -1, 0, 1, 2]\n * range(2, -2) // => [2, 1, 0, -1, -2]\n */\nexport function range(from: number, to: number): number[] {\n return from < to ? ascR(from, to - from + 1) : descR(from, from - to + 1);\n}\n\n/**\n * Rotates a list a number of times. It's completely agnostic about the\n * contents of the list.\n *\n * @param {Integer} times - the number of rotations\n * @param {Array} collection\n * @return {Array} the rotated collection\n *\n * @example\n * rotate(1, [1, 2, 3]) // => [2, 3, 1]\n */\nexport function rotate(times: number, arr: T[]): T[] {\n const len = arr.length;\n const n = ((times % len) + len) % len;\n return arr.slice(n, len).concat(arr.slice(0, n));\n}\n\n/**\n * Return a copy of the collection with the null values removed\n * @function\n * @param {Array} collection\n * @return {Array}\n *\n * @example\n * compact([\"a\", \"b\", null, \"c\"]) // => [\"a\", \"b\", \"c\"]\n */\nexport function compact(arr: any[]): any[] {\n return arr.filter((n) => n === 0 || n);\n}\n\n/**\n * Randomizes the order of the specified collection in-place, using the Fisher–Yates shuffle.\n *\n * @function\n * @param {Array} collection\n * @return {Array} the collection shuffled\n *\n * @example\n * shuffle([\"C\", \"D\", \"E\", \"F\"]) // => [...]\n */\nexport function shuffle(arr: any[], rnd = Math.random): any[] {\n let i: number;\n let t: any;\n let m: number = arr.length;\n while (m) {\n i = Math.floor(rnd() * m--);\n t = arr[m];\n arr[m] = arr[i];\n arr[i] = t;\n }\n return arr;\n}\n\n/**\n * Get all permutations of an collection\n *\n * @param {Array} collection - the collection\n * @return {Array} an collection with all the permutations\n * @example\n * permutations([\"a\", \"b\", \"c\"])) // =>\n * [\n * [\"a\", \"b\", \"c\"],\n * [\"b\", \"a\", \"c\"],\n * [\"b\", \"c\", \"a\"],\n * [\"a\", \"c\", \"b\"],\n * [\"c\", \"a\", \"b\"],\n * [\"c\", \"b\", \"a\"]\n * ]\n */\nexport function permutations(arr: any[]): any[] {\n if (arr.length === 0) {\n return [[]];\n }\n return permutations(arr.slice(1)).reduce((acc, perm) => {\n return acc.concat(\n arr.map((e, pos) => {\n const newPerm = perm.slice();\n newPerm.splice(pos, 0, arr[0]);\n return newPerm;\n }),\n );\n }, []);\n}\n\n/** @deprecated */\nexport default {\n compact,\n permutations,\n range,\n rotate,\n shuffle,\n};\n", "import { compact, range, rotate } from \"@tonaljs/collection\";\nimport { NotFound } from \"@tonaljs/pitch\";\nimport { transpose } from \"@tonaljs/pitch-distance\";\nimport { Interval, IntervalName, interval } from \"@tonaljs/pitch-interval\";\nimport { Note, NoteName, note } from \"@tonaljs/pitch-note\";\n\n/**\n * The properties of a pitch class set\n * @param {number} num - a number between 1 and 4095 (both included) that\n * uniquely identifies the set. It's the decimal number of the chroma.\n * @param {string} chroma - a string representation of the set: a 12-char string\n * with either \"1\" or \"0\" as characters, representing a pitch class or not\n * for the given position in the octave. For example, a \"1\" at index 0 means 'C',\n * a \"1\" at index 2 means 'D', and so on...\n * @param {string} normalized - the chroma but shifted to the first 1\n * @param {number} length - the number of notes of the pitch class set\n * @param {IntervalName[]} intervals - the intervals of the pitch class set\n * *starting from C*\n */\nexport interface Pcset {\n readonly name: string;\n readonly empty: boolean;\n readonly setNum: number;\n readonly chroma: PcsetChroma;\n readonly normalized: PcsetChroma;\n readonly intervals: IntervalName[];\n}\n\nexport const EmptyPcset: Pcset = {\n empty: true,\n name: \"\",\n setNum: 0,\n chroma: \"000000000000\",\n normalized: \"000000000000\",\n intervals: [],\n};\n\nexport type PcsetChroma = string;\nexport type PcsetNum = number;\n\n// UTILITIES\nconst setNumToChroma = (num: number): string =>\n Number(num).toString(2).padStart(12, \"0\");\nconst chromaToNumber = (chroma: string): number => parseInt(chroma, 2);\nconst REGEX = /^[01]{12}$/;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isChroma(set: any): set is PcsetChroma {\n return REGEX.test(set);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isPcsetNum = (set: any): set is PcsetNum =>\n typeof set === \"number\" && set >= 0 && set <= 4095;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isPcset = (set: any): set is Pcset => set && isChroma(set.chroma);\n\nconst cache: { [key in string]: Pcset } = { [EmptyPcset.chroma]: EmptyPcset };\n\n/**\n * A definition of a pitch class set. It could be:\n * - The pitch class set chroma (a 12-length string with only 1s or 0s)\n * - The pitch class set number (an integer between 1 and 4095)\n * - An array of note names\n * - An array of interval names\n */\nexport type Set =\n | Partial\n | PcsetChroma\n | PcsetNum\n | NoteName[]\n | IntervalName[];\n\n/**\n * Get the pitch class set of a collection of notes or set number or chroma\n */\nexport function get(src: Set): Pcset {\n const chroma: PcsetChroma = isChroma(src)\n ? src\n : isPcsetNum(src)\n ? setNumToChroma(src)\n : Array.isArray(src)\n ? listToChroma(src)\n : isPcset(src)\n ? src.chroma\n : EmptyPcset.chroma;\n\n return (cache[chroma] = cache[chroma] || chromaToPcset(chroma));\n}\n\n/**\n * @use Pcset.get\n * @deprecated\n */\nexport const pcset = get;\n\n/**\n * Get pitch class set chroma\n * @function\n * @example\n * Pcset.chroma([\"c\", \"d\", \"e\"]); //=> \"101010000000\"\n */\nexport const chroma = (set: Set) => get(set).chroma;\n\n/**\n * Get intervals (from C) of a set\n * @function\n * @example\n * Pcset.intervals([\"c\", \"d\", \"e\"]); //=>\n */\nexport const intervals = (set: Set) => get(set).intervals;\n\n/**\n * Get pitch class set number\n * @function\n * @example\n * Pcset.num([\"c\", \"d\", \"e\"]); //=> 2192\n */\nexport const num = (set: Set) => get(set).setNum;\n\nconst IVLS = [\n \"1P\",\n \"2m\",\n \"2M\",\n \"3m\",\n \"3M\",\n \"4P\",\n \"5d\",\n \"5P\",\n \"6m\",\n \"6M\",\n \"7m\",\n \"7M\",\n];\n\n/**\n * Get the intervals of a pcset *starting from C*\n * @private\n * @param {Set} set - the pitch class set\n * @return {IntervalName[]} an array of interval names or an empty array\n * if not a valid pitch class set\n */\nfunction chromaToIntervals(chroma: PcsetChroma): IntervalName[] {\n const intervals = [];\n for (let i = 0; i < 12; i++) {\n // tslint:disable-next-line:curly\n if (chroma.charAt(i) === \"1\") intervals.push(IVLS[i]);\n }\n return intervals;\n}\n\nexport function notes(set: Set): NoteName[] {\n return get(set).intervals.map((ivl) => transpose(\"C\", ivl));\n}\n\n/**\n * Get a list of all possible pitch class sets (all possible chromas) *having\n * C as root*. There are 2048 different chromas. If you want them with another\n * note you have to transpose it\n *\n * @see http://allthescales.org/\n * @return {Array} an array of possible chromas from '10000000000' to '11111111111'\n */\nexport function chromas(): PcsetChroma[] {\n return range(2048, 4095).map(setNumToChroma);\n}\n\n/**\n * Given a a list of notes or a pcset chroma, produce the rotations\n * of the chroma discarding the ones that starts with \"0\"\n *\n * This is used, for example, to get all the modes of a scale.\n *\n * @param {Array|string} set - the list of notes or pitchChr of the set\n * @param {boolean} normalize - (Optional, true by default) remove all\n * the rotations that starts with \"0\"\n * @return {Array} an array with all the modes of the chroma\n *\n * @example\n * Pcset.modes([\"C\", \"D\", \"E\"]).map(Pcset.intervals)\n */\nexport function modes(set: Set, normalize = true): PcsetChroma[] {\n const pcs = get(set);\n\n const binary = pcs.chroma.split(\"\");\n return compact(\n binary.map((_, i) => {\n const r = rotate(i, binary);\n return normalize && r[0] === \"0\" ? null : r.join(\"\");\n }),\n );\n}\n\n/**\n * Test if two pitch class sets are equal\n *\n * @param {Array|string} set1 - one of the pitch class sets\n * @param {Array|string} set2 - the other pitch class set\n * @return {boolean} true if they are equal\n * @example\n * Pcset.isEqual([\"c2\", \"d3\"], [\"c5\", \"d2\"]) // => true\n */\nexport function isEqual(s1: Set, s2: Set) {\n return get(s1).setNum === get(s2).setNum;\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * subset of a given set\n *\n * The function is curried.\n *\n * @param {PcsetChroma|NoteName[]} set - the superset to test against (chroma or\n * list of notes)\n * @return{function(PcsetChroma|NoteNames[]): boolean} a function accepting a set\n * to test against (chroma or list of notes)\n * @example\n * const inCMajor = Pcset.isSubsetOf([\"C\", \"E\", \"G\"])\n * inCMajor([\"e6\", \"c4\"]) // => true\n * inCMajor([\"e6\", \"c4\", \"d3\"]) // => false\n */\nexport function isSubsetOf(set: Set) {\n const s = get(set).setNum;\n\n return (notes: Set | Pcset) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o & s) === o;\n };\n}\n\n/**\n * Create a function that test if a collection of notes is a\n * superset of a given set (it contains all notes and at least one more)\n *\n * @param {Set} set - an array of notes or a chroma set string to test against\n * @return {(subset: Set): boolean} a function that given a set\n * returns true if is a subset of the first one\n * @example\n * const extendsCMajor = Pcset.isSupersetOf([\"C\", \"E\", \"G\"])\n * extendsCMajor([\"e6\", \"a\", \"c4\", \"g2\"]) // => true\n * extendsCMajor([\"c6\", \"e4\", \"g3\"]) // => false\n */\nexport function isSupersetOf(set: Set) {\n const s = get(set).setNum;\n return (notes: Set) => {\n const o = get(notes).setNum;\n // tslint:disable-next-line: no-bitwise\n return s && s !== o && (o | s) === o;\n };\n}\n\n/**\n * Test if a given pitch class set includes a note\n *\n * @param {Array} set - the base set to test against\n * @param {string} note - the note to test\n * @return {boolean} true if the note is included in the pcset\n *\n * Can be partially applied\n *\n * @example\n * const isNoteInCMajor = isNoteIncludedIn(['C', 'E', 'G'])\n * isNoteInCMajor('C4') // => true\n * isNoteInCMajor('C#4') // => false\n */\nexport function isNoteIncludedIn(set: Set) {\n const s = get(set);\n\n return (noteName: NoteName): boolean => {\n const n = note(noteName);\n return s && !n.empty && s.chroma.charAt(n.chroma) === \"1\";\n };\n}\n\n/** @deprecated use: isNoteIncludedIn */\nexport const includes = isNoteIncludedIn;\n\n/**\n * Filter a list with a pitch class set\n *\n * @param {Array|string} set - the pitch class set notes\n * @param {Array|string} notes - the note list to be filtered\n * @return {Array} the filtered notes\n *\n * @example\n * Pcset.filter([\"C\", \"D\", \"E\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"d2\", \"c3\", \"d3\" ])\n * Pcset.filter([\"C2\"], [\"c2\", \"c#2\", \"d2\", \"c3\", \"c#3\", \"d3\"]) // => [ \"c2\", \"c3\" ])\n */\nexport function filter(set: Set) {\n const isIncluded = isNoteIncludedIn(set);\n return (notes: NoteName[]) => {\n return notes.filter(isIncluded);\n };\n}\n\n/** @deprecated */\nexport default {\n get,\n chroma,\n num,\n intervals,\n chromas,\n isSupersetOf,\n isSubsetOf,\n isNoteIncludedIn,\n isEqual,\n filter,\n modes,\n notes,\n // deprecated\n pcset,\n};\n\n//// PRIVATE ////\n\nfunction chromaRotations(chroma: string): string[] {\n const binary = chroma.split(\"\");\n return binary.map((_, i) => rotate(i, binary).join(\"\"));\n}\n\nfunction chromaToPcset(chroma: PcsetChroma): Pcset {\n const setNum = chromaToNumber(chroma);\n const normalizedNum = chromaRotations(chroma)\n .map(chromaToNumber)\n .filter((n) => n >= 2048)\n .sort()[0];\n const normalized = setNumToChroma(normalizedNum);\n\n const intervals = chromaToIntervals(chroma);\n\n return {\n empty: false,\n name: \"\",\n setNum,\n chroma,\n normalized,\n intervals,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction listToChroma(set: any[]): PcsetChroma {\n if (set.length === 0) {\n return EmptyPcset.chroma;\n }\n\n let pitch: Note | Interval | NotFound;\n const binary = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < set.length; i++) {\n pitch = note(set[i]);\n // tslint:disable-next-line: curly\n if (pitch.empty) pitch = interval(set[i]);\n // tslint:disable-next-line: curly\n if (!pitch.empty) binary[pitch.chroma] = 1;\n }\n return binary.join(\"\");\n}\n", "import {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\nexport type ChordQuality =\n | \"Major\"\n | \"Minor\"\n | \"Augmented\"\n | \"Diminished\"\n | \"Unknown\";\n\nexport interface ChordType extends Pcset {\n name: string;\n quality: ChordQuality;\n aliases: string[];\n}\nconst NoChordType: ChordType = {\n ...EmptyPcset,\n name: \"\",\n quality: \"Unknown\",\n intervals: [],\n aliases: [],\n};\n\ntype ChordTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ChordType[] = [];\nlet index: Record = {};\n\n/**\n * Given a chord name or chroma, return the chord properties\n * @param {string} source - chord name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/chord-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ChordTypeName): ChordType {\n return index[type] || NoChordType;\n}\n\n/** @deprecated */\nexport const chordType = get;\n\n/**\n * Get all chord (long) names\n */\nexport function names() {\n return dictionary.map((chord) => chord.name).filter((x) => x);\n}\n\n/**\n * Get all chord symbols\n */\nexport function symbols() {\n return dictionary.map((chord) => chord.aliases[0]).filter((x) => x);\n}\n\n/**\n * Keys used to reference chord types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Return a list of all chord types\n */\nexport function all(): ChordType[] {\n return dictionary.slice();\n}\n\n/** @deprecated */\nexport const entries = all;\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a chord to the dictionary.\n * @param intervals\n * @param aliases\n * @param [fullName]\n */\nexport function add(intervals: string[], aliases: string[], fullName?: string) {\n const quality = getQuality(intervals);\n const chord = {\n ...pcset(intervals),\n name: fullName || \"\",\n quality,\n intervals,\n aliases,\n };\n dictionary.push(chord);\n if (chord.name) {\n index[chord.name] = chord;\n }\n index[chord.setNum] = chord;\n index[chord.chroma] = chord;\n chord.aliases.forEach((alias) => addAlias(chord, alias));\n}\n\nexport function addAlias(chord: ChordType, alias: string) {\n index[alias] = chord;\n}\n\nfunction getQuality(intervals: string[]): ChordQuality {\n const has = (interval: string) => intervals.indexOf(interval) !== -1;\n return has(\"5A\")\n ? \"Augmented\"\n : has(\"3M\")\n ? \"Major\"\n : has(\"5d\")\n ? \"Diminished\"\n : has(\"3m\")\n ? \"Minor\"\n : \"Unknown\";\n}\n\ndata.forEach(([ivls, fullName, names]: string[]) =>\n add(ivls.split(\" \"), names.split(\" \"), fullName),\n);\ndictionary.sort((a, b) => a.setNum - b.setNum);\n\n/** @deprecated */\nexport default {\n names,\n symbols,\n get,\n all,\n add,\n removeAll,\n keys,\n // deprecated\n entries,\n chordType,\n};\n", "/**\n * @private\n * Chord List\n * Source: https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns\n * Format: [\"intervals\", \"full name\", \"abrv1 abrv2\"]\n */\nconst CHORDS: string[][] = [\n // ==Major==\n [\"1P 3M 5P\", \"major\", \"M ^ maj\"],\n [\"1P 3M 5P 7M\", \"major seventh\", \"maj7 Δ ma7 M7 Maj7 ^7\"],\n [\"1P 3M 5P 7M 9M\", \"major ninth\", \"maj9 Δ9 ^9\"],\n [\"1P 3M 5P 7M 9M 13M\", \"major thirteenth\", \"maj13 Maj13 ^13\"],\n [\"1P 3M 5P 6M\", \"sixth\", \"6 add6 add13 M6\"],\n [\"1P 3M 5P 6M 9M\", \"sixth added ninth\", \"6add9 6/9 69 M69\"],\n [\"1P 3M 6m 7M\", \"major seventh flat sixth\", \"M7b6 ^7b6\"],\n [\n \"1P 3M 5P 7M 11A\",\n \"major seventh sharp eleventh\",\n \"maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11\",\n ],\n // ==Minor==\n // '''Normal'''\n [\"1P 3m 5P\", \"minor\", \"m min -\"],\n [\"1P 3m 5P 7m\", \"minor seventh\", \"m7 min7 mi7 -7\"],\n [\n \"1P 3m 5P 7M\",\n \"minor/major seventh\",\n \"m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7 -maj7\",\n ],\n [\"1P 3m 5P 6M\", \"minor sixth\", \"m6 -6\"],\n [\"1P 3m 5P 7m 9M\", \"minor ninth\", \"m9 -9\"],\n [\"1P 3m 5P 7M 9M\", \"minor/major ninth\", \"mM9 mMaj9 -^9\"],\n [\"1P 3m 5P 7m 9M 11P\", \"minor eleventh\", \"m11 -11\"],\n [\"1P 3m 5P 7m 9M 13M\", \"minor thirteenth\", \"m13 -13\"],\n // '''Diminished'''\n [\"1P 3m 5d\", \"diminished\", \"dim ° o\"],\n [\"1P 3m 5d 7d\", \"diminished seventh\", \"dim7 °7 o7\"],\n [\"1P 3m 5d 7m\", \"half-diminished\", \"m7b5 ø -7b5 h7 h\"],\n // ==Dominant/Seventh==\n // '''Normal'''\n [\"1P 3M 5P 7m\", \"dominant seventh\", \"7 dom\"],\n [\"1P 3M 5P 7m 9M\", \"dominant ninth\", \"9\"],\n [\"1P 3M 5P 7m 9M 13M\", \"dominant thirteenth\", \"13\"],\n [\"1P 3M 5P 7m 11A\", \"lydian dominant seventh\", \"7#11 7#4\"],\n // '''Altered'''\n [\"1P 3M 5P 7m 9m\", \"dominant flat ninth\", \"7b9\"],\n [\"1P 3M 5P 7m 9A\", \"dominant sharp ninth\", \"7#9\"],\n [\"1P 3M 7m 9m\", \"altered\", \"alt7\"],\n // '''Suspended'''\n [\"1P 4P 5P\", \"suspended fourth\", \"sus4 sus\"],\n [\"1P 2M 5P\", \"suspended second\", \"sus2\"],\n [\"1P 4P 5P 7m\", \"suspended fourth seventh\", \"7sus4 7sus\"],\n [\"1P 5P 7m 9M 11P\", \"eleventh\", \"11\"],\n [\n \"1P 4P 5P 7m 9m\",\n \"suspended fourth flat ninth\",\n \"b9sus phryg 7b9sus 7b9sus4\",\n ],\n // ==Other==\n [\"1P 5P\", \"fifth\", \"5\"],\n [\"1P 3M 5A\", \"augmented\", \"aug + +5 ^#5\"],\n [\"1P 3m 5A\", \"minor augmented\", \"m#5 -#5 m+\"],\n [\"1P 3M 5A 7M\", \"augmented seventh\", \"maj7#5 maj7+5 +maj7 ^7#5\"],\n [\n \"1P 3M 5P 7M 9M 11A\",\n \"major sharp eleventh (lydian)\",\n \"maj9#11 Δ9#11 ^9#11\",\n ],\n // ==Legacy==\n [\"1P 2M 4P 5P\", \"\", \"sus24 sus4add9\"],\n [\"1P 3M 5A 7M 9M\", \"\", \"maj9#5 Maj9#5\"],\n [\"1P 3M 5A 7m\", \"\", \"7#5 +7 7+ 7aug aug7\"],\n [\"1P 3M 5A 7m 9A\", \"\", \"7#5#9 7#9#5 7alt\"],\n [\"1P 3M 5A 7m 9M\", \"\", \"9#5 9+\"],\n [\"1P 3M 5A 7m 9M 11A\", \"\", \"9#5#11\"],\n [\"1P 3M 5A 7m 9m\", \"\", \"7#5b9 7b9#5\"],\n [\"1P 3M 5A 7m 9m 11A\", \"\", \"7#5b9#11\"],\n [\"1P 3M 5A 9A\", \"\", \"+add#9\"],\n [\"1P 3M 5A 9M\", \"\", \"M#5add9 +add9\"],\n [\"1P 3M 5P 6M 11A\", \"\", \"M6#11 M6b5 6#11 6b5\"],\n [\"1P 3M 5P 6M 7M 9M\", \"\", \"M7add13\"],\n [\"1P 3M 5P 6M 9M 11A\", \"\", \"69#11\"],\n [\"1P 3m 5P 6M 9M\", \"\", \"m69 -69\"],\n [\"1P 3M 5P 6m 7m\", \"\", \"7b6\"],\n [\"1P 3M 5P 7M 9A 11A\", \"\", \"maj7#9#11\"],\n [\"1P 3M 5P 7M 9M 11A 13M\", \"\", \"M13#11 maj13#11 M13+4 M13#4\"],\n [\"1P 3M 5P 7M 9m\", \"\", \"M7b9\"],\n [\"1P 3M 5P 7m 11A 13m\", \"\", \"7#11b13 7b5b13\"],\n [\"1P 3M 5P 7m 13M\", \"\", \"7add6 67 7add13\"],\n [\"1P 3M 5P 7m 9A 11A\", \"\", \"7#9#11 7b5#9 7#9b5\"],\n [\"1P 3M 5P 7m 9A 11A 13M\", \"\", \"13#9#11\"],\n [\"1P 3M 5P 7m 9A 11A 13m\", \"\", \"7#9#11b13\"],\n [\"1P 3M 5P 7m 9A 13M\", \"\", \"13#9\"],\n [\"1P 3M 5P 7m 9A 13m\", \"\", \"7#9b13\"],\n [\"1P 3M 5P 7m 9M 11A\", \"\", \"9#11 9+4 9#4\"],\n [\"1P 3M 5P 7m 9M 11A 13M\", \"\", \"13#11 13+4 13#4\"],\n [\"1P 3M 5P 7m 9M 11A 13m\", \"\", \"9#11b13 9b5b13\"],\n [\"1P 3M 5P 7m 9m 11A\", \"\", \"7b9#11 7b5b9 7b9b5\"],\n [\"1P 3M 5P 7m 9m 11A 13M\", \"\", \"13b9#11\"],\n [\"1P 3M 5P 7m 9m 11A 13m\", \"\", \"7b9b13#11 7b9#11b13 7b5b9b13\"],\n [\"1P 3M 5P 7m 9m 13M\", \"\", \"13b9\"],\n [\"1P 3M 5P 7m 9m 13m\", \"\", \"7b9b13\"],\n [\"1P 3M 5P 7m 9m 9A\", \"\", \"7b9#9\"],\n [\"1P 3M 5P 9M\", \"\", \"Madd9 2 add9 add2\"],\n [\"1P 3M 5P 9m\", \"\", \"Maddb9\"],\n [\"1P 3M 5d\", \"\", \"Mb5\"],\n [\"1P 3M 5d 6M 7m 9M\", \"\", \"13b5\"],\n [\"1P 3M 5d 7M\", \"\", \"M7b5\"],\n [\"1P 3M 5d 7M 9M\", \"\", \"M9b5\"],\n [\"1P 3M 5d 7m\", \"\", \"7b5\"],\n [\"1P 3M 5d 7m 9M\", \"\", \"9b5\"],\n [\"1P 3M 7m\", \"\", \"7no5\"],\n [\"1P 3M 7m 13m\", \"\", \"7b13\"],\n [\"1P 3M 7m 9M\", \"\", \"9no5\"],\n [\"1P 3M 7m 9M 13M\", \"\", \"13no5\"],\n [\"1P 3M 7m 9M 13m\", \"\", \"9b13\"],\n [\"1P 3m 4P 5P\", \"\", \"madd4\"],\n [\"1P 3m 5P 6m 7M\", \"\", \"mMaj7b6\"],\n [\"1P 3m 5P 6m 7M 9M\", \"\", \"mMaj9b6\"],\n [\"1P 3m 5P 7m 11P\", \"\", \"m7add11 m7add4\"],\n [\"1P 3m 5P 9M\", \"\", \"madd9\"],\n [\"1P 3m 5d 6M 7M\", \"\", \"o7M7\"],\n [\"1P 3m 5d 7M\", \"\", \"oM7\"],\n [\"1P 3m 6m 7M\", \"\", \"mb6M7\"],\n [\"1P 3m 6m 7m\", \"\", \"m7#5\"],\n [\"1P 3m 6m 7m 9M\", \"\", \"m9#5\"],\n [\"1P 3m 5A 7m 9M 11P\", \"\", \"m11A\"],\n [\"1P 3m 6m 9m\", \"\", \"mb6b9\"],\n [\"1P 2M 3m 5d 7m\", \"\", \"m9b5\"],\n [\"1P 4P 5A 7M\", \"\", \"M7#5sus4\"],\n [\"1P 4P 5A 7M 9M\", \"\", \"M9#5sus4\"],\n [\"1P 4P 5A 7m\", \"\", \"7#5sus4\"],\n [\"1P 4P 5P 7M\", \"\", \"M7sus4\"],\n [\"1P 4P 5P 7M 9M\", \"\", \"M9sus4\"],\n [\"1P 4P 5P 7m 9M\", \"\", \"9sus4 9sus\"],\n [\"1P 4P 5P 7m 9M 13M\", \"\", \"13sus4 13sus\"],\n [\"1P 4P 5P 7m 9m 13m\", \"\", \"7sus4b9b13 7b9b13sus4\"],\n [\"1P 4P 7m 10m\", \"\", \"4 quartal\"],\n [\"1P 5P 7m 9m 11P\", \"\", \"11b9\"],\n];\n\nexport default CHORDS;\n", "import { all, ChordType } from \"@tonaljs/chord-type\";\nimport { modes } from \"@tonaljs/pcset\";\nimport { note } from \"@tonaljs/pitch-note\";\n\ninterface FoundChord {\n readonly weight: number;\n readonly name: string;\n}\n\nconst namedSet = (notes: string[]) => {\n const pcToName = notes.reduce>((record, n) => {\n const chroma = note(n).chroma;\n if (chroma !== undefined) {\n record[chroma] = record[chroma] || note(n).name;\n }\n return record;\n }, {});\n\n return (chroma: number) => pcToName[chroma];\n};\n\ntype DetectOptions = {\n assumePerfectFifth: boolean;\n};\nexport function detect(\n source: string[],\n options: Partial = {},\n): string[] {\n const notes = source.map((n) => note(n).pc).filter((x) => x);\n if (note.length === 0) {\n return [];\n }\n\n const found: FoundChord[] = findMatches(notes, 1, options);\n\n return found\n .filter((chord) => chord.weight)\n .sort((a, b) => b.weight - a.weight)\n .map((chord) => chord.name);\n}\n\n/* tslint:disable:no-bitwise */\nconst BITMASK = {\n // 3m 000100000000\n // 3M 000010000000\n anyThirds: 384,\n // 5P 000000010000\n perfectFifth: 16,\n // 5d 000000100000\n // 5A 000000001000\n nonPerfectFifths: 40,\n anySeventh: 3,\n};\n\nconst testChromaNumber = (bitmask: number) => (chromaNumber: number) =>\n Boolean(chromaNumber & bitmask);\nconst hasAnyThird = testChromaNumber(BITMASK.anyThirds);\nconst hasPerfectFifth = testChromaNumber(BITMASK.perfectFifth);\nconst hasAnySeventh = testChromaNumber(BITMASK.anySeventh);\nconst hasNonPerfectFifth = testChromaNumber(BITMASK.nonPerfectFifths);\n\nfunction hasAnyThirdAndPerfectFifthAndAnySeventh(chordType: ChordType) {\n const chromaNumber = parseInt(chordType.chroma, 2);\n return (\n hasAnyThird(chromaNumber) &&\n hasPerfectFifth(chromaNumber) &&\n hasAnySeventh(chromaNumber)\n );\n}\n\nfunction withPerfectFifth(chroma: string): string {\n const chromaNumber = parseInt(chroma, 2);\n return hasNonPerfectFifth(chromaNumber)\n ? chroma\n : (chromaNumber | 16).toString(2);\n}\n\n/* tslint:enable:no-bitwise */\n\ntype FindMatchesOptions = {\n assumePerfectFifth: boolean;\n};\nfunction findMatches(\n notes: string[],\n weight: number,\n options: Partial,\n): FoundChord[] {\n const tonic = notes[0];\n const tonicChroma = note(tonic).chroma;\n const noteName = namedSet(notes);\n // we need to test all chromas to get the correct baseNote\n const allModes = modes(notes, false);\n\n const found: FoundChord[] = [];\n allModes.forEach((mode, index) => {\n const modeWithPerfectFifth =\n options.assumePerfectFifth && withPerfectFifth(mode);\n // some chords could have the same chroma but different interval spelling\n const chordTypes = all().filter((chordType) => {\n if (\n options.assumePerfectFifth &&\n hasAnyThirdAndPerfectFifthAndAnySeventh(chordType)\n ) {\n return chordType.chroma === modeWithPerfectFifth;\n }\n return chordType.chroma === mode;\n });\n\n chordTypes.forEach((chordType) => {\n const chordName = chordType.aliases[0];\n const baseNote = noteName(index);\n const isInversion = index !== tonicChroma;\n if (isInversion) {\n found.push({\n weight: 0.5 * weight,\n name: `${baseNote}${chordName}/${tonic}`,\n });\n } else {\n found.push({ weight: 1 * weight, name: `${baseNote}${chordName}` });\n }\n });\n });\n\n return found;\n}\n\n/** @deprecated */\nexport default { detect };\n", "import { IntervalCoordinates, NoteCoordinates } from \"@tonaljs/pitch\";\nimport { distance as dist } from \"@tonaljs/pitch-distance\";\nimport {\n IntervalName,\n coordToInterval,\n interval as props,\n} from \"@tonaljs/pitch-interval\";\n\n/**\n * Get the natural list of names\n */\nexport function names(): IntervalName[] {\n return \"1P 2M 3M 4P 5P 6m 7m\".split(\" \");\n}\n\n/**\n * Get properties of an interval\n *\n * @function\n * @example\n * Interval.get('P4') // => {\"alt\": 0, \"dir\": 1, \"name\": \"4P\", \"num\": 4, \"oct\": 0, \"q\": \"P\", \"semitones\": 5, \"simple\": 4, \"step\": 3, \"type\": \"perfectable\"}\n */\nexport const get = props;\n\n/**\n * Get name of an interval\n *\n * @function\n * @example\n * Interval.name('4P') // => \"4P\"\n * Interval.name('P4') // => \"4P\"\n * Interval.name('C4') // => \"\"\n */\nexport const name = (name: string) => props(name).name;\n\n/**\n * Get semitones of an interval\n * @function\n * @example\n * Interval.semitones('P4') // => 5\n */\nexport const semitones = (name: string) => props(name).semitones;\n\n/**\n * Get quality of an interval\n * @function\n * @example\n * Interval.quality('P4') // => \"P\"\n */\nexport const quality = (name: string) => props(name).q;\n\n/**\n * Get number of an interval\n * @function\n * @example\n * Interval.num('P4') // => 4\n */\nexport const num = (name: string) => props(name).num;\n\n/**\n * Get the simplified version of an interval.\n *\n * @function\n * @param {string} interval - the interval to simplify\n * @return {string} the simplified interval\n *\n * @example\n * Interval.simplify(\"9M\") // => \"2M\"\n * Interval.simplify(\"2M\") // => \"2M\"\n * Interval.simplify(\"-2M\") // => \"7m\"\n * [\"8P\", \"9M\", \"10M\", \"11P\", \"12P\", \"13M\", \"14M\", \"15P\"].map(Interval.simplify)\n * // => [ \"8P\", \"2M\", \"3M\", \"4P\", \"5P\", \"6M\", \"7M\", \"8P\" ]\n */\nexport function simplify(name: IntervalName): IntervalName {\n const i = props(name);\n return i.empty ? \"\" : i.simple + i.q;\n}\n\n/**\n * Get the inversion (https://en.wikipedia.org/wiki/Inversion_(music)#Intervals)\n * of an interval.\n *\n * @function\n * @param {string} interval - the interval to invert in interval shorthand\n * notation or interval array notation\n * @return {string} the inverted interval\n *\n * @example\n * Interval.invert(\"3m\") // => \"6M\"\n * Interval.invert(\"2M\") // => \"7m\"\n */\nexport function invert(name: IntervalName): IntervalName {\n const i = props(name);\n if (i.empty) {\n return \"\";\n }\n const step = (7 - i.step) % 7;\n const alt = i.type === \"perfectable\" ? -i.alt : -(i.alt + 1);\n return props({ step, alt, oct: i.oct, dir: i.dir }).name;\n}\n\n// interval numbers\nconst IN = [1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7];\n// interval qualities\nconst IQ = \"P m M m M P d P m M m M\".split(\" \");\n\n/**\n * Get interval name from semitones number. Since there are several interval\n * names for the same number, the name it's arbitrary, but deterministic.\n *\n * @param {Integer} num - the number of semitones (can be negative)\n * @return {string} the interval name\n * @example\n * Interval.fromSemitones(7) // => \"5P\"\n * Interval.fromSemitones(-7) // => \"-5P\"\n */\nexport function fromSemitones(semitones: number): IntervalName {\n const d = semitones < 0 ? -1 : 1;\n const n = Math.abs(semitones);\n const c = n % 12;\n const o = Math.floor(n / 12);\n return d * (IN[c] + 7 * o) + IQ[c];\n}\n\n/**\n * Find interval between two notes\n *\n * @example\n * Interval.distance(\"C4\", \"G4\"); // => \"5P\"\n */\nexport const distance = dist;\n\n/**\n * Adds two intervals\n *\n * @function\n * @param {string} interval1\n * @param {string} interval2\n * @return {string} the added interval name\n * @example\n * Interval.add(\"3m\", \"5P\") // => \"7m\"\n */\nexport const add = combinator((a, b) => [a[0] + b[0], a[1] + b[1]]);\n\n/**\n * Returns a function that adds an interval\n *\n * @function\n * @example\n * ['1P', '2M', '3M'].map(Interval.addTo('5P')) // => [\"5P\", \"6M\", \"7M\"]\n */\nexport const addTo = (interval: string) => (other: string) =>\n add(interval, other);\n\n/**\n * Subtracts two intervals\n *\n * @function\n * @param {string} minuendInterval\n * @param {string} subtrahendInterval\n * @return {string} the subtracted interval name\n * @example\n * Interval.subtract('5P', '3M') // => '3m'\n * Interval.subtract('3M', '5P') // => '-3m'\n */\nexport const subtract = combinator((a, b) => [a[0] - b[0], a[1] - b[1]]);\n\nexport function transposeFifths(\n interval: IntervalName,\n fifths: number,\n): IntervalName {\n const ivl = get(interval);\n if (ivl.empty) return \"\";\n\n const [nFifths, nOcts, dir] = ivl.coord;\n return coordToInterval([nFifths + fifths, nOcts, dir]).name;\n}\n\n/** @deprecated */\nexport default {\n names,\n get,\n name,\n num,\n semitones,\n quality,\n fromSemitones,\n distance,\n invert,\n simplify,\n add,\n addTo,\n subtract,\n transposeFifths,\n};\n\n//// PRIVATE ////\n\ntype Operation = (\n a: IntervalCoordinates,\n b: IntervalCoordinates,\n) => NoteCoordinates;\n\nfunction combinator(fn: Operation) {\n return (a: IntervalName, b: IntervalName): IntervalName | undefined => {\n const coordA = props(a).coord;\n const coordB = props(b).coord;\n if (coordA && coordB) {\n const coord = fn(coordA, coordB);\n return coordToInterval(coord).name;\n }\n };\n}\n", "import {\n EmptyPcset,\n get as pcset,\n Pcset,\n PcsetChroma,\n PcsetNum,\n} from \"@tonaljs/pcset\";\nimport data from \"./data\";\n\n/**\n * Properties for a scale in the scale dictionary. It's a pitch class set\n * properties with the following additional information:\n * - name: the scale name\n * - aliases: alternative list of names\n * - intervals: an array of interval names\n */\nexport interface ScaleType extends Pcset {\n readonly name: string;\n readonly aliases: string[];\n}\n\nexport const NoScaleType: ScaleType = {\n ...EmptyPcset,\n intervals: [],\n aliases: [],\n};\n\ntype ScaleTypeName = string | PcsetChroma | PcsetNum;\n\nlet dictionary: ScaleType[] = [];\nlet index: Record = {};\n\nexport function names() {\n return dictionary.map((scale) => scale.name);\n}\n\n/**\n * Given a scale name or chroma, return the scale properties\n *\n * @param {string} type - scale name or pitch class set chroma\n * @example\n * import { get } from 'tonaljs/scale-type'\n * get('major') // => { name: 'major', ... }\n */\nexport function get(type: ScaleTypeName): ScaleType {\n return index[type] || NoScaleType;\n}\n\n/**\n * @deprecated\n * @use ScaleType.get\n */\nexport const scaleType = get;\n\n/**\n * Return a list of all scale types\n */\nexport function all() {\n return dictionary.slice();\n}\n\n/**\n * @deprecated\n * @use ScaleType.all\n */\nexport const entries = all;\n\n/**\n * Keys used to reference scale types\n */\nexport function keys() {\n return Object.keys(index);\n}\n\n/**\n * Clear the dictionary\n */\nexport function removeAll() {\n dictionary = [];\n index = {};\n}\n\n/**\n * Add a scale into dictionary\n * @param intervals\n * @param name\n * @param aliases\n */\nexport function add(\n intervals: string[],\n name: string,\n aliases: string[] = [],\n): ScaleType {\n const scale = { ...pcset(intervals), name, intervals, aliases };\n dictionary.push(scale);\n index[scale.name] = scale;\n index[scale.setNum] = scale;\n index[scale.chroma] = scale;\n scale.aliases.forEach((alias) => addAlias(scale, alias));\n return scale;\n}\n\nexport function addAlias(scale: ScaleType, alias: string) {\n index[alias] = scale;\n}\n\ndata.forEach(([ivls, name, ...aliases]: string[]) =>\n add(ivls.split(\" \"), name, aliases),\n);\n\n/** @deprecated */\nexport default {\n names,\n get,\n all,\n add,\n removeAll,\n keys,\n\n // deprecated\n entries,\n scaleType,\n};\n", "// SCALES\n// Format: [\"intervals\", \"name\", \"alias1\", \"alias2\", ...]\nconst SCALES: string[][] = [\n // Basic scales\n [\"1P 2M 3M 5P 6M\", \"major pentatonic\", \"pentatonic\"],\n [\"1P 2M 3M 4P 5P 6M 7M\", \"major\", \"ionian\"],\n [\"1P 2M 3m 4P 5P 6m 7m\", \"minor\", \"aeolian\"],\n\n // Jazz common scales\n [\"1P 2M 3m 3M 5P 6M\", \"major blues\"],\n [\"1P 3m 4P 5d 5P 7m\", \"minor blues\", \"blues\"],\n [\"1P 2M 3m 4P 5P 6M 7M\", \"melodic minor\"],\n [\"1P 2M 3m 4P 5P 6m 7M\", \"harmonic minor\"],\n [\"1P 2M 3M 4P 5P 6M 7m 7M\", \"bebop\"],\n [\"1P 2M 3m 4P 5d 6m 6M 7M\", \"diminished\", \"whole-half diminished\"],\n\n // Modes\n [\"1P 2M 3m 4P 5P 6M 7m\", \"dorian\"],\n [\"1P 2M 3M 4A 5P 6M 7M\", \"lydian\"],\n [\"1P 2M 3M 4P 5P 6M 7m\", \"mixolydian\", \"dominant\"],\n [\"1P 2m 3m 4P 5P 6m 7m\", \"phrygian\"],\n [\"1P 2m 3m 4P 5d 6m 7m\", \"locrian\"],\n\n // 5-note scales\n [\"1P 3M 4P 5P 7M\", \"ionian pentatonic\"],\n [\"1P 3M 4P 5P 7m\", \"mixolydian pentatonic\", \"indian\"],\n [\"1P 2M 4P 5P 6M\", \"ritusen\"],\n [\"1P 2M 4P 5P 7m\", \"egyptian\"],\n [\"1P 3M 4P 5d 7m\", \"neopolitan major pentatonic\"],\n [\"1P 3m 4P 5P 6m\", \"vietnamese 1\"],\n [\"1P 2m 3m 5P 6m\", \"pelog\"],\n [\"1P 2m 4P 5P 6m\", \"kumoijoshi\"],\n [\"1P 2M 3m 5P 6m\", \"hirajoshi\"],\n [\"1P 2m 4P 5d 7m\", \"iwato\"],\n [\"1P 2m 4P 5P 7m\", \"in-sen\"],\n [\"1P 3M 4A 5P 7M\", \"lydian pentatonic\", \"chinese\"],\n [\"1P 3m 4P 6m 7m\", \"malkos raga\"],\n [\"1P 3m 4P 5d 7m\", \"locrian pentatonic\", \"minor seven flat five pentatonic\"],\n [\"1P 3m 4P 5P 7m\", \"minor pentatonic\", \"vietnamese 2\"],\n [\"1P 3m 4P 5P 6M\", \"minor six pentatonic\"],\n [\"1P 2M 3m 5P 6M\", \"flat three pentatonic\", \"kumoi\"],\n [\"1P 2M 3M 5P 6m\", \"flat six pentatonic\"],\n [\"1P 2m 3M 5P 6M\", \"scriabin\"],\n [\"1P 3M 5d 6m 7m\", \"whole tone pentatonic\"],\n [\"1P 3M 4A 5A 7M\", \"lydian #5P pentatonic\"],\n [\"1P 3M 4A 5P 7m\", \"lydian dominant pentatonic\"],\n [\"1P 3m 4P 5P 7M\", \"minor #7M pentatonic\"],\n [\"1P 3m 4d 5d 7m\", \"super locrian pentatonic\"],\n\n // 6-note scales\n [\"1P 2M 3m 4P 5P 7M\", \"minor hexatonic\"],\n [\"1P 2A 3M 5P 5A 7M\", \"augmented\"],\n [\"1P 2M 4P 5P 6M 7m\", \"piongio\"],\n [\"1P 2m 3M 4A 6M 7m\", \"prometheus neopolitan\"],\n [\"1P 2M 3M 4A 6M 7m\", \"prometheus\"],\n [\"1P 2m 3M 5d 6m 7m\", \"mystery #1\"],\n [\"1P 2m 3M 4P 5A 6M\", \"six tone symmetric\"],\n [\"1P 2M 3M 4A 5A 6A\", \"whole tone\", \"messiaen's mode #1\"],\n [\"1P 2m 4P 4A 5P 7M\", \"messiaen's mode #5\"],\n\n // 7-note scales\n [\"1P 2M 3M 4P 5d 6m 7m\", \"locrian major\", \"arabian\"],\n [\"1P 2m 3M 4A 5P 6m 7M\", \"double harmonic lydian\"],\n [\n \"1P 2m 2A 3M 4A 6m 7m\",\n \"altered\",\n \"super locrian\",\n \"diminished whole tone\",\n \"pomeroy\",\n ],\n [\"1P 2M 3m 4P 5d 6m 7m\", \"locrian #2\", \"half-diminished\", \"aeolian b5\"],\n [\n \"1P 2M 3M 4P 5P 6m 7m\",\n \"mixolydian b6\",\n \"melodic minor fifth mode\",\n \"hindu\",\n ],\n [\"1P 2M 3M 4A 5P 6M 7m\", \"lydian dominant\", \"lydian b7\", \"overtone\"],\n [\"1P 2M 3M 4A 5A 6M 7M\", \"lydian augmented\"],\n [\n \"1P 2m 3m 4P 5P 6M 7m\",\n \"dorian b2\",\n \"phrygian #6\",\n \"melodic minor second mode\",\n ],\n [\n \"1P 2m 3m 4d 5d 6m 7d\",\n \"ultralocrian\",\n \"superlocrian bb7\",\n \"superlocrian diminished\",\n ],\n [\"1P 2m 3m 4P 5d 6M 7m\", \"locrian 6\", \"locrian natural 6\", \"locrian sharp 6\"],\n [\"1P 2A 3M 4P 5P 5A 7M\", \"augmented heptatonic\"],\n // Source https://en.wikipedia.org/wiki/Ukrainian_Dorian_scale\n [\n \"1P 2M 3m 4A 5P 6M 7m\",\n \"dorian #4\",\n \"ukrainian dorian\",\n \"romanian minor\",\n \"altered dorian\",\n ],\n [\"1P 2M 3m 4A 5P 6M 7M\", \"lydian diminished\"],\n [\"1P 2M 3M 4A 5A 7m 7M\", \"leading whole tone\"],\n [\"1P 2M 3M 4A 5P 6m 7m\", \"lydian minor\"],\n [\"1P 2m 3M 4P 5P 6m 7m\", \"phrygian dominant\", \"spanish\", \"phrygian major\"],\n [\"1P 2m 3m 4P 5P 6m 7M\", \"balinese\"],\n [\"1P 2m 3m 4P 5P 6M 7M\", \"neopolitan major\"],\n [\"1P 2M 3M 4P 5P 6m 7M\", \"harmonic major\"],\n [\"1P 2m 3M 4P 5P 6m 7M\", \"double harmonic major\", \"gypsy\"],\n [\"1P 2M 3m 4A 5P 6m 7M\", \"hungarian minor\"],\n [\"1P 2A 3M 4A 5P 6M 7m\", \"hungarian major\"],\n [\"1P 2m 3M 4P 5d 6M 7m\", \"oriental\"],\n [\"1P 2m 3m 3M 4A 5P 7m\", \"flamenco\"],\n [\"1P 2m 3m 4A 5P 6m 7M\", \"todi raga\"],\n [\"1P 2m 3M 4P 5d 6m 7M\", \"persian\"],\n [\"1P 2m 3M 5d 6m 7m 7M\", \"enigmatic\"],\n [\n \"1P 2M 3M 4P 5A 6M 7M\",\n \"major augmented\",\n \"major #5\",\n \"ionian augmented\",\n \"ionian #5\",\n ],\n [\"1P 2A 3M 4A 5P 6M 7M\", \"lydian #9\"],\n\n // 8-note scales\n [\"1P 2m 2M 4P 4A 5P 6m 7M\", \"messiaen's mode #4\"],\n [\"1P 2m 3M 4P 4A 5P 6m 7M\", \"purvi raga\"],\n [\"1P 2m 3m 3M 4P 5P 6m 7m\", \"spanish heptatonic\"],\n [\"1P 2M 3m 3M 4P 5P 6M 7m\", \"bebop minor\"],\n [\"1P 2M 3M 4P 5P 5A 6M 7M\", \"bebop major\"],\n [\"1P 2m 3m 4P 5d 5P 6m 7m\", \"bebop locrian\"],\n [\"1P 2M 3m 4P 5P 6m 7m 7M\", \"minor bebop\"],\n [\"1P 2M 3M 4P 5d 5P 6M 7M\", \"ichikosucho\"],\n [\"1P 2M 3m 4P 5P 6m 6M 7M\", \"minor six diminished\"],\n [\n \"1P 2m 3m 3M 4A 5P 6M 7m\",\n \"half-whole diminished\",\n \"dominant diminished\",\n \"messiaen's mode #2\",\n ],\n [\"1P 3m 3M 4P 5P 6M 7m 7M\", \"kafi raga\"],\n [\"1P 2M 3M 4P 4A 5A 6A 7M\", \"messiaen's mode #6\"],\n\n // 9-note scales\n [\"1P 2M 3m 3M 4P 5d 5P 6M 7m\", \"composite blues\"],\n [\"1P 2M 3m 3M 4A 5P 6m 7m 7M\", \"messiaen's mode #3\"],\n\n // 10-note scales\n [\"1P 2m 2M 3m 4P 4A 5P 6m 6M 7M\", \"messiaen's mode #7\"],\n\n // 12-note scales\n [\"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M\", \"chromatic\"],\n];\n\nexport default SCALES;\n", "import { detect } from \"@tonaljs/chord-detect\";\nimport {\n ChordType,\n all as chordTypes,\n get as getChordType,\n} from \"@tonaljs/chord-type\";\nimport { subtract } from \"@tonaljs/interval\";\nimport { isSubsetOf, isSupersetOf } from \"@tonaljs/pcset\";\nimport {\n distance,\n tonicIntervalsTransposer,\n transpose as transposeNote,\n} from \"@tonaljs/pitch-distance\";\nimport { NoteName, note, tokenizeNote } from \"@tonaljs/pitch-note\";\nimport { all as scaleTypes } from \"@tonaljs/scale-type\";\n\nexport { detect } from \"@tonaljs/chord-detect\";\n\ntype ChordNameOrTokens =\n | string // full name to be parsed\n | [string] // only the name\n | [string, string] // tonic, name\n | [string, string, string]; // tonic, name, bass\ntype ChordNameTokens = [string, string, string]; // [TONIC, SCALE TYPE, BASS]\n\nexport interface Chord extends ChordType {\n tonic: string | null;\n type: string;\n root: string;\n bass: string;\n rootDegree: number;\n symbol: string;\n notes: NoteName[];\n}\n\nconst NoChord: Chord = {\n empty: true,\n name: \"\",\n symbol: \"\",\n root: \"\",\n bass: \"\",\n rootDegree: 0,\n type: \"\",\n tonic: null,\n setNum: NaN,\n quality: \"Unknown\",\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n// 6, 64, 7, 9, 11 and 13 are consider part of the chord\n// (see https://github.com/danigb/tonal/issues/55)\n//const NUM_TYPES = /^(6|64|7|9|11|13)$/;\n/**\n * Tokenize a chord name. It returns an array with the tonic, chord type and bass\n * If not tonic is found, all the name is considered the chord name.\n *\n * This function does NOT check if the chord type exists or not. It only tries\n * to split the tonic and chord type.\n *\n * This function does NOT check if the bass is part of the chord or not but it\n * only accepts a pitch class as bass\n *\n * @function\n * @param {string} name - the chord name\n * @return {Array} an array with [tonic, type, bass]\n * @example\n * tokenize(\"Cmaj7\") // => [ \"C\", \"maj7\" ]\n * tokenize(\"C7\") // => [ \"C\", \"7\" ]\n * tokenize(\"mMaj7\") // => [ null, \"mMaj7\" ]\n * tokenize(\"Cnonsense\") // => [ null, \"nonsense\" ]\n */\nexport function tokenize(name: string): ChordNameTokens {\n const [letter, acc, oct, type] = tokenizeNote(name);\n if (letter === \"\") {\n return tokenizeBass(\"\", name);\n } else if (letter === \"A\" && type === \"ug\") {\n return tokenizeBass(\"\", \"aug\");\n } else {\n return tokenizeBass(letter + acc, oct + type);\n }\n}\n\nfunction tokenizeBass(note: string, chord: string): ChordNameTokens {\n const split = chord.split(\"/\");\n if (split.length === 1) {\n return [note, split[0], \"\"];\n }\n const [letter, acc, oct, type] = tokenizeNote(split[1]);\n // Only a pitch class is accepted as bass note\n if (letter !== \"\" && oct === \"\" && type === \"\") {\n return [note, split[0], letter + acc];\n } else {\n return [note, chord, \"\"];\n }\n}\n\n/**\n * Get a Chord from a chord name.\n */\nexport function get(src: ChordNameOrTokens): Chord {\n if (Array.isArray(src)) {\n return getChord(src[1] || \"\", src[0], src[2]);\n } else if (src === \"\") {\n return NoChord;\n } else {\n const [tonic, type, bass] = tokenize(src);\n const chord = getChord(type, tonic, bass);\n return chord.empty ? getChord(src) : chord;\n }\n}\n\n/**\n * Get chord properties\n *\n * @param typeName - the chord type name\n * @param [tonic] - Optional tonic\n * @param [root] - Optional root (requires a tonic)\n */\nexport function getChord(\n typeName: string,\n optionalTonic?: string,\n optionalBass?: string,\n): Chord {\n const type = getChordType(typeName);\n const tonic = note(optionalTonic || \"\");\n const bass = note(optionalBass || \"\");\n\n if (\n type.empty ||\n (optionalTonic && tonic.empty) ||\n (optionalBass && bass.empty)\n ) {\n return NoChord;\n }\n\n const bassInterval = distance(tonic.pc, bass.pc);\n const bassIndex = type.intervals.indexOf(bassInterval);\n const hasRoot = bassIndex >= 0;\n const root = hasRoot ? bass : note(\"\");\n const rootDegree = bassIndex === -1 ? NaN : bassIndex + 1;\n const hasBass = bass.pc && bass.pc !== tonic.pc;\n\n const intervals = Array.from(type.intervals);\n\n if (hasRoot) {\n for (let i = 1; i < rootDegree; i++) {\n const num = intervals[0][0];\n const quality = intervals[0][1];\n const newNum = parseInt(num, 10) + 7;\n intervals.push(`${newNum}${quality}`);\n intervals.shift();\n }\n } else if (hasBass) {\n const ivl = subtract(distance(tonic.pc, bass.pc), \"8P\");\n if (ivl) intervals.unshift(ivl);\n }\n\n const notes = tonic.empty\n ? []\n : intervals.map((i) => transposeNote(tonic.pc, i));\n\n typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];\n const symbol = `${tonic.empty ? \"\" : tonic.pc}${typeName}${\n hasRoot && rootDegree > 1 ? \"/\" + root.pc : hasBass ? \"/\" + bass.pc : \"\"\n }`;\n const name = `${optionalTonic ? tonic.pc + \" \" : \"\"}${type.name}${\n hasRoot && rootDegree > 1\n ? \" over \" + root.pc\n : hasBass\n ? \" over \" + bass.pc\n : \"\"\n }`;\n return {\n ...type,\n name,\n symbol,\n tonic: tonic.pc,\n type: type.name,\n root: root.pc,\n bass: hasBass ? bass.pc : \"\",\n intervals,\n rootDegree,\n notes,\n };\n}\n\nexport const chord = get;\n\n/**\n * Transpose a chord name\n *\n * @param {string} chordName - the chord name\n * @return {string} the transposed chord\n *\n * @example\n * transpose('Dm7', 'P4') // => 'Gm7\n */\nexport function transpose(chordName: string, interval: string): string {\n const [tonic, type, bass] = tokenize(chordName);\n if (!tonic) {\n return chordName;\n }\n const tr = transposeNote(bass, interval);\n const slash = tr ? \"/\" + tr : \"\";\n return transposeNote(tonic, interval) + type + slash;\n}\n\n/**\n * Get all scales where the given chord fits\n *\n * @example\n * chordScales('C7b9')\n * // => [\"phrygian dominant\", \"flamenco\", \"spanish heptatonic\", \"half-whole diminished\", \"chromatic\"]\n */\nexport function chordScales(name: string): string[] {\n const s = get(name);\n const isChordIncluded = isSupersetOf(s.chroma);\n return scaleTypes()\n .filter((scale) => isChordIncluded(scale.chroma))\n .map((scale) => scale.name);\n}\n/**\n * Get all chords names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @example\n * extended(\"CMaj7\")\n * // => [ 'Cmaj#4', 'Cmaj7#9#11', 'Cmaj9', 'CM7add13', 'Cmaj13', 'Cmaj9#11', 'CM13#11', 'CM7b9' ]\n */\nexport function extended(chordName: string): string[] {\n const s = get(chordName);\n const isSuperset = isSupersetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSuperset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\n/**\n * Find all chords names that are a subset of the given one\n * (has less notes but all from the given chord)\n *\n * @example\n */\nexport function reduced(chordName: string): string[] {\n const s = get(chordName);\n const isSubset = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => isSubset(chord.chroma))\n .map((chord) => s.tonic + chord.aliases[0]);\n}\n\n/**\n * Return the chord notes\n */\nexport function notes(chordName: ChordNameOrTokens, tonic?: string): string[] {\n const chord = get(chordName);\n const note = tonic || chord.tonic;\n if (!note || chord.empty) return [];\n return chord.intervals.map((ivl) => transposeNote(note, ivl));\n}\n\n/**\n * Returns a function to get a note name from the scale degree.\n *\n * @example\n * [1, 2, 3, 4].map(Chord.degrees(\"C\")) => [\"C\", \"E\", \"G\", \"C\"]\n * [1, 2, 3, 4].map(Chord.degrees(\"C4\")) => [\"C4\", \"E4\", \"G4\", \"C5\"]\n */\nexport function degrees(chordName: ChordNameOrTokens, tonic?: string) {\n const chord = get(chordName);\n const note = tonic || chord.tonic;\n const transpose = tonicIntervalsTransposer(chord.intervals, note);\n return (degree: number) =>\n degree ? transpose(degree > 0 ? degree - 1 : degree) : \"\";\n}\n\n/**\n * Sames as `degree` but with 0-based index\n */\nexport function steps(chordName: ChordNameOrTokens, tonic?: string) {\n const chord = get(chordName);\n const note = tonic || chord.tonic;\n return tonicIntervalsTransposer(chord.intervals, note);\n}\n\n/** @deprecated */\nexport default {\n getChord,\n get,\n detect,\n chordScales,\n extended,\n reduced,\n tokenize,\n transpose,\n degrees,\n steps,\n notes,\n chord,\n};\n", "// source: https://en.wikipedia.org/wiki/Note_value\nconst DATA: [number, string, string[]][] = [\n [\n 0.125,\n \"dl\",\n [\"large\", \"duplex longa\", \"maxima\", \"octuple\", \"octuple whole\"],\n ],\n [0.25, \"l\", [\"long\", \"longa\"]],\n [0.5, \"d\", [\"double whole\", \"double\", \"breve\"]],\n [1, \"w\", [\"whole\", \"semibreve\"]],\n [2, \"h\", [\"half\", \"minim\"]],\n [4, \"q\", [\"quarter\", \"crotchet\"]],\n [8, \"e\", [\"eighth\", \"quaver\"]],\n [16, \"s\", [\"sixteenth\", \"semiquaver\"]],\n [32, \"t\", [\"thirty-second\", \"demisemiquaver\"]],\n [64, \"sf\", [\"sixty-fourth\", \"hemidemisemiquaver\"]],\n [128, \"h\", [\"hundred twenty-eighth\"]],\n [256, \"th\", [\"two hundred fifty-sixth\"]],\n];\n\nexport default DATA;\n", "import DATA from \"./data\";\n\ntype Fraction = [number, number];\n\nconst VALUES: DurationValue[] = [];\n\nDATA.forEach(([denominator, shorthand, names]) =>\n add(denominator, shorthand, names),\n);\n\nexport interface DurationValue {\n empty: boolean;\n value: number;\n name: string;\n fraction: Fraction;\n shorthand: string;\n dots: string;\n names: string[];\n}\n\nconst NoDuration: DurationValue = {\n empty: true,\n name: \"\",\n value: 0,\n fraction: [0, 0],\n shorthand: \"\",\n dots: \"\",\n names: [],\n};\n\nexport function names(): string[] {\n return VALUES.reduce((names, duration) => {\n duration.names.forEach((name) => names.push(name));\n return names;\n }, [] as string[]);\n}\n\nexport function shorthands(): string[] {\n return VALUES.map((dur) => dur.shorthand);\n}\n\nconst REGEX = /^([^.]+)(\\.*)$/;\n\nexport function get(name: string): DurationValue {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, simple, dots] = REGEX.exec(name) || [];\n const base = VALUES.find(\n (dur) => dur.shorthand === simple || dur.names.includes(simple),\n );\n if (!base) {\n return NoDuration;\n }\n\n const fraction = calcDots(base.fraction, dots.length);\n const value = fraction[0] / fraction[1];\n\n return { ...base, name, dots, value, fraction };\n}\n\nexport const value = (name: string) => get(name).value;\nexport const fraction = (name: string) => get(name).fraction;\n\n/** @deprecated */\nexport default { names, shorthands, get, value, fraction };\n\n//// PRIVATE ////\n\nfunction add(denominator: number, shorthand: string, names: string[]) {\n VALUES.push({\n empty: false,\n dots: \"\",\n name: \"\",\n value: 1 / denominator,\n fraction: denominator < 1 ? [1 / denominator, 1] : [1, denominator],\n shorthand,\n names,\n });\n}\n\nfunction calcDots(fraction: Fraction, dots: number): Fraction {\n const pow = Math.pow(2, dots);\n\n let numerator = fraction[0] * pow;\n let denominator = fraction[1] * pow;\n const base = numerator;\n\n // add fractions\n for (let i = 0; i < dots; i++) {\n numerator += base / Math.pow(2, i + 1);\n }\n\n // simplify\n while (numerator % 2 === 0 && denominator % 2 === 0) {\n numerator /= 2;\n denominator /= 2;\n }\n return [numerator, denominator];\n}\n", "import { NoteName, note as props } from \"@tonaljs/pitch-note\";\n\ntype Midi = number;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isMidi(arg: any): arg is Midi {\n return +arg >= 0 && +arg <= 127;\n}\n\n/**\n * Get the note midi number (a number between 0 and 127)\n *\n * It returns undefined if not valid note name\n *\n * @function\n * @param {string|number} note - the note name or midi number\n * @return {Integer} the midi number or undefined if not valid note\n * @example\n * import { toMidi } from '@tonaljs/midi'\n * toMidi(\"C4\") // => 60\n * toMidi(60) // => 60\n * toMidi('60') // => 60\n */\nexport function toMidi(note: NoteName | number): number | null {\n if (isMidi(note)) {\n return +note;\n }\n const n = props(note);\n return n.empty ? null : n.midi;\n}\n\n/**\n * Get the frequency in hertz from midi number\n *\n * @param {number} midi - the note midi number\n * @param {number} [tuning = 440] - A4 tuning frequency in Hz (440 by default)\n * @return {number} the frequency or null if not valid note midi\n * @example\n * import { midiToFreq} from '@tonaljs/midi'\n * midiToFreq(69) // => 440\n */\nexport function midiToFreq(midi: number, tuning = 440): number {\n return Math.pow(2, (midi - 69) / 12) * tuning;\n}\n\nconst L2 = Math.log(2);\nconst L440 = Math.log(440);\n\n/**\n * Get the midi number from a frequency in hertz. The midi number can\n * contain decimals (with two digits precision)\n *\n * @param {number} frequency\n * @return {number}\n * @example\n * import { freqToMidi} from '@tonaljs/midi'\n * freqToMidi(220)); //=> 57\n * freqToMidi(261.62)); //=> 60\n * freqToMidi(261)); //=> 59.96\n */\nexport function freqToMidi(freq: number): number {\n const v = (12 * (Math.log(freq) - L440)) / L2 + 69;\n return Math.round(v * 100) / 100;\n}\n\nexport interface ToNoteNameOptions {\n pitchClass?: boolean;\n sharps?: boolean;\n}\n\nconst SHARPS = \"C C# D D# E F F# G G# A A# B\".split(\" \");\nconst FLATS = \"C Db D Eb E F Gb G Ab A Bb B\".split(\" \");\n/**\n * Given a midi number, returns a note name. The altered notes will have\n * flats unless explicitly set with the optional `useSharps` parameter.\n *\n * @function\n * @param {number} midi - the midi note number\n * @param {Object} options = default: `{ sharps: false, pitchClass: false }`\n * @param {boolean} useSharps - (Optional) set to true to use sharps instead of flats\n * @return {string} the note name\n * @example\n * import { midiToNoteName } from '@tonaljs/midi'\n * midiToNoteName(61) // => \"Db4\"\n * midiToNoteName(61, { pitchClass: true }) // => \"Db\"\n * midiToNoteName(61, { sharps: true }) // => \"C#4\"\n * midiToNoteName(61, { pitchClass: true, sharps: true }) // => \"C#\"\n * // it rounds to nearest note\n * midiToNoteName(61.7) // => \"D4\"\n */\nexport function midiToNoteName(midi: number, options: ToNoteNameOptions = {}) {\n if (isNaN(midi) || midi === -Infinity || midi === Infinity) return \"\";\n midi = Math.round(midi);\n const pcs = options.sharps === true ? SHARPS : FLATS;\n const pc = pcs[midi % 12];\n if (options.pitchClass) {\n return pc;\n }\n const o = Math.floor(midi / 12) - 1;\n return pc + o;\n}\n\nexport function chroma(midi: number): number {\n return midi % 12;\n}\n\nfunction pcsetFromChroma(chroma: string): number[] {\n return chroma.split(\"\").reduce((pcset, val, index) => {\n if (index < 12 && val === \"1\") pcset.push(index);\n return pcset;\n }, [] as number[]);\n}\n\nfunction pcsetFromMidi(midi: number[]): number[] {\n return midi\n .map(chroma)\n .sort((a, b) => a - b)\n .filter((n, i, a) => i === 0 || n !== a[i - 1]);\n}\n\n/**\n * Given a list of midi numbers, returns the pitch class set (unique chroma numbers)\n * @param midi\n * @example\n *\n */\nexport function pcset(notes: number[] | string): number[] {\n return Array.isArray(notes) ? pcsetFromMidi(notes) : pcsetFromChroma(notes);\n}\n\nexport function pcsetNearest(notes: number[] | string) {\n const set = pcset(notes);\n return (midi: number): number | undefined => {\n const ch = chroma(midi);\n for (let i = 0; i < 12; i++) {\n if (set.includes(ch + i)) return midi + i;\n if (set.includes(ch - i)) return midi - i;\n }\n return undefined;\n };\n}\n\nexport function pcsetSteps(notes: number[] | string, tonic: number) {\n const set = pcset(notes);\n const len = set.length;\n return (step: number): number => {\n const index = step < 0 ? (len - (-step % len)) % len : step % len;\n const octaves = Math.floor(step / len);\n return set[index] + octaves * 12 + tonic;\n };\n}\n\nexport function pcsetDegrees(notes: number[] | string, tonic: number) {\n const steps = pcsetSteps(notes, tonic);\n return (degree: number): number | undefined => {\n if (degree === 0) return undefined;\n return steps(degree > 0 ? degree - 1 : degree);\n };\n}\n\n/** @deprecated */\nexport default {\n chroma,\n freqToMidi,\n isMidi,\n midiToFreq,\n midiToNoteName,\n pcsetNearest,\n pcset,\n pcsetDegrees,\n pcsetSteps,\n toMidi,\n};\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { freqToMidi, midiToNoteName } from \"@tonaljs/midi\";\nimport { Pitch } from \"@tonaljs/pitch\";\nimport { distance as _dist, transpose as _tr } from \"@tonaljs/pitch-distance\";\nimport { IntervalName } from \"@tonaljs/pitch-interval\";\nimport {\n Note,\n NoteLiteral,\n NoteName,\n note as props,\n} from \"@tonaljs/pitch-note\";\n\nconst NAMES = [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\n\nconst toName = (n: Note) => n.name;\nconst onlyNotes = (array: any[]) =>\n array.map(props).filter((n) => !n.empty) as Note[];\n\n/**\n * Return the natural note names without octave\n * @function\n * @example\n * Note.names(); // => [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"]\n */\nexport function names(array?: any[]): string[] {\n if (array === undefined) {\n return NAMES.slice();\n } else if (!Array.isArray(array)) {\n return [];\n } else {\n return onlyNotes(array).map(toName);\n }\n}\n\n/**\n * Get a note from a note name\n *\n * @function\n * @example\n * Note.get('Bb4') // => { name: \"Bb4\", midi: 70, chroma: 10, ... }\n */\nexport const get = props;\n\n/**\n * Get the note name\n * @function\n */\nexport const name = (note: NoteLiteral) => get(note).name;\n\n/**\n * Get the note pitch class name\n * @function\n */\nexport const pitchClass = (note: NoteLiteral) => get(note).pc;\n\n/**\n * Get the note accidentals\n * @function\n */\nexport const accidentals = (note: NoteLiteral) => get(note).acc;\n\n/**\n * Get the note octave\n * @function\n */\nexport const octave = (note: NoteLiteral) => get(note).oct;\n\n/**\n * Get the note midi\n * @function\n */\nexport const midi = (note: NoteLiteral) => get(note).midi;\n\n/**\n * Get the note midi\n * @function\n */\nexport const freq = (note: NoteLiteral) => get(note).freq;\n\n/**\n * Get the note chroma\n * @function\n */\nexport const chroma = (note: NoteLiteral) => get(note).chroma;\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidi(61) // => \"Db4\"\n * Note.fromMidi(61.7) // => \"D4\"\n */\nexport function fromMidi(midi: number) {\n return midiToNoteName(midi);\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreq(freq: number) {\n return midiToNoteName(freqToMidi(freq));\n}\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n */\nexport function fromFreqSharps(freq: number) {\n return midiToNoteName(freqToMidi(freq), { sharps: true });\n}\n\n/**\n * Given a midi number, returns a note name. Uses flats for altered notes.\n *\n * @function\n * @param {number} midi - the midi note number\n * @return {string} the note name\n * @example\n * Note.fromMidiSharps(61) // => \"C#4\"\n */\n\nexport function fromMidiSharps(midi: number) {\n return midiToNoteName(midi, { sharps: true });\n}\n\nexport const distance = _dist;\n\n/**\n * Transpose a note by an interval\n */\nexport const transpose = _tr;\nexport const tr = _tr;\n\n/**\n * Transpose by an interval.\n * @function\n * @param {string} interval\n * @return {function} a function that transposes by the given interval\n * @example\n * [\"C\", \"D\", \"E\"].map(Note.transposeBy(\"5P\"));\n * // => [\"G\", \"A\", \"B\"]\n */\nexport const transposeBy = (interval: IntervalName) => (note: NoteName) =>\n transpose(note, interval);\nexport const trBy = transposeBy;\n\n/**\n * Transpose from a note\n * @function\n * @param {string} note\n * @return {function} a function that transposes the the note by an interval\n * [\"1P\", \"3M\", \"5P\"].map(Note.transposeFrom(\"C\"));\n * // => [\"C\", \"E\", \"G\"]\n */\nexport const transposeFrom = (note: NoteName) => (interval: IntervalName) =>\n transpose(note, interval);\nexport const trFrom = transposeFrom;\n\n/**\n * Transpose a note by a number of perfect fifths.\n *\n * @function\n * @param {string} note - the note name\n * @param {number} fifths - the number of fifths\n * @return {string} the transposed note name\n *\n * @example\n * import { transposeFifths } from \"@tonaljs/note\"\n * transposeFifths(\"G4\", 1) // => \"D\"\n * [0, 1, 2, 3, 4].map(fifths => transposeFifths(\"C\", fifths)) // => [\"C\", \"G\", \"D\", \"A\", \"E\"]\n */\nexport function transposeFifths(noteName: NoteName, fifths: number): NoteName {\n return transpose(noteName, [fifths, 0]);\n}\nexport const trFifths = transposeFifths;\n\n// TODO: documentation\nexport function transposeOctaves(\n noteName: NoteName,\n octaves: number,\n): NoteName {\n return transpose(noteName, [0, octaves]);\n}\n\nexport type NoteComparator = (a: Note, b: Note) => number;\n\nexport const ascending: NoteComparator = (a, b) => a.height - b.height;\nexport const descending: NoteComparator = (a, b) => b.height - a.height;\n\nexport function sortedNames(\n notes: any[],\n comparator?: NoteComparator,\n): string[] {\n comparator = comparator || ascending;\n return onlyNotes(notes).sort(comparator).map(toName);\n}\n\nexport function sortedUniqNames(notes: any[]): string[] {\n return sortedNames(notes, ascending).filter(\n (n, i, a) => i === 0 || n !== a[i - 1],\n );\n}\n\n/**\n * Simplify a note\n *\n * @function\n * @param {string} note - the note to be simplified\n * - sameAccType: default true. Use same kind of accidentals that source\n * @return {string} the simplified note or '' if not valid note\n * @example\n * simplify(\"C##\") // => \"D\"\n * simplify(\"C###\") // => \"D#\"\n * simplify(\"C###\")\n * simplify(\"B#4\") // => \"C5\"\n */\nexport const simplify = (noteName: NoteName | Pitch): string => {\n const note = get(noteName);\n if (note.empty) {\n return \"\";\n }\n return midiToNoteName(note.midi || note.chroma, {\n sharps: note.alt > 0,\n pitchClass: note.midi === null,\n });\n};\n/**\n * Get enharmonic of a note\n *\n * @function\n * @param {string} note\n * @param [string] - [optional] Destination pitch class\n * @return {string} the enharmonic note name or '' if not valid note\n * @example\n * Note.enharmonic(\"Db\") // => \"C#\"\n * Note.enharmonic(\"C\") // => \"C\"\n * Note.enharmonic(\"F2\",\"E#\") // => \"E#2\"\n * Note.enharmonic(\"C##b\"); // => \"\"\n */\nexport function enharmonic(noteName: string, destName?: string) {\n const src = get(noteName);\n if (src.empty) {\n return \"\";\n }\n\n // destination: use given or generate one\n const dest = get(\n destName ||\n midiToNoteName(src.midi || src.chroma, {\n sharps: src.alt < 0,\n pitchClass: true,\n }),\n );\n\n // ensure destination is valid\n if (dest.empty || dest.chroma !== src.chroma) {\n return \"\";\n }\n\n // if src has no octave, no need to calculate anything else\n if (src.oct === undefined) {\n return dest.pc;\n }\n\n // detect any octave overflow\n const srcChroma = src.chroma - src.alt;\n const destChroma = dest.chroma - dest.alt;\n const destOctOffset =\n srcChroma > 11 || destChroma < 0\n ? -1\n : srcChroma < 0 || destChroma > 11\n ? +1\n : 0;\n // calculate the new octave\n const destOct = src.oct + destOctOffset;\n return dest.pc + destOct;\n}\n\n/** @deprecated */\nexport default {\n names,\n get,\n name,\n pitchClass,\n accidentals,\n octave,\n midi,\n ascending,\n descending,\n distance,\n sortedNames,\n sortedUniqNames,\n fromMidi,\n fromMidiSharps,\n freq,\n fromFreq,\n fromFreqSharps,\n chroma,\n transpose,\n tr,\n transposeBy,\n trBy,\n transposeFrom,\n trFrom,\n transposeFifths,\n transposeOctaves,\n trFifths,\n simplify,\n enharmonic,\n};\n", "import { isNamedPitch, isPitch, Pitch } from \"@tonaljs/pitch\";\nimport { interval } from \"@tonaljs/pitch-interval\";\nimport { accToAlt, altToAcc } from \"@tonaljs/pitch-note\";\n\nexport interface RomanNumeral extends Pitch {\n readonly name: string;\n readonly empty: boolean;\n readonly roman: string;\n readonly interval: string;\n readonly acc: string;\n readonly chordType: string;\n readonly major: boolean;\n readonly dir: 1;\n}\n\nexport interface NoRomanNumeral extends Partial {\n readonly empty: true;\n readonly name: \"\";\n readonly chordType: \"\";\n}\nconst NoRomanNumeral: NoRomanNumeral = { empty: true, name: \"\", chordType: \"\" };\n\nconst cache: Record = {};\n\n/**\n * Get properties of a roman numeral string\n *\n * @function\n * @param {string} - the roman numeral string (can have type, like: Imaj7)\n * @return {Object} - the roman numeral properties\n * @param {string} name - the roman numeral (tonic)\n * @param {string} type - the chord type\n * @param {string} num - the number (1 = I, 2 = II...)\n * @param {boolean} major - major or not\n *\n * @example\n * romanNumeral(\"VIIb5\") // => { name: \"VII\", type: \"b5\", num: 7, major: true }\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function get(src: any): RomanNumeral | NoRomanNumeral {\n return typeof src === \"string\"\n ? cache[src] || (cache[src] = parse(src))\n : typeof src === \"number\"\n ? get(NAMES[src] || \"\")\n : isPitch(src)\n ? fromPitch(src)\n : isNamedPitch(src)\n ? get(src.name)\n : NoRomanNumeral;\n}\n\n/**\n * @deprecated\n * @use RomanNumeral.get\n */\nexport const romanNumeral = get;\n\n/**\n * Get roman numeral names\n *\n * @function\n * @param {boolean} [isMajor=true]\n * @return {Array}\n *\n * @example\n * names() // => [\"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\"]\n */\nexport function names(major = true) {\n return (major ? NAMES : NAMES_MINOR).slice();\n}\n\nfunction fromPitch(pitch: Pitch): RomanNumeral | NoRomanNumeral {\n return get(altToAcc(pitch.alt) + NAMES[pitch.step]);\n}\n\nconst REGEX =\n /^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;\n\n// [name, accidentals, romanNumeral, chordType]\ntype RomanNumeralTokens = [string, string, string, string];\nexport function tokenize(str: string): RomanNumeralTokens {\n return (REGEX.exec(str) || [\"\", \"\", \"\", \"\"]) as RomanNumeralTokens;\n}\n\nconst ROMANS = \"I II III IV V VI VII\";\nconst NAMES = ROMANS.split(\" \");\nconst NAMES_MINOR = ROMANS.toLowerCase().split(\" \");\n\nfunction parse(src: string): RomanNumeral | NoRomanNumeral {\n const [name, acc, roman, chordType] = tokenize(src);\n if (!roman) {\n return NoRomanNumeral;\n }\n\n const upperRoman = roman.toUpperCase();\n const step = NAMES.indexOf(upperRoman);\n const alt = accToAlt(acc);\n const dir = 1;\n return {\n empty: false,\n name,\n roman,\n interval: interval({ step, alt, dir }).name,\n acc,\n chordType,\n alt,\n step,\n major: roman === upperRoman,\n oct: 0,\n dir,\n };\n}\n\n/** @deprecated */\nexport default {\n names,\n get,\n // deprecated\n romanNumeral,\n};\n", "import { transpose, transposeFifths } from \"@tonaljs/note\";\nimport { accToAlt, altToAcc, note } from \"@tonaljs/pitch-note\";\nimport { get as roman } from \"@tonaljs/roman-numeral\";\n\nconst Empty: readonly string[] = Object.freeze([] as string[]);\n\nexport interface Key {\n readonly type: \"major\" | \"minor\";\n readonly tonic: string;\n readonly alteration: number;\n readonly keySignature: string;\n}\n\nconst NoKey: Key = {\n type: \"major\",\n tonic: \"\",\n alteration: 0,\n keySignature: \"\",\n};\n\nexport interface KeyScale {\n readonly tonic: string;\n readonly grades: readonly string[];\n readonly intervals: readonly string[];\n readonly scale: readonly string[];\n readonly triads: readonly string[];\n readonly chords: readonly string[];\n readonly chordsHarmonicFunction: readonly string[];\n readonly chordScales: readonly string[];\n readonly secondaryDominants: readonly string[];\n readonly secondaryDominantSupertonics: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly substituteDominantSupertonics: readonly string[];\n\n // @deprecated use secondaryDominantsSupertonic\n readonly secondaryDominantsMinorRelative: readonly string[];\n // @deprecated use substituteDominantSupertonics\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoKeyScale: KeyScale = {\n tonic: \"\",\n grades: Empty,\n intervals: Empty,\n scale: Empty,\n triads: Empty,\n chords: Empty,\n chordsHarmonicFunction: Empty,\n chordScales: Empty,\n secondaryDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n substituteDominants: Empty,\n substituteDominantSupertonics: Empty,\n secondaryDominantsMinorRelative: Empty,\n};\n\nexport interface MajorKey extends Key, KeyScale {\n readonly type: \"major\";\n readonly minorRelative: string;\n readonly scale: readonly string[];\n readonly substituteDominants: readonly string[];\n readonly secondaryDominantSupertonics: readonly string[];\n // @deprecated use secondaryDominantsSupertonic\n readonly substituteDominantsMinorRelative: readonly string[];\n}\n\nconst NoMajorKey: MajorKey = {\n ...NoKey,\n ...NoKeyScale,\n type: \"major\",\n minorRelative: \"\",\n scale: Empty,\n substituteDominants: Empty,\n secondaryDominantSupertonics: Empty,\n substituteDominantsMinorRelative: Empty,\n};\n\nexport interface MinorKey extends Key {\n readonly type: \"minor\";\n readonly relativeMajor: string;\n readonly natural: KeyScale;\n readonly harmonic: KeyScale;\n readonly melodic: KeyScale;\n}\n\nconst NoMinorKey: MinorKey = {\n ...NoKey,\n type: \"minor\",\n relativeMajor: \"\",\n natural: NoKeyScale,\n harmonic: NoKeyScale,\n melodic: NoKeyScale,\n};\n\nexport type KeyChord = {\n name: string;\n roles: string[];\n};\n\nconst mapScaleToType = (scale: string[], list: string[], sep = \"\") =>\n list.map((type, i) => `${scale[i]}${sep}${type}`);\n\nfunction keyScale(\n grades: string[],\n triads: string[],\n chordTypes: string[],\n harmonicFunctions: string[],\n chordScales: string[],\n) {\n return (tonic: string): KeyScale => {\n const intervals = grades.map((gr) => roman(gr).interval || \"\");\n const scale = intervals.map((interval) => transpose(tonic, interval));\n const chords = mapScaleToType(scale, chordTypes);\n const secondaryDominants = scale\n .map((note) => transpose(note, \"5P\"))\n .map((note) =>\n // A secondary dominant is a V chord which:\n // 1. is not diatonic to the key,\n // 2. it must have a diatonic root.\n scale.includes(note) && !chords.includes(note + \"7\") ? note + \"7\" : \"\",\n );\n\n const secondaryDominantSupertonics = supertonics(\n secondaryDominants,\n triads,\n );\n const substituteDominants = secondaryDominants.map((chord) => {\n if (!chord) return \"\";\n const domRoot = chord.slice(0, -1);\n const subRoot = transpose(domRoot, \"5d\");\n return subRoot + \"7\";\n });\n const substituteDominantSupertonics = supertonics(\n substituteDominants,\n triads,\n );\n\n return {\n tonic,\n grades,\n intervals,\n scale,\n triads: mapScaleToType(scale, triads),\n chords,\n chordsHarmonicFunction: harmonicFunctions.slice(),\n chordScales: mapScaleToType(scale, chordScales, \" \"),\n secondaryDominants,\n secondaryDominantSupertonics,\n substituteDominants,\n substituteDominantSupertonics,\n\n // @deprecated use secondaryDominantsSupertonic\n secondaryDominantsMinorRelative: secondaryDominantSupertonics,\n // @deprecated use secondaryDominantsSupertonic\n substituteDominantsMinorRelative: substituteDominantSupertonics,\n };\n };\n}\n\nconst supertonics = (dominants: string[], targetTriads: string[]) => {\n return dominants.map((chord, index) => {\n if (!chord) return \"\";\n const domRoot = chord.slice(0, -1);\n const minorRoot = transpose(domRoot, \"5P\");\n const target = targetTriads[index];\n const isMinor = target.endsWith(\"m\");\n return isMinor ? minorRoot + \"m7\" : minorRoot + \"m7b5\";\n });\n};\n\nconst distInFifths = (from: string, to: string) => {\n const f = note(from);\n const t = note(to);\n return f.empty || t.empty ? 0 : t.coord[0] - f.coord[0];\n};\n\nconst MajorScale = keyScale(\n \"I II III IV V VI VII\".split(\" \"),\n \" m m m dim\".split(\" \"),\n \"maj7 m7 m7 maj7 7 m7 m7b5\".split(\" \"),\n \"T SD T SD D T D\".split(\" \"),\n \"major,dorian,phrygian,lydian,mixolydian,minor,locrian\".split(\",\"),\n);\nconst NaturalScale = keyScale(\n \"I II bIII IV V bVI bVII\".split(\" \"),\n \"m dim m m \".split(\" \"),\n \"m7 m7b5 maj7 m7 m7 maj7 7\".split(\" \"),\n \"T SD T SD D SD SD\".split(\" \"),\n \"minor,locrian,major,dorian,phrygian,lydian,mixolydian\".split(\",\"),\n);\nconst HarmonicScale = keyScale(\n \"I II bIII IV V bVI VII\".split(\" \"),\n \"m dim aug m dim\".split(\" \"),\n \"mMaj7 m7b5 +maj7 m7 7 maj7 o7\".split(\" \"),\n \"T SD T SD D SD D\".split(\" \"),\n \"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian\".split(\n \",\",\n ),\n);\nconst MelodicScale = keyScale(\n \"I II bIII IV V VI VII\".split(\" \"),\n \"m m aug dim dim\".split(\" \"),\n \"m6 m7 +maj7 7 7 m7b5 m7b5\".split(\" \"),\n \"T SD T SD D \".split(\" \"),\n \"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered\".split(\n \",\",\n ),\n);\n\n/**\n * Get a major key properties in a given tonic\n * @param tonic\n */\nexport function majorKey(tonic: string): MajorKey {\n const pc = note(tonic).pc;\n if (!pc) return NoMajorKey;\n\n const keyScale = MajorScale(pc);\n const alteration = distInFifths(\"C\", pc);\n\n return {\n ...keyScale,\n type: \"major\",\n minorRelative: transpose(pc, \"-3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n };\n}\n\n/**\n * Get a list of available chords for a given major key\n * @param tonic\n * @returns array of { name: string, roles: string[] }\n */\nexport function majorKeyChords(tonic: string): KeyChord[] {\n const key = majorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key, chords);\n return chords;\n}\n\n/**\n * Get a list of available chords for a given major key\n * @param tonic\n * @returns array of { name: string, roles: string[] }\n */\nexport function minorKeyChords(tonic: string): KeyChord[] {\n const key = minorKey(tonic);\n const chords: KeyChord[] = [];\n keyChordsOf(key.natural, chords);\n keyChordsOf(key.harmonic, chords);\n keyChordsOf(key.melodic, chords);\n return chords;\n}\n\nfunction keyChordsOf(key: KeyScale, chords: KeyChord[]) {\n const updateChord = (name: string, newRole: string) => {\n if (!name) return;\n let keyChord = chords.find((chord) => chord.name === name);\n if (!keyChord) {\n keyChord = { name, roles: [] };\n chords.push(keyChord);\n }\n if (newRole && !keyChord.roles.includes(newRole)) {\n keyChord.roles.push(newRole);\n }\n };\n\n key.chords.forEach((chordName, index) =>\n updateChord(chordName, key.chordsHarmonicFunction[index]),\n );\n key.secondaryDominants.forEach((chordName, index) =>\n updateChord(chordName, `V/${key.grades[index]}`),\n );\n key.secondaryDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `ii/${key.grades[index]}`),\n );\n key.substituteDominants.forEach((chordName, index) =>\n updateChord(chordName, `subV/${key.grades[index]}`),\n );\n key.substituteDominantSupertonics.forEach((chordName, index) =>\n updateChord(chordName, `subii/${key.grades[index]}`),\n );\n}\n\n/**\n * Get minor key properties in a given tonic\n * @param tonic\n */\nexport function minorKey(tnc: string): MinorKey {\n const pc = note(tnc).pc;\n if (!pc) return NoMinorKey;\n\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: transpose(pc, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc),\n };\n}\n\n/**\n * Given a key signature, returns the tonic of the major key\n * @param signature\n * @example\n * majorTonicFromKeySignature('###') // => 'A'\n */\nexport function majorTonicFromKeySignature(\n sig: string | number,\n): string | null {\n if (typeof sig === \"number\") {\n return transposeFifths(\"C\", sig);\n } else if (typeof sig === \"string\" && /^b+|#+$/.test(sig)) {\n return transposeFifths(\"C\", accToAlt(sig));\n }\n return null;\n}\n\n/** @deprecated */\nexport default { majorKey, majorTonicFromKeySignature, minorKey };\n", "import { rotate } from \"@tonaljs/collection\";\nimport { simplify, transposeFifths } from \"@tonaljs/interval\";\nimport { EmptyPcset, Pcset } from \"@tonaljs/pcset\";\nimport { transpose } from \"@tonaljs/pitch-distance\";\nimport { NoteName } from \"@tonaljs/pitch-note\";\nimport { get as getType } from \"@tonaljs/scale-type\";\n\nconst MODES = [\n [0, 2773, 0, \"ionian\", \"\", \"Maj7\", \"major\"],\n [1, 2902, 2, \"dorian\", \"m\", \"m7\"],\n [2, 3418, 4, \"phrygian\", \"m\", \"m7\"],\n [3, 2741, -1, \"lydian\", \"\", \"Maj7\"],\n [4, 2774, 1, \"mixolydian\", \"\", \"7\"],\n [5, 2906, 3, \"aeolian\", \"m\", \"m7\", \"minor\"],\n [6, 3434, 5, \"locrian\", \"dim\", \"m7b5\"],\n] as const;\n\ntype ModeDatum = (typeof MODES)[number];\n\nexport interface Mode extends Pcset {\n readonly name: string;\n readonly modeNum: number;\n readonly alt: number; // number of alterations === number of fifths\n readonly triad: string;\n readonly seventh: string;\n readonly aliases: string[];\n}\n\nconst NoMode: Mode = {\n ...EmptyPcset,\n name: \"\",\n alt: 0,\n modeNum: NaN,\n triad: \"\",\n seventh: \"\",\n aliases: [],\n};\n\nconst modes: Mode[] = MODES.map(toMode);\nconst index: Record = {};\nmodes.forEach((mode) => {\n index[mode.name] = mode;\n mode.aliases.forEach((alias) => {\n index[alias] = mode;\n });\n});\n\ntype ModeLiteral = string | { name: string };\n\n/**\n * Get a Mode by it's name\n *\n * @example\n * get('dorian')\n * // =>\n * // {\n * // intervals: [ '1P', '2M', '3m', '4P', '5P', '6M', '7m' ],\n * // modeNum: 1,\n * // chroma: '101101010110',\n * // normalized: '101101010110',\n * // name: 'dorian',\n * // setNum: 2902,\n * // alt: 2,\n * // triad: 'm',\n * // seventh: 'm7',\n * // aliases: []\n * // }\n */\nexport function get(name: ModeLiteral): Mode {\n return typeof name === \"string\"\n ? index[name.toLowerCase()] || NoMode\n : name && name.name\n ? get(name.name)\n : NoMode;\n}\n\n/** @deprecated */\nexport const mode = get;\n\n/**\n * Get a list of all modes\n */\nexport function all() {\n return modes.slice();\n}\n\n/** @deprecated */\nexport const entries = all;\n\n/**\n * Get a list of all mode names\n */\nexport function names() {\n return modes.map((mode) => mode.name);\n}\n\nfunction toMode(mode: ModeDatum): Mode {\n const [modeNum, setNum, alt, name, triad, seventh, alias] = mode;\n const aliases = alias ? [alias] : [];\n const chroma = Number(setNum).toString(2);\n const intervals = getType(name).intervals;\n return {\n empty: false,\n intervals,\n modeNum,\n chroma,\n normalized: chroma,\n name,\n setNum,\n alt,\n triad,\n seventh,\n aliases,\n };\n}\n\nexport function notes(modeName: ModeLiteral, tonic: NoteName) {\n return get(modeName).intervals.map((ivl) => transpose(tonic, ivl));\n}\n\nfunction chords(chords: string[]) {\n return (modeName: ModeLiteral, tonic: NoteName) => {\n const mode = get(modeName);\n if (mode.empty) return [];\n const triads = rotate(mode.modeNum, chords);\n const tonics = mode.intervals.map((i) => transpose(tonic, i));\n return triads.map((triad, i) => tonics[i] + triad);\n };\n}\n\nexport const triads = chords(MODES.map((x) => x[4]));\nexport const seventhChords = chords(MODES.map((x) => x[5]));\n\nexport function distance(destination: ModeLiteral, source: ModeLiteral) {\n const from = get(source);\n const to = get(destination);\n if (from.empty || to.empty) return \"\";\n return simplify(transposeFifths(\"1P\", to.alt - from.alt));\n}\n\nexport function relativeTonic(\n destination: ModeLiteral,\n source: ModeLiteral,\n tonic: NoteName,\n) {\n return transpose(tonic, distance(destination, source));\n}\n\n/** @deprecated */\nexport default {\n get,\n names,\n all,\n distance,\n relativeTonic,\n notes,\n triads,\n seventhChords,\n // deprecated\n entries,\n mode,\n};\n", "import { tokenize } from \"@tonaljs/chord\";\nimport { distance, transpose } from \"@tonaljs/pitch-distance\";\nimport { interval } from \"@tonaljs/pitch-interval\";\nimport { NoteLiteral } from \"@tonaljs/pitch-note\";\nimport { get as romanNumeral } from \"@tonaljs/roman-numeral\";\n\n/**\n * Given a tonic and a chord list expressed with roman numeral notation\n * returns the progression expressed with leadsheet chords symbols notation\n * @example\n * fromRomanNumerals(\"C\", [\"I\", \"IIm7\", \"V7\"]);\n * // => [\"C\", \"Dm7\", \"G7\"]\n */\nexport function fromRomanNumerals(\n tonic: NoteLiteral,\n chords: string[],\n): string[] {\n const romanNumerals = chords.map(romanNumeral);\n return romanNumerals.map(\n (rn) => transpose(tonic, interval(rn)) + rn.chordType,\n );\n}\n\n/**\n * Given a tonic and a chord list with leadsheet symbols notation,\n * return the chord list with roman numeral notation\n * @example\n * toRomanNumerals(\"C\", [\"CMaj7\", \"Dm7\", \"G7\"]);\n * // => [\"IMaj7\", \"IIm7\", \"V7\"]\n */\nexport function toRomanNumerals(\n tonic: NoteLiteral,\n chords: string[],\n): string[] {\n return chords.map((chord) => {\n const [note, chordType] = tokenize(chord);\n const intervalName = distance(tonic, note);\n const roman = romanNumeral(interval(intervalName));\n return roman.name + chordType;\n });\n}\n\n/** @deprecated */\nexport default { fromRomanNumerals, toRomanNumerals };\n", "import { compact, range } from \"@tonaljs/collection\";\nimport { midiToNoteName, toMidi, ToNoteNameOptions } from \"@tonaljs/midi\";\n\n/**\n * Create a numeric range. You supply a list of notes or numbers and it will\n * be connected to create complex ranges.\n *\n * @param {Array} notes - the list of notes or midi numbers used\n * @return {Array} an array of numbers or empty array if not valid parameters\n *\n * @example\n * numeric([\"C5\", \"C4\"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]\n * // it works midi notes\n * numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]\n * // complex range\n * numeric([\"C4\", \"E4\", \"Bb3\"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]\n */\nexport function numeric(notes: (string | number)[]): number[] {\n const midi: number[] = compact(\n notes.map((note) => (typeof note === \"number\" ? note : toMidi(note))),\n );\n if (!notes.length || midi.length !== notes.length) {\n // there is no valid notes\n return [];\n }\n\n return midi.reduce(\n (result, note) => {\n const last: number = result[result.length - 1];\n return result.concat(range(last, note).slice(1));\n },\n [midi[0]],\n );\n}\n\n/**\n * Create a range of chromatic notes. The altered notes will use flats.\n *\n * @function\n * @param {Array} notes - the list of notes or midi note numbers to create a range from\n * @param {Object} options - The same as `midiToNoteName` (`{ sharps: boolean, pitchClass: boolean }`)\n * @return {Array} an array of note names\n *\n * @example\n * Range.chromatic([\"C2, \"E2\", \"D2\"]) // => [\"C2\", \"Db2\", \"D2\", \"Eb2\", \"E2\", \"Eb2\", \"D2\"]\n * // with sharps\n * Range.chromatic([\"C2\", \"C3\"], { sharps: true }) // => [ \"C2\", \"C#2\", \"D2\", \"D#2\", \"E2\", \"F2\", \"F#2\", \"G2\", \"G#2\", \"A2\", \"A#2\", \"B2\", \"C3\" ]\n */\nexport function chromatic(\n notes: (string | number)[],\n options?: ToNoteNameOptions,\n): string[] {\n return numeric(notes).map((midi) => midiToNoteName(midi, options));\n}\n\n/** @deprecated */\nexport default { numeric, chromatic };\n", "type RhythmPatternValue = 0 | 1;\n\nexport type RhythmPattern = Array;\n\n/**\n * Create a rhythm pattern from a number or concatenation of numbers in binary form\n * @param numbers one or more number\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * binary(13) // => [1, 1, 0, 1]\n * binary(12, 13) // => [1, 1, 0, 0, 1, 1, 0, 1]\n */\nexport function binary(...numbers: number[]): RhythmPattern {\n return numbers.reduce((pattern, number) => {\n number\n .toString(2)\n .split(\"\")\n .forEach((digit: string) => {\n pattern.push(parseInt(digit) as RhythmPatternValue);\n });\n return pattern;\n }, [] as RhythmPattern);\n}\n\n/**\n * Create a rhythmic pattern using an hexadecimal numbers\n * @param hexNumber string with the hexadecimal number\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * R.hex(\"8f\"); // => [1, 0, 0, 0, 1, 1, 1, 1]\n */\nexport function hex(hexNumber: string): RhythmPattern {\n const pattern: RhythmPattern = [];\n for (let i = 0; i < hexNumber.length; i++) {\n const digit = parseInt(\"0x\" + hexNumber[i]);\n const binary = isNaN(digit) ? \"0000\" : digit.toString(2).padStart(4, \"0\");\n binary.split(\"\").forEach((digit: string) => {\n pattern.push(digit === \"1\" ? 1 : 0);\n });\n }\n return pattern;\n}\n\n/**\n * Create a rhythm pattern from the onsets\n * @param numbers the onsets sizes\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * onsets(1, 2, 2, 1) // => [1, 0, 1, 0, 0, 1, 0, 0, 1, 0]\n */\nexport function onsets(...numbers: number[]): RhythmPattern {\n return numbers.reduce((pattern, number) => {\n pattern.push(1);\n for (let i = 0; i < number; i++) {\n pattern.push(0);\n }\n return pattern;\n }, [] as RhythmPattern);\n}\n\n/**\n * Create a random rhythm pattern with a specified length\n * @param length length of the pattern\n * @param probability Threshold where random number is considered a beat (defaults to 0.5)\n * @param rnd A random function (Math.random by default)\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * random(4) // => [1, 0, 0, 1]\n */\nexport function random(\n length: number,\n probability = 0.5,\n rnd: () => number = Math.random,\n): RhythmPattern {\n const pattern: RhythmPattern = [];\n for (let i = 0; i < length; i++) {\n pattern.push(rnd() >= probability ? 1 : 0);\n }\n return pattern;\n}\n\n/**\n * Create a rhythm pattern based on the given probability thresholds\n * @param probabilities An array with the probability of each step to be a beat\n * @param rnd A random function (Math.random by default)\n * @returns an array of 0s and 1s representing the rhythm pattern\n * @example\n * probability([0.6, 0, 0.2, 0.5]) // => [0, 0, 0, 1]\n */\nexport function probability(\n probabilities: number[],\n rnd: () => number = Math.random,\n): RhythmPattern {\n return probabilities.map((probability) => (rnd() <= probability ? 1 : 0));\n}\n\n/**\n * Rotate a pattern right\n * @param pattern the pattern to rotate\n * @param rotations the number of steps to rotate\n * @returns the rotated pattern (an array of 0s and 1s)\n * @example\n * rotate([1, 0, 0, 1], 2); // => [0, 1, 1, 0]\n *\n */\nexport function rotate(\n pattern: RhythmPattern,\n rotations: number,\n): RhythmPattern {\n const len = pattern.length;\n const rotated: RhythmPattern = [];\n for (let i = 0; i < len; i++) {\n const pos = (((i - rotations) % len) + len) % len;\n rotated[i] = pattern[pos];\n }\n return rotated;\n}\n\n/**\n * Generates an euclidean rhythm pattern\n * @param steps The length of the pattern\n * @param beats The number of beats\n * @returns an array with 0s and 1s representing the rhythmic pattern\n * @example\n * euclid(8, 3); // => [1, 0, 0, 1, 0, 0, 1, 0]\n */\nexport function euclid(steps: number, beats: number): RhythmPattern {\n const pattern: RhythmPattern = [];\n let d = -1;\n\n for (let i = 0; i < steps; i++) {\n const v = Math.floor(i * (beats / steps));\n pattern[i] = v !== d ? 1 : 0;\n d = v;\n }\n return pattern;\n}\n", "/**\n * References:\n * - https://www.researchgate.net/publication/327567188_An_Algorithm_for_Spelling_the_Pitches_of_Any_Musical_Scale\n * @module scale\n */\nimport { all as chordTypes } from \"@tonaljs/chord-type\";\nimport { range as nums, rotate } from \"@tonaljs/collection\";\nimport { enharmonic, fromMidi, sortedUniqNames } from \"@tonaljs/note\";\nimport {\n chroma,\n isChroma,\n isSubsetOf,\n isSupersetOf,\n modes,\n} from \"@tonaljs/pcset\";\nimport { tonicIntervalsTransposer, transpose } from \"@tonaljs/pitch-distance\";\nimport { note, NoteName } from \"@tonaljs/pitch-note\";\nimport {\n all,\n get as getScaleType,\n ScaleType,\n names as scaleTypeNames,\n all as scaleTypes,\n} from \"@tonaljs/scale-type\";\n\ntype ScaleName = string;\ntype ScaleNameTokens = [string, string]; // [TONIC, SCALE TYPE]\n\nexport interface Scale extends ScaleType {\n tonic: string | null;\n type: string;\n notes: NoteName[];\n}\n\nconst NoScale: Scale = {\n empty: true,\n name: \"\",\n type: \"\",\n tonic: null,\n setNum: NaN,\n chroma: \"\",\n normalized: \"\",\n aliases: [],\n notes: [],\n intervals: [],\n};\n\n/**\n * Given a string with a scale name and (optionally) a tonic, split\n * that components.\n *\n * It returns an array with the form [ name, tonic ] where tonic can be a\n * note name or null and name can be any arbitrary string\n * (this function doesn't check if that scale name exists)\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array} an array [tonic, name]\n * @example\n * tokenize(\"C mixolydian\") // => [\"C\", \"mixolydian\"]\n * tokenize(\"anything is valid\") // => [\"\", \"anything is valid\"]\n * tokenize() // => [\"\", \"\"]\n */\nexport function tokenize(name: ScaleName): ScaleNameTokens {\n if (typeof name !== \"string\") {\n return [\"\", \"\"];\n }\n const i = name.indexOf(\" \");\n const tonic = note(name.substring(0, i));\n if (tonic.empty) {\n const n = note(name);\n return n.empty ? [\"\", name] : [n.name, \"\"];\n }\n\n const type = name.substring(tonic.name.length + 1).toLowerCase();\n return [tonic.name, type.length ? type : \"\"];\n}\n\n/**\n * Get all scale names\n * @function\n */\nexport const names = scaleTypeNames;\n\n/**\n * Get a Scale from a scale name.\n */\nexport function get(src: ScaleName | ScaleNameTokens): Scale {\n const tokens = Array.isArray(src) ? src : tokenize(src);\n const tonic = note(tokens[0]).name;\n const st = getScaleType(tokens[1]);\n if (st.empty) {\n return NoScale;\n }\n\n const type = st.name;\n const notes: string[] = tonic\n ? st.intervals.map((i) => transpose(tonic, i))\n : [];\n\n const name = tonic ? tonic + \" \" + type : type;\n\n return { ...st, name, type, tonic, notes };\n}\n\n/**\n * @deprecated\n * @use Scale.get\n */\nexport const scale = get;\n\nexport function detect(\n notes: string[],\n options: { tonic?: string; match?: \"exact\" | \"fit\" } = {},\n): string[] {\n const notesChroma = chroma(notes);\n const tonic = note(options.tonic ?? notes[0] ?? \"\");\n const tonicChroma = tonic.chroma;\n if (tonicChroma === undefined) {\n return [];\n }\n\n const pitchClasses = notesChroma.split(\"\");\n pitchClasses[tonicChroma] = \"1\";\n const scaleChroma = rotate(tonicChroma, pitchClasses).join(\"\");\n const match = all().find((scaleType) => scaleType.chroma === scaleChroma);\n\n const results: string[] = [];\n if (match) {\n results.push(tonic.name + \" \" + match.name);\n }\n if (options.match === \"exact\") {\n return results;\n }\n\n extended(scaleChroma).forEach((scaleName) => {\n results.push(tonic.name + \" \" + scaleName);\n });\n\n return results;\n}\n\n/**\n * Get all chords that fits a given scale\n *\n * @function\n * @param {string} name - the scale name\n * @return {Array} - the chord names\n *\n * @example\n * scaleChords(\"pentatonic\") // => [\"5\", \"64\", \"M\", \"M6\", \"Madd9\", \"Msus2\"]\n */\nexport function scaleChords(name: string): string[] {\n const s = get(name);\n const inScale = isSubsetOf(s.chroma);\n return chordTypes()\n .filter((chord) => inScale(chord.chroma))\n .map((chord) => chord.aliases[0]);\n}\n/**\n * Get all scales names that are a superset of the given one\n * (has the same notes and at least one more)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n * @example\n * extended(\"major\") // => [\"bebop\", \"bebop dominant\", \"bebop major\", \"chromatic\", \"ichikosucho\"]\n */\nexport function extended(name: string): string[] {\n const chroma = isChroma(name) ? name : get(name).chroma;\n const isSuperset = isSupersetOf(chroma);\n return scaleTypes()\n .filter((scale) => isSuperset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Find all scales names that are a subset of the given one\n * (has less notes but all from the given scale)\n *\n * @function\n * @param {string} name\n * @return {Array} a list of scale names\n *\n * @example\n * reduced(\"major\") // => [\"ionian pentatonic\", \"major pentatonic\", \"ritusen\"]\n */\nexport function reduced(name: string): string[] {\n const isSubset = isSubsetOf(get(name).chroma);\n return scaleTypes()\n .filter((scale) => isSubset(scale.chroma))\n .map((scale) => scale.name);\n}\n\n/**\n * Given an array of notes, return the scale: a pitch class set starting from\n * the first note of the array\n *\n * @function\n * @param {string[]} notes\n * @return {string[]} pitch classes with same tonic\n * @example\n * scaleNotes(['C4', 'c3', 'C5', 'C4', 'c4']) // => [\"C\"]\n * scaleNotes(['D4', 'c#5', 'A5', 'F#6']) // => [\"D\", \"F#\", \"A\", \"C#\"]\n */\nexport function scaleNotes(notes: NoteName[]) {\n const pcset: string[] = notes.map((n) => note(n).pc).filter((x) => x);\n const tonic = pcset[0];\n const scale = sortedUniqNames(pcset);\n return rotate(scale.indexOf(tonic), scale);\n}\n\ntype ScaleMode = [string, string];\n/**\n * Find mode names of a scale\n *\n * @function\n * @param {string} name - scale name\n * @example\n * modeNames(\"C pentatonic\") // => [\n * [\"C\", \"major pentatonic\"],\n * [\"D\", \"egyptian\"],\n * [\"E\", \"malkos raga\"],\n * [\"G\", \"ritusen\"],\n * [\"A\", \"minor pentatonic\"]\n * ]\n */\nexport function modeNames(name: string): ScaleMode[] {\n const s = get(name);\n if (s.empty) {\n return [];\n }\n\n const tonics = s.tonic ? s.notes : s.intervals;\n return modes(s.chroma)\n .map((chroma: string, i: number): ScaleMode => {\n const modeName = get(chroma).name;\n return modeName ? [tonics[i], modeName] : [\"\", \"\"];\n })\n .filter((x) => x[0]);\n}\n\nfunction getNoteNameOf(scale: string | string[]) {\n const names = Array.isArray(scale) ? scaleNotes(scale) : get(scale).notes;\n const chromas = names.map((name) => note(name).chroma);\n\n return (noteOrMidi: string | number): string | undefined => {\n const currNote =\n typeof noteOrMidi === \"number\"\n ? note(fromMidi(noteOrMidi))\n : note(noteOrMidi);\n const height = currNote.height;\n\n if (height === undefined) return undefined;\n const chroma = height % 12;\n const position = chromas.indexOf(chroma);\n if (position === -1) return undefined;\n return enharmonic(currNote.name, names[position]);\n };\n}\n\nexport function rangeOf(scale: string | string[]) {\n const getName = getNoteNameOf(scale);\n return (fromNote: string, toNote: string) => {\n const from = note(fromNote).height;\n const to = note(toNote).height;\n if (from === undefined || to === undefined) return [];\n\n return nums(from, to)\n .map(getName)\n .filter((x) => x);\n };\n}\n\n/**\n * Returns a function to get a note name from the scale degree.\n *\n * @example\n * [1, 2, 3].map(Scale.degrees(\"C major\")) => [\"C\", \"D\", \"E\"]\n * [1, 2, 3].map(Scale.degrees(\"C4 major\")) => [\"C4\", \"D4\", \"E4\"]\n */\nexport function degrees(scaleName: string | ScaleNameTokens) {\n const { intervals, tonic } = get(scaleName);\n const transpose = tonicIntervalsTransposer(intervals, tonic);\n return (degree: number) =>\n degree ? transpose(degree > 0 ? degree - 1 : degree) : \"\";\n}\n\n/**\n * Sames as `degree` but with 0-based index\n */\nexport function steps(scaleName: string | ScaleNameTokens) {\n const { intervals, tonic } = get(scaleName);\n return tonicIntervalsTransposer(intervals, tonic);\n}\n\n/** @deprecated */\nexport default {\n degrees,\n detect,\n extended,\n get,\n modeNames,\n names,\n rangeOf,\n reduced,\n scaleChords,\n scaleNotes,\n steps,\n tokenize,\n\n // deprecated\n scale,\n};\n", "// TYPES: PARSING\nexport type TimeSignatureLiteral = string | [number, number] | [string, string];\ntype ParsedTimeSignature = [number | number[], number];\n\n// TYPES: PROPERTIES\nexport type ValidTimeSignature = {\n readonly empty: false;\n readonly name: string;\n readonly upper: number | number[];\n readonly lower: number;\n readonly type: \"simple\" | \"compound\" | \"irregular\" | \"irrational\";\n readonly additive: number[];\n};\n\nexport type InvalidTimeSignature = {\n readonly empty: true;\n readonly name: \"\";\n readonly upper: undefined;\n readonly lower: undefined;\n readonly type: undefined;\n readonly additive: [];\n};\n\nexport type TimeSignature = ValidTimeSignature | InvalidTimeSignature;\n\n// CONSTANTS\nconst NONE: InvalidTimeSignature = {\n empty: true,\n name: \"\",\n upper: undefined,\n lower: undefined,\n type: undefined,\n additive: [],\n};\n\nconst NAMES = [\"4/4\", \"3/4\", \"2/4\", \"2/2\", \"12/8\", \"9/8\", \"6/8\", \"3/8\"];\n\n// PUBLIC API\n\nexport function names() {\n return NAMES.slice();\n}\n\nconst REGEX = /^(\\d*\\d(?:\\+\\d)*)\\/(\\d+)$/;\nconst CACHE = new Map();\n\nexport function get(literal: TimeSignatureLiteral): TimeSignature {\n const stringifiedLiteral = JSON.stringify(literal);\n const cached = CACHE.get(stringifiedLiteral);\n if (cached) {\n return cached;\n }\n\n const ts = build(parse(literal));\n CACHE.set(stringifiedLiteral, ts);\n return ts;\n}\n\nexport function parse(literal: TimeSignatureLiteral): ParsedTimeSignature {\n if (typeof literal === \"string\") {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, up, low] = REGEX.exec(literal) || [];\n return parse([up, low]);\n }\n\n const [up, down] = literal;\n const denominator = +down;\n if (typeof up === \"number\") {\n return [up, denominator];\n }\n\n const list = up.split(\"+\").map((n) => +n);\n return list.length === 1 ? [list[0], denominator] : [list, denominator];\n}\n\n/** @deprecated */\nexport default { names, parse, get };\n\n// PRIVATE\n\nconst isPowerOfTwo = (x: number) => (Math.log(x) / Math.log(2)) % 1 === 0;\n\nfunction build([up, down]: ParsedTimeSignature): TimeSignature {\n const upper = Array.isArray(up) ? up.reduce((a, b) => a + b, 0) : up;\n const lower = down;\n if (upper === 0 || lower === 0) {\n return NONE;\n }\n\n const name = Array.isArray(up) ? `${up.join(\"+\")}/${down}` : `${up}/${down}`;\n const additive = Array.isArray(up) ? up : [];\n const type =\n lower === 4 || lower === 2\n ? \"simple\"\n : lower === 8 && upper % 3 === 0\n ? \"compound\"\n : isPowerOfTwo(lower)\n ? \"irregular\"\n : \"irrational\";\n\n return {\n empty: false,\n name,\n type,\n upper,\n lower,\n additive,\n };\n}\n", "import Note from \"@tonaljs/note\";\n\n// A function that decides which of a set of voicings is picked as a follow up to lastVoicing.\nexport declare type VoiceLeadingFunction = (\n voicings: string[][],\n lastVoicing: string[],\n) => string[];\n\nexport const topNoteDiff: VoiceLeadingFunction = (voicings, lastVoicing) => {\n if (!lastVoicing || !lastVoicing.length) {\n return voicings[0];\n }\n const topNoteMidi = (voicing: string[]) =>\n Note.midi(voicing[voicing.length - 1]) || 0;\n const diff = (voicing: string[]) =>\n Math.abs(topNoteMidi(lastVoicing) - topNoteMidi(voicing));\n return voicings.sort((a, b) => diff(a) - diff(b))[0];\n};\n\n/** @deprecated */\nexport default {\n topNoteDiff,\n};\n", "import Chord from \"@tonaljs/chord\";\nimport { all, lefthand, triads, VoicingDictionary } from \"./data\";\nexport { all, lefthand, triads } from \"./data\";\n\nexport const defaultDictionary: VoicingDictionary = lefthand;\n\nexport function lookup(\n symbol: string,\n dictionary = defaultDictionary,\n): string[] | undefined {\n if (dictionary[symbol]) {\n return dictionary[symbol];\n }\n const { aliases } = Chord.get(\"C\" + symbol);\n // TODO: find other way to get aliases of symbol\n const match =\n Object.keys(dictionary).find((_symbol) => aliases.includes(_symbol)) || \"\";\n if (match !== undefined) {\n return dictionary[match];\n }\n return undefined;\n}\n\n/** @deprecated */\nexport default {\n lookup,\n lefthand,\n triads,\n all,\n defaultDictionary,\n};\n", "export type VoicingDictionary = { [symbol: string]: string[] };\n\nexport const triads: VoicingDictionary = {\n M: [\"1P 3M 5P\", \"3M 5P 8P\", \"5P 8P 10M\"],\n m: [\"1P 3m 5P\", \"3m 5P 8P\", \"5P 8P 10m\"],\n o: [\"1P 3m 5d\", \"3m 5d 8P\", \"5d 8P 10m\"],\n aug: [\"1P 3m 5A\", \"3m 5A 8P\", \"5A 8P 10m\"],\n};\nexport const lefthand: VoicingDictionary = {\n m7: [\"3m 5P 7m 9M\", \"7m 9M 10m 12P\"],\n \"7\": [\"3M 6M 7m 9M\", \"7m 9M 10M 13M\"],\n \"^7\": [\"3M 5P 7M 9M\", \"7M 9M 10M 12P\"],\n \"69\": [\"3M 5P 6A 9M\"],\n m7b5: [\"3m 5d 7m 8P\", \"7m 8P 10m 12d\"],\n \"7b9\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n \"7b13\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n o7: [\"1P 3m 5d 6M\", \"5d 6M 8P 10m\"],\n \"7#11\": [\"7m 9M 11A 13A\"],\n \"7#9\": [\"3M 7m 9A\"],\n mM7: [\"3m 5P 7M 9M\", \"7M 9M 10m 12P\"],\n m6: [\"3m 5P 6M 9M\", \"6M 9M 10m 12P\"],\n};\nexport const all: VoicingDictionary = {\n M: [\"1P 3M 5P\", \"3M 5P 8P\", \"5P 8P 10M\"],\n m: [\"1P 3m 5P\", \"3m 5P 8P\", \"5P 8P 10m\"],\n o: [\"1P 3m 5d\", \"3m 5d 8P\", \"5d 8P 10m\"],\n aug: [\"1P 3m 5A\", \"3m 5A 8P\", \"5A 8P 10m\"],\n m7: [\"3m 5P 7m 9M\", \"7m 9M 10m 12P\"],\n \"7\": [\"3M 6M 7m 9M\", \"7m 9M 10M 13M\"],\n \"^7\": [\"3M 5P 7M 9M\", \"7M 9M 10M 12P\"],\n \"69\": [\"3M 5P 6A 9M\"],\n m7b5: [\"3m 5d 7m 8P\", \"7m 8P 10m 12d\"],\n \"7b9\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n \"7b13\": [\"3M 6m 7m 9m\", \"7m 9m 10M 13m\"], // b9 / b13\n o7: [\"1P 3m 5d 6M\", \"5d 6M 8P 10m\"],\n \"7#11\": [\"7m 9M 11A 13A\"],\n \"7#9\": [\"3M 7m 9A\"],\n mM7: [\"3m 5P 7M 9M\", \"7M 9M 10m 12P\"],\n m6: [\"3m 5P 6M 9M\", \"6M 9M 10m 12P\"],\n};\n", "import Chord from \"@tonaljs/chord\";\nimport Interval from \"@tonaljs/interval\";\nimport Note from \"@tonaljs/note\";\nimport Range from \"@tonaljs/range\";\nimport VoiceLeading from \"@tonaljs/voice-leading\";\nimport VoicingDictionary from \"@tonaljs/voicing-dictionary\";\n\nconst defaultRange = [\"C3\", \"C5\"];\nconst defaultDictionary = VoicingDictionary.all;\nconst defaultVoiceLeading = VoiceLeading.topNoteDiff;\n\nexport function get(\n chord: string,\n range: string[] = defaultRange,\n dictionary = defaultDictionary,\n voiceLeading = defaultVoiceLeading,\n lastVoicing?: string[],\n) {\n const voicings = search(chord, range, dictionary);\n if (!lastVoicing || !lastVoicing.length) {\n // notes = voicings[Math.ceil(voicings.length / 2)]; // pick middle voicing..\n return voicings[0]; // pick lowest voicing..\n } else {\n // calculates the distance between the last note and the given voicings top note\n // sort voicings with differ\n return voiceLeading(voicings, lastVoicing);\n }\n}\n\nexport function search(\n chord: string,\n range = defaultRange,\n dictionary = VoicingDictionary.triads,\n): string[][] {\n const [tonic, symbol] = Chord.tokenize(chord);\n const sets = VoicingDictionary.lookup(symbol, dictionary);\n // find equivalent symbol that is used as a key in dictionary:\n if (!sets) {\n return [];\n }\n // resolve array of interval arrays for the wanted symbol\n const voicings = sets.map((intervals) => intervals.split(\" \"));\n const notesInRange = Range.chromatic(range); // gives array of notes inside range\n return voicings.reduce((voiced: string[][], voicing: string[]) => {\n // transpose intervals relative to first interval (e.g. 3m 5P > 1P 3M)\n const relativeIntervals = voicing.map(\n (interval) => Interval.subtract(interval, voicing[0]) || \"\",\n );\n // get enharmonic correct pitch class the bottom note\n const bottomPitchClass = Note.transpose(tonic, voicing[0]);\n // get all possible start notes for voicing\n const starts = notesInRange\n // only get the start notes:\n .filter((note) => Note.chroma(note) === Note.chroma(bottomPitchClass))\n // filter out start notes that will overshoot the top end of the range\n .filter(\n (note) =>\n (Note.midi(\n Note.transpose(\n note,\n relativeIntervals[relativeIntervals.length - 1],\n ),\n ) || 0) <= (Note.midi(range[1]) || 0),\n )\n // replace Range.chromatic notes with the correct enharmonic equivalents\n .map((note) => Note.enharmonic(note, bottomPitchClass));\n // render one voicing for each start note\n const notes = starts.map((start) =>\n relativeIntervals.map((interval) => Note.transpose(start, interval)),\n );\n return voiced.concat(notes);\n }, []);\n}\n\nexport function sequence(\n chords: string[],\n range = defaultRange,\n dictionary = defaultDictionary,\n voiceLeading = defaultVoiceLeading,\n lastVoicing?: string[],\n) {\n const { voicings } = chords.reduce<{\n voicings: string[][];\n lastVoicing: string[] | undefined;\n }>(\n ({ voicings, lastVoicing }, chord) => {\n const voicing = get(chord, range, dictionary, voiceLeading, lastVoicing);\n lastVoicing = voicing;\n voicings.push(voicing);\n return { voicings, lastVoicing };\n },\n { voicings: [], lastVoicing },\n );\n return voicings;\n}\n\n/** @deprecated */\nexport default {\n get,\n search,\n sequence,\n};\n", "import { isNamedPitch } from \"@tonaljs/pitch\";\n\nexport * from \"@tonaljs/pitch\";\nexport * from \"@tonaljs/pitch-distance\";\nexport * from \"@tonaljs/pitch-interval\";\nexport * from \"@tonaljs/pitch-note\";\n\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType,\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"], "mappings": "scAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,iBAAAE,GAAA,UAAAA,GAAA,UAAAA,GAAA,oBAAAC,GAAA,cAAAD,GAAA,eAAAA,GAAA,SAAAA,GAAA,kBAAAA,GAAA,aAAAA,GAAA,QAAAA,GAAA,SAAAA,GAAA,SAAAA,GAAA,SAAAA,GAAA,UAAAE,GAAA,UAAAF,GAAA,gBAAAA,GAAA,UAAAA,GAAA,kBAAAA,GAAA,iBAAAA,GAAA,UAAAA,GAAA,oBAAAG,GAAA,cAAAH,GAAA,kBAAAA,GAAA,UAAAI,GAAA,iBAAAJ,GAAA,YAAAA,GAAA,sBAAAA,GAAA,aAAAK,EAAA,aAAAC,EAAA,WAAAC,GAAA,oBAAAC,EAAA,gBAAAC,GAAA,gBAAAC,EAAA,cAAAC,GAAA,aAAAC,EAAA,YAAAC,GAAA,WAAAC,GAAA,aAAAC,EAAA,YAAAC,GAAA,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AAkBH", "names": ["tonal_exports", "__export", "dist_exports", "ChordDictionary", "PcSet", "ScaleDictionary", "Tonal", "accToAlt", "altToAcc", "chroma", "coordToInterval", "coordToNote", "coordinates", "deprecate", "distance", "fillStr", "height", "interval", "isNamed", "isNamedPitch", "isPitch", "midi", "note", "pitch", "stepToLetter", "tokenizeInterval", "tokenizeNote", "tonicIntervalsTransposer", "transpose", "isNamedPitch", "src", "SIZES", "chroma", "step", "alt", "height", "oct", "dir", "midi", "pitch", "h", "isPitch", "FIFTHS", "STEPS_TO_OCTS", "fifths", "coordinates", "f", "o", "FIFTHS_TO_STEPS", "coord", "unaltered", "i", "fillStr", "s", "NoInterval", "INTERVAL_TONAL_REGEX", "INTERVAL_SHORTHAND_REGEX", "REGEX", "tokenizeInterval", "str", "m", "cache", "interval", "src", "parse", "isPitch", "pitchName", "isNamedPitch", "SIZES", "TYPES", "tokens", "num", "q", "step", "t", "type", "name", "dir", "simple", "alt", "qToAlt", "oct", "semitones", "chroma", "coord", "coordinates", "coordToInterval", "forceDescending", "f", "o", "isDescending", "ivl", "pitch", "props", "calcNum", "d", "altToQ", "fillStr", "s", "NoNote", "cache", "stepToLetter", "step", "altToAcc", "alt", "accToAlt", "acc", "note", "src", "stringSrc", "cached", "value", "parse", "isPitch", "pitchName", "isNamedPitch", "REGEX", "tokenizeNote", "str", "m", "coordToNote", "noteCoord", "pitch", "mod", "n", "SEMI", "noteName", "tokens", "letter", "octStr", "oct", "coord", "coordinates", "name", "pc", "chroma", "height", "midi", "freq", "props", "transpose", "noteName", "intervalName", "note", "intervalCoord", "interval", "noteCoord", "tr", "coordToNote", "tonicIntervalsTransposer", "intervals", "tonic", "len", "normalized", "index", "octaves", "root", "distance", "fromNote", "toNote", "from", "to", "fcoord", "tcoord", "fifths", "octs", "forceDescending", "coordToInterval", "fillStr", "character", "times", "REGEX", "tokenize", "str", "m", "abcToScientificNotation", "acc", "letter", "oct", "scientificToAbcNotation", "note", "l", "o", "transpose", "interval", "distance", "from", "to", "abc_notation_default", "ascR", "b", "a", "descR", "range", "from", "to", "rotate", "times", "arr", "len", "n", "compact", "sortedNoteNames", "notes", "note", "sortedUniqNoteNames", "i", "shuffle", "rnd", "t", "m", "permutations", "acc", "perm", "e", "pos", "newPerm", "ascR", "b", "a", "descR", "range", "from", "to", "rotate", "times", "arr", "len", "n", "compact", "shuffle", "rnd", "i", "t", "m", "permutations", "acc", "perm", "e", "pos", "newPerm", "collection_default", "EmptyPcset", "setNumToChroma", "num", "chromaToNumber", "chroma", "REGEX", "isChroma", "set", "isPcsetNum", "isPcset", "cache", "get", "src", "listToChroma", "chromaToPcset", "pcset", "intervals", "IVLS", "chromaToIntervals", "i", "notes", "ivl", "transpose", "chromas", "range", "modes", "normalize", "binary", "compact", "_", "r", "rotate", "isEqual", "s1", "s2", "isSubsetOf", "s", "o", "isSupersetOf", "isNoteIncludedIn", "noteName", "n", "note", "includes", "filter", "isIncluded", "pcset_default", "chromaRotations", "setNum", "normalizedNum", "normalized", "pitch", "interval", "CHORDS", "data_default", "NoChordType", "EmptyPcset", "dictionary", "index", "get", "type", "chordType", "names", "chord", "x", "symbols", "keys", "all", "entries", "removeAll", "add", "intervals", "aliases", "fullName", "quality", "getQuality", "alias", "addAlias", "has", "interval", "ivls", "a", "b", "chord_type_default", "namedSet", "notes", "pcToName", "record", "n", "chroma", "note", "detect", "source", "options", "x", "findMatches", "chord", "a", "b", "BITMASK", "testChromaNumber", "bitmask", "chromaNumber", "hasAnyThird", "hasPerfectFifth", "hasAnySeventh", "hasNonPerfectFifth", "hasAnyThirdAndPerfectFifthAndAnySeventh", "chordType", "withPerfectFifth", "weight", "tonic", "tonicChroma", "noteName", "allModes", "modes", "found", "mode", "index", "modeWithPerfectFifth", "all", "chordName", "baseNote", "names", "get", "interval", "name", "semitones", "quality", "num", "simplify", "i", "invert", "step", "alt", "IN", "IQ", "fromSemitones", "d", "n", "c", "distance", "add", "combinator", "a", "b", "addTo", "other", "subtract", "transposeFifths", "fifths", "ivl", "nFifths", "nOcts", "dir", "coordToInterval", "interval_default", "fn", "coordA", "coordB", "coord", "SCALES", "data_default", "NoScaleType", "EmptyPcset", "dictionary", "index", "names", "scale", "get", "type", "scaleType", "all", "entries", "keys", "removeAll", "add", "intervals", "name", "aliases", "alias", "addAlias", "ivls", "scale_type_default", "NoChord", "tokenize", "name", "letter", "acc", "oct", "type", "tokenizeNote", "tokenizeBass", "note", "chord", "split", "get", "src", "getChord", "tonic", "bass", "typeName", "optionalTonic", "optionalBass", "bassInterval", "distance", "bassIndex", "hasRoot", "root", "rootDegree", "hasBass", "intervals", "i", "num", "quality", "newNum", "ivl", "subtract", "notes", "transpose", "symbol", "chordName", "interval", "tr", "slash", "chordScales", "s", "isChordIncluded", "isSupersetOf", "all", "scale", "extended", "isSuperset", "reduced", "isSubset", "isSubsetOf", "degrees", "tonicIntervalsTransposer", "degree", "steps", "chord_default", "detect", "DATA", "data_default", "VALUES", "denominator", "shorthand", "names", "add", "NoDuration", "duration", "name", "shorthands", "dur", "REGEX", "get", "_", "simple", "dots", "base", "fraction", "calcDots", "value", "duration_value_default", "pow", "numerator", "isMidi", "arg", "toMidi", "note", "midiToFreq", "midi", "tuning", "L2", "L440", "freqToMidi", "freq", "v", "SHARPS", "FLATS", "midiToNoteName", "options", "pc", "chroma", "pcsetFromChroma", "pcset", "val", "index", "pcsetFromMidi", "a", "b", "i", "notes", "pcsetNearest", "set", "ch", "pcsetSteps", "tonic", "len", "step", "octaves", "pcsetDegrees", "steps", "degree", "midi_default", "NAMES", "toName", "n", "onlyNotes", "array", "note", "names", "get", "name", "pitchClass", "accidentals", "octave", "midi", "freq", "chroma", "fromMidi", "midiToNoteName", "fromFreq", "freqToMidi", "fromFreqSharps", "fromMidiSharps", "distance", "transpose", "tr", "transposeBy", "interval", "trBy", "transposeFrom", "trFrom", "transposeFifths", "noteName", "fifths", "trFifths", "transposeOctaves", "octaves", "ascending", "a", "b", "descending", "sortedNames", "notes", "comparator", "sortedUniqNames", "i", "simplify", "enharmonic", "destName", "src", "dest", "srcChroma", "destChroma", "destOctOffset", "destOct", "note_default", "NoRomanNumeral", "cache", "get", "src", "parse", "NAMES", "isPitch", "fromPitch", "isNamedPitch", "romanNumeral", "names", "major", "NAMES_MINOR", "pitch", "altToAcc", "REGEX", "tokenize", "str", "ROMANS", "name", "acc", "roman", "chordType", "upperRoman", "step", "alt", "accToAlt", "dir", "interval", "roman_numeral_default", "Empty", "NoKey", "NoKeyScale", "NoMajorKey", "NoMinorKey", "mapScaleToType", "scale", "list", "sep", "type", "i", "keyScale", "grades", "triads", "chordTypes", "harmonicFunctions", "chordScales", "tonic", "intervals", "gr", "get", "interval", "transpose", "chords", "secondaryDominants", "note", "secondaryDominantSupertonics", "supertonics", "substituteDominants", "chord", "domRoot", "substituteDominantSupertonics", "dominants", "targetTriads", "index", "minorRoot", "distInFifths", "from", "to", "f", "t", "MajorScale", "NaturalScale", "HarmonicScale", "MelodicScale", "majorKey", "pc", "alteration", "altToAcc", "majorKeyChords", "key", "keyChordsOf", "minorKeyChords", "minorKey", "updateChord", "name", "newRole", "keyChord", "chordName", "tnc", "majorTonicFromKeySignature", "sig", "transposeFifths", "accToAlt", "key_default", "MODES", "NoMode", "EmptyPcset", "modes", "toMode", "index", "mode", "alias", "get", "name", "all", "entries", "names", "modeNum", "setNum", "alt", "triad", "seventh", "aliases", "chroma", "notes", "modeName", "tonic", "ivl", "transpose", "chords", "triads", "rotate", "tonics", "i", "x", "seventhChords", "distance", "destination", "source", "from", "to", "simplify", "transposeFifths", "relativeTonic", "mode_default", "fromRomanNumerals", "tonic", "chords", "get", "rn", "transpose", "interval", "toRomanNumerals", "chord", "note", "chordType", "tokenize", "intervalName", "distance", "progression_default", "numeric", "notes", "midi", "compact", "note", "toMidi", "result", "last", "range", "chromatic", "options", "midiToNoteName", "range_default", "binary", "numbers", "pattern", "number", "digit", "hex", "hexNumber", "i", "onsets", "random", "length", "probability", "rnd", "probabilities", "rotate", "rotations", "len", "rotated", "pos", "euclid", "steps", "beats", "d", "v", "NoScale", "tokenize", "name", "i", "tonic", "note", "n", "type", "names", "get", "src", "tokens", "st", "notes", "transpose", "scale", "detect", "options", "notesChroma", "chroma", "tonicChroma", "pitchClasses", "scaleChroma", "rotate", "match", "all", "scaleType", "results", "extended", "scaleName", "scaleChords", "s", "inScale", "isSubsetOf", "chord", "isChroma", "isSuperset", "isSupersetOf", "reduced", "isSubset", "scaleNotes", "pcset", "x", "sortedUniqNames", "modeNames", "tonics", "modes", "modeName", "getNoteNameOf", "chromas", "noteOrMidi", "currNote", "fromMidi", "height", "position", "enharmonic", "rangeOf", "getName", "fromNote", "toNote", "from", "to", "range", "degrees", "intervals", "tonicIntervalsTransposer", "degree", "steps", "scale_default", "NONE", "NAMES", "names", "REGEX", "CACHE", "get", "literal", "stringifiedLiteral", "cached", "ts", "build", "parse", "_", "up", "low", "down", "denominator", "list", "n", "time_signature_default", "isPowerOfTwo", "x", "upper", "a", "b", "lower", "name", "additive", "type", "topNoteDiff", "voicings", "lastVoicing", "topNoteMidi", "voicing", "note_default", "diff", "a", "b", "voice_leading_default", "triads", "lefthand", "all", "defaultDictionary", "lookup", "symbol", "dictionary", "aliases", "chord_default", "match", "_symbol", "voicing_dictionary_default", "defaultRange", "defaultDictionary", "voicing_dictionary_default", "defaultVoiceLeading", "voice_leading_default", "get", "chord", "range", "dictionary", "voiceLeading", "lastVoicing", "voicings", "search", "tonic", "symbol", "chord_default", "sets", "intervals", "notesInRange", "range_default", "voiced", "voicing", "relativeIntervals", "interval", "interval_default", "bottomPitchClass", "note_default", "notes", "note", "start", "sequence", "chords", "voicing_default", "fillStr", "s", "deprecate", "original", "alternative", "fn", "args", "isNamed", "isNamedPitch", "Tonal", "dist_exports", "PcSet", "ChordDictionary", "ScaleDictionary"] } diff --git a/site/content/docs/groups/chords.md b/site/content/docs/groups/chords.md index 8cd2b7c8..ea636fd7 100644 --- a/site/content/docs/groups/chords.md +++ b/site/content/docs/groups/chords.md @@ -74,7 +74,7 @@ Chord.getChord("maj7", "C", "B") === Chord.get("Cmaj7/B"); Print the notes of the given chord at the given tonic: ```js -Chord.notes("maj4", "C4"); // => ["C4", "E4", "G4", "B4"] +Chord.notes("maj7", "C4"); // => ["C4", "E4", "G4", "B4"] ``` ### `Chord.degrees`